This commit is contained in:
Fredrik Burmester
2024-09-28 19:57:56 +02:00
parent b3a938b53a
commit ddcb410df6
6 changed files with 85 additions and 62 deletions

View File

@@ -2,7 +2,7 @@
"expo": {
"name": "Streamyfin",
"slug": "streamyfin",
"version": "0.15.0",
"version": "0.16.0",
"orientation": "default",
"icon": "./assets/images/icon.png",
"scheme": "streamyfin",
@@ -33,7 +33,7 @@
},
"android": {
"jsEngine": "hermes",
"versionCode": 41,
"versionCode": 42,
"adaptiveIcon": {
"foregroundImage": "./assets/images/icon.png"
},

View File

@@ -9,6 +9,7 @@ import { useMutation } from "@tanstack/react-query";
import axios from "axios";
import { toast } from "sonner-native";
import { useSettings } from "@/utils/atoms/settings";
import { FFmpegKit } from "ffmpeg-kit-react-native";
interface Props extends ViewProps {}
@@ -21,17 +22,25 @@ export const ActiveDownload: React.FC<Props> = ({ ...props }) => {
mutationFn: async () => {
if (!process) throw new Error("No active download");
await axios.delete(settings?.optimizedVersionsServerUrl + process.id, {
headers: {
Authorization: `Bearer ${settings?.optimizedVersionsAuthHeader}`,
},
});
const tasks = await checkForExistingDownloads();
for (const task of tasks) task.stop();
clearProcess();
if (settings?.optimizedVersionsServerUrl) {
await axios.delete(
settings?.optimizedVersionsServerUrl + "cancel-job/" + process.id,
{
headers: {
Authorization: `Bearer ${settings?.optimizedVersionsAuthHeader}`,
},
}
);
const tasks = await checkForExistingDownloads();
for (const task of tasks) task.stop();
clearProcess();
} else {
FFmpegKit.cancel();
clearProcess();
}
},
onSuccess: () => {
toast.success("Download cancelled");
toast.success("Download canceled");
},
onError: (e) => {
console.log(e);

View File

@@ -454,6 +454,12 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
</View>
)}
</View>
</View>
</View>
<View className="mt-4">
<Text className="text-lg font-bold mb-2">Optimized versions</Text>
<View className="flex flex-col rounded-xl overflow-hidden divide-y-2 divide-solid divide-neutral-800">
<View className="flex flex-col bg-neutral-900 px-4 py-4">
<View className="flex flex-col shrink mb-2">
<Text className="font-semibold">Optimized versions server</Text>
@@ -461,26 +467,24 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
Set the URL for the optimized versions server for downloads.
</Text>
</View>
<View className="flex flex-row items-center space-x-2">
<View className="grow">
<Input
placeholder="Optimized versions server URL..."
defaultValue={
settings.optimizedVersionsServerUrl
? settings.optimizedVersionsServerUrl
: ""
}
value={optimizedVersionsServerUrl}
keyboardType="url"
returnKeyType="done"
autoCapitalize="none"
textContentType="URL"
onChangeText={(text) => setOptimizedVersionsServerUrl(text)}
/>
</View>
<View className="flex flex-col">
<Input
placeholder="Optimized versions server URL..."
defaultValue={
settings.optimizedVersionsServerUrl
? settings.optimizedVersionsServerUrl
: ""
}
value={optimizedVersionsServerUrl}
keyboardType="url"
returnKeyType="done"
autoCapitalize="none"
textContentType="URL"
onChangeText={(text) => setOptimizedVersionsServerUrl(text)}
/>
<Button
color="purple"
className="shrink w-16 h-12"
className="h-12 mt-2"
onPress={() => {
updateSettings({
optimizedVersionsServerUrl:
@@ -497,12 +501,13 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
</View>
{settings.optimizedVersionsServerUrl && (
<Text className="text-neutral-500 mt-2">
Current: {settings.optimizedVersionsServerUrl}
</Text>
<View className="p-4 bg-neutral-800 rounded-xl mt-2">
<Text selectable>{settings.optimizedVersionsServerUrl}</Text>
</View>
)}
</View>
<View className="flex flex-col bg-neutral-900 px-4 py-4">
<View className="flex flex-col bg-neutral-900 px-4 py-4 w-full grow-0">
<View className="flex flex-col shrink mb-2">
<Text className="font-semibold">
Optimized versions auth header
@@ -511,26 +516,25 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
The auth header for the optimized versions server.
</Text>
</View>
<View className="flex flex-row items-center space-x-2">
<View className="shrink">
<Input
placeholder="Optimized versions server URL..."
defaultValue={
settings.optimizedVersionsAuthHeader
? settings.optimizedVersionsAuthHeader
: ""
}
value={optimizedVersionsAuthHeader}
keyboardType="url"
returnKeyType="done"
autoCapitalize="none"
textContentType="URL"
onChangeText={(text) => setOptimizedVersionsAuthHeader(text)}
/>
</View>
<View className="flex flex-col w-full">
<Input
placeholder="Optimized versions server URL..."
defaultValue={
settings.optimizedVersionsAuthHeader
? settings.optimizedVersionsAuthHeader
: ""
}
value={optimizedVersionsAuthHeader}
keyboardType="url"
returnKeyType="done"
autoCapitalize="none"
textContentType="URL"
onChangeText={(text) => setOptimizedVersionsAuthHeader(text)}
className="w-full"
/>
<Button
color="purple"
className=" w-16 h-12"
className=" h-12 w-full mt-2"
onPress={() => {
updateSettings({
optimizedVersionsAuthHeader,
@@ -542,10 +546,24 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
</View>
{settings.optimizedVersionsAuthHeader && (
<Text className="text-neutral-500 mt-2">
Current: {settings.optimizedVersionsAuthHeader}
</Text>
<View className="p-4 bg-neutral-800 rounded-xl mt-2">
<Text className="" selectable>
{settings.optimizedVersionsAuthHeader}
</Text>
</View>
)}
<Button
color="red"
className="mt-2"
onPress={() => {
updateSettings({
optimizedVersionsAuthHeader: null,
optimizedVersionsServerUrl: null,
});
}}
>
Reset
</Button>
</View>
</View>
</View>

View File

@@ -21,13 +21,13 @@
}
},
"production": {
"channel": "0.15.0",
"channel": "0.16.0",
"android": {
"image": "latest"
}
},
"production-apk": {
"channel": "0.15.0",
"channel": "0.16.0",
"android": {
"buildType": "apk",
"image": "latest"

View File

@@ -126,10 +126,6 @@ export const useRemuxHlsToMp4 = (item: BaseItemDto) => {
const cancelRemuxing = useCallback(() => {
FFmpegKit.cancel();
clearProcess();
writeToLog(
"INFO",
`useRemuxHlsToMp4 ~ remuxing cancelled for item: ${item.Name}`
);
}, [item.Name, clearProcess]);
return { startRemuxing, cancelRemuxing };

View File

@@ -63,7 +63,7 @@ export const JellyfinProvider: React.FC<{ children: ReactNode }> = ({
setJellyfin(
() =>
new Jellyfin({
clientInfo: { name: "Streamyfin", version: "0.15.0" },
clientInfo: { name: "Streamyfin", version: "0.16.0" },
deviceInfo: { name: Platform.OS === "ios" ? "iOS" : "Android", id },
})
);
@@ -97,7 +97,7 @@ export const JellyfinProvider: React.FC<{ children: ReactNode }> = ({
return {
authorization: `MediaBrowser Client="Streamyfin", Device=${
Platform.OS === "android" ? "Android" : "iOS"
}, DeviceId="${deviceId}", Version="0.15.0"`,
}, DeviceId="${deviceId}", Version="0.16.0"`,
};
}, [deviceId]);