mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
feat: Add ability to start with custom streming server
This commit is contained in:
parent
df00d762fe
commit
a95459efd3
2 changed files with 27 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ const { NotFound } = require('stremio/routes');
|
|||
const { ToastProvider, CONSTANTS } = require('stremio/common');
|
||||
const ServicesToaster = require('./ServicesToaster');
|
||||
const DeepLinkHandler = require('./DeepLinkHandler');
|
||||
const DefaultSettingsHandler = require('./DefaultSettingsHandler');
|
||||
const ErrorDialog = require('./ErrorDialog');
|
||||
const routerViewsConfig = require('./routerViewsConfig');
|
||||
const styles = require('./styles');
|
||||
|
|
@ -152,6 +153,7 @@ const App = () => {
|
|||
<ToastProvider className={styles['toasts-container']}>
|
||||
<ServicesToaster />
|
||||
<DeepLinkHandler />
|
||||
<DefaultSettingsHandler />
|
||||
<Router
|
||||
className={styles['router']}
|
||||
viewsConfig={routerViewsConfig}
|
||||
|
|
|
|||
25
src/App/DefaultSettingsHandler.js
Normal file
25
src/App/DefaultSettingsHandler.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright (C) 2017-2023 Smart code 203358507
|
||||
|
||||
const React = require('react');
|
||||
const {
|
||||
withCoreSuspender,
|
||||
useProfile,
|
||||
} = require('stremio/common');
|
||||
const useProfileSettingsInputs = require('stremio/routes/Settings/useProfileSettingsInputs');
|
||||
|
||||
const DefaultSettingsHandler = () => {
|
||||
const profile = useProfile();
|
||||
|
||||
const { streamingServerUrlInput } = useProfileSettingsInputs(profile);
|
||||
|
||||
React.useLayoutEffect(() => {
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
if (searchParams.has('streamingServerUrl')) {
|
||||
streamingServerUrlInput.onChange(searchParams.get('streamingServerUrl'));
|
||||
}
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
module.exports = withCoreSuspender(DefaultSettingsHandler);
|
||||
Loading…
Reference in a new issue