mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-28 04:46:07 -08:00
fix(subsync): harden auto-sync fallbacks and temp cleanup
- Keep sampled-audio misalignment verdicts when escalated full audio is unavailable - Try remaining remote embedded tracks one at a time in rank order when the combined rip fails - Skip the ffmpeg requirement for alass when the reference is fetched over HTTP - Remove temp dirs when subtitle extraction or write fails - Build Jellyfin subtitle URLs on the media origin so double-slash paths can't redirect the ApiKey
This commit is contained in:
4 files changed
+543
-86
No files matched your search
@@ -134,4 +134,19 @@ test('buildJellyfinEmbeddedSubtitleUrl derives direct-play subtitle endpoints an
|
||||
buildJellyfinEmbeddedSubtitleUrl('https://cdn.example.test/episode.mkv', 2, 'srt'),
|
||||
null,
|
||||
);
|
||||
// Leading double-slash in pathname must stay anchored to the media origin and never redirect ApiKey.
|
||||
const doubleSlashResult = buildJellyfinEmbeddedSubtitleUrl(
|
||||
'https://media.example//collector.example/Videos/item-1/stream?static=true&ApiKey=tok789&MediaSourceId=ms-1',
|
||||
2,
|
||||
'srt',
|
||||
);
|
||||
assert.ok(doubleSlashResult !== null);
|
||||
const parsedDoubleSlash = new URL(doubleSlashResult);
|
||||
assert.equal(parsedDoubleSlash.origin, 'https://media.example');
|
||||
assert.equal(parsedDoubleSlash.host, 'media.example');
|
||||
assert.equal(parsedDoubleSlash.searchParams.get('ApiKey'), 'tok789');
|
||||
assert.equal(
|
||||
parsedDoubleSlash.pathname,
|
||||
'//collector.example/Videos/item-1/ms-1/Subtitles/2/Stream.srt',
|
||||
);
|
||||
});
|
||||
@@ -299,10 +299,8 @@ export function buildJellyfinEmbeddedSubtitleUrl(
|
||||
}
|
||||
|
||||
const deliveryExt = extension === 'ttml' ? 'srt' : extension;
|
||||
const subtitleUrl = new URL(
|
||||
`${basePath}/Videos/${encodeURIComponent(itemId)}/${encodeURIComponent(mediaSourceId)}/Subtitles/${ffIndex}/Stream.${deliveryExt}`,
|
||||
`${url.origin}/`,
|
||||
);
|
||||
const subtitleUrl = new URL(url.origin);
|
||||
subtitleUrl.pathname = `${basePath}/Videos/${encodeURIComponent(itemId)}/${encodeURIComponent(mediaSourceId)}/Subtitles/${ffIndex}/Stream.${deliveryExt}`;
|
||||
subtitleUrl.searchParams.set('ApiKey', apiKey);
|
||||
return subtitleUrl.toString();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user