diff --git a/graphql/schema/types/config.graphql b/graphql/schema/types/config.graphql index b6f52091b..b0b8898b2 100644 --- a/graphql/schema/types/config.graphql +++ b/graphql/schema/types/config.graphql @@ -413,6 +413,9 @@ input ConfigInterfaceInput { noBrowser: Boolean "True if we should send notifications to the desktop" notificationsEnabled: Boolean + + "True if 'Open Org File' in scene details is shown" + showOpenExternal: Boolean } type ConfigDisableDropdownCreate { @@ -483,6 +486,9 @@ type ConfigInterfaceResult { funscriptOffset: Int "Whether to use Stash Hosted Funscript" useStashHostedFunscript: Boolean + + "Show 'Open Org File' in scene details" + showOpenExternal: Boolean } input ConfigDLNAInput { diff --git a/ui/v2.5/graphql/data/config.graphql b/ui/v2.5/graphql/data/config.graphql index b65ba21cc..a823cc6fa 100644 --- a/ui/v2.5/graphql/data/config.graphql +++ b/ui/v2.5/graphql/data/config.graphql @@ -59,7 +59,7 @@ fragment ConfigGeneralData on ConfigGeneralResult { liveTranscodeInputArgs liveTranscodeOutputArgs drawFunscriptHeatmapRange - + scraperPackageSources { name url @@ -112,6 +112,7 @@ fragment ConfigInterfaceData on ConfigInterfaceResult { handyKey funscriptOffset useStashHostedFunscript + showOpenExternal } fragment ConfigDLNAData on ConfigDLNAResult { diff --git a/ui/v2.5/src/components/Scenes/SceneDetails/ExternalPlayerButton.tsx b/ui/v2.5/src/components/Scenes/SceneDetails/ExternalPlayerButton.tsx index 35d066838..5728ad02b 100644 --- a/ui/v2.5/src/components/Scenes/SceneDetails/ExternalPlayerButton.tsx +++ b/ui/v2.5/src/components/Scenes/SceneDetails/ExternalPlayerButton.tsx @@ -5,6 +5,7 @@ import { useIntl } from "react-intl"; import { Icon } from "src/components/Shared/Icon"; import { objectTitle } from "src/core/files"; import { SceneDataFragment } from "src/core/generated-graphql"; +import { useConfigurationContext } from "src/hooks/Config"; export interface IExternalPlayerButtonProps { scene: SceneDataFragment; @@ -16,18 +17,17 @@ export const ExternalPlayerButton: React.FC = ({ const isAndroid = /(android)/i.test(navigator.userAgent); const isAppleDevice = /(ipod|iphone|ipad)/i.test(navigator.userAgent); const intl = useIntl(); - + const { configuration } = useConfigurationContext(); + const interfaceConfig = configuration?.interface; + const uiConfig = configuration?.ui; + const showOpenExternal = uiConfig?.showOpenExternal??true; const { paths } = scene; - // Added by Philip - const alwaysShow = true; const { files } = scene; const { path } = files[0]; - const pathStr = path??''; - const fileName = pathStr.split('/').pop()?.split('\\').pop()??''; - // Added ends. - - if (!paths || !paths.stream || (!isAndroid && !isAppleDevice && !alwaysShow)) // Modded by Philip + const fileName = path.split('/').pop()?.split('\\').pop()??''; + + if (!paths || !paths.stream || (!isAndroid && !isAppleDevice && !showOpenExternal)) return ; const { stream } = paths; @@ -55,10 +55,9 @@ export const ExternalPlayerButton: React.FC = ({ url = streamURL .toString() .replace(new RegExp(`^${streamURL.protocol}`), "vlc-x-callback:"); - } else if (alwaysShow) { // Added by Philip + } else if (showOpenExternal) { // Added by Philip url = stream + "/org/" + encodeURIComponent(fileName); // like http://192.168.1.10:9999/scene/123/stream/org/file.mp4 } - // Added ends. return ( ); }; diff --git a/ui/v2.5/src/components/Settings/SettingsInterfacePanel/SettingsInterfacePanel.tsx b/ui/v2.5/src/components/Settings/SettingsInterfacePanel/SettingsInterfacePanel.tsx index 0ebe3f736..cffe1b410 100644 --- a/ui/v2.5/src/components/Settings/SettingsInterfacePanel/SettingsInterfacePanel.tsx +++ b/ui/v2.5/src/components/Settings/SettingsInterfacePanel/SettingsInterfacePanel.tsx @@ -462,13 +462,18 @@ export const SettingsInterfacePanel: React.FC = PatchComponent( return {TextUtils.secondsToTimestamp(v ?? 0)}; }} /> - saveUI({ showAbLoopControls: v })} /> + saveUI({ showOpenExternal: v })} + />