mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-03-16 22:36:25 +00:00
Compare commits
4 Commits
fix/remove
...
feat/refre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4696671bf5 | ||
|
|
69d744c86f | ||
|
|
ad1bd72123 | ||
|
|
b93c56f300 |
46
.github/renovate.json
vendored
Normal file
46
.github/renovate.json
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"description": "Renovate configuration for Streamyfin - Expo React Native Jellyfin client",
|
||||||
|
"extends": [
|
||||||
|
"config:best-practices",
|
||||||
|
":dependencyDashboard",
|
||||||
|
":enableVulnerabilityAlertsWithLabel(security)",
|
||||||
|
":semanticCommits",
|
||||||
|
":timezone(Etc/UTC)",
|
||||||
|
"group:testNonMajor",
|
||||||
|
"group:monorepos",
|
||||||
|
"helpers:pinGitHubActionDigests",
|
||||||
|
"customManagers:biomeVersions",
|
||||||
|
":automergeBranch",
|
||||||
|
":automergeRequireAllStatusChecks"
|
||||||
|
],
|
||||||
|
"addLabels": ["dependencies"],
|
||||||
|
"rebaseWhen": "conflicted",
|
||||||
|
"ignorePaths": ["**/node_modules/**"],
|
||||||
|
"ignoreUnstable": true,
|
||||||
|
"minimumReleaseAge": "3 days",
|
||||||
|
"schedule": ["before 6am on Sunday"],
|
||||||
|
"branchPrefix": "renovate/",
|
||||||
|
"commitMessagePrefix": "chore(deps):",
|
||||||
|
"osvVulnerabilityAlerts": true,
|
||||||
|
"configMigration": true,
|
||||||
|
"separateMinorPatch": true,
|
||||||
|
"lockFileMaintenance": {
|
||||||
|
"vulnerabilityAlerts": {
|
||||||
|
"enabled": true,
|
||||||
|
"addLabels": ["security", "vulnerability"],
|
||||||
|
"assigneesFromCodeOwners": true,
|
||||||
|
"commitMessageSuffix": " [SECURITY]"
|
||||||
|
},
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"description": "Group minor and patch GitHub Action updates into a single PR",
|
||||||
|
"matchManagers": ["github-actions"],
|
||||||
|
"groupName": "CI dependencies",
|
||||||
|
"groupSlug": "ci-deps",
|
||||||
|
"matchUpdateTypes": ["minor", "patch", "digest", "pin"],
|
||||||
|
"automerge": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
6
app.json
6
app.json
@@ -29,7 +29,11 @@
|
|||||||
},
|
},
|
||||||
"supportsTablet": true,
|
"supportsTablet": true,
|
||||||
"bundleIdentifier": "com.fredrikburmester.streamyfin",
|
"bundleIdentifier": "com.fredrikburmester.streamyfin",
|
||||||
"icon": "./assets/images/icon-ios-liquid-glass.icon",
|
"icon": {
|
||||||
|
"dark": "./assets/images/icon-ios-plain.png",
|
||||||
|
"light": "./assets/images/icon-ios-light.png",
|
||||||
|
"tinted": "./assets/images/icon-ios-tinted.png"
|
||||||
|
},
|
||||||
"appleTeamId": "MWD5K362T8"
|
"appleTeamId": "MWD5K362T8"
|
||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
||||||
<svg width="100%" height="100%" viewBox="0 0 384 415" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
||||||
<g transform="matrix(0.133333,0,0,-0.133333,-110.933,512.698)">
|
|
||||||
<g id="g10">
|
|
||||||
<path id="path88" d="M3547.01,1831.49C3493.38,1822.66 3262.53,1779.28 2992.01,1820.24C2424.16,1906.21 2154.85,2275.8 1882,2420.24C1473.31,2636.6 1060.97,2644.95 832,2592.03L832,1445.92C832,1321.76 863.078,1198.06 925.307,1090.27C1057.09,862.011 1323.38,718.405 1586.6,736.145C1695.48,743.482 1801.3,777.735 1895.64,832.199L3357.51,1676.21C3424.47,1714.87 3482.92,1761.76 3532.01,1815.41L3547.01,1831.49Z" style="fill:url(#_Linear1);fill-rule:nonzero;"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(2879.19,0,0,2879.19,832.651,2289.93)"><stop offset="0" style="stop-color:rgb(149,41,235);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(98,22,247);stop-opacity:1"/></linearGradient>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
||||||
<svg width="100%" height="100%" viewBox="0 0 384 415" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
||||||
<g transform="matrix(0.133333,0,0,-0.133333,-110.933,512.698)">
|
|
||||||
<g id="g10">
|
|
||||||
<path id="path66" d="M3357.51,2903.64L1895.64,3747.65C1670.29,3877.76 1412.33,3877.76 1186.98,3747.65C961.629,3617.55 832.648,3394.14 832.648,3133.93L832.648,1445.92C832.648,1185.71 961.629,962.305 1186.98,832.199C1412.33,702.094 1670.29,702.094 1895.64,832.199L3357.51,1676.21C3582.86,1806.31 3711.84,2029.71 3711.84,2289.93C3711.84,2550.14 3582.86,2773.54 3357.51,2903.64ZM1721.48,3213.68L3098.31,2454.7C3163.9,2418.55 3193.45,2364.85 3193.45,2289.93C3193.45,2215 3163.93,2161.32 3098.31,2125.15L1721.48,1366.18C1655.87,1330.01 1596.09,1328.72 1531.21,1366.18C1466.34,1403.63 1436.08,1456.03 1436.08,1530.96L1436.08,3048.89C1436.08,3123.77 1466.35,3176.23 1531.21,3213.68C1596.08,3251.11 1655.89,3249.83 1721.48,3213.68" style="fill:url(#_Linear1);fill-rule:nonzero;"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(2879.19,0,0,2879.19,832.651,2289.93)"><stop offset="0" style="stop-color:rgb(188,74,241);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(227,105,219);stop-opacity:1"/></linearGradient>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.6 KiB |
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
||||||
<svg width="100%" height="100%" viewBox="0 0 384 415" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
||||||
<g>
|
|
||||||
<g id="g10">
|
|
||||||
<path id="path88" d="M0,319.909L0,234C17.667,234.844 138.649,236.708 195,190C220.441,168.912 271.21,169.515 294.001,178.788C332.576,194.487 378.643,259.549 360,270.644C353.455,277.797 345.662,284.049 336.734,289.204L141.818,401.738C129.24,409 115.13,413.567 100.613,414.546C65.517,416.911 30.012,397.763 12.441,367.329C4.144,352.957 0,336.464 0,319.909Z" style="fill:url(#_Linear1);fill-rule:nonzero;"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(2879.19,0,0,2879.19,832.651,2289.93)"><stop offset="0" style="stop-color:rgb(225,102,222);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(204,88,233);stop-opacity:1"/></linearGradient>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
||||||
<svg width="100%" height="100%" viewBox="0 0 384 415" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
||||||
<g transform="matrix(0.133333,0,0,-0.133333,-110.933,512.698)">
|
|
||||||
<g id="g10">
|
|
||||||
<path id="path28" d="M1427.29,1523.37C1427.29,1447.7 1457.85,1394.77 1523.38,1356.94C1588.91,1319.11 1649.28,1320.41 1715.55,1356.94L3106.14,2123.5C3172.42,2160.03 3202.24,2214.25 3202.24,2289.93C3202.24,2365.6 3172.39,2419.83 3106.14,2456.35L1715.55,3222.91C1649.31,3259.43 1588.89,3260.73 1523.38,3222.91C1457.87,3185.1 1427.29,3132.11 1427.29,3056.48L1427.29,1523.37" style="fill:url(#_Linear1);fill-rule:nonzero;"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.17673e-13,-1921.74,1921.74,1.17673e-13,2314.76,3250.79)"><stop offset="0" style="stop-color:rgb(93,17,250);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(143,40,236);stop-opacity:1"/></linearGradient>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,184 +0,0 @@
|
|||||||
{
|
|
||||||
"fill": {
|
|
||||||
"solid": "display-p3:0.18039,0.18039,0.18039,1.00000"
|
|
||||||
},
|
|
||||||
"groups": [
|
|
||||||
{
|
|
||||||
"blur-material": 0.3,
|
|
||||||
"layers": [
|
|
||||||
{
|
|
||||||
"fill-specializations": [
|
|
||||||
{
|
|
||||||
"value": "none"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearance": "tinted",
|
|
||||||
"value": {
|
|
||||||
"automatic-gradient": "display-p3:0.76482,0.76482,0.76482,0.84903"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"glass": true,
|
|
||||||
"hidden": false,
|
|
||||||
"image-name": "streamyfin_logo_layer1.svg",
|
|
||||||
"name": "streamyfin_logo_layer1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"opacity": 1,
|
|
||||||
"position": {
|
|
||||||
"scale": 1.7,
|
|
||||||
"translation-in-points": [30, 0]
|
|
||||||
},
|
|
||||||
"shadow": {
|
|
||||||
"kind": "none",
|
|
||||||
"opacity": 1
|
|
||||||
},
|
|
||||||
"specular": true,
|
|
||||||
"translucency": {
|
|
||||||
"enabled": true,
|
|
||||||
"value": 0.6
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"blend-mode": "normal",
|
|
||||||
"blur-material": 0.8,
|
|
||||||
"hidden": false,
|
|
||||||
"layers": [
|
|
||||||
{
|
|
||||||
"blend-mode": "normal",
|
|
||||||
"fill-specializations": [
|
|
||||||
{
|
|
||||||
"value": "none"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearance": "tinted",
|
|
||||||
"value": {
|
|
||||||
"automatic-gradient": "gray:0.75000,1.00000"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"hidden": false,
|
|
||||||
"image-name": "streamyfin_logo_layer2.svg",
|
|
||||||
"name": "streamyfin_logo_layer2",
|
|
||||||
"opacity": 1,
|
|
||||||
"position": {
|
|
||||||
"scale": 1,
|
|
||||||
"translation-in-points": [0, 0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"lighting": "individual",
|
|
||||||
"name": "Group",
|
|
||||||
"opacity": 1,
|
|
||||||
"position": {
|
|
||||||
"scale": 1.7,
|
|
||||||
"translation-in-points": [30, -0.01613253252572302]
|
|
||||||
},
|
|
||||||
"shadow": {
|
|
||||||
"kind": "layer-color",
|
|
||||||
"opacity": 0.35
|
|
||||||
},
|
|
||||||
"specular": true,
|
|
||||||
"translucency-specializations": [
|
|
||||||
{
|
|
||||||
"value": {
|
|
||||||
"enabled": true,
|
|
||||||
"value": 0.5
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearance": "tinted",
|
|
||||||
"value": {
|
|
||||||
"enabled": true,
|
|
||||||
"value": 0.8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"blend-mode": "normal",
|
|
||||||
"blur-material": 0.5,
|
|
||||||
"layers": [
|
|
||||||
{
|
|
||||||
"fill-specializations": [
|
|
||||||
{
|
|
||||||
"appearance": "tinted",
|
|
||||||
"value": {
|
|
||||||
"automatic-gradient": "gray:0.29000,1.00000"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"glass": true,
|
|
||||||
"hidden": false,
|
|
||||||
"image-name": "streamyfin_logo_layer3.svg",
|
|
||||||
"name": "streamyfin_logo_layer3",
|
|
||||||
"opacity": 0.9
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "Group",
|
|
||||||
"opacity": 0.8,
|
|
||||||
"position": {
|
|
||||||
"scale": 1.7,
|
|
||||||
"translation-in-points": [30, 0]
|
|
||||||
},
|
|
||||||
"shadow": {
|
|
||||||
"kind": "none",
|
|
||||||
"opacity": 0.5
|
|
||||||
},
|
|
||||||
"specular": true,
|
|
||||||
"translucency": {
|
|
||||||
"enabled": true,
|
|
||||||
"value": 0.7
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"blur-material": 0.5,
|
|
||||||
"hidden": false,
|
|
||||||
"layers": [
|
|
||||||
{
|
|
||||||
"glass": true,
|
|
||||||
"hidden-specializations": [
|
|
||||||
{
|
|
||||||
"value": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearance": "tinted",
|
|
||||||
"value": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"image-name": "streamyfin_logo_layer4.svg",
|
|
||||||
"name": "streamyfin_logo_layer4",
|
|
||||||
"opacity-specializations": [
|
|
||||||
{
|
|
||||||
"value": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearance": "tinted",
|
|
||||||
"value": 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"lighting": "combined",
|
|
||||||
"name": "Group",
|
|
||||||
"opacity": 0.9,
|
|
||||||
"position": {
|
|
||||||
"scale": 1.7,
|
|
||||||
"translation-in-points": [30, 0]
|
|
||||||
},
|
|
||||||
"shadow": {
|
|
||||||
"kind": "neutral",
|
|
||||||
"opacity": 0.5
|
|
||||||
},
|
|
||||||
"specular": false,
|
|
||||||
"translucency": {
|
|
||||||
"enabled": true,
|
|
||||||
"value": 0.5
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"supported-platforms": {
|
|
||||||
"circles": ["watchOS"],
|
|
||||||
"squares": "shared"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -35,6 +35,7 @@ import { ItemTechnicalDetails } from "./ItemTechnicalDetails";
|
|||||||
import { MediaSourceSheet } from "./MediaSourceSheet";
|
import { MediaSourceSheet } from "./MediaSourceSheet";
|
||||||
import { MoreMoviesWithActor } from "./MoreMoviesWithActor";
|
import { MoreMoviesWithActor } from "./MoreMoviesWithActor";
|
||||||
import { PlayInRemoteSessionButton } from "./PlayInRemoteSession";
|
import { PlayInRemoteSessionButton } from "./PlayInRemoteSession";
|
||||||
|
import { RefreshMetadata } from "./RefreshMetadata";
|
||||||
import { TrackSheet } from "./TrackSheet";
|
import { TrackSheet } from "./TrackSheet";
|
||||||
|
|
||||||
const Chromecast = !Platform.isTV ? require("./Chromecast") : null;
|
const Chromecast = !Platform.isTV ? require("./Chromecast") : null;
|
||||||
@@ -115,7 +116,10 @@ export const ItemContent: React.FC<ItemContentProps> = React.memo(
|
|||||||
<DownloadSingleItem item={item} size='large' />
|
<DownloadSingleItem item={item} size='large' />
|
||||||
)}
|
)}
|
||||||
{user?.Policy?.IsAdministrator && (
|
{user?.Policy?.IsAdministrator && (
|
||||||
<PlayInRemoteSessionButton item={item} size='large' />
|
<>
|
||||||
|
<PlayInRemoteSessionButton item={item} size='large' />
|
||||||
|
<RefreshMetadata item={item} />
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<PlayedStatus items={[item]} size='large' />
|
<PlayedStatus items={[item]} size='large' />
|
||||||
@@ -132,7 +136,10 @@ export const ItemContent: React.FC<ItemContentProps> = React.memo(
|
|||||||
<DownloadSingleItem item={item} size='large' />
|
<DownloadSingleItem item={item} size='large' />
|
||||||
)}
|
)}
|
||||||
{user?.Policy?.IsAdministrator && (
|
{user?.Policy?.IsAdministrator && (
|
||||||
<PlayInRemoteSessionButton item={item} size='large' />
|
<>
|
||||||
|
<PlayInRemoteSessionButton item={item} size='large' />
|
||||||
|
<RefreshMetadata item={item} />
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<PlayedStatus items={[item]} size='large' />
|
<PlayedStatus items={[item]} size='large' />
|
||||||
|
|||||||
38
components/RefreshMetadata.tsx
Normal file
38
components/RefreshMetadata.tsx
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import type { FC } from "react";
|
||||||
|
import { Platform, View, type ViewProps } from "react-native";
|
||||||
|
import { RoundButton } from "@/components/RoundButton";
|
||||||
|
import { useRefreshMetadata } from "@/hooks/useRefreshMetadata";
|
||||||
|
|
||||||
|
interface Props extends ViewProps {
|
||||||
|
item: BaseItemDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const RefreshMetadata: FC<Props> = ({ item, ...props }) => {
|
||||||
|
const { refreshMetadata, isRefreshing } = useRefreshMetadata(item);
|
||||||
|
|
||||||
|
if (Platform.OS === "ios") {
|
||||||
|
return (
|
||||||
|
<View {...props}>
|
||||||
|
<RoundButton
|
||||||
|
size='large'
|
||||||
|
icon='reload-outline'
|
||||||
|
onPress={refreshMetadata}
|
||||||
|
hapticFeedback={!isRefreshing}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View {...props}>
|
||||||
|
<RoundButton
|
||||||
|
size='large'
|
||||||
|
icon='reload-outline'
|
||||||
|
onPress={refreshMetadata}
|
||||||
|
hapticFeedback={!isRefreshing}
|
||||||
|
fillColor={isRefreshing ? "primary" : undefined}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
42
hooks/useRefreshMetadata.ts
Normal file
42
hooks/useRefreshMetadata.ts
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { getItemRefreshApi } from "@jellyfin/sdk/lib/utils/api";
|
||||||
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { toast } from "sonner-native";
|
||||||
|
import { apiAtom } from "@/providers/JellyfinProvider";
|
||||||
|
|
||||||
|
export const useRefreshMetadata = (item: BaseItemDto) => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const [api] = useAtom(apiAtom);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const type = "item";
|
||||||
|
|
||||||
|
const refreshMetadataMutation = useMutation({
|
||||||
|
mutationFn: async () => {
|
||||||
|
if (api && item.Id) {
|
||||||
|
await getItemRefreshApi(api).refreshItem({
|
||||||
|
itemId: item.Id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSuccess: () => {
|
||||||
|
toast.success(t("metadata.refresh_triggered"));
|
||||||
|
queryClient.invalidateQueries({ queryKey: [type, item.Id] });
|
||||||
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
console.error("Failed to refresh metadata:", error);
|
||||||
|
toast.error(t("metadata.refresh_failed"));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const refreshMetadata = () => {
|
||||||
|
refreshMetadataMutation.mutate();
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
refreshMetadata,
|
||||||
|
isRefreshing: refreshMetadataMutation.isPending,
|
||||||
|
refreshMetadataMutation,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -528,5 +528,9 @@
|
|||||||
"library": "Library",
|
"library": "Library",
|
||||||
"custom_links": "Custom Links",
|
"custom_links": "Custom Links",
|
||||||
"favorites": "Favorites"
|
"favorites": "Favorites"
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
"refresh_triggered": "Metadata refresh triggered",
|
||||||
|
"refresh_failed": "Failed to refresh metadata"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user