From 3a4992633ee62d5edfbb484d9c6bcb3cf158489d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 31 Jul 2023 14:34:36 +0200 Subject: Migrate server to ESM Sorry for the very big commit that may lead to git log issues and merge conflicts, but it's a major step forward: * Server can be faster at startup because imports() are async and we can easily lazy import big modules * Angular doesn't seem to support ES import (with .js extension), so we had to correctly organize peertube into a monorepo: * Use yarn workspace feature * Use typescript reference projects for dependencies * Shared projects have been moved into "packages", each one is now a node module (with a dedicated package.json/tsconfig.json) * server/tools have been moved into apps/ and is now a dedicated app bundled and published on NPM so users don't have to build peertube cli tools manually * server/tests have been moved into packages/ so we don't compile them every time we want to run the server * Use isolatedModule option: * Had to move from const enum to const (https://www.typescriptlang.org/docs/handbook/enums.html#objects-vs-enums) * Had to explictely specify "type" imports when used in decorators * Prefer tsx (that uses esbuild under the hood) instead of ts-node to load typescript files (tests with mocha or scripts): * To reduce test complexity as esbuild doesn't support decorator metadata, we only test server files that do not import server models * We still build tests files into js files for a faster CI * Remove unmaintained peertube CLI import script * Removed some barrels to speed up execution (less imports) --- .../form-validators/video-playlist-validators.ts | 4 ++-- .../shared-abuse-list/abuse-details.component.ts | 2 +- .../shared-abuse-list/abuse-list-table.component.ts | 4 ++-- .../shared-abuse-list/abuse-message-modal.component.ts | 2 +- .../moderation-comment-modal.component.ts | 2 +- .../shared/shared-abuse-list/processed-abuse.model.ts | 2 +- .../shared-actor-image/actor-avatar.component.ts | 2 +- .../shared-custom-markup/custom-markup.service.ts | 2 +- .../shared-custom-markup/dynamic-element.service.ts | 2 +- .../channel-miniature-markup.component.ts | 2 +- .../peertube-custom-tags/embed-markup.component.ts | 2 +- .../video-miniature-markup.component.ts | 2 +- .../videos-list-markup.component.ts | 4 ++-- .../shared-forms/dynamic-form-field.component.ts | 2 +- .../app/shared/shared-forms/form-validator.service.ts | 2 +- .../shared/shared-forms/markdown-textarea.component.ts | 2 +- .../shared/shared-forms/preview-upload.component.ts | 2 +- .../shared/shared-forms/timestamp-input.component.ts | 2 +- .../instance-about-accordion.component.ts | 3 +-- .../instance-features-table.component.ts | 2 +- .../shared/shared-instance/instance-follow.service.ts | 4 ++-- .../src/app/shared/shared-instance/instance.service.ts | 5 ++--- .../app/shared/shared-main/account/account.model.ts | 2 +- .../app/shared/shared-main/account/account.service.ts | 2 +- .../src/app/shared/shared-main/account/actor.model.ts | 2 +- .../shared-main/auth/auth-interceptor.service.ts | 3 +-- .../shared-main/custom-page/custom-page.service.ts | 2 +- .../app/shared/shared-main/feeds/syndication.model.ts | 4 ++-- .../src/app/shared/shared-main/misc/help.component.ts | 2 +- .../plugins/plugin-placeholder.component.ts | 2 +- .../shared-main/plugins/plugin-selector.directive.ts | 2 +- .../shared/shared-main/users/user-history.service.ts | 2 +- .../shared-main/users/user-notification.model.ts | 15 ++++++++------- .../shared-main/users/user-notification.service.ts | 2 +- .../shared-main/users/user-notifications.component.ts | 2 +- .../shared-main/video-caption/video-caption.service.ts | 4 ++-- .../video-channel-sync/video-channel-sync.service.ts | 3 +-- .../shared-main/video-channel/video-channel.model.ts | 2 +- .../shared-main/video-channel/video-channel.service.ts | 2 +- .../app/shared/shared-main/video/embed.component.ts | 4 ++-- .../app/shared/shared-main/video/redundancy.service.ts | 2 +- .../shared/shared-main/video/video-details.model.ts | 6 +++--- .../app/shared/shared-main/video/video-edit.model.ts | 6 +++--- .../shared-main/video/video-file-token.service.ts | 2 +- .../shared/shared-main/video/video-import.service.ts | 4 ++-- .../shared-main/video/video-ownership.service.ts | 2 +- .../shared/shared-main/video/video-password.service.ts | 2 +- client/src/app/shared/shared-main/video/video.model.ts | 11 ++++++----- .../src/app/shared/shared-main/video/video.service.ts | 17 +++++++++-------- .../src/app/shared/shared-moderation/abuse.service.ts | 2 +- .../shared/shared-moderation/account-block.model.ts | 2 +- .../app/shared/shared-moderation/blocklist.service.ts | 4 ++-- .../src/app/shared/shared-moderation/bulk.service.ts | 2 +- .../report-modals/account-report.component.ts | 4 ++-- .../report-modals/comment-report.component.ts | 4 ++-- .../report-modals/video-report.component.ts | 4 ++-- .../shared-moderation/server-blocklist.component.ts | 2 +- .../shared-moderation/user-ban-modal.component.ts | 2 +- .../user-moderation-dropdown.component.ts | 2 +- .../shared/shared-moderation/video-block.service.ts | 6 +++--- .../app/shared/shared-search/advanced-search.model.ts | 2 +- .../app/shared/shared-search/find-in-bulk.service.ts | 4 ++-- client/src/app/shared/shared-search/search.service.ts | 2 +- .../shared/shared-share-modal/video-share.component.ts | 4 ++-- .../shared-support-modal/support-modal.component.ts | 2 +- .../shared-thumbnail/video-thumbnail.component.ts | 2 +- .../user-interface-settings.component.ts | 2 +- .../user-video-settings.component.ts | 3 +-- .../subscribe-button.component.ts | 2 +- .../user-subscription.service.ts | 2 +- .../src/app/shared/shared-users/two-factor.service.ts | 2 +- .../src/app/shared/shared-users/user-admin.service.ts | 4 ++-- .../video-comment-thread-tree.model.ts | 2 +- .../shared/shared-video-comment/video-comment.model.ts | 2 +- .../shared-video-comment/video-comment.service.ts | 2 +- .../live-stream-information.component.ts | 4 ++-- .../app/shared/shared-video-live/live-video.service.ts | 2 +- .../video-actions-dropdown.component.ts | 2 +- .../shared-video-miniature/video-download.component.ts | 4 ++-- .../video-filters-header.component.ts | 2 +- .../shared-video-miniature/video-filters.model.ts | 18 ++++++++++++------ .../video-miniature.component.ts | 2 +- .../shared-video-miniature/videos-list.component.ts | 4 ++-- .../videos-selection.component.ts | 4 ++-- .../video-add-to-playlist.component.ts | 4 ++-- .../video-playlist-element-miniature.component.ts | 4 ++-- .../video-playlist-element.model.ts | 4 ++-- .../shared-video-playlist/video-playlist.model.ts | 14 +++++++------- .../shared-video-playlist/video-playlist.service.ts | 2 +- 89 files changed, 155 insertions(+), 151 deletions(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/form-validators/video-playlist-validators.ts b/client/src/app/shared/form-validators/video-playlist-validators.ts index 63af637a3..3cddcaad2 100644 --- a/client/src/app/shared/form-validators/video-playlist-validators.ts +++ b/client/src/app/shared/form-validators/video-playlist-validators.ts @@ -1,6 +1,6 @@ import { Validators, AbstractControl } from '@angular/forms' import { BuildFormValidator } from './form-validator.model' -import { VideoPlaylistPrivacy } from '@shared/models' +import { VideoPlaylistPrivacy, VideoPlaylistPrivacyType } from '@peertube/peertube-models' export const VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR: BuildFormValidator = { VALIDATORS: [ @@ -42,7 +42,7 @@ export const VIDEO_PLAYLIST_CHANNEL_ID_VALIDATOR: BuildFormValidator = { } } -export function setPlaylistChannelValidator (channelControl: AbstractControl, privacy: VideoPlaylistPrivacy) { +export function setPlaylistChannelValidator (channelControl: AbstractControl, privacy: VideoPlaylistPrivacyType) { if (privacy.toString() === VideoPlaylistPrivacy.PUBLIC.toString()) { channelControl.setValidators([ Validators.required ]) } else { diff --git a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts index e15edf8c2..357dc4522 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core' import { durationToString } from '@app/helpers' -import { AbusePredefinedReasonsString } from '@shared/models' +import { AbusePredefinedReasonsString } from '@peertube/peertube-models' import { ProcessedAbuse } from './processed-abuse.model' @Component({ diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index d8470e927..c38e1286f 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts @@ -7,8 +7,8 @@ import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' import { VideoCommentService } from '@app/shared/shared-video-comment' +import { AbuseState, AbuseStateType, AdminAbuse } from '@peertube/peertube-models' import { logger } from '@root-helpers/logger' -import { AbuseState, AdminAbuse } from '@shared/models' import { AdvancedInputFilter } from '../shared-forms' import { AbuseMessageModalComponent } from './abuse-message-modal.component' import { ModerationCommentModalComponent } from './moderation-comment-modal.component' @@ -144,7 +144,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit { }) } - updateAbuseState (abuse: AdminAbuse, state: AbuseState) { + updateAbuseState (abuse: AdminAbuse, state: AbuseStateType) { this.abuseService.updateAbuse(abuse, { state }) .subscribe({ next: () => this.reloadData(), diff --git a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts index 12d503f56..8d20166f6 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts @@ -4,7 +4,7 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' import { logger } from '@root-helpers/logger' -import { AbuseMessage, UserAbuse } from '@shared/models' +import { AbuseMessage, UserAbuse } from '@peertube/peertube-models' import { ABUSE_MESSAGE_VALIDATOR } from '../form-validators/abuse-validators' import { AbuseService } from '../shared-moderation' diff --git a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts index 4ad807d25..e42939f96 100644 --- a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts +++ b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts @@ -4,7 +4,7 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' import { AbuseService } from '@app/shared/shared-moderation' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { AdminAbuse } from '@shared/models' +import { AdminAbuse } from '@peertube/peertube-models' import { ABUSE_MODERATION_COMMENT_VALIDATOR } from '../form-validators/abuse-validators' @Component({ diff --git a/client/src/app/shared/shared-abuse-list/processed-abuse.model.ts b/client/src/app/shared/shared-abuse-list/processed-abuse.model.ts index b9a9bd889..076ccb40b 100644 --- a/client/src/app/shared/shared-abuse-list/processed-abuse.model.ts +++ b/client/src/app/shared/shared-abuse-list/processed-abuse.model.ts @@ -1,5 +1,5 @@ import { Account } from '@app/shared/shared-main' -import { AdminAbuse } from '@shared/models' +import { AdminAbuse } from '@peertube/peertube-models' // Don't use an abuse model because we need external services to compute some properties // And this model is only used in this component diff --git a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts index ab2e02ad7..36babbe34 100644 --- a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts +++ b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts @@ -1,7 +1,7 @@ import { Component, Input, OnChanges, OnInit } from '@angular/core' import { VideoChannel } from '../shared-main' import { Account } from '../shared-main/account/account.model' -import { objectKeysTyped } from '@shared/core-utils' +import { objectKeysTyped } from '@peertube/peertube-core-utils' type ActorInput = { name: string diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts index b49f64834..4ab78a250 100644 --- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts +++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts @@ -10,7 +10,7 @@ import { PlaylistMiniatureMarkupData, VideoMiniatureMarkupData, VideosListMarkupData -} from '@shared/models' +} from '@peertube/peertube-models' import { DynamicElementService } from './dynamic-element.service' import { ButtonMarkupComponent, diff --git a/client/src/app/shared/shared-custom-markup/dynamic-element.service.ts b/client/src/app/shared/shared-custom-markup/dynamic-element.service.ts index a12907055..dc4f683ac 100644 --- a/client/src/app/shared/shared-custom-markup/dynamic-element.service.ts +++ b/client/src/app/shared/shared-custom-markup/dynamic-element.service.ts @@ -10,7 +10,7 @@ import { SimpleChanges, Type } from '@angular/core' -import { objectKeysTyped } from '@shared/core-utils' +import { objectKeysTyped } from '@peertube/peertube-core-utils' @Injectable() export class DynamicElementService { diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts index 4f00eabd3..b731ccc64 100644 --- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts +++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts @@ -3,7 +3,7 @@ import { finalize, map, switchMap, tap } from 'rxjs/operators' import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core' import { MarkdownService, Notifier, UserService } from '@app/core' import { FindInBulkService } from '@app/shared/shared-search' -import { VideoSortField } from '@shared/models' +import { VideoSortField } from '@peertube/peertube-models' import { Video, VideoChannel, VideoService } from '../../shared-main' import { CustomMarkupComponent } from './shared' diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts index 0baf2428b..bca7444ec 100644 --- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts +++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts @@ -1,7 +1,7 @@ import { environment } from 'src/environments/environment' import { Component, ElementRef, Input, OnInit } from '@angular/core' import { buildVideoOrPlaylistEmbed } from '@root-helpers/video' -import { buildPlaylistEmbedLink, buildVideoEmbedLink } from '@shared/core-utils' +import { buildPlaylistEmbedLink, buildVideoEmbedLink } from '@peertube/peertube-core-utils' import { CustomMarkupComponent } from './shared' @Component({ diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts index bd93929c9..d692abbe3 100644 --- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts +++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts @@ -2,7 +2,7 @@ import { finalize } from 'rxjs/operators' import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core' import { AuthService, Notifier } from '@app/core' import { FindInBulkService } from '@app/shared/shared-search' -import { objectKeysTyped } from '@shared/core-utils' +import { objectKeysTyped } from '@peertube/peertube-core-utils' import { Video } from '../../shared-main' import { MiniatureDisplayOptions } from '../../shared-video-miniature' import { CustomMarkupComponent } from './shared' diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts index 81363be87..cbd5c7bf5 100644 --- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts +++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts @@ -1,8 +1,8 @@ import { finalize } from 'rxjs/operators' import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core' import { AuthService, Notifier } from '@app/core' -import { objectKeysTyped } from '@shared/core-utils' -import { VideoSortField } from '@shared/models' +import { objectKeysTyped } from '@peertube/peertube-core-utils' +import { VideoSortField } from '@peertube/peertube-models' import { Video, VideoService } from '../../shared-main' import { MiniatureDisplayOptions } from '../../shared-video-miniature' import { CustomMarkupComponent } from './shared' diff --git a/client/src/app/shared/shared-forms/dynamic-form-field.component.ts b/client/src/app/shared/shared-forms/dynamic-form-field.component.ts index e1a1f8034..a95463944 100644 --- a/client/src/app/shared/shared-forms/dynamic-form-field.component.ts +++ b/client/src/app/shared/shared-forms/dynamic-form-field.component.ts @@ -1,6 +1,6 @@ import { Component, Input } from '@angular/core' import { FormGroup } from '@angular/forms' -import { RegisterClientFormFieldOptions } from '@shared/models' +import { RegisterClientFormFieldOptions } from '@peertube/peertube-models' @Component({ selector: 'my-dynamic-form-field', diff --git a/client/src/app/shared/shared-forms/form-validator.service.ts b/client/src/app/shared/shared-forms/form-validator.service.ts index 14ee044b5..e7dedf52a 100644 --- a/client/src/app/shared/shared-forms/form-validator.service.ts +++ b/client/src/app/shared/shared-forms/form-validator.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core' import { AsyncValidatorFn, FormArray, FormBuilder, FormControl, FormGroup, ValidatorFn } from '@angular/forms' -import { objectKeysTyped } from '@shared/core-utils' +import { objectKeysTyped } from '@peertube/peertube-core-utils' import { BuildFormArgument, BuildFormDefaultValues } from '../form-validators/form-validator.model' import { FormReactiveErrors, FormReactiveValidationMessages } from './form-reactive.service' diff --git a/client/src/app/shared/shared-forms/markdown-textarea.component.ts b/client/src/app/shared/shared-forms/markdown-textarea.component.ts index 036fab3d9..7edcf868c 100644 --- a/client/src/app/shared/shared-forms/markdown-textarea.component.ts +++ b/client/src/app/shared/shared-forms/markdown-textarea.component.ts @@ -6,7 +6,7 @@ import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@an import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' import { SafeHtml } from '@angular/platform-browser' import { MarkdownService, ScreenService } from '@app/core' -import { Video } from '@shared/models' +import { Video } from '@peertube/peertube-models' @Component({ selector: 'my-markdown-textarea', diff --git a/client/src/app/shared/shared-forms/preview-upload.component.ts b/client/src/app/shared/shared-forms/preview-upload.component.ts index cdfa26a23..3db7c34f7 100644 --- a/client/src/app/shared/shared-forms/preview-upload.component.ts +++ b/client/src/app/shared/shared-forms/preview-upload.component.ts @@ -2,7 +2,7 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' import { ServerService } from '@app/core' import { imageToDataURL } from '@root-helpers/images' -import { HTMLServerConfig } from '@shared/models' +import { HTMLServerConfig } from '@peertube/peertube-models' import { BytesPipe } from '../shared-main' @Component({ diff --git a/client/src/app/shared/shared-forms/timestamp-input.component.ts b/client/src/app/shared/shared-forms/timestamp-input.component.ts index 79ca63673..280491852 100644 --- a/client/src/app/shared/shared-forms/timestamp-input.component.ts +++ b/client/src/app/shared/shared-forms/timestamp-input.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectorRef, Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' -import { secondsToTime, timeToInt } from '@shared/core-utils' +import { secondsToTime, timeToInt } from '@peertube/peertube-core-utils' @Component({ selector: 'my-timestamp-input', diff --git a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts index a7c521876..78d960d93 100644 --- a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts +++ b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts @@ -1,8 +1,7 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' import { HooksService, Notifier } from '@app/core' import { NgbAccordionDirective } from '@ng-bootstrap/ng-bootstrap' -import { ClientFilterHookName, PluginClientScope } from '@shared/models/plugins' -import { About } from '@shared/models/server' +import { About, ClientFilterHookName, PluginClientScope } from '@peertube/peertube-models' import { InstanceService } from './instance.service' @Component({ diff --git a/client/src/app/shared/shared-instance/instance-features-table.component.ts b/client/src/app/shared/shared-instance/instance-features-table.component.ts index ab1b1458a..11c6cc0ac 100644 --- a/client/src/app/shared/shared-instance/instance-features-table.component.ts +++ b/client/src/app/shared/shared-instance/instance-features-table.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core' import { ServerService } from '@app/core' import { formatICU } from '@app/helpers' -import { ServerConfig } from '@shared/models' +import { ServerConfig } from '@peertube/peertube-models' @Component({ selector: 'my-instance-features-table', diff --git a/client/src/app/shared/shared-instance/instance-follow.service.ts b/client/src/app/shared/shared-instance/instance-follow.service.ts index 7568fbbf4..f243273ba 100644 --- a/client/src/app/shared/shared-instance/instance-follow.service.ts +++ b/client/src/app/shared/shared-instance/instance-follow.service.ts @@ -4,8 +4,8 @@ import { catchError, concatMap, toArray } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService } from '@app/core' -import { arrayify } from '@shared/core-utils' -import { ActivityPubActorType, ActorFollow, FollowState, ResultList, ServerFollowCreate } from '@shared/models' +import { arrayify } from '@peertube/peertube-core-utils' +import { ActivityPubActorType, ActorFollow, FollowState, ResultList, ServerFollowCreate } from '@peertube/peertube-models' import { environment } from '../../../environments/environment' import { AdvancedInputFilter } from '../shared-forms' diff --git a/client/src/app/shared/shared-instance/instance.service.ts b/client/src/app/shared/shared-instance/instance.service.ts index 3088f0899..9a55cf972 100644 --- a/client/src/app/shared/shared-instance/instance.service.ts +++ b/client/src/app/shared/shared-instance/instance.service.ts @@ -3,9 +3,8 @@ import { catchError, map } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { MarkdownService, RestExtractor, ServerService } from '@app/core' -import { objectKeysTyped } from '@shared/core-utils' -import { peertubeTranslate } from '@shared/core-utils/i18n' -import { About } from '@shared/models' +import { objectKeysTyped, peertubeTranslate } from '@peertube/peertube-core-utils' +import { About } from '@peertube/peertube-models' import { environment } from '../../../environments/environment' export type AboutHTML = Pick + state: VideoConstant likesPercent: number dislikesPercent: number diff --git a/client/src/app/shared/shared-main/video/video-edit.model.ts b/client/src/app/shared/shared-main/video/video-edit.model.ts index 9129ab93f..a3e736c0f 100644 --- a/client/src/app/shared/shared-main/video/video-edit.model.ts +++ b/client/src/app/shared/shared-main/video/video-edit.model.ts @@ -1,7 +1,7 @@ import { getAbsoluteAPIUrl } from '@app/helpers' -import { VideoPassword, VideoPrivacy, VideoScheduleUpdate, VideoUpdate } from '@shared/models' +import { objectKeysTyped } from '@peertube/peertube-core-utils' +import { VideoPassword, VideoPrivacy, VideoPrivacyType, VideoScheduleUpdate, VideoUpdate } from '@peertube/peertube-models' import { VideoDetails } from './video-details.model' -import { objectKeysTyped } from '@shared/core-utils' export class VideoEdit implements VideoUpdate { static readonly SPECIAL_SCHEDULED_PRIVACY = -1 @@ -17,7 +17,7 @@ export class VideoEdit implements VideoUpdate { downloadEnabled: boolean waitTranscoding: boolean channelId: number - privacy: VideoPrivacy + privacy: VideoPrivacyType videoPassword?: string support: string thumbnailfile?: any diff --git a/client/src/app/shared/shared-main/video/video-file-token.service.ts b/client/src/app/shared/shared-main/video/video-file-token.service.ts index 9bca5b9ec..87a952895 100644 --- a/client/src/app/shared/shared-main/video/video-file-token.service.ts +++ b/client/src/app/shared/shared-main/video/video-file-token.service.ts @@ -2,7 +2,7 @@ import { catchError, map, of, tap } from 'rxjs' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor } from '@app/core' -import { VideoToken } from '@shared/models' +import { VideoToken } from '@peertube/peertube-models' import { VideoService } from './video.service' import { VideoPasswordService } from './video-password.service' diff --git a/client/src/app/shared/shared-main/video/video-import.service.ts b/client/src/app/shared/shared-main/video/video-import.service.ts index 607c08d71..bb9052401 100644 --- a/client/src/app/shared/shared-main/video/video-import.service.ts +++ b/client/src/app/shared/shared-main/video/video-import.service.ts @@ -5,8 +5,8 @@ import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService, ServerService, UserService } from '@app/core' import { objectToFormData } from '@app/helpers' -import { peertubeTranslate } from '@shared/core-utils/i18n' -import { ResultList, VideoImport, VideoImportCreate, VideoUpdate } from '@shared/models' +import { peertubeTranslate } from '@peertube/peertube-core-utils' +import { ResultList, VideoImport, VideoImportCreate, VideoUpdate } from '@peertube/peertube-models' import { environment } from '../../../../environments/environment' @Injectable() diff --git a/client/src/app/shared/shared-main/video/video-ownership.service.ts b/client/src/app/shared/shared-main/video/video-ownership.service.ts index 1e8f7f68c..03e8fc946 100644 --- a/client/src/app/shared/shared-main/video/video-ownership.service.ts +++ b/client/src/app/shared/shared-main/video/video-ownership.service.ts @@ -4,7 +4,7 @@ import { catchError } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService } from '@app/core' -import { ResultList, VideoChangeOwnership, VideoChangeOwnershipAccept, VideoChangeOwnershipCreate } from '@shared/models' +import { ResultList, VideoChangeOwnership, VideoChangeOwnershipAccept, VideoChangeOwnershipCreate } from '@peertube/peertube-models' import { environment } from '../../../../environments/environment' @Injectable() diff --git a/client/src/app/shared/shared-main/video/video-password.service.ts b/client/src/app/shared/shared-main/video/video-password.service.ts index d5b0406f8..156efd60f 100644 --- a/client/src/app/shared/shared-main/video/video-password.service.ts +++ b/client/src/app/shared/shared-main/video/video-password.service.ts @@ -1,4 +1,4 @@ -import { ResultList, VideoPassword } from '@shared/models' +import { ResultList, VideoPassword } from '@peertube/peertube-models' import { Injectable } from '@angular/core' import { catchError, switchMap } from 'rxjs' import { HttpClient, HttpHeaders } from '@angular/common/http' diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index 1d077a613..ed28fb3f8 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -2,8 +2,7 @@ import { AuthUser } from '@app/core' import { User } from '@app/core/users/user.model' import { durationToString, formatICU, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers' import { Actor } from '@app/shared/shared-main/account/actor.model' -import { buildVideoWatchPath, getAllFiles } from '@shared/core-utils' -import { peertubeTranslate } from '@shared/core-utils/i18n' +import { buildVideoWatchPath, getAllFiles, peertubeTranslate } from '@peertube/peertube-core-utils' import { ActorImage, HTMLServerConfig, @@ -12,11 +11,13 @@ import { VideoConstant, VideoFile, VideoPrivacy, + VideoPrivacyType, VideoScheduleUpdate, VideoState, + VideoStateType, VideoStreamingPlaylist, VideoStreamingPlaylistType -} from '@shared/models' +} from '@peertube/peertube-models' export class Video implements VideoServerModel { byVideoChannel: string @@ -30,7 +31,7 @@ export class Video implements VideoServerModel { category: VideoConstant licence: VideoConstant language: VideoConstant - privacy: VideoConstant + privacy: VideoConstant truncatedDescription: string description: string @@ -70,7 +71,7 @@ export class Video implements VideoServerModel { originInstanceHost: string waitTranscoding?: boolean - state?: VideoConstant + state?: VideoConstant scheduledUpdate?: VideoScheduleUpdate blacklisted?: boolean diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index a980c2dcf..9b2bc5dee 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts @@ -5,7 +5,7 @@ import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http' import { Injectable } from '@angular/core' import { AuthService, ComponentPaginationLight, ConfirmService, RestExtractor, RestService, ServerService, UserService } from '@app/core' import { objectToFormData } from '@app/helpers' -import { arrayify } from '@shared/core-utils' +import { arrayify } from '@peertube/peertube-core-utils' import { BooleanBothQuery, FeedFormat, @@ -21,13 +21,14 @@ import { VideoConstant, VideoDetails as VideoDetailsServerModel, VideoFileMetadata, - VideoInclude, + VideoIncludeType, VideoPrivacy, + VideoPrivacyType, VideoSortField, + VideoSource, VideoTranscodingCreate, VideoUpdate -} from '@shared/models' -import { VideoSource } from '@shared/models/videos/video-source' +} from '@peertube/peertube-models' import { environment } from '../../../../environments/environment' import { Account } from '../account/account.model' import { AccountService } from '../account/account.service' @@ -40,11 +41,11 @@ import { Video } from './video.model' export type CommonVideoParams = { videoPagination?: ComponentPaginationLight sort: VideoSortField | SortMeta - include?: VideoInclude + include?: VideoIncludeType isLocal?: boolean categoryOneOf?: number[] languageOneOf?: string[] - privacyOneOf?: VideoPrivacy[] + privacyOneOf?: VideoPrivacyType[] isLive?: boolean skipCount?: boolean nsfw?: BooleanBothQuery @@ -455,7 +456,7 @@ export class VideoService { ) } - explainedPrivacyLabels (serverPrivacies: VideoConstant[], defaultPrivacyId = VideoPrivacy.PUBLIC) { + explainedPrivacyLabels (serverPrivacies: VideoConstant[], defaultPrivacyId: VideoPrivacyType = VideoPrivacy.PUBLIC) { const descriptions = { [VideoPrivacy.PRIVATE]: $localize`Only I can see this video`, [VideoPrivacy.UNLISTED]: $localize`Only shareable via a private link`, @@ -478,7 +479,7 @@ export class VideoService { } } - getHighestAvailablePrivacy (serverPrivacies: VideoConstant[]) { + getHighestAvailablePrivacy (serverPrivacies: VideoConstant[]) { // We do not add a password as this requires additional configuration. const order = [ VideoPrivacy.PRIVATE, diff --git a/client/src/app/shared/shared-moderation/abuse.service.ts b/client/src/app/shared/shared-moderation/abuse.service.ts index 5d1539f69..8055b6dd1 100644 --- a/client/src/app/shared/shared-moderation/abuse.service.ts +++ b/client/src/app/shared/shared-moderation/abuse.service.ts @@ -15,7 +15,7 @@ import { AdminAbuse, ResultList, UserAbuse -} from '@shared/models' +} from '@peertube/peertube-models' import { environment } from '../../../environments/environment' @Injectable() diff --git a/client/src/app/shared/shared-moderation/account-block.model.ts b/client/src/app/shared/shared-moderation/account-block.model.ts index 8f76c69dc..a5bde327a 100644 --- a/client/src/app/shared/shared-moderation/account-block.model.ts +++ b/client/src/app/shared/shared-moderation/account-block.model.ts @@ -1,4 +1,4 @@ -import { AccountBlock as AccountBlockServer } from '@shared/models' +import { AccountBlock as AccountBlockServer } from '@peertube/peertube-models' import { Account } from '@app/shared/shared-main' export class AccountBlock implements AccountBlockServer { diff --git a/client/src/app/shared/shared-moderation/blocklist.service.ts b/client/src/app/shared/shared-moderation/blocklist.service.ts index 0fb7536e5..f755b812a 100644 --- a/client/src/app/shared/shared-moderation/blocklist.service.ts +++ b/client/src/app/shared/shared-moderation/blocklist.service.ts @@ -4,8 +4,8 @@ import { catchError, concatMap, map, toArray } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService } from '@app/core' -import { arrayify } from '@shared/core-utils' -import { AccountBlock as AccountBlockServer, BlockStatus, ResultList, ServerBlock } from '@shared/models' +import { arrayify } from '@peertube/peertube-core-utils' +import { AccountBlock as AccountBlockServer, BlockStatus, ResultList, ServerBlock } from '@peertube/peertube-models' import { environment } from '../../../environments/environment' import { Account } from '../shared-main' import { AccountBlock } from './account-block.model' diff --git a/client/src/app/shared/shared-moderation/bulk.service.ts b/client/src/app/shared/shared-moderation/bulk.service.ts index f0b869421..36d1b0b1e 100644 --- a/client/src/app/shared/shared-moderation/bulk.service.ts +++ b/client/src/app/shared/shared-moderation/bulk.service.ts @@ -2,7 +2,7 @@ import { catchError } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor } from '@app/core' -import { BulkRemoveCommentsOfBody } from '@shared/models' +import { BulkRemoveCommentsOfBody } from '@peertube/peertube-models' import { environment } from '../../../environments/environment' @Injectable() diff --git a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts index d587a9709..042b57aa7 100644 --- a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts +++ b/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts @@ -6,8 +6,8 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' import { Account } from '@app/shared/shared-main' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' -import { AbusePredefinedReasonsString } from '@shared/models' +import { abusePredefinedReasonsMap } from '@peertube/peertube-core-utils' +import { AbusePredefinedReasonsString } from '@peertube/peertube-models' import { AbuseService } from '../abuse.service' @Component({ diff --git a/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts index e35d70c8f..fd50b745a 100644 --- a/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts +++ b/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts @@ -6,8 +6,8 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' import { VideoComment } from '@app/shared/shared-video-comment' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' -import { AbusePredefinedReasonsString } from '@shared/models' +import { abusePredefinedReasonsMap } from '@peertube/peertube-core-utils' +import { AbusePredefinedReasonsString } from '@peertube/peertube-models' import { AbuseService } from '../abuse.service' @Component({ diff --git a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts index 16be8e0a1..479957d21 100644 --- a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts +++ b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts @@ -6,8 +6,8 @@ import { ABUSE_REASON_VALIDATOR } from '@app/shared/form-validators/abuse-valida import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' -import { AbusePredefinedReasonsString } from '@shared/models' +import { abusePredefinedReasonsMap } from '@peertube/peertube-core-utils' +import { AbusePredefinedReasonsString } from '@peertube/peertube-models' import { Video } from '../../shared-main' import { AbuseService } from '../abuse.service' diff --git a/client/src/app/shared/shared-moderation/server-blocklist.component.ts b/client/src/app/shared/shared-moderation/server-blocklist.component.ts index f1bcbd561..4105645fa 100644 --- a/client/src/app/shared/shared-moderation/server-blocklist.component.ts +++ b/client/src/app/shared/shared-moderation/server-blocklist.component.ts @@ -2,7 +2,7 @@ import { SortMeta } from 'primeng/api' import { Directive, OnInit, ViewChild } from '@angular/core' import { Notifier, RestPagination, RestTable } from '@app/core' import { BatchDomainsModalComponent } from '@app/shared/shared-moderation/batch-domains-modal.component' -import { ServerBlock } from '@shared/models' +import { ServerBlock } from '@peertube/peertube-models' import { BlocklistComponentType, BlocklistService } from './blocklist.service' @Directive() diff --git a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts index 34295c34a..fcada7acc 100644 --- a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts +++ b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts @@ -5,7 +5,7 @@ import { formatICU } from '@app/helpers' import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { User } from '@shared/models' +import { User } from '@peertube/peertube-models' import { USER_BAN_REASON_VALIDATOR } from '../form-validators/user-validators' import { Account } from '../shared-main' import { UserAdminService } from '../shared-users' diff --git a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts index 50dccf862..7de152e60 100644 --- a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts +++ b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts @@ -1,7 +1,7 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core' import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core' import { Account, DropdownAction } from '@app/shared/shared-main' -import { BulkRemoveCommentsOfBody, User, UserRight } from '@shared/models' +import { BulkRemoveCommentsOfBody, User, UserRight } from '@peertube/peertube-models' import { UserAdminService } from '../shared-users' import { BlocklistService } from './blocklist.service' import { BulkService } from './bulk.service' diff --git a/client/src/app/shared/shared-moderation/video-block.service.ts b/client/src/app/shared/shared-moderation/video-block.service.ts index ab352a2d6..18950c92b 100644 --- a/client/src/app/shared/shared-moderation/video-block.service.ts +++ b/client/src/app/shared/shared-moderation/video-block.service.ts @@ -4,8 +4,8 @@ import { catchError, concatMap, toArray } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService } from '@app/core' -import { arrayify } from '@shared/core-utils' -import { ResultList, VideoBlacklist, VideoBlacklistType } from '@shared/models' +import { arrayify } from '@peertube/peertube-core-utils' +import { ResultList, VideoBlacklist, VideoBlacklistType, VideoBlacklistType_Type } from '@peertube/peertube-models' import { environment } from '../../../environments/environment' @Injectable() @@ -22,7 +22,7 @@ export class VideoBlockService { pagination: RestPagination sort: SortMeta search?: string - type?: VideoBlacklistType + type?: VideoBlacklistType_Type }): Observable> { const { pagination, sort, search, type } = options diff --git a/client/src/app/shared/shared-search/advanced-search.model.ts b/client/src/app/shared/shared-search/advanced-search.model.ts index 29fe3e8dc..b977a4801 100644 --- a/client/src/app/shared/shared-search/advanced-search.model.ts +++ b/client/src/app/shared/shared-search/advanced-search.model.ts @@ -6,7 +6,7 @@ import { VideoChannelsSearchQuery, VideoPlaylistsSearchQuery, VideosSearchQuery -} from '@shared/models' +} from '@peertube/peertube-models' export type AdvancedSearchResultType = 'videos' | 'playlists' | 'channels' diff --git a/client/src/app/shared/shared-search/find-in-bulk.service.ts b/client/src/app/shared/shared-search/find-in-bulk.service.ts index 125d5e2b8..de57c7f64 100644 --- a/client/src/app/shared/shared-search/find-in-bulk.service.ts +++ b/client/src/app/shared/shared-search/find-in-bulk.service.ts @@ -3,11 +3,11 @@ import { Observable, Subject } from 'rxjs' import { filter, first, map } from 'rxjs/operators' import { Injectable } from '@angular/core' import { buildBulkObservable } from '@app/helpers' -import { ResultList } from '@shared/models/common' +import { ResultList } from '@peertube/peertube-models' import { Video, VideoChannel } from '../shared-main' import { VideoPlaylist } from '../shared-video-playlist' -import { SearchService } from './search.service' import { AdvancedSearch } from './advanced-search.model' +import { SearchService } from './search.service' const debugLogger = debug('peertube:search:FindInBulkService') diff --git a/client/src/app/shared/shared-search/search.service.ts b/client/src/app/shared/shared-search/search.service.ts index ad2de0f37..281e0b4bd 100644 --- a/client/src/app/shared/shared-search/search.service.ts +++ b/client/src/app/shared/shared-search/search.service.ts @@ -9,7 +9,7 @@ import { Video as VideoServerModel, VideoChannel as VideoChannelServerModel, VideoPlaylist as VideoPlaylistServerModel -} from '@shared/models' +} from '@peertube/peertube-models' import { environment } from '../../../environments/environment' import { VideoPlaylist, VideoPlaylistService } from '../shared-video-playlist' import { AdvancedSearch } from './advanced-search.model' diff --git a/client/src/app/shared/shared-share-modal/video-share.component.ts b/client/src/app/shared/shared-share-modal/video-share.component.ts index b09222c3e..24c9cdeca 100644 --- a/client/src/app/shared/shared-share-modal/video-share.component.ts +++ b/client/src/app/shared/shared-share-modal/video-share.component.ts @@ -5,8 +5,8 @@ import { VideoDetails } from '@app/shared/shared-main' import { VideoPlaylist } from '@app/shared/shared-video-playlist' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { buildVideoOrPlaylistEmbed } from '@root-helpers/video' -import { buildPlaylistLink, buildVideoLink, decoratePlaylistLink, decorateVideoLink } from '@shared/core-utils' -import { VideoCaption, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' +import { buildPlaylistLink, buildVideoLink, decoratePlaylistLink, decorateVideoLink } from '@peertube/peertube-core-utils' +import { VideoCaption, VideoPlaylistPrivacy, VideoPrivacy } from '@peertube/peertube-models' type Customizations = { startAtCheckbox: boolean diff --git a/client/src/app/shared/shared-support-modal/support-modal.component.ts b/client/src/app/shared/shared-support-modal/support-modal.component.ts index f330228e1..d911b45d8 100644 --- a/client/src/app/shared/shared-support-modal/support-modal.component.ts +++ b/client/src/app/shared/shared-support-modal/support-modal.component.ts @@ -2,7 +2,7 @@ import { Component, Input, ViewChild } from '@angular/core' import { MarkdownService } from '@app/core' import { VideoDetails } from '@app/shared/shared-main' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { VideoChannel } from '@shared/models' +import { VideoChannel } from '@peertube/peertube-models' @Component({ selector: 'my-support-modal', diff --git a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts index ad5d30db2..c9a5c97db 100644 --- a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts +++ b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts @@ -1,6 +1,6 @@ import { Component, EventEmitter, Input, Output } from '@angular/core' import { ScreenService } from '@app/core' -import { VideoState } from '@shared/models' +import { VideoState } from '@peertube/peertube-models' import { Video } from '../shared-main' @Component({ diff --git a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts index c2c30d38b..08c6b6933 100644 --- a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts +++ b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts @@ -2,7 +2,7 @@ import { Subject, Subscription } from 'rxjs' import { Component, Input, OnDestroy, OnInit } from '@angular/core' import { AuthService, Notifier, ServerService, ThemeService, UserService } from '@app/core' import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' -import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models' +import { HTMLServerConfig, User, UserUpdateMe } from '@peertube/peertube-models' import { SelectOptionsItem } from 'src/types' @Component({ diff --git a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts index ed6e7fffd..234d5b217 100644 --- a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts +++ b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts @@ -4,8 +4,7 @@ import { first } from 'rxjs/operators' import { Component, Input, OnDestroy, OnInit } from '@angular/core' import { AuthService, Notifier, ServerService, User, UserService } from '@app/core' import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' -import { UserUpdateMe } from '@shared/models' -import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' +import { NSFWPolicyType, UserUpdateMe } from '@peertube/peertube-models' @Component({ selector: 'my-user-video-settings', diff --git a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts index a002bf4e7..2a5751824 100644 --- a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts +++ b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts @@ -2,7 +2,7 @@ import { concat, forkJoin, merge } from 'rxjs' import { Component, Input, OnChanges, OnInit } from '@angular/core' import { AuthService, Notifier, RedirectService } from '@app/core' import { Account, VideoChannel, VideoService } from '@app/shared/shared-main' -import { FeedFormat } from '@shared/models' +import { FeedFormat } from '@peertube/peertube-models' import { UserSubscriptionService } from './user-subscription.service' @Component({ diff --git a/client/src/app/shared/shared-user-subscription/user-subscription.service.ts b/client/src/app/shared/shared-user-subscription/user-subscription.service.ts index 9cf6b4d16..b83f7ebc5 100644 --- a/client/src/app/shared/shared-user-subscription/user-subscription.service.ts +++ b/client/src/app/shared/shared-user-subscription/user-subscription.service.ts @@ -6,7 +6,7 @@ import { Injectable } from '@angular/core' import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' import { buildBulkObservable } from '@app/helpers' import { Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' -import { ActorFollow, ResultList, VideoChannel as VideoChannelServer, VideoSortField } from '@shared/models' +import { ActorFollow, ResultList, VideoChannel as VideoChannelServer, VideoSortField } from '@peertube/peertube-models' import { environment } from '../../../environments/environment' const debugLogger = debug('peertube:subscriptions:UserSubscriptionService') diff --git a/client/src/app/shared/shared-users/two-factor.service.ts b/client/src/app/shared/shared-users/two-factor.service.ts index 9ff916f15..cb4450e8f 100644 --- a/client/src/app/shared/shared-users/two-factor.service.ts +++ b/client/src/app/shared/shared-users/two-factor.service.ts @@ -2,7 +2,7 @@ import { catchError } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, UserService } from '@app/core' -import { TwoFactorEnableResult } from '@shared/models' +import { TwoFactorEnableResult } from '@peertube/peertube-models' @Injectable() export class TwoFactorService { diff --git a/client/src/app/shared/shared-users/user-admin.service.ts b/client/src/app/shared/shared-users/user-admin.service.ts index 5842bd271..cc706343f 100644 --- a/client/src/app/shared/shared-users/user-admin.service.ts +++ b/client/src/app/shared/shared-users/user-admin.service.ts @@ -5,8 +5,8 @@ import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService, ServerService, UserService } from '@app/core' import { getBytes } from '@root-helpers/bytes' -import { arrayify, peertubeTranslate } from '@shared/core-utils' -import { ResultList, User as UserServerModel, UserCreate, UserUpdate } from '@shared/models' +import { arrayify, peertubeTranslate } from '@peertube/peertube-core-utils' +import { ResultList, User as UserServerModel, UserCreate, UserUpdate } from '@peertube/peertube-models' @Injectable() export class UserAdminService { diff --git a/client/src/app/shared/shared-video-comment/video-comment-thread-tree.model.ts b/client/src/app/shared/shared-video-comment/video-comment-thread-tree.model.ts index 9956c88a6..62683f57f 100644 --- a/client/src/app/shared/shared-video-comment/video-comment-thread-tree.model.ts +++ b/client/src/app/shared/shared-video-comment/video-comment-thread-tree.model.ts @@ -1,4 +1,4 @@ -import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '@shared/models' +import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '@peertube/peertube-models' import { VideoComment } from './video-comment.model' export class VideoCommentThreadTree implements VideoCommentThreadTreeServerModel { diff --git a/client/src/app/shared/shared-video-comment/video-comment.model.ts b/client/src/app/shared/shared-video-comment/video-comment.model.ts index adab4cfbd..7048ed66f 100644 --- a/client/src/app/shared/shared-video-comment/video-comment.model.ts +++ b/client/src/app/shared/shared-video-comment/video-comment.model.ts @@ -4,7 +4,7 @@ import { Account as AccountInterface, VideoComment as VideoCommentServerModel, VideoCommentAdmin as VideoCommentAdminServerModel -} from '@shared/models' +} from '@peertube/peertube-models' export class VideoComment implements VideoCommentServerModel { id: number diff --git a/client/src/app/shared/shared-video-comment/video-comment.service.ts b/client/src/app/shared/shared-video-comment/video-comment.service.ts index 3906652be..d1db773c4 100644 --- a/client/src/app/shared/shared-video-comment/video-comment.service.ts +++ b/client/src/app/shared/shared-video-comment/video-comment.service.ts @@ -14,7 +14,7 @@ import { VideoCommentAdmin, VideoCommentCreate, VideoCommentThreadTree as VideoCommentThreadTreeServerModel -} from '@shared/models' +} from '@peertube/peertube-models' import { environment } from '../../../environments/environment' import { VideoCommentThreadTree } from './video-comment-thread-tree.model' import { VideoComment } from './video-comment.model' diff --git a/client/src/app/shared/shared-video-live/live-stream-information.component.ts b/client/src/app/shared/shared-video-live/live-stream-information.component.ts index 400a6fa01..4089c88fb 100644 --- a/client/src/app/shared/shared-video-live/live-stream-information.component.ts +++ b/client/src/app/shared/shared-video-live/live-stream-information.component.ts @@ -1,7 +1,7 @@ import { Component, ElementRef, ViewChild } from '@angular/core' import { Video } from '@app/shared/shared-main' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { LiveVideo, LiveVideoError, LiveVideoSession } from '@shared/models' +import { LiveVideo, LiveVideoError, LiveVideoErrorType, LiveVideoSession } from '@peertube/peertube-models' import { LiveVideoService } from './live-video.service' @Component({ @@ -38,7 +38,7 @@ export class LiveStreamInformationComponent { getErrorLabel (session: LiveVideoSession) { if (!session.error) return undefined - const errors: { [ id in LiveVideoError ]: string } = { + const errors: { [ id in LiveVideoErrorType ]: string } = { [LiveVideoError.BAD_SOCKET_HEALTH]: $localize`Server too slow`, [LiveVideoError.BLACKLISTED]: $localize`Live blacklisted`, [LiveVideoError.DURATION_EXCEEDED]: $localize`Max duration exceeded`, diff --git a/client/src/app/shared/shared-video-live/live-video.service.ts b/client/src/app/shared/shared-video-live/live-video.service.ts index 89bfd84a0..8ac0eb924 100644 --- a/client/src/app/shared/shared-video-live/live-video.service.ts +++ b/client/src/app/shared/shared-video-live/live-video.service.ts @@ -2,7 +2,7 @@ import { catchError } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor } from '@app/core' -import { LiveVideo, LiveVideoCreate, LiveVideoSession, LiveVideoUpdate, ResultList, VideoCreateResult } from '@shared/models' +import { LiveVideo, LiveVideoCreate, LiveVideoSession, LiveVideoUpdate, ResultList, VideoCreateResult } from '@peertube/peertube-models' import { environment } from '../../../environments/environment' import { VideoService } from '../shared-main' diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts index 9891aae2e..4b3ed6e99 100644 --- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts @@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@a import { AuthService, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core' import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation' import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' -import { VideoCaption } from '@shared/models' +import { VideoCaption } from '@peertube/peertube-models' import { Actor, DropdownAction, diff --git a/client/src/app/shared/shared-video-miniature/video-download.component.ts b/client/src/app/shared/shared-video-miniature/video-download.component.ts index 146ea7dfe..123f40b2f 100644 --- a/client/src/app/shared/shared-video-miniature/video-download.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-download.component.ts @@ -6,8 +6,8 @@ import { HooksService } from '@app/core' import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' import { logger } from '@root-helpers/logger' import { videoRequiresFileToken } from '@root-helpers/video' -import { objectKeysTyped, pick } from '@shared/core-utils' -import { VideoCaption, VideoFile } from '@shared/models' +import { objectKeysTyped, pick } from '@peertube/peertube-core-utils' +import { VideoCaption, VideoFile } from '@peertube/peertube-models' import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoFileTokenService, VideoService } from '../shared-main' type DownloadType = 'video' | 'subtitles' diff --git a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts b/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts index a5da9ebf3..2826408e7 100644 --- a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts @@ -4,7 +4,7 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angu import { FormBuilder, FormGroup } from '@angular/forms' import { AuthService } from '@app/core' import { ServerService } from '@app/core/server/server.service' -import { UserRight } from '@shared/models' +import { UserRight } from '@peertube/peertube-models' import { PeertubeModalService } from '../shared-main' import { VideoFilters } from './video-filters.model' diff --git a/client/src/app/shared/shared-video-miniature/video-filters.model.ts b/client/src/app/shared/shared-video-miniature/video-filters.model.ts index f57a45eb1..8db17c015 100644 --- a/client/src/app/shared/shared-video-miniature/video-filters.model.ts +++ b/client/src/app/shared/shared-video-miniature/video-filters.model.ts @@ -1,8 +1,14 @@ import { splitIntoArray, toBoolean } from '@app/helpers' -import { getAllPrivacies } from '@shared/core-utils' -import { escapeHTML } from '@shared/core-utils/renderer' -import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoPrivacy, VideoSortField } from '@shared/models' -import { AttributesOnly } from '@shared/typescript-utils' +import { escapeHTML, getAllPrivacies } from '@peertube/peertube-core-utils' +import { + BooleanBothQuery, + NSFWPolicyType, + VideoInclude, + VideoIncludeType, + VideoPrivacyType, + VideoSortField +} from '@peertube/peertube-models' +import { AttributesOnly } from '@peertube/peertube-typescript-utils' type VideoFiltersKeys = { [ id in keyof AttributesOnly ]: any @@ -207,8 +213,8 @@ export class VideoFilters { toVideosAPIObject () { let isLocal: boolean - let include: VideoInclude - let privacyOneOf: VideoPrivacy[] + let include: VideoIncludeType + let privacyOneOf: VideoPrivacyType[] if (this.scope === 'local') { isLocal = true diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index d453f37a1..11cd6726e 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts @@ -11,7 +11,7 @@ import { Output } from '@angular/core' import { AuthService, ScreenService, ServerService, User } from '@app/core' -import { HTMLServerConfig, VideoExistInPlaylist, VideoPlaylistType, VideoPrivacy, VideoState } from '@shared/models' +import { HTMLServerConfig, VideoExistInPlaylist, VideoPlaylistType, VideoPrivacy, VideoState } from '@peertube/peertube-models' import { LinkType } from '../../../types/link.type' import { ActorAvatarSize } from '../shared-actor-image/actor-avatar.component' import { Video, VideoService } from '../shared-main' diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.ts b/client/src/app/shared/shared-video-miniature/videos-list.component.ts index 14a5abd7a..afdef5ace 100644 --- a/client/src/app/shared/shared-video-miniature/videos-list.component.ts +++ b/client/src/app/shared/shared-video-miniature/videos-list.component.ts @@ -15,8 +15,8 @@ import { } from '@app/core' import { GlobalIconName } from '@app/shared/shared-icons' import { logger } from '@root-helpers/logger' -import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils' -import { ResultList, UserRight, VideoSortField } from '@shared/models' +import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@peertube/peertube-core-utils' +import { ResultList, UserRight, VideoSortField } from '@peertube/peertube-models' import { Syndication, Video } from '../shared-main' import { VideoFilters, VideoFilterScope } from './video-filters.model' import { MiniatureDisplayOptions } from './video-miniature.component' diff --git a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts index 86fe502e2..286b33dd4 100644 --- a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts +++ b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts @@ -2,8 +2,8 @@ import { Observable, Subject } from 'rxjs' import { AfterContentInit, Component, ContentChildren, EventEmitter, Input, Output, QueryList, TemplateRef } from '@angular/core' import { ComponentPagination, Notifier, User } from '@app/core' import { logger } from '@root-helpers/logger' -import { objectKeysTyped } from '@shared/core-utils' -import { ResultList, VideosExistInPlaylists, VideoSortField } from '@shared/models' +import { objectKeysTyped } from '@peertube/peertube-core-utils' +import { ResultList, VideosExistInPlaylists, VideoSortField } from '@peertube/peertube-models' import { PeerTubeTemplateDirective, Video } from '../shared-main' import { MiniatureDisplayOptions } from './video-miniature.component' diff --git a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts index f802416a4..84173ba69 100644 --- a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts +++ b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts @@ -4,7 +4,7 @@ import { debounceTime, filter } from 'rxjs/operators' import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core' import { AuthService, DisableForReuseHook, Notifier } from '@app/core' import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' -import { secondsToTime } from '@shared/core-utils' +import { secondsToTime } from '@peertube/peertube-core-utils' import { CachedVideoExistInPlaylist, Video, @@ -12,7 +12,7 @@ import { VideoPlaylistElementCreate, VideoPlaylistElementUpdate, VideoPlaylistPrivacy -} from '@shared/models' +} from '@peertube/peertube-models' import { VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR } from '../form-validators/video-playlist-validators' import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service' diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts index b9a1d9623..0c0f11ecc 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts @@ -2,8 +2,8 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, In import { AuthService, Notifier, ServerService } from '@app/core' import { Video, VideoService } from '@app/shared/shared-main' import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' -import { secondsToTime } from '@shared/core-utils' -import { HTMLServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate, VideoPrivacy } from '@shared/models' +import { secondsToTime } from '@peertube/peertube-core-utils' +import { HTMLServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate, VideoPrivacy } from '@peertube/peertube-models' import { VideoPlaylistElement } from './video-playlist-element.model' import { VideoPlaylist } from './video-playlist.model' import { VideoPlaylistService } from './video-playlist.service' diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element.model.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element.model.ts index b661378bd..16b212281 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist-element.model.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist-element.model.ts @@ -1,5 +1,5 @@ import { Video } from '@app/shared/shared-main' -import { VideoPlaylistElement as ServerVideoPlaylistElement, VideoPlaylistElementType } from '@shared/models' +import { VideoPlaylistElement as ServerVideoPlaylistElement, VideoPlaylistElementType_Type } from '@peertube/peertube-models' export class VideoPlaylistElement implements ServerVideoPlaylistElement { id: number @@ -7,7 +7,7 @@ export class VideoPlaylistElement implements ServerVideoPlaylistElement { startTimestamp: number stopTimestamp: number - type: VideoPlaylistElementType + type: VideoPlaylistElementType_Type video?: Video diff --git a/client/src/app/shared/shared-video-playlist/video-playlist.model.ts b/client/src/app/shared/shared-video-playlist/video-playlist.model.ts index 6b38d9ca3..24f1041ce 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist.model.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist.model.ts @@ -1,15 +1,15 @@ import { getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers' import { Actor } from '@app/shared/shared-main' -import { buildPlaylistWatchPath } from '@shared/core-utils' -import { peertubeTranslate } from '@shared/core-utils/i18n' +import { buildPlaylistWatchPath, peertubeTranslate } from '@peertube/peertube-core-utils' import { AccountSummary, VideoChannelSummary, VideoConstant, VideoPlaylist as ServerVideoPlaylist, - VideoPlaylistPrivacy, - VideoPlaylistType -} from '@shared/models' + VideoPlaylistPrivacyType, + VideoPlaylistType, + VideoPlaylistType_Type +} from '@peertube/peertube-models' export class VideoPlaylist implements ServerVideoPlaylist { id: number @@ -22,11 +22,11 @@ export class VideoPlaylist implements ServerVideoPlaylist { displayName: string description: string - privacy: VideoConstant + privacy: VideoConstant videosLength: number - type: VideoConstant + type: VideoConstant createdAt: Date | string updatedAt: Date | string diff --git a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts index bc9fb0d74..7f0da2be8 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts @@ -20,7 +20,7 @@ import { VideoPlaylistReorder, VideoPlaylistUpdate, VideosExistInPlaylists -} from '@shared/models' +} from '@peertube/peertube-models' import { environment } from '../../../environments/environment' import { VideoPlaylistElement } from './video-playlist-element.model' import { VideoPlaylist } from './video-playlist.model' -- cgit v1.2.3