mirror of
https://github.com/stashapp/stash.git
synced 2025-12-25 01:34:41 +01:00
Fix seeking (#3096)
* Update apikey when generating/clearing * Fix seeking on systems with api key
This commit is contained in:
parent
962bc7df4e
commit
b9e07ade92
3 changed files with 24 additions and 7 deletions
|
|
@ -397,8 +397,10 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
|
|||
const sourceSelector = player.sourceSelector();
|
||||
sourceSelector.setSources(
|
||||
scene.sceneStreams.map((stream) => {
|
||||
const src = new URL(stream.url);
|
||||
const isDirect =
|
||||
stream.url.endsWith("/stream") || stream.url.endsWith("/stream.m3u8");
|
||||
src.pathname.endsWith("/stream") ||
|
||||
src.pathname.endsWith("/stream.m3u8");
|
||||
|
||||
return {
|
||||
src: stream.url,
|
||||
|
|
|
|||
|
|
@ -71,9 +71,14 @@ export const SettingsSecurityPanel: React.FC = () => {
|
|||
const intl = useIntl();
|
||||
const Toast = useToast();
|
||||
|
||||
const { general, apiKey, loading, error, saveGeneral } = React.useContext(
|
||||
SettingStateContext
|
||||
);
|
||||
const {
|
||||
general,
|
||||
apiKey,
|
||||
loading,
|
||||
error,
|
||||
saveGeneral,
|
||||
refetch,
|
||||
} = React.useContext(SettingStateContext);
|
||||
|
||||
const [generateAPIKey] = useGenerateAPIKey();
|
||||
|
||||
|
|
@ -84,6 +89,7 @@ export const SettingsSecurityPanel: React.FC = () => {
|
|||
input: {},
|
||||
},
|
||||
});
|
||||
refetch();
|
||||
} catch (e) {
|
||||
Toast.error(e);
|
||||
}
|
||||
|
|
@ -98,6 +104,7 @@ export const SettingsSecurityPanel: React.FC = () => {
|
|||
},
|
||||
},
|
||||
});
|
||||
refetch();
|
||||
} catch (e) {
|
||||
Toast.error(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ export interface ISettingsContextState {
|
|||
saveScraping: (input: Partial<GQL.ConfigScrapingInput>) => void;
|
||||
saveDLNA: (input: Partial<GQL.ConfigDlnaInput>) => void;
|
||||
saveUI: (input: Partial<IUIConfig>) => void;
|
||||
|
||||
refetch: () => void;
|
||||
}
|
||||
|
||||
export const SettingStateContext = React.createContext<ISettingsContextState>({
|
||||
|
|
@ -64,12 +66,13 @@ export const SettingStateContext = React.createContext<ISettingsContextState>({
|
|||
saveScraping: () => {},
|
||||
saveDLNA: () => {},
|
||||
saveUI: () => {},
|
||||
refetch: () => {},
|
||||
});
|
||||
|
||||
export const SettingsContext: React.FC = ({ children }) => {
|
||||
const Toast = useToast();
|
||||
|
||||
const { data, error, loading } = useConfiguration();
|
||||
const { data, error, loading, refetch } = useConfiguration();
|
||||
const initialRef = useRef(false);
|
||||
|
||||
const [general, setGeneral] = useState<GQL.ConfigGeneralInput>({});
|
||||
|
|
@ -125,9 +128,14 @@ export const SettingsContext: React.FC = ({ children }) => {
|
|||
}, [saveError, Toast]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!data?.configuration || error) return;
|
||||
|
||||
// always set api key
|
||||
setApiKey(data.configuration.general.apiKey);
|
||||
|
||||
// only initialise once - assume we have control over these settings and
|
||||
// they aren't modified elsewhere
|
||||
if (!data?.configuration || error || initialRef.current) return;
|
||||
if (initialRef.current) return;
|
||||
initialRef.current = true;
|
||||
|
||||
setGeneral({ ...withoutTypename(data.configuration.general) });
|
||||
|
|
@ -136,7 +144,6 @@ export const SettingsContext: React.FC = ({ children }) => {
|
|||
setScraping({ ...withoutTypename(data.configuration.scraping) });
|
||||
setDLNA({ ...withoutTypename(data.configuration.dlna) });
|
||||
setUI(data.configuration.ui);
|
||||
setApiKey(data.configuration.general.apiKey);
|
||||
}, [data, error]);
|
||||
|
||||
const resetSuccess = useMemo(
|
||||
|
|
@ -509,6 +516,7 @@ export const SettingsContext: React.FC = ({ children }) => {
|
|||
saveScraping,
|
||||
saveDLNA,
|
||||
saveUI,
|
||||
refetch,
|
||||
}}
|
||||
>
|
||||
{maybeRenderLoadingIndicator()}
|
||||
|
|
|
|||
Loading…
Reference in a new issue