mirror of
https://github.com/Viren070/AIOStreams.git
synced 2025-12-01 23:14:04 +01:00
fix: only use file info store when length exceeds certain amount
This commit is contained in:
@@ -498,10 +498,14 @@ export function generatePlaybackUrl(
|
|||||||
filename?: string
|
filename?: string
|
||||||
): string {
|
): string {
|
||||||
const fileInfoCache = fileInfoStore();
|
const fileInfoCache = fileInfoStore();
|
||||||
let fileInfoId: string | undefined;
|
let fileInfoStr: string = toUrlSafeBase64(JSON.stringify(fileInfo));
|
||||||
if (fileInfoCache) {
|
if (fileInfoCache && fileInfoStr.length > 500) {
|
||||||
fileInfoId = getSimpleTextHash(JSON.stringify(fileInfo));
|
fileInfoStr = getSimpleTextHash(JSON.stringify(fileInfo));
|
||||||
fileInfoCache.set(fileInfoId, fileInfo, Env.BUILTIN_PLAYBACK_LINK_VALIDITY);
|
fileInfoCache.set(
|
||||||
|
fileInfoStr,
|
||||||
|
fileInfo,
|
||||||
|
Env.BUILTIN_PLAYBACK_LINK_VALIDITY
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return `${Env.BASE_URL}/api/v1/debrid/playback/${encryptedStoreAuth}/${fileInfoId ?? toUrlSafeBase64(JSON.stringify(fileInfo))}/${metadataId}/${encodeURIComponent(filename ?? title ?? 'unknown')}`;
|
return `${Env.BASE_URL}/api/v1/debrid/playback/${encryptedStoreAuth}/${fileInfoStr}/${metadataId}/${encodeURIComponent(filename ?? title ?? 'unknown')}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user