ActivityPub-federated video streaming platform using P2P directly in your web browser
Add "copyrighted" licence
Chocobozzzb591f42914d2
diff --git a/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.ts b/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.tsindex 036231a3d6..a3856c2a1e 100644--- a/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.ts+++ b/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.ts@@ -184,7 +184,7 @@ export class VideoMainInfoComponent implements OnInit, OnDestroy {.subscribe(res => this.videoCategories = res)this.serverService.getVideoLicences()- .subscribe(res => this.videoLicences = res)+ .subscribe(res => this.videoLicences = this.videoService.explainedLicenceLabels(res))this.buildLanguages()this.buildPrivacies()diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.tsindex ffbaee98cb..15db40d3cf 100644--- a/client/src/app/core/server/server.service.ts+++ b/client/src/app/core/server/server.service.ts@@ -8,6 +8,7 @@ import {ServerStats,VideoCommentPolicy,VideoConstant,+ VideoLicenceType,VideoPlaylistPrivacyType,VideoPrivacyType} from '@peertube/peertube-models'@@ -30,7 +31,7 @@ export class ServerService {configReloaded = new Subject<ServerConfig>()private localeObservable: Observable<any>- private videoLicensesObservable: Observable<VideoConstant<number>[]>+ private videoLicensesObservable: Observable<VideoConstant<VideoLicenceType>[]>private videoCategoriesObservable: Observable<VideoConstant<number>[]>private videoPrivaciesObservable: Observable<VideoConstant<VideoPrivacyType>[]>private videoPlaylistPrivaciesObservable: Observable<VideoConstant<VideoPlaylistPrivacyType>[]>@@ -129,7 +130,7 @@ export class ServerService {getVideoLicences () {if (!this.videoLicensesObservable) {- this.videoLicensesObservable = this.loadAttributeEnum<number>(ServerService.BASE_VIDEO_URL, 'licences')+ this.videoLicensesObservable = this.loadAttributeEnum<VideoLicenceType>(ServerService.BASE_VIDEO_URL, 'licences')}return this.videoLicensesObservable.pipe(first())diff --git a/client/src/app/shared/shared-forms/select/select-options.component.html b/client/src/app/shared/shared-forms/select/select-options.component.htmlindex 7a23c4537d..536cd9757c 100644--- a/client/src/app/shared/shared-forms/select/select-options.component.html+++ b/client/src/app/shared/shared-forms/select/select-options.component.html@@ -27,7 +27,7 @@<ng-template [ngTemplateOutlet]="customItemTemplate" [ngTemplateOutletContext]="{ $implicit: item }"></ng-template>} @else {<div>- <div class="d-flex align-items-center item-label">+ <div class="d-flex align-items-center item-label custom-item"><img *ngIf="item.imageUrl" alt="" class="me-2" [src]="item.imageUrl" /><span class="ellipsis" [ngClass]="item.classes">{{ item.label }}</span>diff --git a/client/src/app/shared/shared-forms/select/select-options.component.scss b/client/src/app/shared/shared-forms/select/select-options.component.scssindex 31be5290d5..e3e3335dba 100644--- a/client/src/app/shared/shared-forms/select/select-options.component.scss+++ b/client/src/app/shared/shared-forms/select/select-options.component.scss@@ -1,5 +1,5 @@-@use '_variables' as *;-@use '_mixins' as *;+@use "_variables" as *;+@use "_mixins" as *;img {border-radius: 50%;@@ -10,8 +10,15 @@ img {.muted {font-size: 90%;+ line-height: 1.2;+ display: block;+ white-space: normal;}.item-label {min-height: 24px;}++p-select ::ng-deep p-overlay {+ max-width: 100%;+}diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.tsindex 4c6a62182c..4cfa6e3a74 100644--- a/client/src/app/shared/shared-main/video/video.service.ts+++ b/client/src/app/shared/shared-main/video/video.service.ts@@ -31,6 +31,8 @@ import {VideoDetails as VideoDetailsServerModel,VideoFile,VideoFileMetadata,+ VideoLicence,+ VideoLicenceType,VideoPrivacy,VideoPrivacyType,VideosCommonQuery,@@ -526,6 +528,8 @@ export class VideoService {)}+ // ---------------------------------------------------------------------------+explainedPrivacyLabels (serverPrivacies: VideoConstant<VideoPrivacyType>[], defaultPrivacyId: VideoPrivacyType = VideoPrivacy.PUBLIC) {const descriptions = {[VideoPrivacy.PRIVATE]: $localize`Only I can see this video`,@@ -549,6 +553,30 @@ export class VideoService {}}+ explainedLicenceLabels (serverLicences: VideoConstant<VideoLicenceType>[]) {+ const descriptions = {+ [VideoLicence['CC-BY']]: $localize`CC-BY`,+ [VideoLicence['CC-BY-SA']]: $localize`CC-BY-SA`,+ [VideoLicence['CC-BY-ND']]: $localize`CC-BY-ND`,+ [VideoLicence['CC-BY-NC']]: $localize`CC-BY-NC`,+ [VideoLicence['CC-BY-NC-SA']]: $localize`CC-BY-NC-SA`,+ [VideoLicence['CC-BY-NC-ND']]: $localize`CC-BY-NC-ND`,+ [VideoLicence['CC0']]: '',+ [VideoLicence.PDM]: $localize`Public domain mark`,+ [VideoLicence['COPYRIGHT']]: 'You are the owner of the content or you have the rights of the copyright holders'+ }++ return serverLicences.map(p => {+ return {+ ...p,++ description: descriptions[p.id]+ }+ })+ }++ // ---------------------------------------------------------------------------+buildNSFWTooltip (video: Pick<VideoServerModel, 'nsfw' | 'nsfwFlags'>) {const flags: string[] = []diff --git a/packages/models/src/videos/index.ts b/packages/models/src/videos/index.tsindex 5cf14d2e3d..dd581d797b 100644--- a/packages/models/src/videos/index.ts+++ b/packages/models/src/videos/index.ts@@ -24,6 +24,7 @@ export * from './video-constant.model.js'export * from './video-create.model.js'export * from './video-create-update-common.model.js'+export * from './video-licence.enum.js'export * from './video-privacy.enum.js'export * from './video-include.enum.js'export * from './video-rate.type.js'diff --git a/packages/models/src/videos/video-licence.enum.ts b/packages/models/src/videos/video-licence.enum.tsnew file mode 100644index 0000000000..c56655cc7b--- /dev/null+++ b/packages/models/src/videos/video-licence.enum.ts@@ -0,0 +1,13 @@+export const VideoLicence = {+ 'CC-BY': 1,+ 'CC-BY-SA': 2,+ 'CC-BY-ND': 3,+ 'CC-BY-NC': 4,+ 'CC-BY-NC-SA': 5,+ 'CC-BY-NC-ND': 6,+ 'CC0': 7,+ 'PDM': 8,+ 'COPYRIGHT': 9+} as const++export type VideoLicenceType = typeof VideoLicence[keyof typeof VideoLicence]diff --git a/server/core/initializers/constants.ts b/server/core/initializers/constants.tsindex ee3bbffc29..c87f0fc214 100644--- a/server/core/initializers/constants.ts+++ b/server/core/initializers/constants.ts@@ -24,6 +24,8 @@ import {VideoCommentPolicyType,VideoImportState,VideoImportStateType,+ VideoLicence,+ VideoLicenceType,VideoPlaylistPrivacy,VideoPlaylistPrivacyType,VideoPlaylistType,@@ -578,14 +580,16 @@ export const VIDEO_CATEGORIES = {}// See https://creativecommons.org/licenses/?lang=en-export const VIDEO_LICENCES = {- 1: 'Attribution',- 2: 'Attribution - Share Alike',- 3: 'Attribution - No Derivatives',- 4: 'Attribution - Non Commercial',- 5: 'Attribution - Non Commercial - Share Alike',- 6: 'Attribution - Non Commercial - No Derivatives',- 7: 'Public Domain Dedication'+export const VIDEO_LICENCES: { [id in VideoLicenceType]: string } = {+ [VideoLicence['CC-BY']]: 'Attribution',+ [VideoLicence['CC-BY-SA']]: 'Attribution - Share Alike',+ [VideoLicence['CC-BY-ND']]: 'Attribution - No Derivatives',+ [VideoLicence['CC-BY-NC']]: 'Attribution - Non Commercial',+ [VideoLicence['CC-BY-NC-SA']]: 'Attribution - Non Commercial - Share Alike',+ [VideoLicence['CC-BY-NC-ND']]: 'Attribution - Non Commercial - No Derivatives',+ [VideoLicence['CC0']]: 'Public Domain Dedication',+ [VideoLicence['PDM']]: 'Free of known copyright restrictions',+ [VideoLicence['COPYRIGHT']]: 'Copyrighted - All Rights Reserved'}export const VIDEO_LANGUAGES: { [id: string]: string } = {}