Custom quality configurations now use the old downloading method to avoid errors

postsservice now does jwt auth after checking if multi user mode is enabled

Minor update to user profile UI

Added setting for enabling and disabling multi user mode
This commit is contained in:
Isaac Grynsztein
2020-04-26 21:37:08 -04:00
parent e790c9fadf
commit 1ac6683f33
4 changed files with 51 additions and 18 deletions

View File

@@ -33,6 +33,11 @@ export class PostsService implements CanActivate {
isLoggedIn = false;
token = null;
user = null;
reload_config = new BehaviorSubject<boolean>(false);
config_reloaded = new BehaviorSubject<boolean>(false);
config = null;
constructor(private http: HttpClient, private router: Router, @Inject(DOCUMENT) private document: Document,
public snackBar: MatSnackBar) {
console.log('PostsService Initialized...');
@@ -53,17 +58,25 @@ export class PostsService implements CanActivate {
}),
};
// login stuff
if (localStorage.getItem('jwt_token')) {
this.token = localStorage.getItem('jwt_token');
this.httpOptions = {
params: new HttpParams({
fromString: `apiKey=${this.auth_token}&sessionID=${this.session_id}&jwt=${this.token}`
}),
};
this.jwtAuth();
}
// get config
this.loadNavItems().subscribe(res => {
const result = !this.debugMode ? res['config_file'] : res;
if (result) {
this.config = result['YoutubeDLMaterial'];
if (this.config['Advanced']['multi_user_mode']) {
// login stuff
if (localStorage.getItem('jwt_token')) {
this.token = localStorage.getItem('jwt_token');
this.httpOptions = {
params: new HttpParams({
fromString: `apiKey=${this.auth_token}&sessionID=${this.session_id}&jwt=${this.token}`
}),
};
this.jwtAuth();
}
}
}
});
}
canActivate(route, state): Promise<boolean> {
return new Promise(resolve => {
@@ -85,6 +98,15 @@ export class PostsService implements CanActivate {
return this.http.get(url + 'geturl');
}
reloadConfig() {
this.loadNavItems().subscribe(res => {
const result = !this.debugMode ? res['config_file'] : res;
if (result) {
this.config = result['YoutubeDLMaterial'];
}
});
}
getVideoFolder() {
return this.http.get(this.startPath + 'videofolder');
}