mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-16 06:41:29 +03:00
Rename last few active API routes
This commit is contained in:
@@ -437,11 +437,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/DownloadFileRequest'
|
||||||
properties: {}
|
|
||||||
application/xml:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/body_15'
|
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: 'The file itself is in the response, as well as an options object.'
|
description: 'The file itself is in the response, as well as an options object.'
|
||||||
@@ -474,7 +470,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/body_17'
|
$ref: '#/components/schemas/DownloadArchiveRequest'
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: The archive text file is sent as a response
|
description: The archive text file is sent as a response
|
||||||
@@ -495,7 +491,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/inline_response_200_14'
|
$ref: '#/components/schemas/UpdaterStatus'
|
||||||
security:
|
security:
|
||||||
- Auth query parameter: []
|
- Auth query parameter: []
|
||||||
/api/updateServer:
|
/api/updateServer:
|
||||||
@@ -509,7 +505,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/body_18'
|
$ref: '#/components/schemas/UpdateServerRequest'
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
@@ -590,7 +586,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/inline_response_200_16'
|
$ref: '#/components/schemas/GenerateNewApiKeyResponse'
|
||||||
security:
|
security:
|
||||||
- Auth query parameter: []
|
- Auth query parameter: []
|
||||||
/api/deleteMp3:
|
/api/deleteMp3:
|
||||||
@@ -627,7 +623,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/inline_response_200_17'
|
$ref: '#/components/schemas/ConfigResponse'
|
||||||
security:
|
security:
|
||||||
- Auth query parameter: []
|
- Auth query parameter: []
|
||||||
/api/setConfig:
|
/api/setConfig:
|
||||||
@@ -639,7 +635,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/body_22'
|
$ref: '#/components/schemas/SetConfigRequest'
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
@@ -647,6 +643,8 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/SuccessObject'
|
$ref: '#/components/schemas/SuccessObject'
|
||||||
|
'404':
|
||||||
|
description: Tried to save invalid config file.
|
||||||
security:
|
security:
|
||||||
- Auth query parameter: []
|
- Auth query parameter: []
|
||||||
/api/downloads:
|
/api/downloads:
|
||||||
@@ -937,6 +935,13 @@ components:
|
|||||||
enum:
|
enum:
|
||||||
- audio
|
- audio
|
||||||
- video
|
- video
|
||||||
|
Config:
|
||||||
|
required:
|
||||||
|
- YoutubeDLMaterial
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
YoutubeDLMaterial:
|
||||||
|
type: object
|
||||||
BaseDownloadRequest:
|
BaseDownloadRequest:
|
||||||
required:
|
required:
|
||||||
- url
|
- url
|
||||||
@@ -1304,29 +1309,33 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
$ref: '#/components/schemas/FileType'
|
$ref: '#/components/schemas/FileType'
|
||||||
body_15:
|
DownloadFileRequest:
|
||||||
required:
|
required:
|
||||||
- fileNames
|
- fileNames
|
||||||
- type
|
- type
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
fileNames:
|
fileNames:
|
||||||
type: array
|
oneOf:
|
||||||
description: Array of 1 or more files to download
|
- type: string
|
||||||
items:
|
- type: array
|
||||||
type: string
|
description: Array of 1 or more files to download
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
zip_mode:
|
zip_mode:
|
||||||
type: boolean
|
type: boolean
|
||||||
type:
|
type:
|
||||||
type: string
|
$ref: '#/components/schemas/FileType'
|
||||||
outputName:
|
outputName:
|
||||||
type: string
|
type: string
|
||||||
fullPathProvided:
|
fullPathProvided:
|
||||||
|
type: boolean
|
||||||
|
uuid:
|
||||||
type: string
|
type: string
|
||||||
subscriptionName:
|
subscriptionName:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: Only used for subscriptions
|
description: Only used for subscriptions
|
||||||
subscriptionPlaylist:
|
subPlaylist:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: Only used for subscriptions
|
description: Only used for subscriptions
|
||||||
DeleteFileRequest:
|
DeleteFileRequest:
|
||||||
@@ -1351,7 +1360,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
archive_dir:
|
archive_dir:
|
||||||
type: string
|
type: string
|
||||||
inline_response_200_14:
|
UpdaterStatus:
|
||||||
required:
|
required:
|
||||||
- details
|
- details
|
||||||
- updating
|
- updating
|
||||||
@@ -1361,7 +1370,11 @@ components:
|
|||||||
type: boolean
|
type: boolean
|
||||||
details:
|
details:
|
||||||
type: string
|
type: string
|
||||||
body_18:
|
error:
|
||||||
|
type: boolean
|
||||||
|
UpdateServerRequest:
|
||||||
|
required:
|
||||||
|
- tag
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
tag:
|
tag:
|
||||||
@@ -1387,7 +1400,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
unhashed_pin:
|
unhashed_pin:
|
||||||
type: string
|
type: string
|
||||||
inline_response_200_16:
|
GenerateNewApiKeyResponse:
|
||||||
required:
|
required:
|
||||||
- new_api_key
|
- new_api_key
|
||||||
type: object
|
type: object
|
||||||
@@ -1404,23 +1417,23 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
blacklistMode:
|
blacklistMode:
|
||||||
type: boolean
|
type: boolean
|
||||||
inline_response_200_17:
|
ConfigResponse:
|
||||||
required:
|
required:
|
||||||
- config_file
|
- config_file
|
||||||
- success
|
- success
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
config_file:
|
config_file:
|
||||||
type: object
|
$ref: '#/components/schemas/Config'
|
||||||
success:
|
success:
|
||||||
type: boolean
|
type: boolean
|
||||||
body_22:
|
SetConfigRequest:
|
||||||
required:
|
required:
|
||||||
- new_config_file
|
- new_config_file
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
new_config_file:
|
new_config_file:
|
||||||
type: object
|
$ref: '#/components/schemas/Config'
|
||||||
DatabaseFile:
|
DatabaseFile:
|
||||||
required:
|
required:
|
||||||
- duration
|
- duration
|
||||||
@@ -1621,7 +1634,7 @@ components:
|
|||||||
subscriptions:
|
subscriptions:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/inline_response_200_9_subscription'
|
$ref: '#/components/schemas/Subscription'
|
||||||
created:
|
created:
|
||||||
type: number
|
type: number
|
||||||
role:
|
role:
|
||||||
@@ -1643,6 +1656,11 @@ components:
|
|||||||
- sharing
|
- sharing
|
||||||
- advanced_download
|
- advanced_download
|
||||||
- downloads_manager
|
- downloads_manager
|
||||||
|
YesNo:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- 'yes'
|
||||||
|
- 'no'
|
||||||
BaseChangePermissionsRequest:
|
BaseChangePermissionsRequest:
|
||||||
required:
|
required:
|
||||||
- permission
|
- permission
|
||||||
@@ -1652,10 +1670,7 @@ components:
|
|||||||
permission:
|
permission:
|
||||||
$ref: '#/components/schemas/UserPermission'
|
$ref: '#/components/schemas/UserPermission'
|
||||||
new_value:
|
new_value:
|
||||||
type: string
|
$ref: '#/components/schemas/YesNo'
|
||||||
enum:
|
|
||||||
- 'yes'
|
|
||||||
- 'no'
|
|
||||||
ChangeUserPermissionsRequest:
|
ChangeUserPermissionsRequest:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/components/schemas/BaseChangePermissionsRequest'
|
- $ref: '#/components/schemas/BaseChangePermissionsRequest'
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { PostsService } from 'app/posts.services';
|
import { PostsService } from 'app/posts.services';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import type { FileType } from '../../../api-types';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-recent-videos',
|
selector: 'app-recent-videos',
|
||||||
@@ -161,7 +162,7 @@ export class RecentVideosComponent implements OnInit {
|
|||||||
// normal subscriptions
|
// normal subscriptions
|
||||||
!new_tab ? this.router.navigate(['/player', {fileNames: file.id,
|
!new_tab ? this.router.navigate(['/player', {fileNames: file.id,
|
||||||
type: file.isAudio ? 'audio' : 'video', subscriptionName: sub.name,
|
type: file.isAudio ? 'audio' : 'video', subscriptionName: sub.name,
|
||||||
subPlaylist: sub.isPlaylist}])
|
subPlaylist: sub.isPlaylist}])
|
||||||
: window.open(`/#/player;fileNames=${file.id};type=${file.isAudio ? 'audio' : 'video'};subscriptionName=${sub.name};subPlaylist=${sub.isPlaylist}`);
|
: window.open(`/#/player;fileNames=${file.id};type=${file.isAudio ? 'audio' : 'video'};subscriptionName=${sub.name};subPlaylist=${sub.isPlaylist}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -186,7 +187,7 @@ export class RecentVideosComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
downloadSubscriptionFile(file) {
|
downloadSubscriptionFile(file) {
|
||||||
const type = file.isAudio ? 'audio' : 'video';
|
const type = (file.isAudio ? 'audio' : 'video') as FileType;
|
||||||
const ext = type === 'audio' ? '.mp3' : '.mp4'
|
const ext = type === 'audio' ? '.mp3' : '.mp4'
|
||||||
const sub = this.postsService.getSubscriptionByID(file.sub_id);
|
const sub = this.postsService.getSubscriptionByID(file.sub_id);
|
||||||
this.postsService.downloadFileFromServer(file.id, type, null, null, sub.name, sub.isPlaylist,
|
this.postsService.downloadFileFromServer(file.id, type, null, null, sub.name, sub.isPlaylist,
|
||||||
@@ -199,7 +200,7 @@ export class RecentVideosComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
downloadNormalFile(file) {
|
downloadNormalFile(file) {
|
||||||
const type = file.isAudio ? 'audio' : 'video';
|
const type = (file.isAudio ? 'audio' : 'video') as FileType;
|
||||||
const ext = type === 'audio' ? '.mp3' : '.mp4'
|
const ext = type === 'audio' ? '.mp3' : '.mp4'
|
||||||
const name = file.id;
|
const name = file.id;
|
||||||
this.downloading_content[type][name] = true;
|
this.downloading_content[type][name] = true;
|
||||||
@@ -276,7 +277,7 @@ export class RecentVideosComponent implements OnInit {
|
|||||||
const result = b.registered - a.registered;
|
const result = b.registered - a.registered;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
durationStringToNumber(dur_str) {
|
durationStringToNumber(dur_str) {
|
||||||
let num_sum = 0;
|
let num_sum = 0;
|
||||||
const dur_str_parts = dur_str.split(':');
|
const dur_str_parts = dur_str.split(':');
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { PostsService } from 'app/posts.services';
|
import { PostsService } from 'app/posts.services';
|
||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
|
import type { UpdaterStatus } from '../../../api-types';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-update-progress-dialog',
|
selector: 'app-update-progress-dialog',
|
||||||
@@ -9,7 +10,7 @@ import { MatSnackBar } from '@angular/material/snack-bar';
|
|||||||
})
|
})
|
||||||
export class UpdateProgressDialogComponent implements OnInit {
|
export class UpdateProgressDialogComponent implements OnInit {
|
||||||
|
|
||||||
updateStatus = null;
|
updateStatus: UpdaterStatus = null;
|
||||||
updateInterval = 250;
|
updateInterval = 250;
|
||||||
errored = false;
|
errored = false;
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import { CreatePlaylistComponent } from 'app/create-playlist/create-playlist.com
|
|||||||
import { Platform } from '@angular/cdk/platform';
|
import { Platform } from '@angular/cdk/platform';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
import { ArgModifierDialogComponent } from 'app/dialogs/arg-modifier-dialog/arg-modifier-dialog.component';
|
import { ArgModifierDialogComponent } from 'app/dialogs/arg-modifier-dialog/arg-modifier-dialog.component';
|
||||||
import type { FileType } from 'api-types';
|
import type { FileType } from '../../api-types';
|
||||||
|
|
||||||
export let audioFilesMouseHovering = false;
|
export let audioFilesMouseHovering = false;
|
||||||
export let videoFilesMouseHovering = false;
|
export let videoFilesMouseHovering = false;
|
||||||
@@ -34,7 +34,7 @@ export interface Download {
|
|||||||
percent_complete: number;
|
percent_complete: number;
|
||||||
downloading: boolean;
|
downloading: boolean;
|
||||||
is_playlist: boolean;
|
is_playlist: boolean;
|
||||||
error: boolean | string;
|
error?: boolean | string;
|
||||||
fileNames?: string[];
|
fileNames?: string[];
|
||||||
complete?: boolean;
|
complete?: boolean;
|
||||||
timestamp_start?: number;
|
timestamp_start?: number;
|
||||||
@@ -740,7 +740,7 @@ export class MainComponent implements OnInit {
|
|||||||
|
|
||||||
downloadAudioFile(name) {
|
downloadAudioFile(name) {
|
||||||
this.downloading_content['audio'][name] = true;
|
this.downloading_content['audio'][name] = true;
|
||||||
this.postsService.downloadFileFromServer(name, 'audio').subscribe(res => {
|
this.postsService.downloadFileFromServer(name, 'audio' as FileType).subscribe(res => {
|
||||||
this.downloading_content['audio'][name] = false;
|
this.downloading_content['audio'][name] = false;
|
||||||
const blob: Blob = res;
|
const blob: Blob = res;
|
||||||
saveAs(blob, decodeURIComponent(name) + '.mp3');
|
saveAs(blob, decodeURIComponent(name) + '.mp3');
|
||||||
@@ -757,7 +757,7 @@ export class MainComponent implements OnInit {
|
|||||||
|
|
||||||
downloadVideoFile(name) {
|
downloadVideoFile(name) {
|
||||||
this.downloading_content['video'][name] = true;
|
this.downloading_content['video'][name] = true;
|
||||||
this.postsService.downloadFileFromServer(name, 'video').subscribe(res => {
|
this.postsService.downloadFileFromServer(name, 'video' as FileType).subscribe(res => {
|
||||||
this.downloading_content['video'][name] = false;
|
this.downloading_content['video'][name] = false;
|
||||||
const blob: Blob = res;
|
const blob: Blob = res;
|
||||||
saveAs(blob, decodeURIComponent(name) + '.mp4');
|
saveAs(blob, decodeURIComponent(name) + '.mp4');
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { MatSnackBar } from '@angular/material/snack-bar';
|
|||||||
import { InputDialogComponent } from 'app/input-dialog/input-dialog.component';
|
import { InputDialogComponent } from 'app/input-dialog/input-dialog.component';
|
||||||
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||||
import { ShareMediaDialogComponent } from '../dialogs/share-media-dialog/share-media-dialog.component';
|
import { ShareMediaDialogComponent } from '../dialogs/share-media-dialog/share-media-dialog.component';
|
||||||
import type { FileType } from 'api-types';
|
import type { FileType } from '../../api-types';
|
||||||
|
|
||||||
export interface IMedia {
|
export interface IMedia {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -35,7 +35,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
// params
|
// params
|
||||||
fileNames: string[];
|
fileNames: string[];
|
||||||
type: string;
|
type: FileType;
|
||||||
id = null; // used for playlists (not subscription)
|
id = null; // used for playlists (not subscription)
|
||||||
uid = null; // used for non-subscription files (audio, video, playlist)
|
uid = null; // used for non-subscription files (audio, video, playlist)
|
||||||
subscriptionName = null;
|
subscriptionName = null;
|
||||||
@@ -74,7 +74,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.innerWidth = window.innerWidth;
|
this.innerWidth = window.innerWidth;
|
||||||
|
|
||||||
this.type = this.route.snapshot.paramMap.get('type');
|
this.type = this.route.snapshot.paramMap.get('type') as FileType;
|
||||||
this.id = this.route.snapshot.paramMap.get('id');
|
this.id = this.route.snapshot.paramMap.get('id');
|
||||||
this.uid = this.route.snapshot.paramMap.get('uid');
|
this.uid = this.route.snapshot.paramMap.get('uid');
|
||||||
this.subscriptionName = this.route.snapshot.paramMap.get('subscriptionName');
|
this.subscriptionName = this.route.snapshot.paramMap.get('subscriptionName');
|
||||||
@@ -160,7 +160,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
if (!this.id) {
|
if (!this.id) {
|
||||||
// regular video/audio file (not playlist)
|
// regular video/audio file (not playlist)
|
||||||
this.fileNames = [this.db_file['id']];
|
this.fileNames = [this.db_file['id']];
|
||||||
this.type = this.db_file['isAudio'] ? 'audio' : 'video';
|
this.type = (this.db_file['isAudio'] ? 'audio' : 'video') as FileType;
|
||||||
if (!already_has_filenames) { this.parseFileNames(); }
|
if (!already_has_filenames) { this.parseFileNames(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,13 +10,19 @@ import { DOCUMENT } from '@angular/common';
|
|||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
import * as Fingerprint2 from 'fingerprintjs2';
|
import * as Fingerprint2 from 'fingerprintjs2';
|
||||||
import {
|
import type {
|
||||||
|
ChangeRolePermissionsRequest,
|
||||||
|
ChangeUserPermissionsRequest,
|
||||||
|
ConfigResponse,
|
||||||
CreatePlaylistRequest,
|
CreatePlaylistRequest,
|
||||||
CreatePlaylistResponse,
|
CreatePlaylistResponse,
|
||||||
DeleteMp3Mp4Request,
|
DeleteMp3Mp4Request,
|
||||||
DeletePlaylistRequest,
|
DeletePlaylistRequest,
|
||||||
DeleteSubscriptionFileRequest,
|
DeleteSubscriptionFileRequest,
|
||||||
|
DownloadArchiveRequest,
|
||||||
|
DownloadFileRequest,
|
||||||
FileType,
|
FileType,
|
||||||
|
GenerateNewApiKeyResponse,
|
||||||
GetAllDownloadsResponse,
|
GetAllDownloadsResponse,
|
||||||
GetAllFilesResponse,
|
GetAllFilesResponse,
|
||||||
GetAllSubscriptionsResponse,
|
GetAllSubscriptionsResponse,
|
||||||
@@ -35,16 +41,21 @@ import {
|
|||||||
Mp4DownloadRequest,
|
Mp4DownloadRequest,
|
||||||
Mp4DownloadResponse,
|
Mp4DownloadResponse,
|
||||||
Playlist,
|
Playlist,
|
||||||
|
SetConfigRequest,
|
||||||
SharingToggle,
|
SharingToggle,
|
||||||
SubscribeRequest,
|
SubscribeRequest,
|
||||||
SubscribeResponse,
|
SubscribeResponse,
|
||||||
SubscriptionRequestData,
|
SubscriptionRequestData,
|
||||||
SuccessObject,
|
SuccessObject,
|
||||||
|
UpdaterStatus,
|
||||||
UnsubscribeRequest,
|
UnsubscribeRequest,
|
||||||
UnsubscribeResponse,
|
UnsubscribeResponse,
|
||||||
UpdatePlaylistFilesRequest,
|
UpdatePlaylistFilesRequest,
|
||||||
UpdatePlaylistRequest,
|
UpdatePlaylistRequest,
|
||||||
} from 'api-types';
|
UpdateServerRequest,
|
||||||
|
UserPermission,
|
||||||
|
YesNo,
|
||||||
|
} from '../api-types';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PostsService implements CanActivate {
|
export class PostsService implements CanActivate {
|
||||||
@@ -224,7 +235,7 @@ export class PostsService implements CanActivate {
|
|||||||
if (isDevMode()) {
|
if (isDevMode()) {
|
||||||
return this.http.get('./assets/default.json');
|
return this.http.get('./assets/default.json');
|
||||||
} else {
|
} else {
|
||||||
return this.http.get(this.path + 'config', this.httpOptions);
|
return this.http.get<ConfigResponse>(this.path + 'config', this.httpOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +244,8 @@ export class PostsService implements CanActivate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setConfig(config) {
|
setConfig(config) {
|
||||||
return this.http.post(this.path + 'setConfig', {new_config_file: config}, this.httpOptions);
|
const body: SetConfigRequest = {new_config_file: config};
|
||||||
|
return this.http.post<SuccessObject>(this.path + 'setConfig', body, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteFile(uid: string, isAudio: boolean, blacklistMode = false) {
|
deleteFile(uid: string, isAudio: boolean, blacklistMode = false) {
|
||||||
@@ -262,19 +274,19 @@ export class PostsService implements CanActivate {
|
|||||||
return this.http.post<GetAllFilesResponse>(this.path + 'getAllFiles', {}, this.httpOptions);
|
return this.http.post<GetAllFilesResponse>(this.path + 'getAllFiles', {}, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadFileFromServer(fileName, type, outputName = null, fullPathProvided = null, subscriptionName = null, subPlaylist = null,
|
downloadFileFromServer(fileName: string | string[], type: FileType, outputName: string = null, fullPathProvided: boolean = null, subscriptionName: boolean = null, subPlaylist: boolean = null,
|
||||||
uid = null, uuid = null, id = null) {
|
uid = null, uuid: string = null, id = null) {
|
||||||
return this.http.post(this.path + 'downloadFile', {fileNames: fileName,
|
const body: DownloadFileRequest = {fileNames: fileName,
|
||||||
type: type,
|
type: type,
|
||||||
zip_mode: Array.isArray(fileName),
|
zip_mode: Array.isArray(fileName),
|
||||||
outputName: outputName,
|
outputName: outputName,
|
||||||
fullPathProvided: fullPathProvided,
|
fullPathProvided: fullPathProvided,
|
||||||
subscriptionName: subscriptionName,
|
subscriptionName: subscriptionName,
|
||||||
subPlaylist: subPlaylist,
|
subPlaylist: subPlaylist,
|
||||||
uuid: uuid,
|
uuid: uuid,
|
||||||
uid: uid,
|
id: id,
|
||||||
id: id
|
};
|
||||||
},
|
return this.http.post(this.path + 'downloadFile', body,
|
||||||
{responseType: 'blob', params: this.httpOptions.params});
|
{responseType: 'blob', params: this.httpOptions.params});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,7 +295,8 @@ export class PostsService implements CanActivate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
downloadArchive(sub) {
|
downloadArchive(sub) {
|
||||||
return this.http.post(this.path + 'downloadArchive', {sub: sub}, {responseType: 'blob', params: this.httpOptions.params});
|
const body: DownloadArchiveRequest = {sub: sub};
|
||||||
|
return this.http.post(this.path + 'downloadArchive', body, {responseType: 'blob', params: this.httpOptions.params});
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileInfo(fileNames, type, urlMode) {
|
getFileInfo(fileNames, type, urlMode) {
|
||||||
@@ -299,7 +312,7 @@ export class PostsService implements CanActivate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
generateNewAPIKey() {
|
generateNewAPIKey() {
|
||||||
return this.http.post(this.path + 'generateNewAPIKey', {}, this.httpOptions);
|
return this.http.post<GenerateNewApiKeyResponse>(this.path + 'generateNewAPIKey', {}, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
enableSharing(uid: string, type: FileType, is_playlist: boolean) {
|
enableSharing(uid: string, type: FileType, is_playlist: boolean) {
|
||||||
@@ -393,12 +406,13 @@ export class PostsService implements CanActivate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// updates the server to the latest version
|
// updates the server to the latest version
|
||||||
updateServer(tag) {
|
updateServer(tag: string) {
|
||||||
return this.http.post(this.path + 'updateServer', {tag: tag}, this.httpOptions);
|
const body: UpdateServerRequest = {tag: tag};
|
||||||
|
return this.http.post<SuccessObject>(this.path + 'updateServer', body, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
getUpdaterStatus() {
|
getUpdaterStatus() {
|
||||||
return this.http.get(this.path + 'updaterStatus', this.httpOptions);
|
return this.http.get<UpdaterStatus>(this.path + 'updaterStatus', this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets tag of the latest version of youtubedl-material
|
// gets tag of the latest version of youtubedl-material
|
||||||
@@ -534,11 +548,11 @@ export class PostsService implements CanActivate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeUser(change_obj) {
|
changeUser(change_obj) {
|
||||||
return this.http.post(this.path + 'updateUser', {change_object: change_obj}, this.httpOptions);
|
return this.http.post<SuccessObject>(this.path + 'updateUser', {change_object: change_obj}, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteUser(uid) {
|
deleteUser(uid) {
|
||||||
return this.http.post(this.path + 'deleteUser', {uid: uid}, this.httpOptions);
|
return this.http.post<SuccessObject>(this.path + 'deleteUser', {uid: uid}, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeUserPassword(user_uid, new_password) {
|
changeUserPassword(user_uid, new_password) {
|
||||||
@@ -553,13 +567,15 @@ export class PostsService implements CanActivate {
|
|||||||
return this.http.post(this.path + 'getRoles', {}, this.httpOptions);
|
return this.http.post(this.path + 'getRoles', {}, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
setUserPermission(user_uid, permission, new_value) {
|
setUserPermission(user_uid: string, permission: UserPermission, new_value: YesNo) {
|
||||||
return this.http.post(this.path + 'changeUserPermissions', {user_uid: user_uid, permission: permission, new_value: new_value},
|
const body: ChangeUserPermissionsRequest = {user_uid: user_uid, permission: permission, new_value: new_value};
|
||||||
|
return this.http.post<SuccessObject>(this.path + 'changeUserPermissions', body,
|
||||||
this.httpOptions);
|
this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
setRolePermission(role_name, permission, new_value) {
|
setRolePermission(role_name: string, permission: UserPermission, new_value: YesNo) {
|
||||||
return this.http.post(this.path + 'changeRolePermissions', {role: role_name, permission: permission, new_value: new_value},
|
const body: ChangeRolePermissionsRequest = {role: role_name, permission: permission, new_value: new_value};
|
||||||
|
return this.http.post<SuccessObject>(this.path + 'changeRolePermissions', body,
|
||||||
this.httpOptions);
|
this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { PostsService } from 'app/posts.services';
|
|||||||
import { ActivatedRoute, Router, ParamMap } from '@angular/router';
|
import { ActivatedRoute, Router, ParamMap } from '@angular/router';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { EditSubscriptionDialogComponent } from 'app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component';
|
import { EditSubscriptionDialogComponent } from 'app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component';
|
||||||
|
import type { FileType } from '../../../api-types';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-subscription',
|
selector: 'app-subscription',
|
||||||
@@ -151,7 +152,7 @@ export class SubscriptionComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.downloading = true;
|
this.downloading = true;
|
||||||
this.postsService.downloadFileFromServer(fileNames, 'video', this.subscription.name, true).subscribe(res => {
|
this.postsService.downloadFileFromServer(fileNames, 'video' as FileType, this.subscription.name, true).subscribe(res => {
|
||||||
this.downloading = false;
|
this.downloading = false;
|
||||||
const blob: Blob = res;
|
const blob: Blob = res;
|
||||||
saveAs(blob, this.subscription.name + '.zip');
|
saveAs(blob, this.subscription.name + '.zip');
|
||||||
|
|||||||
Reference in New Issue
Block a user