mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-21 07:42:22 +00:00
include TIDB api key in segment request if provided
This commit is contained in:
parent
1a01e8d255
commit
ce5bcace5b
1 changed files with 7 additions and 1 deletions
|
|
@ -50,6 +50,7 @@ export function useSkipTime() {
|
||||||
const skipSegmentsCacheKey = usePlayerStore((s) => s.skipSegmentsCacheKey);
|
const skipSegmentsCacheKey = usePlayerStore((s) => s.skipSegmentsCacheKey);
|
||||||
const skipSegments = usePlayerStore((s) => s.skipSegments);
|
const skipSegments = usePlayerStore((s) => s.skipSegments);
|
||||||
const setSkipSegments = usePlayerStore((s) => s.setSkipSegments);
|
const setSkipSegments = usePlayerStore((s) => s.setSkipSegments);
|
||||||
|
const tidbKey = usePreferencesStore((s) => s.tidbKey);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!cacheKey) return;
|
if (!cacheKey) return;
|
||||||
|
|
@ -75,7 +76,11 @@ export function useSkipTime() {
|
||||||
apiUrl += `&season=${meta.season.number}&episode=${meta.episode.number}`;
|
apiUrl += `&season=${meta.season.number}&episode=${meta.episode.number}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await mwFetch(apiUrl);
|
const data = await mwFetch(apiUrl, {
|
||||||
|
headers: {
|
||||||
|
Authorization: tidbKey ? `Bearer ${tidbKey}` : undefined,
|
||||||
|
} as HeadersInit,
|
||||||
|
});
|
||||||
|
|
||||||
const fetchedSegments: SegmentData[] = [];
|
const fetchedSegments: SegmentData[] = [];
|
||||||
|
|
||||||
|
|
@ -287,6 +292,7 @@ export function useSkipTime() {
|
||||||
meta?.episode?.number,
|
meta?.episode?.number,
|
||||||
febboxKey,
|
febboxKey,
|
||||||
setSkipSegments,
|
setSkipSegments,
|
||||||
|
tidbKey,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Only return segments when they're for the current media (avoid showing stale data)
|
// Only return segments when they're for the current media (avoid showing stale data)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue