Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix playlist content type issues #176

Merged
merged 1 commit into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions crates/librqbit/src/http_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/librqbit/webui/src/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export interface ErrorDetails {
path?: string;
status?: number;
statusText?: string;
text: string;
text: string | React.ReactNode;
}

export type Duration = number;
Expand Down
25 changes: 19 additions & 6 deletions crates/librqbit/webui/src/components/buttons/TorrentActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -45,7 +46,7 @@ export const TorrentActions: React.FC<{
text: `Error starting torrent id=${id}`,
details: e,
});
}
},
)
.finally(() => setDisabled(false));
};
Expand All @@ -62,7 +63,7 @@ export const TorrentActions: React.FC<{
text: `Error pausing torrent id=${id}`,
details: e,
});
}
},
)
.finally(() => setDisabled(false));
};
Expand All @@ -88,17 +89,29 @@ 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;
}

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.",
},
});
};
Expand Down