diff --git a/Modification List.txt b/Modification List.txt new file mode 100644 index 00000000000..2f93cc345e4 --- /dev/null +++ b/Modification List.txt @@ -0,0 +1,92 @@ +Modification List: +============= +api/routes_scene.go + +func Routes() + r.Route("/{sceneId}", func(r chi.Router) { + // Added + r.Get("/stream/org/*", rs.StreamOrgDirect) + +} + +// Added: +func (rs sceneRoutes) StreamOrgDirect(w http.ResponseWriter, r *http.Request) { + scene := r.Context().Value(sceneKey).(*models.Scene) + // check if it's funscript + aStr := strings.Split(r.RequestURI, ".") + if strings.ToLower(aStr[len(aStr)-1]) == "funscript" { + // it's a funscript request + rs.Funscript(w, r) + return + } + + // return 404 if the scene does not have file + // Primary file method no longer works, only Files.List()[0].Path + Path := scene.Files.List()[0].Path + if Path == "" { + w.WriteHeader(http.StatusNotFound) + return + } + http.ServeFile(w, r, Path) +} + +=========== +ui/v2.5/src/components/Scenes/SceneDetails/ExternalPlayerButton.tsx + +export const ExternalPlayerButton: React.FC = ({ + scene, +}) => { + + const intl = useIntl(); + + + const alwaysShow = true; // Added + + const { paths } = scene; + const { files } = scene; // added + const { path } = files[0]; // added. + + if (!paths || !paths.stream || (!isAndroid && !isAppleDevice && !alwaysShow)) + // moded + return ; + + + if (isAndroid) { + const scheme = streamURL.protocol.slice(0, -1); + streamURL.hash = `Intent;action=android.intent.action.VIEW;scheme=${scheme};type=video/mp4;S.title=${encodeURI( + title + )};end`; + streamURL.protocol = "intent"; + url = streamURL.toString(); + } else if (isAppleDevice) { + streamURL.host = "x-callback-url"; + streamURL.port = ""; + streamURL.pathname = "stream"; + streamURL.search = `url=${encodeURIComponent(stream)}`; + streamURL.protocol = "vlc-x-callback"; + url = streamURL.toString(); + } else if (alwaysShow) { + // In all other cases. + + url = stream + "/org/" + encodeURIComponent(file.toString()); // like http://192.168.1.10:9999/scene/123/stream/org/file.mp4 + url2 = url; // for now. Need to fix it for PlayA + streamURL.pathname = "/api/playa/v1/video/" + scene.id; + } + + return ( + + ); +}; \ No newline at end of file diff --git a/internal/api/routes_scene.go b/internal/api/routes_scene.go index cc67cb16eda..4c632d351fc 100644 --- a/internal/api/routes_scene.go +++ b/internal/api/routes_scene.go @@ -105,13 +105,14 @@ func (rs sceneRoutes) StreamOrgDirect(w http.ResponseWriter, r *http.Request) { return } - // return 404 if the scene does not have primary file - filePath := scene.Files.Primary() - if filePath == nil { + // return 404 if the scene does not have file + // Primary file method no longer works, only Files.List()[0].Path + Path := scene.Files.List()[0].Path + if Path == "" { w.WriteHeader(http.StatusNotFound) return } - http.ServeFile(w, r, filePath.Path) + http.ServeFile(w, r, Path) } func (rs sceneRoutes) StreamDirect(w http.ResponseWriter, r *http.Request) { diff --git a/ui/v2.5/src/components/Scenes/SceneDetails/ExternalPlayerButton.tsx b/ui/v2.5/src/components/Scenes/SceneDetails/ExternalPlayerButton.tsx index 8821c864e3a..7dca7278440 100644 --- a/ui/v2.5/src/components/Scenes/SceneDetails/ExternalPlayerButton.tsx +++ b/ui/v2.5/src/components/Scenes/SceneDetails/ExternalPlayerButton.tsx @@ -64,11 +64,11 @@ export const ExternalPlayerButton: React.FC = ({ PlayA   - +    DeoVR   - +    ); };