Merge pull request #176 from ikatson/playlist-content-type

Fix playlist content type issues
This commit is contained in:
Igor Katson 2024-08-10 13:59:56 +01:00 committed by GitHub
commit bf1a23075f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 16 deletions

View file

@ -177,15 +177,13 @@ impl HttpApi {
})
.join("\r\n");
(
if cfg!(any(target_os = "macos", target_os = "ios")) {
[(
"Content-Type",
"application/vnd.apple.mpegurl; charset=utf-8",
)]
} else {
// apple mime does not work with VLC on linux
[("Content-Type", "text/plain; charset=utf-8")]
},
[
("Content-Type", "application/mpegurl; charset=utf-8"),
(
"Content-Disposition",
"attachment; filename=\"rqbit-playlist.m3u8\"",
),
],
body,
)
}

View file

@ -94,7 +94,7 @@ export interface ErrorDetails {
path?: string;
status?: number;
statusText?: string;
text: string;
text: string | React.ReactNode;
}
export type Duration = number;

View file

@ -11,6 +11,7 @@ import {
FaClipboardList,
} from "react-icons/fa";
import { useErrorStore } from "../../stores/errorStore";
import { ErrorComponent } from "../ErrorComponent";
export const TorrentActions: React.FC<{
id: number;
@ -45,7 +46,7 @@ export const TorrentActions: React.FC<{
text: `Error starting torrent id=${id}`,
details: e,
});
}
},
)
.finally(() => setDisabled(false));
};
@ -62,7 +63,7 @@ export const TorrentActions: React.FC<{
text: `Error pausing torrent id=${id}`,
details: e,
});
}
},
)
.finally(() => setDisabled(false));
};
@ -88,9 +89,21 @@ export const TorrentActions: React.FC<{
try {
await navigator.clipboard.writeText(playlistUrl);
} catch (e) {
setCloseableError({
text: "Error",
details: { text: `Error copying playlist URL to clipboard: ${e}` },
setAlert({
text: "Copy playlist URL",
details: {
text: (
<>
<p>
Copy{" "}
<a href={playlistUrl} className="text-blue-500">
playlist URL
</a>{" "}
to clipboard and paste into e.g. VLC to play.
</p>
</>
),
},
});
return;
}
@ -98,7 +111,7 @@ export const TorrentActions: React.FC<{
setAlert({
text: "Copied",
details: {
text: `Playlist URL copied to clipboard. Paste into e.g. VLC to play.`,
text: "Playlist URL copied to clipboard. Paste into e.g. VLC to play.",
},
});
};