From 2b02c520e66ea452687cab39401b371711caa9ed Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 May 2021 11:27:40 +0200 Subject: Cleanup shared models --- server/controllers/api/videos/comment.ts | 2 +- server/controllers/static.ts | 2 +- server/helpers/audit-logger.ts | 2 +- server/helpers/ffprobe-utils.ts | 3 +- server/lib/moderation.ts | 4 +- server/lib/video-comment.ts | 2 +- server/middlewares/validators/videos/videos.ts | 2 +- server/models/video/video-comment.ts | 2 +- server/tests/api/moderation/blocklist.ts | 56 +++++----- .../api/notifications/comments-notifications.ts | 25 +++-- server/tests/api/server/bulk.ts | 9 +- server/tests/api/server/follows.ts | 48 ++++----- server/tests/api/server/handle-down.ts | 2 +- server/tests/api/videos/multiple-servers.ts | 13 ++- server/tests/api/videos/video-comments.ts | 3 +- server/tests/plugins/filter-hooks.ts | 2 +- shared/extra-utils/index.ts | 16 ++- shared/models/nodeinfo/index.d.ts | 117 --------------------- shared/models/nodeinfo/index.ts | 1 + shared/models/nodeinfo/nodeinfo.model.ts | 117 +++++++++++++++++++++ shared/models/overviews/index.ts | 2 +- shared/models/overviews/videos-overview.model.ts | 24 +++++ shared/models/overviews/videos-overview.ts | 24 ----- shared/models/redundancy/index.ts | 3 +- shared/models/videos/change-ownership/index.ts | 3 + .../video-change-ownership-accept.model.ts | 3 + .../video-change-ownership-create.model.ts | 3 + .../video-change-ownership.model.ts | 17 +++ shared/models/videos/comment/index.ts | 1 + .../models/videos/comment/video-comment.model.ts | 46 ++++++++ shared/models/videos/index.ts | 12 +-- .../videos/video-change-ownership-accept.model.ts | 3 - .../videos/video-change-ownership-create.model.ts | 3 - .../models/videos/video-change-ownership.model.ts | 17 --- shared/models/videos/video-comment.model.ts | 46 -------- shared/models/videos/video-file-metadata.model.ts | 13 +++ shared/models/videos/video-file-metadata.ts | 13 --- shared/models/videos/video-file.model.ts | 2 +- 38 files changed, 341 insertions(+), 322 deletions(-) delete mode 100644 shared/models/nodeinfo/index.d.ts create mode 100644 shared/models/nodeinfo/index.ts create mode 100644 shared/models/nodeinfo/nodeinfo.model.ts create mode 100644 shared/models/overviews/videos-overview.model.ts delete mode 100644 shared/models/overviews/videos-overview.ts create mode 100644 shared/models/videos/change-ownership/index.ts create mode 100644 shared/models/videos/change-ownership/video-change-ownership-accept.model.ts create mode 100644 shared/models/videos/change-ownership/video-change-ownership-create.model.ts create mode 100644 shared/models/videos/change-ownership/video-change-ownership.model.ts create mode 100644 shared/models/videos/comment/index.ts create mode 100644 shared/models/videos/comment/video-comment.model.ts delete mode 100644 shared/models/videos/video-change-ownership-accept.model.ts delete mode 100644 shared/models/videos/video-change-ownership-create.model.ts delete mode 100644 shared/models/videos/video-change-ownership.model.ts delete mode 100644 shared/models/videos/video-comment.model.ts create mode 100644 shared/models/videos/video-file-metadata.model.ts delete mode 100644 shared/models/videos/video-file-metadata.ts diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts index f1f53d354..cfdf2773f 100644 --- a/server/controllers/api/videos/comment.ts +++ b/server/controllers/api/videos/comment.ts @@ -1,7 +1,7 @@ import * as express from 'express' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { ResultList, ThreadsResultList, UserRight } from '../../../../shared/models' -import { VideoCommentCreate } from '../../../../shared/models/videos/video-comment.model' +import { VideoCommentCreate } from '../../../../shared/models/videos/comment/video-comment.model' import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger' import { getFormattedObjects } from '../../../helpers/utils' import { sequelizeTypescript } from '../../../initializers/database' diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 97c48b1d7..8a747ec52 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts @@ -4,7 +4,7 @@ import { join } from 'path' import { serveIndexHTML } from '@server/lib/client-html' import { getEnabledResolutions, getRegisteredPlugins, getRegisteredThemes } from '@server/lib/config' import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' -import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' +import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo/nodeinfo.model' import { root } from '../helpers/core-utils' import { CONFIG, isEmailEnabled } from '../initializers/config' import { diff --git a/server/helpers/audit-logger.ts b/server/helpers/audit-logger.ts index 6aae5e821..884bd187d 100644 --- a/server/helpers/audit-logger.ts +++ b/server/helpers/audit-logger.ts @@ -7,7 +7,7 @@ import * as winston from 'winston' import { AUDIT_LOG_FILENAME } from '@server/initializers/constants' import { AdminAbuse, User, VideoChannel, VideoDetails, VideoImport } from '../../shared' import { CustomConfig } from '../../shared/models/server/custom-config.model' -import { VideoComment } from '../../shared/models/videos/video-comment.model' +import { VideoComment } from '../../shared/models/videos/comment/video-comment.model' import { CONFIG } from '../initializers/config' import { jsonLoggerFormat, labelFormatter } from './logger' diff --git a/server/helpers/ffprobe-utils.ts b/server/helpers/ffprobe-utils.ts index 40eaafd57..ef2aa3f89 100644 --- a/server/helpers/ffprobe-utils.ts +++ b/server/helpers/ffprobe-utils.ts @@ -1,6 +1,5 @@ import * as ffmpeg from 'fluent-ffmpeg' -import { VideoFileMetadata } from '@shared/models/videos/video-file-metadata' -import { getMaxBitrate, VideoResolution } from '../../shared/models/videos' +import { getMaxBitrate, VideoFileMetadata, VideoResolution } from '../../shared/models/videos' import { CONFIG } from '../initializers/config' import { VIDEO_TRANSCODING_FPS } from '../initializers/constants' import { logger } from './logger' diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts index d83086005..0cefe1648 100644 --- a/server/lib/moderation.ts +++ b/server/lib/moderation.ts @@ -23,9 +23,9 @@ import { ActivityCreate } from '../../shared/models/activitypub' import { VideoObject } from '../../shared/models/activitypub/objects' import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object' import { LiveVideoCreate, VideoCreate, VideoImportCreate } from '../../shared/models/videos' -import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model' -import { UserModel } from '../models/user/user' +import { VideoCommentCreate } from '../../shared/models/videos/comment/video-comment.model' import { ActorModel } from '../models/actor/actor' +import { UserModel } from '../models/user/user' import { VideoModel } from '../models/video/video' import { VideoCommentModel } from '../models/video/video-comment' import { sendAbuse } from './activitypub/send/send-flag' diff --git a/server/lib/video-comment.ts b/server/lib/video-comment.ts index 736ebb2f8..51a9c747e 100644 --- a/server/lib/video-comment.ts +++ b/server/lib/video-comment.ts @@ -3,7 +3,7 @@ import * as Sequelize from 'sequelize' import { logger } from '@server/helpers/logger' import { sequelizeTypescript } from '@server/initializers/database' import { ResultList } from '../../shared/models' -import { VideoCommentThreadTree } from '../../shared/models/videos/video-comment.model' +import { VideoCommentThreadTree } from '../../shared/models/videos/comment/video-comment.model' import { VideoCommentModel } from '../models/video/video-comment' import { MAccountDefault, MComment, MCommentOwnerVideo, MCommentOwnerVideoReply, MVideoFullLight } from '../types/models' import { sendCreateVideoComment, sendDeleteVideoComment } from './activitypub/send' diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index d26bcd4a6..3219e10d4 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts @@ -7,7 +7,7 @@ import { ExpressPromiseHandler } from '@server/types/express' import { MUserAccountId, MVideoWithRights } from '@server/types/models' import { ServerErrorCode, UserRight, VideoChangeOwnershipStatus, VideoPrivacy } from '../../../../shared' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' -import { VideoChangeOwnershipAccept } from '../../../../shared/models/videos/video-change-ownership-accept.model' +import { VideoChangeOwnershipAccept } from '../../../../shared/models/videos/change-ownership/video-change-ownership-accept.model' import { exists, isBooleanValid, diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index 87c66dc9f..ffd324526 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts @@ -19,7 +19,7 @@ import { MAccount, MAccountId, MUserAccountId } from '@server/types/models' import { VideoPrivacy } from '@shared/models' import { ActivityTagObject, ActivityTombstoneObject } from '../../../shared/models/activitypub/objects/common-objects' import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object' -import { VideoComment, VideoCommentAdmin } from '../../../shared/models/videos/video-comment.model' +import { VideoComment, VideoCommentAdmin } from '../../../shared/models/videos/comment/video-comment.model' import { actorNameAlphabet } from '../../helpers/custom-validators/activitypub/actor' import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' import { regexpCapture } from '../../helpers/regexp' diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts index e8202aff1..b767d38c7 100644 --- a/server/tests/api/moderation/blocklist.ts +++ b/server/tests/api/moderation/blocklist.ts @@ -1,46 +1,50 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' import 'mocha' -import { AccountBlock, ServerBlock, Video, UserNotification, UserNotificationType } from '../../../../shared/index' +import * as chai from 'chai' import { + addAccountToAccountBlocklist, + addAccountToServerBlocklist, + addServerToAccountBlocklist, + addServerToServerBlocklist, + addVideoCommentReply, + addVideoCommentThread, cleanupTests, createUser, deleteVideoComment, doubleFollow, + findCommentId, flushAndRunMultipleServers, - ServerInfo, - uploadVideo, - userLogin, follow, - unfollow -} from '../../../../shared/extra-utils/index' -import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' -import { getVideosList, getVideosListWithToken } from '../../../../shared/extra-utils/videos/videos' -import { - addVideoCommentReply, - addVideoCommentThread, - getVideoCommentThreads, - getVideoThreadComments, - findCommentId -} from '../../../../shared/extra-utils/videos/video-comments' -import { waitJobs } from '../../../../shared/extra-utils/server/jobs' -import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' -import { - addAccountToAccountBlocklist, - addAccountToServerBlocklist, - addServerToAccountBlocklist, - addServerToServerBlocklist, getAccountBlocklistByAccount, getAccountBlocklistByServer, getServerBlocklistByAccount, getServerBlocklistByServer, + getUserNotifications, + getVideoCommentThreads, + getVideosList, + getVideosListWithToken, + getVideoThreadComments, removeAccountFromAccountBlocklist, removeAccountFromServerBlocklist, removeServerFromAccountBlocklist, - removeServerFromServerBlocklist -} from '../../../../shared/extra-utils/users/blocklist' -import { getUserNotifications } from '../../../../shared/extra-utils/users/user-notifications' + removeServerFromServerBlocklist, + ServerInfo, + setAccessTokensToServers, + unfollow, + uploadVideo, + userLogin, + waitJobs +} from '@shared/extra-utils' +import { + AccountBlock, + ServerBlock, + UserNotification, + UserNotificationType, + Video, + VideoComment, + VideoCommentThreadTree +} from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts index 5e4ab0d6c..d2badf237 100644 --- a/server/tests/api/notifications/comments-notifications.ts +++ b/server/tests/api/notifications/comments-notifications.ts @@ -2,20 +2,25 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, getVideoCommentThreads, getVideoThreadComments, updateMyUser } from '../../../../shared/extra-utils' -import { ServerInfo, uploadVideo } from '../../../../shared/extra-utils/index' -import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' -import { waitJobs } from '../../../../shared/extra-utils/server/jobs' -import { addAccountToAccountBlocklist, removeAccountFromAccountBlocklist } from '../../../../shared/extra-utils/users/blocklist' import { + addAccountToAccountBlocklist, + addVideoCommentReply, + addVideoCommentThread, checkCommentMention, CheckerBaseParams, checkNewCommentOnMyVideo, - prepareNotificationsTest -} from '../../../../shared/extra-utils/users/user-notifications' -import { addVideoCommentReply, addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments' -import { UserNotification } from '../../../../shared/models/users' -import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' + cleanupTests, + getVideoCommentThreads, + getVideoThreadComments, + MockSmtpServer, + prepareNotificationsTest, + removeAccountFromAccountBlocklist, + ServerInfo, + updateMyUser, + uploadVideo, + waitJobs +} from '@shared/extra-utils' +import { UserNotification, VideoCommentThreadTree } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/server/bulk.ts b/server/tests/api/server/bulk.ts index 51ba0e7af..80fa7fce6 100644 --- a/server/tests/api/server/bulk.ts +++ b/server/tests/api/server/bulk.ts @@ -2,12 +2,14 @@ import 'mocha' import * as chai from 'chai' -import { VideoComment } from '@shared/models/videos/video-comment.model' +import { Video, VideoComment } from '@shared/models' import { + addVideoCommentReply, addVideoCommentThread, bulkRemoveCommentsOf, cleanupTests, createUser, + doubleFollow, flushAndRunMultipleServers, getVideoCommentThreads, getVideosList, @@ -15,11 +17,8 @@ import { setAccessTokensToServers, uploadVideo, userLogin, - waitJobs, - addVideoCommentReply + waitJobs } from '../../../../shared/extra-utils/index' -import { doubleFollow } from '../../../../shared/extra-utils/server/follows' -import { Video } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index eb9ab10eb..e1c062020 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts @@ -1,37 +1,35 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' import 'mocha' -import { Video, VideoPrivacy } from '../../../../shared/models/videos' -import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' -import { cleanupTests, completeVideoCheck, deleteVideoComment } from '../../../../shared/extra-utils' +import * as chai from 'chai' import { + addVideoCommentReply, + addVideoCommentThread, + cleanupTests, + completeVideoCheck, + createUser, + createVideoCaption, + dateIsValid, + deleteVideoComment, + expectAccountFollows, flushAndRunMultipleServers, - getVideosList, - ServerInfo, - setAccessTokensToServers, - uploadVideo -} from '../../../../shared/extra-utils/index' -import { dateIsValid } from '../../../../shared/extra-utils/miscs/miscs' -import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, - unfollow -} from '../../../../shared/extra-utils/server/follows' -import { expectAccountFollows } from '../../../../shared/extra-utils/users/accounts' -import { userLogin } from '../../../../shared/extra-utils/users/login' -import { createUser } from '../../../../shared/extra-utils/users/users' -import { - addVideoCommentReply, - addVideoCommentThread, getVideoCommentThreads, - getVideoThreadComments -} from '../../../../shared/extra-utils/videos/video-comments' -import { rateVideo } from '../../../../shared/extra-utils/videos/videos' -import { waitJobs } from '../../../../shared/extra-utils/server/jobs' -import { createVideoCaption, listVideoCaptions, testCaptionFile } from '../../../../shared/extra-utils/videos/video-captions' -import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model' + getVideosList, + getVideoThreadComments, + listVideoCaptions, + rateVideo, + ServerInfo, + setAccessTokensToServers, + testCaptionFile, + unfollow, + uploadVideo, + userLogin, + waitJobs +} from '@shared/extra-utils' +import { Video, VideoCaption, VideoComment, VideoCommentThreadTree, VideoPrivacy } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index 817c79f6e..fa1a3c444 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts @@ -4,7 +4,7 @@ import * as chai from 'chai' import 'mocha' import { JobState, Video } from '../../../../shared/models' import { VideoPrivacy } from '../../../../shared/models/videos' -import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' +import { VideoCommentThreadTree } from '../../../../shared/models/videos/comment/video-comment.model' import { cleanupTests, diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 41cd814e0..6aa996038 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -1,11 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' import 'mocha' +import * as chai from 'chai' import { join } from 'path' import * as request from 'supertest' -import { VideoPrivacy } from '../../../../shared/models/videos' -import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' +import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { addVideoChannel, checkTmpIsEmpty, @@ -32,16 +31,16 @@ import { wait, webtorrentAdd } from '../../../../shared/extra-utils' +import { waitJobs } from '../../../../shared/extra-utils/server/jobs' import { addVideoCommentReply, addVideoCommentThread, deleteVideoComment, + findCommentId, getVideoCommentThreads, - getVideoThreadComments, - findCommentId + getVideoThreadComments } from '../../../../shared/extra-utils/videos/video-comments' -import { waitJobs } from '../../../../shared/extra-utils/server/jobs' -import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' +import { VideoComment, VideoCommentThreadTree, VideoPrivacy } from '../../../../shared/models/videos' const expect = chai.expect diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index 615e0ea45..a5ff3a39d 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts @@ -2,7 +2,7 @@ import 'mocha' import * as chai from 'chai' - +import { VideoComment, VideoCommentAdmin, VideoCommentThreadTree } from '@shared/models' import { cleanupTests, testImage } from '../../../../shared/extra-utils' import { createUser, @@ -22,7 +22,6 @@ import { getVideoCommentThreads, getVideoThreadComments } from '../../../../shared/extra-utils/videos/video-comments' -import { VideoComment, VideoCommentAdmin, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' const expect = chai.expect diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index 7d4f7abb4..1d6bb6cf4 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts @@ -38,6 +38,7 @@ import { import { cleanupTests, flushAndRunMultipleServers, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers' import { getGoodVideoUrl, getMyVideoImports, importVideo } from '../../../shared/extra-utils/videos/video-imports' import { + VideoCommentThreadTree, VideoDetails, VideoImport, VideoImportState, @@ -45,7 +46,6 @@ import { VideoPlaylistPrivacy, VideoPrivacy } from '../../../shared/models/videos' -import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model' const expect = chai.expect diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts index 898a92d43..720db19cb 100644 --- a/shared/extra-utils/index.ts +++ b/shared/extra-utils/index.ts @@ -1,15 +1,24 @@ export * from './bulk/bulk' + export * from './cli/cli' + export * from './feeds/feeds' + export * from './mock-servers/mock-instances-index' -export * from './miscs/miscs' + +export * from './miscs/email' export * from './miscs/sql' +export * from './miscs/miscs' export * from './miscs/stubs' + export * from './moderation/abuses' export * from './plugins/mock-blocklist' + export * from './requests/check-api-params' export * from './requests/requests' + export * from './search/videos' + export * from './server/activitypub' export * from './server/clients' export * from './server/config' @@ -18,9 +27,14 @@ export * from './server/follows' export * from './server/jobs' export * from './server/plugins' export * from './server/servers' + export * from './users/accounts' +export * from './users/blocklist' export * from './users/login' +export * from './users/user-notifications' +export * from './users/user-subscriptions' export * from './users/users' + export * from './videos/live' export * from './videos/services' export * from './videos/video-blacklist' diff --git a/shared/models/nodeinfo/index.d.ts b/shared/models/nodeinfo/index.d.ts deleted file mode 100644 index 336cb66d2..000000000 --- a/shared/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.ts b/shared/models/nodeinfo/index.ts new file mode 100644 index 000000000..faa64302a --- /dev/null +++ b/shared/models/nodeinfo/index.ts @@ -0,0 +1 @@ +export * from './nodeinfo.model' diff --git a/shared/models/nodeinfo/nodeinfo.model.ts b/shared/models/nodeinfo/nodeinfo.model.ts new file mode 100644 index 000000000..336cb66d2 --- /dev/null +++ b/shared/models/nodeinfo/nodeinfo.model.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 + } +} diff --git a/shared/models/overviews/index.ts b/shared/models/overviews/index.ts index 376609efa..468507c6b 100644 --- a/shared/models/overviews/index.ts +++ b/shared/models/overviews/index.ts @@ -1 +1 @@ -export * from './videos-overview' +export * from './videos-overview.model' diff --git a/shared/models/overviews/videos-overview.model.ts b/shared/models/overviews/videos-overview.model.ts new file mode 100644 index 000000000..0f3cb4a52 --- /dev/null +++ b/shared/models/overviews/videos-overview.model.ts @@ -0,0 +1,24 @@ +import { Video, VideoChannelSummary, VideoConstant } from '../videos' + +export interface ChannelOverview { + channel: VideoChannelSummary + videos: Video[] +} + +export interface CategoryOverview { + category: VideoConstant + videos: Video[] +} + +export interface TagOverview { + tag: string + videos: Video[] +} + +export interface VideosOverview { + channels: ChannelOverview[] + + categories: CategoryOverview[] + + tags: TagOverview[] +} diff --git a/shared/models/overviews/videos-overview.ts b/shared/models/overviews/videos-overview.ts deleted file mode 100644 index 0f3cb4a52..000000000 --- a/shared/models/overviews/videos-overview.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Video, VideoChannelSummary, VideoConstant } from '../videos' - -export interface ChannelOverview { - channel: VideoChannelSummary - videos: Video[] -} - -export interface CategoryOverview { - category: VideoConstant - videos: Video[] -} - -export interface TagOverview { - tag: string - videos: Video[] -} - -export interface VideosOverview { - channels: ChannelOverview[] - - categories: CategoryOverview[] - - tags: TagOverview[] -} diff --git a/shared/models/redundancy/index.ts b/shared/models/redundancy/index.ts index 649cc489f..641a5d625 100644 --- a/shared/models/redundancy/index.ts +++ b/shared/models/redundancy/index.ts @@ -1,3 +1,4 @@ -export * from './videos-redundancy-strategy.model' export * from './video-redundancies-filters.model' +export * from './video-redundancy-config-filter.type' export * from './video-redundancy.model' +export * from './videos-redundancy-strategy.model' diff --git a/shared/models/videos/change-ownership/index.ts b/shared/models/videos/change-ownership/index.ts new file mode 100644 index 000000000..a942fb2cd --- /dev/null +++ b/shared/models/videos/change-ownership/index.ts @@ -0,0 +1,3 @@ +export * from './video-change-ownership-accept.model' +export * from './video-change-ownership-create.model' +export * from './video-change-ownership.model' diff --git a/shared/models/videos/change-ownership/video-change-ownership-accept.model.ts b/shared/models/videos/change-ownership/video-change-ownership-accept.model.ts new file mode 100644 index 000000000..f27247633 --- /dev/null +++ b/shared/models/videos/change-ownership/video-change-ownership-accept.model.ts @@ -0,0 +1,3 @@ +export interface VideoChangeOwnershipAccept { + channelId: number +} diff --git a/shared/models/videos/change-ownership/video-change-ownership-create.model.ts b/shared/models/videos/change-ownership/video-change-ownership-create.model.ts new file mode 100644 index 000000000..40fcca285 --- /dev/null +++ b/shared/models/videos/change-ownership/video-change-ownership-create.model.ts @@ -0,0 +1,3 @@ +export interface VideoChangeOwnershipCreate { + username: string +} diff --git a/shared/models/videos/change-ownership/video-change-ownership.model.ts b/shared/models/videos/change-ownership/video-change-ownership.model.ts new file mode 100644 index 000000000..3d31cad0a --- /dev/null +++ b/shared/models/videos/change-ownership/video-change-ownership.model.ts @@ -0,0 +1,17 @@ +import { Account } from '../../actors' +import { Video } from '../video.model' + +export interface VideoChangeOwnership { + id: number + status: VideoChangeOwnershipStatus + initiatorAccount: Account + nextOwnerAccount: Account + video: Video + createdAt: Date +} + +export const enum VideoChangeOwnershipStatus { + WAITING = 'WAITING', + ACCEPTED = 'ACCEPTED', + REFUSED = 'REFUSED' +} diff --git a/shared/models/videos/comment/index.ts b/shared/models/videos/comment/index.ts new file mode 100644 index 000000000..7b9261a36 --- /dev/null +++ b/shared/models/videos/comment/index.ts @@ -0,0 +1 @@ +export * from './video-comment.model' diff --git a/shared/models/videos/comment/video-comment.model.ts b/shared/models/videos/comment/video-comment.model.ts new file mode 100644 index 000000000..79c0e4c0a --- /dev/null +++ b/shared/models/videos/comment/video-comment.model.ts @@ -0,0 +1,46 @@ +import { Account } from '../../actors' + +export interface VideoComment { + id: number + url: string + text: string + threadId: number + inReplyToCommentId: number + videoId: number + createdAt: Date | string + updatedAt: Date | string + deletedAt: Date | string + isDeleted: boolean + totalRepliesFromVideoAuthor: number + totalReplies: number + account: Account +} + +export interface VideoCommentAdmin { + id: number + url: string + text: string + + threadId: number + inReplyToCommentId: number + + createdAt: Date | string + updatedAt: Date | string + + account: Account + + video: { + id: number + uuid: string + name: string + } +} + +export interface VideoCommentThreadTree { + comment: VideoComment + children: VideoCommentThreadTree[] +} + +export interface VideoCommentCreate { + text: string +} diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts index fac3e0b2f..64f2c9df6 100644 --- a/shared/models/videos/index.ts +++ b/shared/models/videos/index.ts @@ -1,6 +1,8 @@ export * from './blacklist' export * from './caption' +export * from './change-ownership' export * from './channel' +export * from './comment' export * from './live' export * from './import' export * from './playlist' @@ -10,17 +12,11 @@ export * from './nsfw-policy.type' export * from './thumbnail.type' -export * from './video-change-ownership-accept.model' -export * from './video-change-ownership-create.model' -export * from './video-change-ownership.model' - -export * from './video-comment.model' export * from './video-constant.model' export * from './video-create.model' -export * from './video-file-metadata' -export * from './video-file.model' -export * from './live/live-video.model' +export * from './video-file-metadata.model' +export * from './video-file.model' export * from './video-privacy.enum' export * from './video-query.type' diff --git a/shared/models/videos/video-change-ownership-accept.model.ts b/shared/models/videos/video-change-ownership-accept.model.ts deleted file mode 100644 index f27247633..000000000 --- a/shared/models/videos/video-change-ownership-accept.model.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface VideoChangeOwnershipAccept { - channelId: number -} diff --git a/shared/models/videos/video-change-ownership-create.model.ts b/shared/models/videos/video-change-ownership-create.model.ts deleted file mode 100644 index 40fcca285..000000000 --- a/shared/models/videos/video-change-ownership-create.model.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface VideoChangeOwnershipCreate { - username: string -} diff --git a/shared/models/videos/video-change-ownership.model.ts b/shared/models/videos/video-change-ownership.model.ts deleted file mode 100644 index 669c7f3e7..000000000 --- a/shared/models/videos/video-change-ownership.model.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Account } from '../actors' -import { Video } from './video.model' - -export interface VideoChangeOwnership { - id: number - status: VideoChangeOwnershipStatus - initiatorAccount: Account - nextOwnerAccount: Account - video: Video - createdAt: Date -} - -export const enum VideoChangeOwnershipStatus { - WAITING = 'WAITING', - ACCEPTED = 'ACCEPTED', - REFUSED = 'REFUSED' -} diff --git a/shared/models/videos/video-comment.model.ts b/shared/models/videos/video-comment.model.ts deleted file mode 100644 index 9730a3f76..000000000 --- a/shared/models/videos/video-comment.model.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Account } from '../actors' - -export interface VideoComment { - id: number - url: string - text: string - threadId: number - inReplyToCommentId: number - videoId: number - createdAt: Date | string - updatedAt: Date | string - deletedAt: Date | string - isDeleted: boolean - totalRepliesFromVideoAuthor: number - totalReplies: number - account: Account -} - -export interface VideoCommentAdmin { - id: number - url: string - text: string - - threadId: number - inReplyToCommentId: number - - createdAt: Date | string - updatedAt: Date | string - - account: Account - - video: { - id: number - uuid: string - name: string - } -} - -export interface VideoCommentThreadTree { - comment: VideoComment - children: VideoCommentThreadTree[] -} - -export interface VideoCommentCreate { - text: string -} diff --git a/shared/models/videos/video-file-metadata.model.ts b/shared/models/videos/video-file-metadata.model.ts new file mode 100644 index 000000000..8f527c0a7 --- /dev/null +++ b/shared/models/videos/video-file-metadata.model.ts @@ -0,0 +1,13 @@ +export class VideoFileMetadata { + streams: { [x: string]: any, [x: number]: any }[] + format: { [x: string]: any, [x: number]: any } + chapters: any[] + + constructor (hash: { chapters: any[], format: any, streams: any[] }) { + this.chapters = hash.chapters + this.format = hash.format + this.streams = hash.streams + + delete this.format.filename + } +} diff --git a/shared/models/videos/video-file-metadata.ts b/shared/models/videos/video-file-metadata.ts deleted file mode 100644 index 8f527c0a7..000000000 --- a/shared/models/videos/video-file-metadata.ts +++ /dev/null @@ -1,13 +0,0 @@ -export class VideoFileMetadata { - streams: { [x: string]: any, [x: number]: any }[] - format: { [x: string]: any, [x: number]: any } - chapters: any[] - - constructor (hash: { chapters: any[], format: any, streams: any[] }) { - this.chapters = hash.chapters - this.format = hash.format - this.streams = hash.streams - - delete this.format.filename - } -} diff --git a/shared/models/videos/video-file.model.ts b/shared/models/videos/video-file.model.ts index 1e830b19c..28fce0aaf 100644 --- a/shared/models/videos/video-file.model.ts +++ b/shared/models/videos/video-file.model.ts @@ -1,5 +1,5 @@ import { VideoConstant } from './video-constant.model' -import { VideoFileMetadata } from './video-file-metadata' +import { VideoFileMetadata } from './video-file-metadata.model' import { VideoResolution } from './video-resolution.enum' export interface VideoFile { -- cgit v1.2.3