From c75937d04f0a45b1ba169d28d0854ad33cfee900 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Sep 2018 15:34:11 +0200 Subject: Move nodeinfo model in shared/ --- server/controllers/static.ts | 4 +- server/models/migrations.ts | 27 +++++++++ server/models/migrations/index.ts | 27 --------- server/models/nodeinfo/index.d.ts | 117 -------------------------------------- shared/models/nodeinfo/index.d.ts | 117 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 146 insertions(+), 146 deletions(-) create mode 100644 server/models/migrations.ts delete mode 100644 server/models/migrations/index.ts delete mode 100644 server/models/nodeinfo/index.d.ts create mode 100644 shared/models/nodeinfo/index.d.ts diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 6e8f1a07f..df31c3134 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts @@ -1,7 +1,7 @@ import * as cors from 'cors' import { createReadStream } from 'fs-extra' import * as express from 'express' -import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers' +import { CONFIG, ROUTE_CACHE_LIFETIME, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers' import { VideosPreviewCache } from '../lib/cache' import { cacheRoute } from '../middlewares/cache' import { asyncMiddleware, videosGetValidator } from '../middlewares' @@ -9,7 +9,7 @@ import { VideoModel } from '../models/video/video' import { VideosCaptionCache } from '../lib/cache/videos-caption-cache' import { UserModel } from '../models/account/user' import { VideoCommentModel } from '../models/video/video-comment' -import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../models/nodeinfo' +import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' const packageJSON = require('../../../package.json') const staticRouter = express.Router() diff --git a/server/models/migrations.ts b/server/models/migrations.ts new file mode 100644 index 000000000..24badb166 --- /dev/null +++ b/server/models/migrations.ts @@ -0,0 +1,27 @@ +import * as Sequelize from 'sequelize' + +declare namespace Migration { + interface Boolean extends Sequelize.DefineAttributeColumnOptions { + defaultValue: boolean | null + } + + interface String extends Sequelize.DefineAttributeColumnOptions { + defaultValue: string | null + } + + interface Integer extends Sequelize.DefineAttributeColumnOptions { + defaultValue: number | null + } + + interface BigInteger extends Sequelize.DefineAttributeColumnOptions { + defaultValue: Sequelize.DataTypeBigInt | number | null + } + + interface UUID extends Sequelize.DefineAttributeColumnOptions { + defaultValue: Sequelize.DataTypeUUIDv4 | null + } +} + +export { + Migration +} diff --git a/server/models/migrations/index.ts b/server/models/migrations/index.ts deleted file mode 100644 index 24badb166..000000000 --- a/server/models/migrations/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as Sequelize from 'sequelize' - -declare namespace Migration { - interface Boolean extends Sequelize.DefineAttributeColumnOptions { - defaultValue: boolean | null - } - - interface String extends Sequelize.DefineAttributeColumnOptions { - defaultValue: string | null - } - - interface Integer extends Sequelize.DefineAttributeColumnOptions { - defaultValue: number | null - } - - interface BigInteger extends Sequelize.DefineAttributeColumnOptions { - defaultValue: Sequelize.DataTypeBigInt | number | null - } - - interface UUID extends Sequelize.DefineAttributeColumnOptions { - defaultValue: Sequelize.DataTypeUUIDv4 | null - } -} - -export { - Migration -} diff --git a/server/models/nodeinfo/index.d.ts b/server/models/nodeinfo/index.d.ts deleted file mode 100644 index 0a2d0492e..000000000 --- a/server/models/nodeinfo/index.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -/** - * NodeInfo schema version 2.0. - */ -export interface HttpNodeinfoDiasporaSoftwareNsSchema20 { - /** - * The schema version, must be 2.0. - */ - version: '2.0' - /** - * Metadata about server software in use. - */ - software: { - /** - * The canonical name of this server software. - */ - name: string - /** - * The version of this server software. - */ - version: string - } - /** - * The protocols supported on this server. - */ - protocols: ( - | 'activitypub' - | 'buddycloud' - | 'dfrn' - | 'diaspora' - | 'libertree' - | 'ostatus' - | 'pumpio' - | 'tent' - | 'xmpp' - | 'zot')[] - /** - * The third party sites this server can connect to via their application API. - */ - services: { - /** - * The third party sites this server can retrieve messages from for combined display with regular traffic. - */ - inbound: ('atom1.0' | 'gnusocial' | 'imap' | 'pnut' | 'pop3' | 'pumpio' | 'rss2.0' | 'twitter')[] - /** - * The third party sites this server can publish messages to on the behalf of a user. - */ - outbound: ( - | 'atom1.0' - | 'blogger' - | 'buddycloud' - | 'diaspora' - | 'dreamwidth' - | 'drupal' - | 'facebook' - | 'friendica' - | 'gnusocial' - | 'google' - | 'insanejournal' - | 'libertree' - | 'linkedin' - | 'livejournal' - | 'mediagoblin' - | 'myspace' - | 'pinterest' - | 'pnut' - | 'posterous' - | 'pumpio' - | 'redmatrix' - | 'rss2.0' - | 'smtp' - | 'tent' - | 'tumblr' - | 'twitter' - | 'wordpress' - | 'xmpp')[] - } - /** - * Whether this server allows open self-registration. - */ - openRegistrations: boolean - /** - * Usage statistics for this server. - */ - usage: { - /** - * statistics about the users of this server. - */ - users: { - /** - * The total amount of on this server registered users. - */ - total?: number - /** - * The amount of users that signed in at least once in the last 180 days. - */ - activeHalfyear?: number - /** - * The amount of users that signed in at least once in the last 30 days. - */ - activeMonth?: number - }; - /** - * The amount of posts that were made by users that are registered on this server. - */ - localPosts?: number - /** - * The amount of comments that were made by users that are registered on this server. - */ - localComments?: number - } - /** - * Free form key value pairs for software specific values. Clients should not rely on any specific key present. - */ - metadata: { - [k: string]: any - } -} diff --git a/shared/models/nodeinfo/index.d.ts b/shared/models/nodeinfo/index.d.ts new file mode 100644 index 000000000..0a2d0492e --- /dev/null +++ b/shared/models/nodeinfo/index.d.ts @@ -0,0 +1,117 @@ +/** + * NodeInfo schema version 2.0. + */ +export interface HttpNodeinfoDiasporaSoftwareNsSchema20 { + /** + * The schema version, must be 2.0. + */ + version: '2.0' + /** + * Metadata about server software in use. + */ + software: { + /** + * The canonical name of this server software. + */ + name: string + /** + * The version of this server software. + */ + version: string + } + /** + * The protocols supported on this server. + */ + protocols: ( + | 'activitypub' + | 'buddycloud' + | 'dfrn' + | 'diaspora' + | 'libertree' + | 'ostatus' + | 'pumpio' + | 'tent' + | 'xmpp' + | 'zot')[] + /** + * The third party sites this server can connect to via their application API. + */ + services: { + /** + * The third party sites this server can retrieve messages from for combined display with regular traffic. + */ + inbound: ('atom1.0' | 'gnusocial' | 'imap' | 'pnut' | 'pop3' | 'pumpio' | 'rss2.0' | 'twitter')[] + /** + * The third party sites this server can publish messages to on the behalf of a user. + */ + outbound: ( + | 'atom1.0' + | 'blogger' + | 'buddycloud' + | 'diaspora' + | 'dreamwidth' + | 'drupal' + | 'facebook' + | 'friendica' + | 'gnusocial' + | 'google' + | 'insanejournal' + | 'libertree' + | 'linkedin' + | 'livejournal' + | 'mediagoblin' + | 'myspace' + | 'pinterest' + | 'pnut' + | 'posterous' + | 'pumpio' + | 'redmatrix' + | 'rss2.0' + | 'smtp' + | 'tent' + | 'tumblr' + | 'twitter' + | 'wordpress' + | 'xmpp')[] + } + /** + * Whether this server allows open self-registration. + */ + openRegistrations: boolean + /** + * Usage statistics for this server. + */ + usage: { + /** + * statistics about the users of this server. + */ + users: { + /** + * The total amount of on this server registered users. + */ + total?: number + /** + * The amount of users that signed in at least once in the last 180 days. + */ + activeHalfyear?: number + /** + * The amount of users that signed in at least once in the last 30 days. + */ + activeMonth?: number + }; + /** + * The amount of posts that were made by users that are registered on this server. + */ + localPosts?: number + /** + * The amount of comments that were made by users that are registered on this server. + */ + localComments?: number + } + /** + * Free form key value pairs for software specific values. Clients should not rely on any specific key present. + */ + metadata: { + [k: string]: any + } +} -- cgit v1.2.3