diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-08 15:16:01 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-08 15:16:01 +0200 |
commit | dc48fdbe68e9dd3a3a6028181e61d8595d98e654 (patch) | |
tree | b641873412bfb4ff2a754a27762cd533c735e7d8 | |
parent | 27ec473f5306621643fcb169be7cfe6b15136265 (diff) | |
parent | b9244002fcc48dda7f3a588980d910a40429238f (diff) | |
download | PeerTube-dc48fdbe68e9dd3a3a6028181e61d8595d98e654.tar.gz PeerTube-dc48fdbe68e9dd3a3a6028181e61d8595d98e654.tar.zst PeerTube-dc48fdbe68e9dd3a3a6028181e61d8595d98e654.zip |
Merge branch 'release/3.1.0' into develop
10 files changed, 60 insertions, 20 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html index 5d826fbe9..10d5278c1 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html | |||
@@ -153,7 +153,7 @@ | |||
153 | <my-select-options | 153 | <my-select-options |
154 | id="liveTranscodingProfile" | 154 | id="liveTranscodingProfile" |
155 | formControlName="profile" | 155 | formControlName="profile" |
156 | [items]="getAvailableTranscodingProfile()" | 156 | [items]="transcodingProfiles" |
157 | [clearable]="false" | 157 | [clearable]="false" |
158 | > | 158 | > |
159 | </my-select-options> | 159 | </my-select-options> |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts index 3328d28a9..72372ffac 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' | 2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' |
3 | import { Component, Input, OnInit } from '@angular/core' | 3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' |
4 | import { FormGroup } from '@angular/forms' | 4 | import { FormGroup } from '@angular/forms' |
5 | import { ServerConfig } from '@shared/models' | 5 | import { ServerConfig } from '@shared/models' |
6 | import { ConfigService } from '../shared/config.service' | 6 | import { ConfigService } from '../shared/config.service' |
@@ -11,12 +11,14 @@ import { EditConfigurationService, ResolutionOption } from './edit-configuration | |||
11 | templateUrl: './edit-live-configuration.component.html', | 11 | templateUrl: './edit-live-configuration.component.html', |
12 | styleUrls: [ './edit-custom-config.component.scss' ] | 12 | styleUrls: [ './edit-custom-config.component.scss' ] |
13 | }) | 13 | }) |
14 | export class EditLiveConfigurationComponent implements OnInit { | 14 | export class EditLiveConfigurationComponent implements OnInit, OnChanges { |
15 | @Input() form: FormGroup | 15 | @Input() form: FormGroup |
16 | @Input() formErrors: any | 16 | @Input() formErrors: any |
17 | @Input() serverConfig: ServerConfig | 17 | @Input() serverConfig: ServerConfig |
18 | 18 | ||
19 | transcodingThreadOptions: SelectOptionsItem[] = [] | 19 | transcodingThreadOptions: SelectOptionsItem[] = [] |
20 | transcodingProfiles: SelectOptionsItem[] = [] | ||
21 | |||
20 | liveMaxDurationOptions: SelectOptionsItem[] = [] | 22 | liveMaxDurationOptions: SelectOptionsItem[] = [] |
21 | liveResolutions: ResolutionOption[] = [] | 23 | liveResolutions: ResolutionOption[] = [] |
22 | 24 | ||
@@ -39,7 +41,13 @@ export class EditLiveConfigurationComponent implements OnInit { | |||
39 | this.liveResolutions = this.editConfigurationService.getLiveResolutions() | 41 | this.liveResolutions = this.editConfigurationService.getLiveResolutions() |
40 | } | 42 | } |
41 | 43 | ||
42 | getAvailableTranscodingProfile () { | 44 | ngOnChanges (changes: SimpleChanges) { |
45 | if (changes['serverConfig']) { | ||
46 | this.transcodingProfiles = this.buildAvailableTranscodingProfile() | ||
47 | } | ||
48 | } | ||
49 | |||
50 | buildAvailableTranscodingProfile () { | ||
43 | const profiles = this.serverConfig.live.transcoding.availableProfiles | 51 | const profiles = this.serverConfig.live.transcoding.availableProfiles |
44 | 52 | ||
45 | return profiles.map(p => { | 53 | return profiles.map(p => { |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html index cf13b27bb..1c5d6a9b4 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html | |||
@@ -181,7 +181,7 @@ | |||
181 | <my-select-options | 181 | <my-select-options |
182 | id="transcodingProfile" | 182 | id="transcodingProfile" |
183 | formControlName="profile" | 183 | formControlName="profile" |
184 | [items]="getAvailableTranscodingProfile()" | 184 | [items]="transcodingProfiles" |
185 | [clearable]="false" | 185 | [clearable]="false" |
186 | ></my-select-options> | 186 | ></my-select-options> |
187 | 187 | ||
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts index b864f1bc4..a2dc3e52a 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' | 2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' |
3 | import { Component, Input, OnInit } from '@angular/core' | 3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' |
4 | import { FormGroup } from '@angular/forms' | 4 | import { FormGroup } from '@angular/forms' |
5 | import { ServerConfig } from '@shared/models' | 5 | import { ServerConfig } from '@shared/models' |
6 | import { ConfigService } from '../shared/config.service' | 6 | import { ConfigService } from '../shared/config.service' |
@@ -11,12 +11,13 @@ import { EditConfigurationService, ResolutionOption } from './edit-configuration | |||
11 | templateUrl: './edit-vod-transcoding.component.html', | 11 | templateUrl: './edit-vod-transcoding.component.html', |
12 | styleUrls: [ './edit-custom-config.component.scss' ] | 12 | styleUrls: [ './edit-custom-config.component.scss' ] |
13 | }) | 13 | }) |
14 | export class EditVODTranscodingComponent implements OnInit { | 14 | export class EditVODTranscodingComponent implements OnInit, OnChanges { |
15 | @Input() form: FormGroup | 15 | @Input() form: FormGroup |
16 | @Input() formErrors: any | 16 | @Input() formErrors: any |
17 | @Input() serverConfig: ServerConfig | 17 | @Input() serverConfig: ServerConfig |
18 | 18 | ||
19 | transcodingThreadOptions: SelectOptionsItem[] = [] | 19 | transcodingThreadOptions: SelectOptionsItem[] = [] |
20 | transcodingProfiles: SelectOptionsItem[] = [] | ||
20 | resolutions: ResolutionOption[] = [] | 21 | resolutions: ResolutionOption[] = [] |
21 | 22 | ||
22 | constructor ( | 23 | constructor ( |
@@ -31,7 +32,13 @@ export class EditVODTranscodingComponent implements OnInit { | |||
31 | this.checkTranscodingFields() | 32 | this.checkTranscodingFields() |
32 | } | 33 | } |
33 | 34 | ||
34 | getAvailableTranscodingProfile () { | 35 | ngOnChanges (changes: SimpleChanges) { |
36 | if (changes['serverConfig']) { | ||
37 | this.transcodingProfiles = this.buildAvailableTranscodingProfile() | ||
38 | } | ||
39 | } | ||
40 | |||
41 | buildAvailableTranscodingProfile () { | ||
35 | const profiles = this.serverConfig.transcoding.availableProfiles | 42 | const profiles = this.serverConfig.transcoding.availableProfiles |
36 | 43 | ||
37 | return profiles.map(p => { | 44 | return profiles.map(p => { |
diff --git a/client/src/app/shared/shared-main/date/date-toggle.component.ts b/client/src/app/shared/shared-main/date/date-toggle.component.ts index 53f25f0ad..0c3949f11 100644 --- a/client/src/app/shared/shared-main/date/date-toggle.component.ts +++ b/client/src/app/shared/shared-main/date/date-toggle.component.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { DatePipe } from '@angular/common' | 1 | import { Component, Input, OnChanges } from '@angular/core' |
2 | import { Component, Input, OnChanges, OnInit } from '@angular/core' | ||
3 | import { FromNowPipe } from '../angular/from-now.pipe' | 2 | import { FromNowPipe } from '../angular/from-now.pipe' |
4 | 3 | ||
5 | @Component({ | 4 | @Component({ |
@@ -14,10 +13,7 @@ export class DateToggleComponent implements OnChanges { | |||
14 | dateRelative: string | 13 | dateRelative: string |
15 | dateAbsolute: string | 14 | dateAbsolute: string |
16 | 15 | ||
17 | constructor ( | 16 | constructor (private fromNowPipe: FromNowPipe) { } |
18 | private datePipe: DatePipe, | ||
19 | private fromNowPipe: FromNowPipe | ||
20 | ) { } | ||
21 | 17 | ||
22 | ngOnChanges () { | 18 | ngOnChanges () { |
23 | this.updateDates() | 19 | this.updateDates() |
diff --git a/client/src/sass/player/playlist.scss b/client/src/sass/player/playlist.scss index cf125a562..ebbed02d9 100644 --- a/client/src/sass/player/playlist.scss +++ b/client/src/sass/player/playlist.scss | |||
@@ -5,7 +5,8 @@ $playlist-menu-width: 350px; | |||
5 | right: 0; | 5 | right: 0; |
6 | height: 100%; | 6 | height: 100%; |
7 | width: $playlist-menu-width; | 7 | width: $playlist-menu-width; |
8 | background: rgba(0, 0, 0, 0.8); | 8 | // !important to prevent none background set on focus |
9 | background: rgba(0, 0, 0, 0.8) !important; | ||
9 | z-index: 101; | 10 | z-index: 101; |
10 | transition: right 0.2s; | 11 | transition: right 0.2s; |
11 | overflow-y: scroll; | 12 | overflow-y: scroll; |
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts index 9d2e54fb5..fac3da6ba 100644 --- a/server/helpers/youtube-dl.ts +++ b/server/helpers/youtube-dl.ts | |||
@@ -76,7 +76,7 @@ function getYoutubeDLSubs (url: string, opts?: object): Promise<YoutubeDLSubs> { | |||
76 | logger.debug('Get subtitles from youtube dl.', { url, files }) | 76 | logger.debug('Get subtitles from youtube dl.', { url, files }) |
77 | 77 | ||
78 | const subtitles = files.reduce((acc, filename) => { | 78 | const subtitles = files.reduce((acc, filename) => { |
79 | const matched = filename.match(/\.([a-z]{2})\.(vtt|ttml)/i) | 79 | const matched = filename.match(/\.([a-z]{2})(-[a-z]+)?\.(vtt|ttml)/i) |
80 | if (!matched || !matched[1]) return acc | 80 | if (!matched || !matched[1]) return acc |
81 | 81 | ||
82 | return [ | 82 | return [ |
diff --git a/server/initializers/migrations/0612-captions-unique.ts b/server/initializers/migrations/0612-captions-unique.ts new file mode 100644 index 000000000..368838a2a --- /dev/null +++ b/server/initializers/migrations/0612-captions-unique.ts | |||
@@ -0,0 +1,23 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | async function up (utils: { | ||
4 | transaction: Sequelize.Transaction | ||
5 | queryInterface: Sequelize.QueryInterface | ||
6 | sequelize: Sequelize.Sequelize | ||
7 | db: any | ||
8 | }): Promise<void> { | ||
9 | |||
10 | await utils.sequelize.query( | ||
11 | 'DELETE FROM "videoCaption" v1 USING (SELECT MIN(id) as id, "filename" FROM "videoCaption" ' + | ||
12 | 'GROUP BY "filename" HAVING COUNT(*) > 1) v2 WHERE v1."filename" = v2."filename" AND v1.id <> v2.id' | ||
13 | ) | ||
14 | } | ||
15 | |||
16 | function down (options) { | ||
17 | throw new Error('Not implemented.') | ||
18 | } | ||
19 | |||
20 | export { | ||
21 | up, | ||
22 | down | ||
23 | } | ||
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index b10c6e38e..e9afb2c18 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -917,7 +917,7 @@ export class VideoModel extends Model { | |||
917 | }, | 917 | }, |
918 | include: [ | 918 | include: [ |
919 | { | 919 | { |
920 | attributes: [ 'language', 'fileUrl' ], | 920 | attributes: [ 'filename', 'language', 'fileUrl' ], |
921 | model: VideoCaptionModel.unscoped(), | 921 | model: VideoCaptionModel.unscoped(), |
922 | required: false | 922 | required: false |
923 | }, | 923 | }, |
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index 8be6575b4..373b17ddf 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml | |||
@@ -2646,9 +2646,14 @@ paths: | |||
2646 | content: | 2646 | content: |
2647 | application/json: | 2647 | application/json: |
2648 | schema: | 2648 | schema: |
2649 | type: array | 2649 | properties: |
2650 | items: | 2650 | total: |
2651 | $ref: '#/components/schemas/VideoChannel' | 2651 | type: integer |
2652 | example: 1 | ||
2653 | data: | ||
2654 | type: array | ||
2655 | items: | ||
2656 | $ref: '#/components/schemas/VideoChannel' | ||
2652 | '/accounts/{name}/ratings': | 2657 | '/accounts/{name}/ratings': |
2653 | get: | 2658 | get: |
2654 | summary: List ratings of an account | 2659 | summary: List ratings of an account |