Reorganize shared models
This commit is contained in:
parent
583eb04b54
commit
bd45d503e5
59 changed files with 155 additions and 144 deletions
|
@ -5,12 +5,12 @@ import { Injectable } from '@angular/core'
|
||||||
import { ComponentPagination, RestExtractor, RestService } from '@app/core'
|
import { ComponentPagination, RestExtractor, RestService } from '@app/core'
|
||||||
import { PluginService } from '@app/core/plugins/plugin.service'
|
import { PluginService } from '@app/core/plugins/plugin.service'
|
||||||
import { I18n } from '@ngx-translate/i18n-polyfill'
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
|
import { peertubeTranslate } from '@shared/core-utils/i18n'
|
||||||
import {
|
import {
|
||||||
InstallOrUpdatePlugin,
|
InstallOrUpdatePlugin,
|
||||||
ManagePlugin,
|
ManagePlugin,
|
||||||
PeerTubePlugin,
|
PeerTubePlugin,
|
||||||
PeerTubePluginIndex,
|
PeerTubePluginIndex,
|
||||||
peertubeTranslate,
|
|
||||||
PluginType,
|
PluginType,
|
||||||
RegisteredServerSettings,
|
RegisteredServerSettings,
|
||||||
ResultList
|
ResultList
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { OnInit, Directive } from '@angular/core'
|
import { Directive, OnInit } from '@angular/core'
|
||||||
import { ConfigService } from '@app/+admin/config/shared/config.service'
|
import { ConfigService } from '@app/+admin/config/shared/config.service'
|
||||||
import { AuthService, ScreenService, ServerService, User } from '@app/core'
|
import { AuthService, ScreenService, ServerService, User } from '@app/core'
|
||||||
import { FormReactive } from '@app/shared/shared-forms'
|
import { FormReactive } from '@app/shared/shared-forms'
|
||||||
import { ServerConfig, USER_ROLE_LABELS, UserAdminFlag, UserRole, VideoResolution } from '@shared/models'
|
import { USER_ROLE_LABELS } from '@shared/core-utils/users'
|
||||||
|
import { ServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models'
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export abstract class UserEdit extends FormReactive implements OnInit {
|
export abstract class UserEdit extends FormReactive implements OnInit {
|
||||||
|
|
|
@ -5,7 +5,8 @@ import { Injectable } from '@angular/core'
|
||||||
import { RestExtractor, ServerService } from '@app/core'
|
import { RestExtractor, ServerService } from '@app/core'
|
||||||
import { immutableAssign } from '@app/helpers'
|
import { immutableAssign } from '@app/helpers'
|
||||||
import { VideoService } from '@app/shared/shared-main'
|
import { VideoService } from '@app/shared/shared-main'
|
||||||
import { peertubeTranslate, VideosOverview as VideosOverviewServer } from '@shared/models'
|
import { peertubeTranslate } from '@shared/core-utils/i18n'
|
||||||
|
import { VideosOverview as VideosOverviewServer } from '@shared/models'
|
||||||
import { environment } from '../../../../environments/environment'
|
import { environment } from '../../../../environments/environment'
|
||||||
import { VideosOverview } from './videos-overview.model'
|
import { VideosOverview } from './videos-overview.model'
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-
|
||||||
import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
|
import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { I18n } from '@ngx-translate/i18n-polyfill'
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
import { BroadcastMessageLevel, getShortLocale, is18nPath, ServerConfig, UserRole } from '@shared/models'
|
import { getShortLocale, is18nPath } from '@shared/core-utils/i18n'
|
||||||
|
import { BroadcastMessageLevel, ServerConfig, UserRole } from '@shared/models'
|
||||||
import { MenuService } from './core/menu/menu.service'
|
import { MenuService } from './core/menu/menu.service'
|
||||||
import { POP_STATE_MODAL_DISMISS } from './helpers'
|
import { POP_STATE_MODAL_DISMISS } from './helpers'
|
||||||
import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
|
import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { BrowserModule } from '@angular/platform-browser'
|
||||||
import { ServerService } from '@app/core'
|
import { ServerService } from '@app/core'
|
||||||
import localeOc from '@app/helpers/locales/oc'
|
import localeOc from '@app/helpers/locales/oc'
|
||||||
import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core'
|
import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core'
|
||||||
import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models'
|
import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/core-utils/i18n'
|
||||||
import { AppRoutingModule } from './app-routing.module'
|
import { AppRoutingModule } from './app-routing.module'
|
||||||
import { AppComponent } from './app.component'
|
import { AppComponent } from './app.component'
|
||||||
import { CoreModule } from './core'
|
import { CoreModule } from './core'
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Observable, of } from 'rxjs'
|
import { Observable, of } from 'rxjs'
|
||||||
import { map } from 'rxjs/operators'
|
import { map } from 'rxjs/operators'
|
||||||
import { User } from '@app/core/users/user.model'
|
import { User } from '@app/core/users/user.model'
|
||||||
import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
|
import { peertubeLocalStorage } from '@app/helpers/peertube-web-storage'
|
||||||
|
import { hasUserRight } from '@shared/core-utils/users'
|
||||||
import {
|
import {
|
||||||
hasUserRight,
|
|
||||||
MyUser as ServerMyUserModel,
|
MyUser as ServerMyUserModel,
|
||||||
MyUserSpecialPlaylist,
|
MyUserSpecialPlaylist,
|
||||||
NSFWPolicyType,
|
NSFWPolicyType,
|
||||||
|
|
|
@ -9,15 +9,13 @@ import { RestExtractor } from '@app/core/rest'
|
||||||
import { ServerService } from '@app/core/server/server.service'
|
import { ServerService } from '@app/core/server/server.service'
|
||||||
import { getDevLocale, importModule, isOnDevLocale } from '@app/helpers'
|
import { getDevLocale, importModule, isOnDevLocale } from '@app/helpers'
|
||||||
import { CustomModalComponent } from '@app/modal/custom-modal.component'
|
import { CustomModalComponent } from '@app/modal/custom-modal.component'
|
||||||
|
import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n'
|
||||||
import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks'
|
import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks'
|
||||||
import {
|
import {
|
||||||
ClientHook,
|
ClientHook,
|
||||||
ClientHookName,
|
ClientHookName,
|
||||||
clientHookObject,
|
clientHookObject,
|
||||||
ClientScript,
|
ClientScript,
|
||||||
getCompleteLocale,
|
|
||||||
isDefaultLocale,
|
|
||||||
peertubeTranslate,
|
|
||||||
PluginClientScope,
|
PluginClientScope,
|
||||||
PluginTranslation,
|
PluginTranslation,
|
||||||
PluginType,
|
PluginType,
|
||||||
|
|
|
@ -4,15 +4,8 @@ import { HttpClient } from '@angular/common/http'
|
||||||
import { Inject, Injectable, LOCALE_ID } from '@angular/core'
|
import { Inject, Injectable, LOCALE_ID } from '@angular/core'
|
||||||
import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers'
|
import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers'
|
||||||
import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
|
import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
|
||||||
import {
|
import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n'
|
||||||
getCompleteLocale,
|
import { SearchTargetType, ServerConfig, ServerStats, VideoConstant } from '@shared/models'
|
||||||
isDefaultLocale,
|
|
||||||
peertubeTranslate,
|
|
||||||
SearchTargetType,
|
|
||||||
ServerConfig,
|
|
||||||
ServerStats,
|
|
||||||
VideoConstant
|
|
||||||
} from '@shared/models'
|
|
||||||
import { environment } from '../../../environments/environment'
|
import { environment } from '../../../environments/environment'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Account } from '@app/shared/shared-main/account/account.model'
|
import { Account } from '@app/shared/shared-main/account/account.model'
|
||||||
|
import { hasUserRight } from '@shared/core-utils/users'
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
hasUserRight,
|
|
||||||
NSFWPolicyType,
|
NSFWPolicyType,
|
||||||
User as UserServerModel,
|
User as UserServerModel,
|
||||||
UserAdminFlag,
|
UserAdminFlag,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core'
|
import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core'
|
||||||
import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers'
|
import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers'
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { getCompleteLocale, getShortLocale, I18N_LOCALES } from '@shared/models'
|
import { getCompleteLocale, getShortLocale, I18N_LOCALES } from '@shared/core-utils/i18n'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-language-chooser',
|
selector: 'my-language-chooser',
|
||||||
|
|
|
@ -3,7 +3,8 @@ import { catchError, map } from 'rxjs/operators'
|
||||||
import { HttpClient } from '@angular/common/http'
|
import { HttpClient } from '@angular/common/http'
|
||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { MarkdownService, RestExtractor, ServerService } from '@app/core'
|
import { MarkdownService, RestExtractor, ServerService } from '@app/core'
|
||||||
import { About, peertubeTranslate } from '@shared/models'
|
import { peertubeTranslate } from '@shared/core-utils/i18n'
|
||||||
|
import { About } from '@shared/models'
|
||||||
import { environment } from '../../../environments/environment'
|
import { environment } from '../../../environments/environment'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
|
@ -5,7 +5,8 @@ import { Injectable } from '@angular/core'
|
||||||
import { RestExtractor, ServerService } from '@app/core'
|
import { RestExtractor, ServerService } from '@app/core'
|
||||||
import { objectToFormData, sortBy } from '@app/helpers'
|
import { objectToFormData, sortBy } from '@app/helpers'
|
||||||
import { VideoService } from '@app/shared/shared-main/video'
|
import { VideoService } from '@app/shared/shared-main/video'
|
||||||
import { peertubeTranslate, ResultList, VideoCaption } from '@shared/models'
|
import { peertubeTranslate } from '@shared/core-utils/i18n'
|
||||||
|
import { ResultList, VideoCaption } from '@shared/models'
|
||||||
import { VideoCaptionEdit } from './video-caption-edit.model'
|
import { VideoCaptionEdit } from './video-caption-edit.model'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
|
@ -5,7 +5,8 @@ import { HttpClient, HttpParams } from '@angular/common/http'
|
||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { RestExtractor, RestPagination, RestService, ServerService, UserService } from '@app/core'
|
import { RestExtractor, RestPagination, RestService, ServerService, UserService } from '@app/core'
|
||||||
import { objectToFormData } from '@app/helpers'
|
import { objectToFormData } from '@app/helpers'
|
||||||
import { peertubeTranslate, ResultList, VideoImport, VideoImportCreate, VideoUpdate } from '@shared/models'
|
import { peertubeTranslate } from '@shared/core-utils/i18n'
|
||||||
|
import { ResultList, VideoImport, VideoImportCreate, VideoUpdate } from '@shared/models'
|
||||||
import { environment } from '../../../../environments/environment'
|
import { environment } from '../../../../environments/environment'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { AuthUser } from '@app/core'
|
import { AuthUser } from '@app/core'
|
||||||
import { User } from '@app/core/users/user.model'
|
import { User } from '@app/core/users/user.model'
|
||||||
import { durationToString, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers'
|
import { durationToString, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers'
|
||||||
|
import { peertubeTranslate } from '@shared/core-utils/i18n'
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
peertubeTranslate,
|
|
||||||
ServerConfig,
|
ServerConfig,
|
||||||
UserRight,
|
UserRight,
|
||||||
Video as VideoServerModel,
|
Video as VideoServerModel,
|
||||||
|
|
|
@ -6,7 +6,8 @@ import { Account } from '@app/shared/shared-main'
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
|
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
|
||||||
import { I18n } from '@ngx-translate/i18n-polyfill'
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
import { abusePredefinedReasonsMap, AbusePredefinedReasonsString } from '@shared/models'
|
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
|
||||||
|
import { AbusePredefinedReasonsString } from '@shared/models'
|
||||||
import { AbuseService } from '../abuse.service'
|
import { AbuseService } from '../abuse.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -6,7 +6,8 @@ import { VideoComment } from '@app/shared/shared-video-comment'
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
|
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
|
||||||
import { I18n } from '@ngx-translate/i18n-polyfill'
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
import { abusePredefinedReasonsMap, AbusePredefinedReasonsString } from '@shared/models'
|
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
|
||||||
|
import { AbusePredefinedReasonsString } from '@shared/models'
|
||||||
import { AbuseService } from '../abuse.service'
|
import { AbuseService } from '../abuse.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -7,7 +7,8 @@ import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
|
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
|
||||||
import { I18n } from '@ngx-translate/i18n-polyfill'
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
import { abusePredefinedReasonsMap, AbusePredefinedReasonsString } from '@shared/models'
|
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
|
||||||
|
import { AbusePredefinedReasonsString } from '@shared/models'
|
||||||
import { Video } from '../../shared-main'
|
import { Video } from '../../shared-main'
|
||||||
import { AbuseService } from '../abuse.service'
|
import { AbuseService } from '../abuse.service'
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { getAbsoluteAPIUrl } from '@app/helpers'
|
import { getAbsoluteAPIUrl } from '@app/helpers'
|
||||||
import { Actor } from '@app/shared/shared-main'
|
import { Actor } from '@app/shared/shared-main'
|
||||||
|
import { peertubeTranslate } from '@shared/core-utils/i18n'
|
||||||
import {
|
import {
|
||||||
AccountSummary,
|
AccountSummary,
|
||||||
peertubeTranslate,
|
|
||||||
VideoChannelSummary,
|
VideoChannelSummary,
|
||||||
VideoConstant,
|
VideoConstant,
|
||||||
VideoPlaylist as ServerVideoPlaylist,
|
VideoPlaylist as ServerVideoPlaylist,
|
||||||
|
|
|
@ -19,7 +19,8 @@ import './videojs-components/settings-panel'
|
||||||
import './videojs-components/settings-panel-child'
|
import './videojs-components/settings-panel-child'
|
||||||
import './videojs-components/theater-button'
|
import './videojs-components/theater-button'
|
||||||
import videojs from 'video.js'
|
import videojs from 'video.js'
|
||||||
import { isDefaultLocale, VideoFile } from '@shared/models'
|
import { VideoFile } from '@shared/models'
|
||||||
|
import { isDefaultLocale } from '@shared/core-utils/i18n'
|
||||||
import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
|
import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
|
||||||
import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder'
|
import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder'
|
||||||
import { segmentValidatorFactory } from './p2p-media-loader/segment-validator'
|
import { segmentValidatorFactory } from './p2p-media-loader/segment-validator'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from '@shared/models'
|
import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from '@shared/core-utils/i18n'
|
||||||
|
|
||||||
export class TranslationsManager {
|
export class TranslationsManager {
|
||||||
private static videojsLocaleCache: { [ path: string ]: any } = {}
|
private static videojsLocaleCache: { [ path: string ]: any } = {}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import './embed.scss'
|
import './embed.scss'
|
||||||
import videojs from 'video.js'
|
import videojs from 'video.js'
|
||||||
import { objectToUrlEncoded, peertubeLocalStorage, PureAuthUser } from '@root-helpers/index'
|
import { objectToUrlEncoded, peertubeLocalStorage, PureAuthUser } from '@root-helpers/index'
|
||||||
|
import { peertubeTranslate } from '../../../../shared/core-utils/i18n'
|
||||||
import {
|
import {
|
||||||
peertubeTranslate,
|
|
||||||
ResultList,
|
ResultList,
|
||||||
ServerConfig,
|
ServerConfig,
|
||||||
UserRefreshToken,
|
UserRefreshToken,
|
||||||
|
|
|
@ -29,6 +29,7 @@ module.exports = function () {
|
||||||
'video.js$': path.resolve('node_modules/video.js/core.js'),
|
'video.js$': path.resolve('node_modules/video.js/core.js'),
|
||||||
'@root-helpers': path.resolve('src/root-helpers'),
|
'@root-helpers': path.resolve('src/root-helpers'),
|
||||||
'@shared/models': path.resolve('../shared/models'),
|
'@shared/models': path.resolve('../shared/models'),
|
||||||
|
'@shared/core-utils': path.resolve('../shared/core-utils')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
|
import { logger } from '@server/helpers/logger'
|
||||||
import { createAccountAbuse, createVideoAbuse, createVideoCommentAbuse } from '@server/lib/moderation'
|
import { createAccountAbuse, createVideoAbuse, createVideoCommentAbuse } from '@server/lib/moderation'
|
||||||
|
import { Notifier } from '@server/lib/notifier'
|
||||||
import { AbuseModel } from '@server/models/abuse/abuse'
|
import { AbuseModel } from '@server/models/abuse/abuse'
|
||||||
import { AbuseMessageModel } from '@server/models/abuse/abuse-message'
|
import { AbuseMessageModel } from '@server/models/abuse/abuse-message'
|
||||||
import { getServerActor } from '@server/models/application/application'
|
import { getServerActor } from '@server/models/application/application'
|
||||||
import { AbuseCreate, abusePredefinedReasonsMap, AbuseState, UserRight } from '../../../shared'
|
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
|
||||||
|
import { AbuseCreate, AbuseState, UserRight } from '../../../shared'
|
||||||
import { getFormattedObjects } from '../../helpers/utils'
|
import { getFormattedObjects } from '../../helpers/utils'
|
||||||
import { sequelizeTypescript } from '../../initializers/database'
|
import { sequelizeTypescript } from '../../initializers/database'
|
||||||
import {
|
import {
|
||||||
|
@ -25,8 +28,6 @@ import {
|
||||||
setDefaultSort
|
setDefaultSort
|
||||||
} from '../../middlewares'
|
} from '../../middlewares'
|
||||||
import { AccountModel } from '../../models/account/account'
|
import { AccountModel } from '../../models/account/account'
|
||||||
import { Notifier } from '@server/lib/notifier'
|
|
||||||
import { logger } from '@server/helpers/logger'
|
|
||||||
|
|
||||||
const abuseRouter = express.Router()
|
const abuseRouter = express.Router()
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { constants, promises as fs } from 'fs'
|
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
|
import { constants, promises as fs } from 'fs'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { root } from '../helpers/core-utils'
|
|
||||||
import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers/constants'
|
|
||||||
import { asyncMiddleware, embedCSP } from '../middlewares'
|
|
||||||
import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n'
|
|
||||||
import { ClientHtml } from '../lib/client-html'
|
|
||||||
import { logger } from '../helpers/logger'
|
|
||||||
import { CONFIG } from '@server/initializers/config'
|
import { CONFIG } from '@server/initializers/config'
|
||||||
|
import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '@shared/core-utils/i18n'
|
||||||
|
import { root } from '../helpers/core-utils'
|
||||||
|
import { logger } from '../helpers/logger'
|
||||||
|
import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers/constants'
|
||||||
|
import { ClientHtml } from '../lib/client-html'
|
||||||
|
import { asyncMiddleware, embedCSP } from '../middlewares'
|
||||||
|
|
||||||
const clientsRouter = express.Router()
|
const clientsRouter = express.Router()
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { getPluginValidator, pluginStaticDirectoryValidator, getExternalAuthVali
|
||||||
import { serveThemeCSSValidator } from '../middlewares/validators/themes'
|
import { serveThemeCSSValidator } from '../middlewares/validators/themes'
|
||||||
import { PluginType } from '../../shared/models/plugins/plugin.type'
|
import { PluginType } from '../../shared/models/plugins/plugin.type'
|
||||||
import { isTestInstance } from '../helpers/core-utils'
|
import { isTestInstance } from '../helpers/core-utils'
|
||||||
import { getCompleteLocale, is18nLocale } from '../../shared/models/i18n'
|
import { getCompleteLocale, is18nLocale } from '../../shared/core-utils/i18n'
|
||||||
import { logger } from '@server/helpers/logger'
|
import { logger } from '@server/helpers/logger'
|
||||||
|
|
||||||
const sendFileOptions = {
|
const sendFileOptions = {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import validator from 'validator'
|
import validator from 'validator'
|
||||||
import { AbuseFilter, abusePredefinedReasonsMap, AbusePredefinedReasonsString, AbuseVideoIs, AbuseCreate } from '@shared/models'
|
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
|
||||||
|
import { AbuseCreate, AbuseFilter, AbusePredefinedReasonsString, AbuseVideoIs } from '@shared/models'
|
||||||
import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants'
|
import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants'
|
||||||
import { exists, isArray } from './misc'
|
import { exists, isArray } from './misc'
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@ import { isUrlValid } from './activitypub/misc'
|
||||||
const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS
|
const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS
|
||||||
|
|
||||||
function isPluginTypeValid (value: any) {
|
function isPluginTypeValid (value: any) {
|
||||||
return exists(value) && validator.isInt('' + value) && PluginType[value] !== undefined
|
return exists(value) &&
|
||||||
|
(value === PluginType.PLUGIN || value === PluginType.THEME)
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPluginNameValid (value: string) {
|
function isPluginNameValid (value: string) {
|
||||||
|
|
|
@ -10,7 +10,8 @@ function isVideoBlacklistReasonValid (value: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isVideoBlacklistTypeValid (value: any) {
|
function isVideoBlacklistTypeValid (value: any) {
|
||||||
return exists(value) && validator.isInt('' + value) && VideoBlacklistType[value] !== undefined
|
return exists(value) &&
|
||||||
|
(value === VideoBlacklistType.AUTO_BEFORE_PUBLISHED || value === VideoBlacklistType.MANUAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { createAccountAbuse, createVideoAbuse, createVideoCommentAbuse } from '@
|
||||||
import { AccountModel } from '@server/models/account/account'
|
import { AccountModel } from '@server/models/account/account'
|
||||||
import { VideoModel } from '@server/models/video/video'
|
import { VideoModel } from '@server/models/video/video'
|
||||||
import { VideoCommentModel } from '@server/models/video/video-comment'
|
import { VideoCommentModel } from '@server/models/video/video-comment'
|
||||||
import { AbuseObject, abusePredefinedReasonsMap, AbuseState, ActivityCreate, ActivityFlag } from '../../../../shared'
|
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
|
||||||
|
import { AbuseObject, AbuseState, ActivityCreate, ActivityFlag } from '../../../../shared'
|
||||||
import { getAPId } from '../../../helpers/activitypub'
|
import { getAPId } from '../../../helpers/activitypub'
|
||||||
import { retryTransactionWrapper } from '../../../helpers/database-utils'
|
import { retryTransactionWrapper } from '../../../helpers/database-utils'
|
||||||
import { logger } from '../../../helpers/logger'
|
import { logger } from '../../../helpers/logger'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/models/i18n/i18n'
|
import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n'
|
||||||
import {
|
import {
|
||||||
AVATARS_SIZE,
|
AVATARS_SIZE,
|
||||||
CUSTOM_HTML_TAG_COMMENTS,
|
CUSTOM_HTML_TAG_COMMENTS,
|
||||||
|
|
|
@ -6,7 +6,7 @@ function ensureUserHasRight (userRight: UserRight) {
|
||||||
return function (req: express.Request, res: express.Response, next: express.NextFunction) {
|
return function (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||||
const user = res.locals.oauth.token.user
|
const user = res.locals.oauth.token.user
|
||||||
if (user.hasRight(userRight) === false) {
|
if (user.hasRight(userRight) === false) {
|
||||||
const message = `User ${user.username} does not have right ${UserRight[userRight]} to access to ${req.path}.`
|
const message = `User ${user.username} does not have right ${userRight} to access to ${req.path}.`
|
||||||
logger.info(message)
|
logger.info(message)
|
||||||
|
|
||||||
return res.status(403).json({ error: message })
|
return res.status(403).json({ error: message })
|
||||||
|
|
|
@ -17,11 +17,11 @@ import {
|
||||||
UpdatedAt
|
UpdatedAt
|
||||||
} from 'sequelize-typescript'
|
} from 'sequelize-typescript'
|
||||||
import { isAbuseModerationCommentValid, isAbuseReasonValid, isAbuseStateValid } from '@server/helpers/custom-validators/abuses'
|
import { isAbuseModerationCommentValid, isAbuseReasonValid, isAbuseStateValid } from '@server/helpers/custom-validators/abuses'
|
||||||
|
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
|
||||||
import {
|
import {
|
||||||
AbuseFilter,
|
AbuseFilter,
|
||||||
AbuseObject,
|
AbuseObject,
|
||||||
AbusePredefinedReasons,
|
AbusePredefinedReasons,
|
||||||
abusePredefinedReasonsMap,
|
|
||||||
AbusePredefinedReasonsString,
|
AbusePredefinedReasonsString,
|
||||||
AbuseState,
|
AbuseState,
|
||||||
AbuseVideoIs,
|
AbuseVideoIs,
|
||||||
|
@ -646,8 +646,10 @@ export class AbuseModel extends Model<AbuseModel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static getPredefinedReasonsStrings (predefinedReasons: AbusePredefinedReasons[]): AbusePredefinedReasonsString[] {
|
private static getPredefinedReasonsStrings (predefinedReasons: AbusePredefinedReasons[]): AbusePredefinedReasonsString[] {
|
||||||
|
const invertedPredefinedReasons = invert(abusePredefinedReasonsMap)
|
||||||
|
|
||||||
return (predefinedReasons || [])
|
return (predefinedReasons || [])
|
||||||
.filter(r => r in AbusePredefinedReasons)
|
.map(r => invertedPredefinedReasons[r] as AbusePredefinedReasonsString)
|
||||||
.map(r => invert(abusePredefinedReasonsMap)[r] as AbusePredefinedReasonsString)
|
.filter(v => !!v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import * as Bluebird from 'bluebird'
|
||||||
|
import { values } from 'lodash'
|
||||||
import { col, FindOptions, fn, literal, Op, QueryTypes, where, WhereOptions } from 'sequelize'
|
import { col, FindOptions, fn, literal, Op, QueryTypes, where, WhereOptions } from 'sequelize'
|
||||||
import {
|
import {
|
||||||
AfterDestroy,
|
AfterDestroy,
|
||||||
|
@ -19,8 +21,21 @@ import {
|
||||||
Table,
|
Table,
|
||||||
UpdatedAt
|
UpdatedAt
|
||||||
} from 'sequelize-typescript'
|
} from 'sequelize-typescript'
|
||||||
import { hasUserRight, MyUser, USER_ROLE_LABELS, UserRight, AbuseState, VideoPlaylistType, VideoPrivacy } from '../../../shared'
|
import {
|
||||||
|
MMyUserFormattable,
|
||||||
|
MUserDefault,
|
||||||
|
MUserFormattable,
|
||||||
|
MUserId,
|
||||||
|
MUserNotifSettingChannelDefault,
|
||||||
|
MUserWithNotificationSetting,
|
||||||
|
MVideoFullLight
|
||||||
|
} from '@server/types/models'
|
||||||
|
import { hasUserRight, USER_ROLE_LABELS } from '../../../shared/core-utils/users'
|
||||||
|
import { AbuseState, MyUser, UserRight, VideoPlaylistType, VideoPrivacy } from '../../../shared/models'
|
||||||
import { User, UserRole } from '../../../shared/models/users'
|
import { User, UserRole } from '../../../shared/models/users'
|
||||||
|
import { UserAdminFlag } from '../../../shared/models/users/user-flag.model'
|
||||||
|
import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type'
|
||||||
|
import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
|
||||||
import {
|
import {
|
||||||
isNoInstanceConfigWarningModal,
|
isNoInstanceConfigWarningModal,
|
||||||
isNoWelcomeModal,
|
isNoWelcomeModal,
|
||||||
|
@ -42,33 +57,19 @@ import {
|
||||||
isUserWebTorrentEnabledValid
|
isUserWebTorrentEnabledValid
|
||||||
} from '../../helpers/custom-validators/users'
|
} from '../../helpers/custom-validators/users'
|
||||||
import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'
|
import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'
|
||||||
import { OAuthTokenModel } from '../oauth/oauth-token'
|
|
||||||
import { getSort, throwIfNotValid } from '../utils'
|
|
||||||
import { VideoChannelModel } from '../video/video-channel'
|
|
||||||
import { VideoPlaylistModel } from '../video/video-playlist'
|
|
||||||
import { AccountModel } from './account'
|
|
||||||
import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type'
|
|
||||||
import { values } from 'lodash'
|
|
||||||
import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants'
|
import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants'
|
||||||
import { clearCacheByUserId } from '../../lib/oauth-model'
|
import { clearCacheByUserId } from '../../lib/oauth-model'
|
||||||
import { UserNotificationSettingModel } from './user-notification-setting'
|
import { getThemeOrDefault } from '../../lib/plugins/theme-utils'
|
||||||
import { VideoModel } from '../video/video'
|
|
||||||
import { ActorModel } from '../activitypub/actor'
|
import { ActorModel } from '../activitypub/actor'
|
||||||
import { ActorFollowModel } from '../activitypub/actor-follow'
|
import { ActorFollowModel } from '../activitypub/actor-follow'
|
||||||
|
import { OAuthTokenModel } from '../oauth/oauth-token'
|
||||||
|
import { getSort, throwIfNotValid } from '../utils'
|
||||||
|
import { VideoModel } from '../video/video'
|
||||||
|
import { VideoChannelModel } from '../video/video-channel'
|
||||||
import { VideoImportModel } from '../video/video-import'
|
import { VideoImportModel } from '../video/video-import'
|
||||||
import { UserAdminFlag } from '../../../shared/models/users/user-flag.model'
|
import { VideoPlaylistModel } from '../video/video-playlist'
|
||||||
import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
|
import { AccountModel } from './account'
|
||||||
import { getThemeOrDefault } from '../../lib/plugins/theme-utils'
|
import { UserNotificationSettingModel } from './user-notification-setting'
|
||||||
import * as Bluebird from 'bluebird'
|
|
||||||
import {
|
|
||||||
MMyUserFormattable,
|
|
||||||
MUserDefault,
|
|
||||||
MUserFormattable,
|
|
||||||
MUserId,
|
|
||||||
MUserNotifSettingChannelDefault,
|
|
||||||
MUserWithNotificationSetting,
|
|
||||||
MVideoFullLight
|
|
||||||
} from '@server/types/models'
|
|
||||||
|
|
||||||
enum ScopeNames {
|
enum ScopeNames {
|
||||||
FOR_ME_API = 'FOR_ME_API',
|
FOR_ME_API = 'FOR_ME_API',
|
||||||
|
|
14
shared/core-utils/abuse/abuse-predefined-reasons.ts
Normal file
14
shared/core-utils/abuse/abuse-predefined-reasons.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import { AbusePredefinedReasons, AbusePredefinedReasonsString } from '../../models/moderation/abuse/abuse-reason.model'
|
||||||
|
|
||||||
|
export const abusePredefinedReasonsMap: {
|
||||||
|
[key in AbusePredefinedReasonsString]: AbusePredefinedReasons
|
||||||
|
} = {
|
||||||
|
violentOrRepulsive: AbusePredefinedReasons.VIOLENT_OR_REPULSIVE,
|
||||||
|
hatefulOrAbusive: AbusePredefinedReasons.HATEFUL_OR_ABUSIVE,
|
||||||
|
spamOrMisleading: AbusePredefinedReasons.SPAM_OR_MISLEADING,
|
||||||
|
privacy: AbusePredefinedReasons.PRIVACY,
|
||||||
|
rights: AbusePredefinedReasons.RIGHTS,
|
||||||
|
serverRules: AbusePredefinedReasons.SERVER_RULES,
|
||||||
|
thumbnails: AbusePredefinedReasons.THUMBNAILS,
|
||||||
|
captions: AbusePredefinedReasons.CAPTIONS
|
||||||
|
}
|
1
shared/core-utils/abuse/index.ts
Normal file
1
shared/core-utils/abuse/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export * from './abuse-predefined-reasons'
|
1
shared/core-utils/users/index.ts
Normal file
1
shared/core-utils/users/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export * from './user-role'
|
35
shared/core-utils/users/user-role.ts
Normal file
35
shared/core-utils/users/user-role.ts
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import { UserRight, UserRole } from '../../models/users'
|
||||||
|
|
||||||
|
export const USER_ROLE_LABELS: { [ id in UserRole ]: string } = {
|
||||||
|
[UserRole.USER]: 'User',
|
||||||
|
[UserRole.MODERATOR]: 'Moderator',
|
||||||
|
[UserRole.ADMINISTRATOR]: 'Administrator'
|
||||||
|
}
|
||||||
|
|
||||||
|
const userRoleRights: { [ id in UserRole ]: UserRight[] } = {
|
||||||
|
[UserRole.ADMINISTRATOR]: [
|
||||||
|
UserRight.ALL
|
||||||
|
],
|
||||||
|
|
||||||
|
[UserRole.MODERATOR]: [
|
||||||
|
UserRight.MANAGE_VIDEO_BLACKLIST,
|
||||||
|
UserRight.MANAGE_ABUSES,
|
||||||
|
UserRight.REMOVE_ANY_VIDEO,
|
||||||
|
UserRight.REMOVE_ANY_VIDEO_CHANNEL,
|
||||||
|
UserRight.REMOVE_ANY_VIDEO_PLAYLIST,
|
||||||
|
UserRight.REMOVE_ANY_VIDEO_COMMENT,
|
||||||
|
UserRight.UPDATE_ANY_VIDEO,
|
||||||
|
UserRight.SEE_ALL_VIDEOS,
|
||||||
|
UserRight.MANAGE_ACCOUNTS_BLOCKLIST,
|
||||||
|
UserRight.MANAGE_SERVERS_BLOCKLIST,
|
||||||
|
UserRight.MANAGE_USERS
|
||||||
|
],
|
||||||
|
|
||||||
|
[UserRole.USER]: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasUserRight (userRole: UserRole, userRight: UserRight) {
|
||||||
|
const userRights = userRoleRights[userRole]
|
||||||
|
|
||||||
|
return userRights.includes(UserRight.ALL) || userRights.includes(userRight)
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
export enum FeedFormat {
|
export const enum FeedFormat {
|
||||||
RSS = 'xml',
|
RSS = 'xml',
|
||||||
ATOM = 'atom',
|
ATOM = 'atom',
|
||||||
JSON = 'json'
|
JSON = 'json'
|
||||||
|
|
|
@ -7,7 +7,6 @@ export * from './redundancy'
|
||||||
export * from './users'
|
export * from './users'
|
||||||
export * from './videos'
|
export * from './videos'
|
||||||
export * from './feeds'
|
export * from './feeds'
|
||||||
export * from './i18n'
|
|
||||||
export * from './overviews'
|
export * from './overviews'
|
||||||
export * from './plugins'
|
export * from './plugins'
|
||||||
export * from './search'
|
export * from './search'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum AbusePredefinedReasons {
|
export const enum AbusePredefinedReasons {
|
||||||
VIOLENT_OR_REPULSIVE = 1,
|
VIOLENT_OR_REPULSIVE = 1,
|
||||||
HATEFUL_OR_ABUSIVE,
|
HATEFUL_OR_ABUSIVE,
|
||||||
SPAM_OR_MISLEADING,
|
SPAM_OR_MISLEADING,
|
||||||
|
@ -18,16 +18,3 @@ export type AbusePredefinedReasonsString =
|
||||||
'serverRules' |
|
'serverRules' |
|
||||||
'thumbnails' |
|
'thumbnails' |
|
||||||
'captions'
|
'captions'
|
||||||
|
|
||||||
export const abusePredefinedReasonsMap: {
|
|
||||||
[key in AbusePredefinedReasonsString]: AbusePredefinedReasons
|
|
||||||
} = {
|
|
||||||
violentOrRepulsive: AbusePredefinedReasons.VIOLENT_OR_REPULSIVE,
|
|
||||||
hatefulOrAbusive: AbusePredefinedReasons.HATEFUL_OR_ABUSIVE,
|
|
||||||
spamOrMisleading: AbusePredefinedReasons.SPAM_OR_MISLEADING,
|
|
||||||
privacy: AbusePredefinedReasons.PRIVACY,
|
|
||||||
rights: AbusePredefinedReasons.RIGHTS,
|
|
||||||
serverRules: AbusePredefinedReasons.SERVER_RULES,
|
|
||||||
thumbnails: AbusePredefinedReasons.THUMBNAILS,
|
|
||||||
captions: AbusePredefinedReasons.CAPTIONS
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum AbuseState {
|
export const enum AbuseState {
|
||||||
PENDING = 1,
|
PENDING = 1,
|
||||||
REJECTED = 2,
|
REJECTED = 2,
|
||||||
ACCEPTED = 3
|
ACCEPTED = 3
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum HookType {
|
export const enum HookType {
|
||||||
STATIC = 1,
|
STATIC = 1,
|
||||||
ACTION = 2,
|
ACTION = 2,
|
||||||
FILTER = 3
|
FILTER = 3
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum UserAdminFlag {
|
export const enum UserAdminFlag {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
BYPASS_VIDEO_AUTO_BLACKLIST = 1 << 0
|
BYPASS_VIDEO_AUTO_BLACKLIST = 1 << 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum UserNotificationSettingValue {
|
export const enum UserNotificationSettingValue {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
WEB = 1 << 0,
|
WEB = 1 << 0,
|
||||||
EMAIL = 1 << 1
|
EMAIL = 1 << 1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum UserRight {
|
export const enum UserRight {
|
||||||
ALL,
|
ALL,
|
||||||
|
|
||||||
MANAGE_USERS,
|
MANAGE_USERS,
|
||||||
|
|
|
@ -1,42 +1,6 @@
|
||||||
import { UserRight } from './user-right.enum'
|
|
||||||
|
|
||||||
// Keep the order
|
// Keep the order
|
||||||
export enum UserRole {
|
export enum UserRole {
|
||||||
ADMINISTRATOR = 0,
|
ADMINISTRATOR = 0,
|
||||||
MODERATOR = 1,
|
MODERATOR = 1,
|
||||||
USER = 2
|
USER = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
export const USER_ROLE_LABELS: { [ id in UserRole ]: string } = {
|
|
||||||
[UserRole.USER]: 'User',
|
|
||||||
[UserRole.MODERATOR]: 'Moderator',
|
|
||||||
[UserRole.ADMINISTRATOR]: 'Administrator'
|
|
||||||
}
|
|
||||||
|
|
||||||
const userRoleRights: { [ id in UserRole ]: UserRight[] } = {
|
|
||||||
[UserRole.ADMINISTRATOR]: [
|
|
||||||
UserRight.ALL
|
|
||||||
],
|
|
||||||
|
|
||||||
[UserRole.MODERATOR]: [
|
|
||||||
UserRight.MANAGE_VIDEO_BLACKLIST,
|
|
||||||
UserRight.MANAGE_ABUSES,
|
|
||||||
UserRight.REMOVE_ANY_VIDEO,
|
|
||||||
UserRight.REMOVE_ANY_VIDEO_CHANNEL,
|
|
||||||
UserRight.REMOVE_ANY_VIDEO_PLAYLIST,
|
|
||||||
UserRight.REMOVE_ANY_VIDEO_COMMENT,
|
|
||||||
UserRight.UPDATE_ANY_VIDEO,
|
|
||||||
UserRight.SEE_ALL_VIDEOS,
|
|
||||||
UserRight.MANAGE_ACCOUNTS_BLOCKLIST,
|
|
||||||
UserRight.MANAGE_SERVERS_BLOCKLIST,
|
|
||||||
UserRight.MANAGE_USERS
|
|
||||||
],
|
|
||||||
|
|
||||||
[UserRole.USER]: []
|
|
||||||
}
|
|
||||||
|
|
||||||
export function hasUserRight (userRole: UserRole, userRight: UserRight) {
|
|
||||||
const userRights = userRoleRights[userRole]
|
|
||||||
|
|
||||||
return userRights.includes(UserRight.ALL) || userRights.includes(userRight)
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Video } from '../video.model'
|
import { Video } from '../video.model'
|
||||||
|
|
||||||
export enum VideoBlacklistType {
|
export const enum VideoBlacklistType {
|
||||||
MANUAL = 1,
|
MANUAL = 1,
|
||||||
AUTO_BEFORE_PUBLISHED = 2
|
AUTO_BEFORE_PUBLISHED = 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum VideoImportState {
|
export const enum VideoImportState {
|
||||||
PENDING = 1,
|
PENDING = 1,
|
||||||
SUCCESS = 2,
|
SUCCESS = 2,
|
||||||
FAILED = 3,
|
FAILED = 3,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Video } from '../video.model'
|
import { Video } from '../video.model'
|
||||||
|
|
||||||
export enum VideoPlaylistElementType {
|
export const enum VideoPlaylistElementType {
|
||||||
REGULAR = 0,
|
REGULAR = 0,
|
||||||
DELETED = 1,
|
DELETED = 1,
|
||||||
PRIVATE = 2,
|
PRIVATE = 2,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum VideoPlaylistPrivacy {
|
export const enum VideoPlaylistPrivacy {
|
||||||
PUBLIC = 1,
|
PUBLIC = 1,
|
||||||
UNLISTED = 2,
|
UNLISTED = 2,
|
||||||
PRIVATE = 3
|
PRIVATE = 3
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum VideoPlaylistType {
|
export const enum VideoPlaylistType {
|
||||||
REGULAR = 1,
|
REGULAR = 1,
|
||||||
WATCH_LATER = 2
|
WATCH_LATER = 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum ThumbnailType {
|
export const enum ThumbnailType {
|
||||||
MINIATURE = 1,
|
MINIATURE = 1,
|
||||||
PREVIEW = 2
|
PREVIEW = 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ export interface VideoChangeOwnership {
|
||||||
createdAt: Date
|
createdAt: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum VideoChangeOwnershipStatus {
|
export const enum VideoChangeOwnershipStatus {
|
||||||
WAITING = 'WAITING',
|
WAITING = 'WAITING',
|
||||||
ACCEPTED = 'ACCEPTED',
|
ACCEPTED = 'ACCEPTED',
|
||||||
REFUSED = 'REFUSED'
|
REFUSED = 'REFUSED'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum VideoPrivacy {
|
export const enum VideoPrivacy {
|
||||||
PUBLIC = 1,
|
PUBLIC = 1,
|
||||||
UNLISTED = 2,
|
UNLISTED = 2,
|
||||||
PRIVATE = 3,
|
PRIVATE = 3,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { VideoTranscodingFPS } from './video-transcoding-fps.model'
|
import { VideoTranscodingFPS } from './video-transcoding-fps.model'
|
||||||
|
|
||||||
export enum VideoResolution {
|
export const enum VideoResolution {
|
||||||
H_NOVIDEO = 0,
|
H_NOVIDEO = 0,
|
||||||
H_240P = 240,
|
H_240P = 240,
|
||||||
H_360P = 360,
|
H_360P = 360,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum VideoState {
|
export const enum VideoState {
|
||||||
PUBLISHED = 1,
|
PUBLISHED = 1,
|
||||||
TO_TRANSCODE = 2,
|
TO_TRANSCODE = 2,
|
||||||
TO_IMPORT = 3
|
TO_IMPORT = 3
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export enum VideoStreamingPlaylistType {
|
export const enum VideoStreamingPlaylistType {
|
||||||
HLS = 1
|
HLS = 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue