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
pull/67/head
Isaac Grynsztein 5 years ago
parent e790c9fadf
commit 1ac6683f33

@ -1411,9 +1411,9 @@ async function generateArgs(url, type, options) {
downloadConfig = customArgs.split(' ');
} else {
if (customQualityConfiguration) {
qualityPath = customQualityConfiguration;
qualityPath = `-f ${customQualityConfiguration}`;
} else if (selectedHeight && selectedHeight !== '' && !is_audio) {
qualityPath = `-f bestvideo[height=${selectedHeight}]+bestaudio/best[height=${selectedHeight}]`;
qualityPath = `-f '(mp4)[height=${selectedHeight}]'`;
} else if (maxBitrate && is_audio) {
qualityPath = `--audio-quality ${maxBitrate}`
}
@ -1783,7 +1783,7 @@ app.post('/api/tomp4', optionalJwt, async function(req, res) {
const is_playlist = url.includes('playlist');
let result_obj = null;
if (is_playlist)
if (is_playlist || options.customQualityConfiguration)
result_obj = await downloadFileByURL_exec(url, 'video', options, req.query.sessionID);
else
result_obj = await downloadFileByURL_normal(url, 'video', options, req.query.sessionID);

@ -11,8 +11,7 @@
<div>
<strong><ng-container i18n="Created">Created:</ng-container></strong>&nbsp;{{postsService.user.created ? postsService.user.created : 'N/A'}}
</div>
<div style="margin-top: 10px;">
<button (click)="logoutClicked()" mat-flat-button color="warn"><ng-container i18n="Logout">Logout</ng-container></button>
<div style="margin-top: 20px;">
</div>
</div>
@ -21,3 +20,12 @@
<button (click)="loginClicked()" mat-raised-button color="primary"><ng-container i18n="Login">Login</ng-container></button>
</div>
</mat-dialog-content>
<mat-dialog-actions>
<div style="width: 100%">
<div style="position: relative">
<button mat-stroked-button mat-dialog-close color="primary"><ng-container i18n="Close">Close</ng-container></button>
<button style="position: absolute; right: 0px;" (click)="logoutClicked()" mat-stroked-button color="warn"><ng-container i18n="Logout">Logout</ng-container></button>
</div>
</div>
</mat-dialog-actions>

@ -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');
}

@ -166,7 +166,7 @@
<mat-checkbox color="accent" [(ngModel)]="new_config['Extra']['allow_multi_download_mode']"><ng-container i18n="Allow multi-downloade mode setting">Allow multi-download mode</ng-container></mat-checkbox>
</div>
<div class="col-12">
<mat-checkbox color="accent" [(ngModel)]="new_config['Extra']['settings_pin_required']"><ng-container i18n="Require pin for settings setting">Require pin for settings</ng-container></mat-checkbox>
<mat-checkbox [disabled]="new_config['Advanced']['multi_user_mode']" color="accent" [(ngModel)]="new_config['Extra']['settings_pin_required']"><ng-container i18n="Require pin for settings setting">Require pin for settings</ng-container></mat-checkbox>
<button style="margin-left: 15px; margin-bottom: 10px;" mat-stroked-button (click)="setNewPin()" [disabled]="!new_config['Extra']['settings_pin_required']"><ng-container i18n="Set new pin button">Set New Pin</ng-container></button>
</div>
</div>
@ -252,9 +252,12 @@
</mat-select>
</mat-form-field>
</div>
<div class="col-12 mb-3">
<div class="col-12">
<mat-checkbox color="accent" [(ngModel)]="new_config['Advanced']['allow_advanced_download']"><ng-container i18n="Allow advanced downloading setting">Allow advanced download</ng-container></mat-checkbox>
</div>
<div class="col-12 mb-3 mt-3">
<mat-checkbox color="accent" [(ngModel)]="new_config['Advanced']['multi_user_mode']"><ng-container i18n="Multi user mode setting">Multi-user mode</ng-container></mat-checkbox>
</div>
</div>
</div>
<mat-divider></mat-divider>

Loading…
Cancel
Save