Skip to content

Commit

Permalink
Merge pull request #176 from ikatson/playlist-content-type
Browse files Browse the repository at this point in the history
Fix playlist content type issues
  • Loading branch information
ikatson authored Aug 10, 2024
2 parents 62067b2 + 14b023b commit bf1a230
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
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

0 comments on commit bf1a230

Please sign in to comment.