diff --git a/src/KodiApi/RecentSearches/recent-searches.service.ts b/src/KodiApi/RecentSearches/recent-searches.service.ts index 6bd0e56..0b729ff 100644 --- a/src/KodiApi/RecentSearches/recent-searches.service.ts +++ b/src/KodiApi/RecentSearches/recent-searches.service.ts @@ -35,15 +35,19 @@ export class RecentSearchesService { } data.push(term); const rawData = JSON.stringify(data); - const filePath = join(this.configService.getRecentSearchesFolder(), module); + const filePath = this.getFilePath(module); await writeFile(filePath, rawData); } private async getRecentSearchesData(module: string): Promise> { - const filePath = join(this.configService.getRecentSearchesFolder(), module); + const filePath = this.getFilePath(module); const rawData = '' + (await readFile(filePath).catch(() => '[]')); return JSON.parse(rawData); } + + private getFilePath(module: string): string { + return join(this.configService.getRecentSearchesFolder(), module + '.json'); + } } diff --git a/src/config/config.service.ts b/src/config/config.service.ts index 301a498..4f69b66 100644 --- a/src/config/config.service.ts +++ b/src/config/config.service.ts @@ -33,7 +33,7 @@ export class ConfigService { } public getRecentSearchesFolder(): string { - return join(this.getRootPath(), this.getEnv('STATIC_SERVE_FOLDER')); + return join(this.getRootPath(), this.getEnv('RECENT_SEARCHES_FOLDER')); } private getRootPath(): string {