feat: support folder uploads and sanitize upload paths
- Implement `cleanUploadDisplayName` in the backend to safely sanitize uploaded file paths, preserving directory structures while stripping unsafe characters and preventing path traversal. - Add folder upload capability in the frontend using the Directory Picker API. - Implement desktop notifications for completed uploads.
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
bindLargeGate();
|
||||
bindThemeChanges();
|
||||
bindRenderFullscreen();
|
||||
configureMediaSession();
|
||||
renderTabs();
|
||||
selectMode(state.defaultMode);
|
||||
|
||||
@@ -301,6 +302,32 @@
|
||||
document.addEventListener("fullscreenchange", updateRenderFullscreenButton);
|
||||
}
|
||||
|
||||
function configureMediaSession() {
|
||||
if (!("mediaSession" in navigator) || typeof window.MediaMetadata !== "function") {
|
||||
return;
|
||||
}
|
||||
if (!fileType.isAudio && !fileType.isVideo) {
|
||||
return;
|
||||
}
|
||||
var artworkURL = "";
|
||||
if (fileType.isVideo && els.videoPane) {
|
||||
artworkURL = els.videoPane.getAttribute("poster") || state.iconURL || "";
|
||||
} else {
|
||||
artworkURL = state.iconURL || "";
|
||||
}
|
||||
var metadata = {
|
||||
title: state.fileName || "Warpbox media",
|
||||
artist: "Warpbox",
|
||||
album: state.sizeLabel || state.contentType || ""
|
||||
};
|
||||
if (artworkURL) {
|
||||
metadata.artwork = [
|
||||
{ src: window.Warpbox.absoluteURL(artworkURL), sizes: "512x512", type: "image/png" }
|
||||
];
|
||||
}
|
||||
navigator.mediaSession.metadata = new MediaMetadata(metadata);
|
||||
}
|
||||
|
||||
function ensureTextLoaded() {
|
||||
if (state.textLoaded) {
|
||||
return Promise.resolve(state.textSource);
|
||||
|
||||
Reference in New Issue
Block a user