Merge pull request #911 from Tzahi12345/registration-fixes

Registration fixes
pull/917/head
Tzahi12345 2 years ago committed by GitHub
commit ab5d8dc5ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2742,7 +2742,7 @@ components:
error: error:
type: string type: string
schedule: schedule:
type: object $ref: '#/components/schemas/Schedule'
options: options:
type: object type: object
Schedule: Schedule:
@ -2877,6 +2877,7 @@ components:
- sharing - sharing
- advanced_download - advanced_download
- downloads_manager - downloads_manager
- tasks_manager
YesNo: YesNo:
type: string type: string
enum: enum:

@ -68,15 +68,7 @@ exports.initialize = function () {
const setupRoles = async () => { const setupRoles = async () => {
const required_roles = { const required_roles = {
admin: { admin: {
permissions: [ permissions: consts.AVAILABLE_PERMISSIONS
'filemanager',
'settings',
'subscriptions',
'sharing',
'advanced_download',
'downloads_manager',
'tasks_manager'
]
}, },
user: { user: {
permissions: [ permissions: [

@ -3,5 +3,5 @@
/* eslint-disable */ /* eslint-disable */
export type Config = { export type Config = {
YoutubeDLMaterial: any; YoutubeDLMaterial: Record<string, any>;
}; };

@ -26,5 +26,5 @@ export type Download = {
user_uid?: string; user_uid?: string;
sub_id?: string; sub_id?: string;
sub_name?: string; sub_name?: string;
prefetched_info?: any; prefetched_info?: Record<string, any>;
}; };

@ -5,6 +5,6 @@
export type GetFileFormatsResponse = { export type GetFileFormatsResponse = {
success: boolean; success: boolean;
result: { result: {
formats?: Array<any>; formats?: Array<Record<string, any>>;
}; };
}; };

@ -6,5 +6,5 @@ import type { Subscription } from './Subscription';
export type GetSubscriptionResponse = { export type GetSubscriptionResponse = {
subscription: Subscription; subscription: Subscription;
files: Array<any>; files: Array<Record<string, any>>;
}; };

@ -11,6 +11,6 @@ export type Notification = {
user_uid?: string; user_uid?: string;
action?: Array<NotificationAction>; action?: Array<NotificationAction>;
read: boolean; read: boolean;
data?: any; data?: Record<string, any>;
timestamp: number; timestamp: number;
}; };

@ -15,5 +15,5 @@ export type Subscription = {
timerange?: string; timerange?: string;
custom_args?: string; custom_args?: string;
custom_output?: string; custom_output?: string;
videos: Array<any>; videos: Array<Record<string, any>>;
}; };

@ -2,6 +2,8 @@
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
import type { Schedule } from './Schedule';
export type Task = { export type Task = {
key: string; key: string;
title?: string; title?: string;
@ -9,8 +11,8 @@ export type Task = {
last_confirmed: number; last_confirmed: number;
running: boolean; running: boolean;
confirming: boolean; confirming: boolean;
data: any; data: Record<string, any>;
error: string; error: string;
schedule: any; schedule: Schedule;
options?: any; options?: Record<string, any>;
}; };

@ -10,5 +10,5 @@ export type UpdateFileRequest = {
/** /**
* Object with fields to update as keys and their new values * Object with fields to update as keys and their new values
*/ */
change_obj: any; change_obj: Record<string, any>;
}; };

@ -4,5 +4,5 @@
export type UpdateTaskDataRequest = { export type UpdateTaskDataRequest = {
task_key: string; task_key: string;
new_data: any; new_data: Record<string, any>;
}; };

@ -4,5 +4,5 @@
export type UpdateTaskOptionsRequest = { export type UpdateTaskOptionsRequest = {
task_key: string; task_key: string;
new_options: any; new_options: Record<string, any>;
}; };

@ -9,4 +9,5 @@ export enum UserPermission {
SHARING = 'sharing', SHARING = 'sharing',
ADVANCED_DOWNLOAD = 'advanced_download', ADVANCED_DOWNLOAD = 'advanced_download',
DOWNLOADS_MANAGER = 'downloads_manager', DOWNLOADS_MANAGER = 'downloads_manager',
TASKS_MANAGER = 'tasks_manager',
} }

@ -84,8 +84,8 @@ export class AppComponent implements OnInit, AfterViewInit {
this.postsService.open_create_default_admin_dialog.subscribe(open => { this.postsService.open_create_default_admin_dialog.subscribe(open => {
if (open) { if (open) {
const dialogRef = this.dialog.open(SetDefaultAdminDialogComponent); const dialogRef = this.dialog.open(SetDefaultAdminDialogComponent);
dialogRef.afterClosed().subscribe(success => { dialogRef.afterClosed().subscribe(res => {
if (success) { if (!res || !res['user']) {
if (this.router.url !== '/login') { this.router.navigate(['/login']); } if (this.router.url !== '/login') { this.router.navigate(['/login']); }
} else { } else {
console.error('Failed to create default admin account. See logs for details.'); console.error('Failed to create default admin account. See logs for details.');

@ -734,7 +734,7 @@ export class PostsService implements CanActivate {
this.afterLogin(res['user'], res['token'], res['permissions'], res['available_permissions']); this.afterLogin(res['user'], res['token'], res['permissions'], res['available_permissions']);
} }
}, err => { }, err => {
if (err.status === 401) { if (err === 'Unauthorized') {
this.sendToLogin(); this.sendToLogin();
this.token = null; this.token = null;
this.resetHttpParams(); this.resetHttpParams();

Loading…
Cancel
Save