mirror of
https://github.com/sakaljurgis/kodi-api-server.git
synced 2026-07-08 20:37:41 +00:00
fix recent searches path
This commit is contained in:
@@ -35,15 +35,19 @@ export class RecentSearchesService {
|
|||||||
}
|
}
|
||||||
data.push(term);
|
data.push(term);
|
||||||
const rawData = JSON.stringify(data);
|
const rawData = JSON.stringify(data);
|
||||||
const filePath = join(this.configService.getRecentSearchesFolder(), module);
|
const filePath = this.getFilePath(module);
|
||||||
|
|
||||||
await writeFile(filePath, rawData);
|
await writeFile(filePath, rawData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getRecentSearchesData(module: string): Promise<Array<string>> {
|
private async getRecentSearchesData(module: string): Promise<Array<string>> {
|
||||||
const filePath = join(this.configService.getRecentSearchesFolder(), module);
|
const filePath = this.getFilePath(module);
|
||||||
const rawData = '' + (await readFile(filePath).catch(() => '[]'));
|
const rawData = '' + (await readFile(filePath).catch(() => '[]'));
|
||||||
|
|
||||||
return JSON.parse(rawData);
|
return JSON.parse(rawData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getFilePath(module: string): string {
|
||||||
|
return join(this.configService.getRecentSearchesFolder(), module + '.json');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export class ConfigService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getRecentSearchesFolder(): string {
|
public getRecentSearchesFolder(): string {
|
||||||
return join(this.getRootPath(), this.getEnv('STATIC_SERVE_FOLDER'));
|
return join(this.getRootPath(), this.getEnv('RECENT_SEARCHES_FOLDER'));
|
||||||
}
|
}
|
||||||
|
|
||||||
private getRootPath(): string {
|
private getRootPath(): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user