mirror of
https://github.com/alexta69/metube.git
synced 2026-09-21 13:35:01 +00:00
Merge PR #1058: DEFAULT_FOLDER pre-selects a download folder
This commit is contained in:
@@ -149,6 +149,25 @@ describe('App', () => {
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it('pre-fills the download folder from DEFAULT_FOLDER', () => {
|
||||
const fixture = TestBed.createComponent(App);
|
||||
fixture.detectChanges();
|
||||
|
||||
downloads.configurationChanged.next({ DEFAULT_FOLDER: 'youtube' });
|
||||
|
||||
expect(fixture.componentInstance.folder).toBe('youtube');
|
||||
});
|
||||
|
||||
it('does not overwrite a folder the user already typed', () => {
|
||||
const fixture = TestBed.createComponent(App);
|
||||
fixture.detectChanges();
|
||||
fixture.componentInstance.folder = 'music';
|
||||
|
||||
downloads.configurationChanged.next({ DEFAULT_FOLDER: 'youtube' });
|
||||
|
||||
expect(fixture.componentInstance.folder).toBe('music');
|
||||
});
|
||||
|
||||
it('asIsOrder returns a stable comparator value (insertion order preserved)', () => {
|
||||
const fixture = TestBed.createComponent(App);
|
||||
const app = fixture.componentInstance;
|
||||
|
||||
@@ -437,6 +437,12 @@ export class App implements AfterViewInit, OnInit, OnDestroy {
|
||||
if (!Number.isNaN(playlistItemLimit) && playlistItemLimit > 0) {
|
||||
this.playlistItemLimit = playlistItemLimit;
|
||||
}
|
||||
// Pre-fill the download folder, unless the user has already typed one
|
||||
// this session. The server drops DEFAULT_FOLDER when CUSTOM_DIRS is
|
||||
// off, so there is nothing to guard against here.
|
||||
if (!this.folder) {
|
||||
this.folder = String(config['DEFAULT_FOLDER'] ?? '');
|
||||
}
|
||||
// Set chapter template from backend config if not already set by cookie
|
||||
if (!this.chapterTemplate) {
|
||||
this.chapterTemplate = config['OUTPUT_TEMPLATE_CHAPTER'];
|
||||
|
||||
Reference in New Issue
Block a user