-import * as memoizee from 'memoizee'
+import memoizee from 'memoizee'
import { AllowNull, Column, Default, DefaultScope, HasOne, IsInt, Model, Table } from 'sequelize-typescript'
-import { AttributesOnly } from '@shared/core-utils'
+import { getNodeABIVersion } from '@server/helpers/version'
+import { AttributesOnly } from '@shared/typescript-utils'
import { AccountModel } from '../account/account'
export const getServerActor = memoizee(async function () {
@Column
latestPeerTubeVersion: string
+ @AllowNull(false)
+ @Column
+ nodeVersion: string
+
+ @AllowNull(false)
+ @Column
+ nodeABIVersion: number
+
@HasOne(() => AccountModel, {
foreignKey: {
allowNull: true
static load () {
return ApplicationModel.findOne()
}
+
+ static async nodeABIChanged () {
+ const application = await this.load()
+
+ return application.nodeABIVersion !== getNodeABIVersion()
+ }
+
+ static async updateNodeVersions () {
+ const application = await this.load()
+
+ application.nodeABIVersion = getNodeABIVersion()
+ application.nodeVersion = process.version
+
+ await application.save()
+ }
}