Skip to content

A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol

adapt webui to work with littlefs

Geo7874ede9df63
diff --git a/webui/index.h b/webui/index.h
index e8cd3771..9ac016b5 100644
--- a/webui/index.h
+++ b/webui/index.h
@@ -10,19 +10,62 @@ inline const char* index_html = R"rawliteral(
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, user-scalable=no">
</head>
<body>
+
+ <!-- Main Terminal Area -->
<main>
+ <!-- Output area -->
<textarea id="output" readonly></textarea>
+ <!-- Input area -->
<div class="input-area">
- <input type="text" id="command" placeholder="Enter command" autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false">
- <button onclick="sendCommand()">Send</button>
+ <div class="input-wrap">
+ <input type="text" id="command" placeholder="Enter command"
+ autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false">
+ <button id="files-btn" type="button" title="Manage files">📁 Files</button>
+ </div>
+ <div class="actions">
+ <button onclick="sendCommand()">Send</button>
+ </div>
</div>
<h3 id="history-title" style="display: none;">Command History</h3>
<div id="history" class="history-area"></div>
</main>
+
+ <!-- WebSocket Lost -->
<div id="ws-lost-popup" class="popup" style="display: none;">
<span class="popup-text">Connection lost.</span>
<a href="#" onclick="location.reload()">Refresh</a>
</div>
+
+ <!-- File Panel -->
+ <div id="file-panel-overlay" class="fp-overlay" style="display:none;"></div>
+ <div id="file-panel" class="fp" style="display:none;"
+ ondragover="onDropOver(event)"
+ ondragleave="onDropLeave(event)"
+ ondrop="onDrop(event)">
+ <!-- Header -->
+ <div class="fp-header">
+ <h2 id="fp-header-title">📁 LittleFS</h2>
+ <button class="fp-close" type="button" aria-label="Close" onclick="closeFilePanel()">×</button>
+ </div>
+ <!-- Drag Drop -->
+ <div id="dropzone" class="fp-drop"
+ ondragover="onDropOver(event)"
+ ondragleave="onDropLeave(event)"
+ ondrop="onDrop(event)">
+ <p>Drag & drop a file here, or</p>
+ <label class="fp-upload-btn">
+ <input id="file-input" type="file" onchange="onFileInput(event)" />
+ Choose file
+ </label>
+ </div>
+
+ <!-- File list -->
+ <div class="fp-list-header">
+ <span id="fp-space">Loading...</span>
+ </div>
+ <div id="file-list" class="fp-list"></div>
+ </div>
+
<script src="/scripts.js"></script>
</body>
</html>
diff --git a/webui/scripts.h b/webui/scripts.h
index 7960e975..3a27a95f 100644
--- a/webui/scripts.h
+++ b/webui/scripts.h
@@ -8,29 +8,34 @@ let reconnectInterval = 1000; // ms
let responseTimeout = null;
let responseTimeoutDelay = 6000; // ms
let bridgeMode = false;
+let fsTotalBytes = 0;
+let fsUsedBytes = 0;
+let isUploading = false;
+const filePanel = document.getElementById("file-panel");
+
+/* =========================
+ WebSocket / Terminal
+ ========================= */
function connectSocket() {
socket = new WebSocket("ws://" + window.location.host + "/ws");
socket.onopen = function () {
- hideWsLostPopup(); // Supprime le popup
+ hideWsLostPopup();
bridgeMode = false;
pendingEchoLines = 0;
console.log("[WebSocket] Connected");
};
socket.onmessage = function (event) {
-
const output = document.getElementById("output");
const lines = event.data.split("\n");
- // Bridge mode specific
if (event.data.includes("Bridge: Stopped by user.")) {
bridgeMode = false;
console.log("[WebSocket] Bridge mode exited.");
}
- // Clear response timeout
clearTimeout(responseTimeout);
hideWsLostPopup();
@@ -50,7 +55,7 @@ function connectSocket() {
socket.onclose = function () {
console.warn("[WebSocket] Disconnected. Retrying in 1s...");
- showWsLostPopup(); // Affiche le popup
+ showWsLostPopup();
setTimeout(connectSocket, reconnectInterval);
};
}
@@ -58,16 +63,11 @@ function connectSocket() {
function showWsLostPopup() {
if (bridgeMode) return;
const popup = document.getElementById("ws-lost-popup");
- if (popup) {
- popup.style.display = "block";
- }
+ if (popup) popup.style.display = "block";
}
-
function hideWsLostPopup() {
const popup = document.getElementById("ws-lost-popup");
- if (popup) {
- popup.style.display = "none";
- }
+ if (popup) popup.style.display = "none";
}
function sendCommand() {
@@ -75,10 +75,8 @@ function sendCommand() {
const output = document.getElementById("output");
const cmd = input.value.trim();
- // No socket
- if (socket.readyState !== WebSocket.OPEN) return;
+ if (!socket || socket.readyState !== WebSocket.OPEN) return;
- // Bridge mode start
if (cmd === "bridge" || cmd === "keyboard") {
bridgeMode = true;
clearTimeout(responseTimeout);
@@ -89,36 +87,31 @@ function sendCommand() {
input.value = "";
addToHistory(cmd);
output.value += cmd + "\n";
- return; // enter bridge mode
+ return;
}
- // Set timeout in non-bridge mode
clearTimeout(responseTimeout);
responseTimeout = setTimeout(() => {
console.warn("[WebSocket] No response after command.");
showWsLostPopup();
}, responseTimeoutDelay);
- // Normal Send
socket.send(cmd + "\n");
input.value = "";
- // Don't save the cmd if it's just a number, unless we're in bridge mode
if (!bridgeMode && !/^\d+$/.test(cmd)) {
output.value += cmd;
addToHistory(cmd);
pendingEchoLines = cmd.length;
} else {
- pendingEchoLines = 0;
+ pendingEchoLines = 0;
}
}
-// Bind
window.addEventListener("DOMContentLoaded", function () {
const input = document.getElementById("command");
const output = document.getElementById("output");
- // Initialize terminal
output.value =
` ____ _ _
| __ ) _ _ ___ _ __ (_)_ __ __ _| |_ ___
@@ -132,97 +125,43 @@ window.addEventListener("DOMContentLoaded", function () {
HIZ> `;
- // Key events
input.addEventListener("keydown", function (event) {
- // --- ENTER ---
- if (event.key === "Enter") {
- event.preventDefault();
- sendCommand();
- return;
- }
-
- // --- ESCAPE (0x1B) ---
- if (event.key === "Escape") {
- if (bridgeMode) {
- event.preventDefault();
- socket.send("\x1B");
- }
- return;
- }
-
- // --- CTRL+C (0x03) ---
- if (event.ctrlKey && event.key.toLowerCase() === "c") {
- if (bridgeMode) {
- event.preventDefault();
- socket.send("\x03");
- }
- return;
- }
-
- // --- TAB (0x09) ---
- if (event.key === "Tab") {
- if (bridgeMode) {
- event.preventDefault();
- socket.send("\x09");
- }
- return;
- }
-
- // --- CTRL+D -----
- if (event.ctrlKey && event.key.toLowerCase() === "d") {
- if (bridgeMode) {
- event.preventDefault();
- socket.send("\x04");
- }
- return;
- }
-
- // --- CTRL+Z -----
- if (event.ctrlKey && event.key.toLowerCase() === "z") {
- if (bridgeMode) {
- event.preventDefault();
- socket.send("\x1A");
- }
- return;
- }
-
- // --- CTRL+X -----
- if (event.ctrlKey && event.key.toLowerCase() === "x") {
- if (bridgeMode) {
- event.preventDefault();
- socket.send("\x18");
- }
- return;
- }
-
+ if (event.key === "Enter") { event.preventDefault(); sendCommand(); return; }
+ if (event.key === "Escape") { if (bridgeMode) { event.preventDefault(); socket.send("\x1B"); } return; }
+ if (event.ctrlKey && event.key.toLowerCase() === "c") { if (bridgeMode) { event.preventDefault(); socket.send("\x03"); } return; }
+ if (event.key === "Tab") { if (bridgeMode) { event.preventDefault(); socket.send("\x09"); } return; }
+ if (event.ctrlKey && event.key.toLowerCase() === "d") { if (bridgeMode) { event.preventDefault(); socket.send("\x04"); } return; }
+ if (event.ctrlKey && event.key.toLowerCase() === "z") { if (bridgeMode) { event.preventDefault(); socket.send("\x1A"); } return; }
+ if (event.ctrlKey && event.key.toLowerCase() === "x") { if (bridgeMode) { event.preventDefault(); socket.send("\x18"); } return; }
});
- connectSocket(); // Initial connection
+ // Files button
+ const filesBtn = document.getElementById("files-btn");
+ if (filesBtn) filesBtn.addEventListener("click", openFilePanel);
+
+ connectSocket();
});
+/* =========================
+ Command History
+ ========================= */
function addToHistory(cmd) {
if (!isValidCommand(cmd)) return;
const history = document.getElementById("history");
-
const last = history.firstChild;
if (last && last.textContent === cmd) return;
const btn = document.createElement("button");
-
- // Limiter l'affichage du texte à 15 caractères
const maxLength = 15;
const displayText = cmd.length > maxLength ? cmd.slice(0, maxLength - 3) + "..." : cmd;
-
btn.textContent = displayText;
- btn.title = cmd; // Tooltip complet au survol
+ btn.title = cmd;
btn.onclick = () => {
document.getElementById("command").value = cmd;
document.getElementById("command").focus();
};
-
history.insertBefore(btn, history.firstChild);
}
-
function isValidCommand(cmd) {
if (!cmd) return false;
if (cmd.length < 2) return false;
@@ -230,4 +169,226 @@ function isValidCommand(cmd) {
return true;
}
+/* =========================
+ File Panel
+ ========================= */
+
+function openFilePanel() {
+ document.getElementById("file-panel-overlay").style.display = "block";
+ document.getElementById("file-panel").style.display = "flex";
+ refreshFileList();
+}
+
+function closeFilePanel() {
+ document.getElementById("file-panel-overlay").style.display = "none";
+ document.getElementById("file-panel").style.display = "none";
+}
+
+async function refreshFileList() {
+ const listEl = document.getElementById("file-list");
+ listEl.innerHTML = "<div class='fp-empty'>Loading...</div>";
+ try {
+ const r = await fetch("/littlefs/list?dir=/", { cache: "no-store" });
+ const j = await r.json();
+ fsTotalBytes = Number(j.total) || 0;
+ fsUsedBytes = Number(j.used) || 0;
+
+ // update space info
+ const totalKB = Math.floor(j.total / 1024);
+ const usedKB = Math.floor(j.used / 1024);
+ const percent = totalKB > 0 ? Math.round((usedKB / totalKB) * 100) : 0;
+ document.getElementById("fp-space").textContent =
+ `Total: ${totalKB} KB — Used: ${usedKB} KB (${percent}%)`;
+
+ // Get files
+ const entries = (j && Array.isArray(j.entries)) ? j.entries : [];
+ const files = entries.filter(e => !e.isDir);
+ if (files.length === 0) {
+ listEl.innerHTML = "<div class='fp-empty'>No files found.</div>";
+ } else {
+ renderFileList(files);
+ }
+ } catch (e) {
+ listEl.innerHTML = "<div class='fp-empty'>Failed to load.</div>";
+ console.error(e);
+ }
+}
+
+function renderFileList(entries) {
+ const listEl = document.getElementById("file-list");
+ listEl.innerHTML = "";
+ if (!Array.isArray(entries) || entries.length === 0) {
+ listEl.innerHTML = "<div class='fp-empty'>No files yet.</div>";
+ return;
+ }
+ entries
+ .filter(e => !e.isDir)
+ .sort((a,b)=> a.name.localeCompare(b.name))
+ .forEach(e => {
+ const card = document.createElement("div");
+ card.className = "fp-item";
+
+ const icon = document.createElement("div");
+ icon.className = "fp-icon";
+ icon.textContent = "📄";
+ icon.title = e.name;
+
+ const name = document.createElement("div");
+ name.className = "fp-name";
+ name.textContent = e.name;
+
+ const meta = document.createElement("div");
+ meta.className = "fp-meta";
+ meta.textContent = humanSize(e.size);
+
+ const actions = document.createElement("div");
+ actions.className = "fp-actions";
+
+ const dl = document.createElement("button");
+ dl.className = "fp-dl";
+ dl.textContent = "💾";
+ dl.title = "Download file";
+ dl.onclick = (ev) => {
+ ev.stopPropagation();
+ downloadFile(e.name);
+ };
+
+ const del = document.createElement("button");
+ del.className = "fp-del";
+ del.textContent = "🗑️";
+ del.title = "Delete file";
+ del.onclick = async (ev) => {
+ ev.stopPropagation();
+ await deleteFile(e.name);
+ };
+
+ actions.appendChild(dl);
+ actions.appendChild(del);
+
+ const topWrap = document.createElement("div");
+ topWrap.style.display = "flex";
+ topWrap.style.flexDirection = "column";
+ topWrap.style.gap = "4px";
+ topWrap.appendChild(icon);
+ topWrap.appendChild(name);
+ topWrap.appendChild(meta);
+
+ card.appendChild(topWrap);
+ card.appendChild(actions);
+ listEl.appendChild(card);
+ });
+}
+
+function humanSize(n) {
+ const units = ["B","KB","MB","GB"];
+ let i = 0, s = Number(n);
+ while (s >= 1024 && i < units.length - 1) { s /= 1024; i++; }
+ return (i===0 ? s.toString() : s.toFixed(1)) + " " + units[i];
+}
+
+/* Upload */
+
+function onDropOver(e) {
+ if (isUploading) return; // ignore
+ e.preventDefault();
+ e.dataTransfer.dropEffect = "copy";
+ document.getElementById("dropzone").classList.add("drag");
+}
+function onDropLeave(e) {
+ e.preventDefault();
+ document.getElementById("dropzone").classList.remove("drag");
+}
+async function onDrop(e) {
+ e.preventDefault();
+ if (isUploading) return;
+ document.getElementById("dropzone").classList.remove("drag");
+ const files = e.dataTransfer.files;
+ if (!files || !files.length) return;
+ await uploadFile(files[0]);
+}
+
+async function onFileInput(e) {
+ const f = e.target.files && e.target.files[0];
+ if (!f) return;
+ await uploadFile(f);
+ e.target.value = "";
+}
+
+function disableDropArea(disabled) {
+ const dz = document.getElementById("dropzone");
+ const inp = document.getElementById("file-input");
+ if (!dz || !inp) return;
+ if (disabled) {
+ dz.classList.add("disabled");
+ inp.disabled = true;
+ } else {
+ dz.classList.remove("disabled");
+ inp.disabled = false;
+ }
+}
+
+/* Upload a single file */
+
+async function uploadFile(file) {
+ const titleEl = document.getElementById("fp-header-title");
+ const originalTitle = titleEl.textContent;
+
+ // Free space check
+ const FREE_MARGIN = 1024; // 1 KB de marge
+ const freeBytes = Math.max(0, fsTotalBytes - fsUsedBytes - FREE_MARGIN);
+
+ // Size
+ if (file.size > freeBytes) {
+ const needKB = Math.ceil(file.size / 1024);
+ const freeKB = Math.floor(freeBytes / 1024);
+ alert(`Not enough space.\nNeeded: ${needKB} KB\nFree: ${freeKB} KB`);
+ return;
+ }
+
+ try {
+ isUploading = true;
+ disableDropArea(true);
+ titleEl.textContent = "⏳ Upload... Please wait";
+
+ const r = await fetch("/littlefs/upload?file=" + encodeURIComponent(file.name), {
+ method: "POST",
+ headers: { "Content-Type": "application/octet-stream" },
+ body: file
+ });
+
+ if (!r.ok) throw new Error("Upload failed");
+
+ await refreshFileList();
+ } catch (e) {
+ alert("Upload error: " + e.message);
+ console.error(e);
+ } finally {
+ titleEl.textContent = originalTitle;
+ disableDropArea(false);
+ isUploading = false;
+ }
+}
+
+/* Download */
+
+function downloadFile(name) {
+ // Content-Type binaire Content-Disposition: attachment
+ const url = "/littlefs/download?file=" + encodeURIComponent(name);
+ window.open(url, "_blank");
+}
+
+/* Delete */
+
+async function deleteFile(name) {
+ if (!confirm(`Delete '${name}' ?`)) return;
+ try {
+ const url = "/littlefs/delete?file=" + encodeURIComponent(name);
+ const r = await fetch(url, { method: "DELETE" });
+ if (!r.ok) throw new Error("Delete failed");
+ await refreshFileList();
+ } catch (e) {
+ alert("Delete error: " + e.message);
+ console.error(e);
+ }
+}
)rawliteral";
diff --git a/webui/style.h b/webui/style.h
index cae1f9dd..97d49aab 100644
--- a/webui/style.h
+++ b/webui/style.h
@@ -1,100 +1,83 @@
#pragma once
inline const char* style_css = R"rawliteral(
-* {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- overflow-wrap: break-word;
-}
+/* Global styles */
+* { margin: 0; padding: 0; box-sizing: border-box; overflow-wrap: break-word; }
html, body {
- height: 100%;
- width: 100%;
- max-width: 100vw;
- max-height: 100dvh;
+ height: 100%; width: 100%; max-width: 100vw; max-height: 100dvh;
font-family: Menlo, 'Courier New', Courier, 'Liberation Mono', monospace;
- background-color: #121212;
- color: #e0e0e0;
- overflow: hidden;
- touch-action: manipulation;
+ background-color: #121212; color: #e0e0e0; overflow: hidden; touch-action: manipulation;
}
-
main {
- display: flex;
- flex-direction: column;
- flex-grow: 1;
- height: 100dvh;
+ display: flex; flex-direction: column; flex-grow: 1; height: 100dvh;
padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
- gap: 10px;
- overflow: hidden;
- min-width: 0;
- max-width: 100%;
+ gap: 10px; overflow: hidden; min-width: 0; max-width: 100%;
}
/* Terminal output */
#output {
font-family: Menlo, 'Courier New', Courier, 'Liberation Mono', monospace;
- font-size: 0.9rem;
- letter-spacing: 0;
- line-height: 1.2;
- flex-grow: 1;
- min-height: 0;
- width: 100%;
- background: linear-gradient(145deg, #1a1a1a, #0f0f0f);
- color: #00ff00;
- border: 1px solid #333;
- border-radius: 8px;
- padding: 12px;
- font-size: 0.9rem;
- resize: none;
- box-shadow: inset 0 0 5px #000;
- box-sizing: border-box;
- overflow-y: auto;
- overflow-x: hidden;
- white-space: pre-wrap;
- word-break: break-word;
- caret-color: transparent;
+ font-size: 0.9rem; letter-spacing: 0; line-height: 1.2;
+ flex-grow: 1; min-height: 0; width: 100%;
+ background: linear-gradient(145deg, #1a1a1a, #0f0f0f); color: #00ff00;
+ border: 1px solid #333; border-radius: 8px; padding: 12px; resize: none;
+ box-shadow: inset 0 0 5px #000; overflow-y: auto; overflow-x: hidden; white-space: pre-wrap; word-break: break-word; caret-color: transparent;
}
+#output:focus { outline: none; border-color: #00ffcc; box-shadow: 0 0 5px #00ffcc44; }
+#output::-webkit-scrollbar { display: none; }
-#output:focus {
- outline: none;
- border-color: #00ffcc;
- box-shadow: 0 0 5px #00ffcc44;
-}
-
-#output::-webkit-scrollbar {
- display: none;
-}
-
-/* Input + Send Button */
+/* Input area */
.input-area {
display: flex;
gap: 8px;
- flex-shrink: 0;
width: 100%;
- max-width: 100%;
- box-sizing: border-box;
- min-width: 0;
+ flex-shrink: 0;
}
-
-input[type="text"] {
+.input-wrap {
+ position: relative;
flex: 1;
+}
+.input-wrap input[type="text"] {
+ width: 100%;
padding: 10px;
+ padding-right: 80px; /* bouton Files */
background-color: #1c1c1c;
color: #00ff00;
border: 1px solid #333;
border-radius: 8px;
font-size: 1rem;
outline: none;
- box-sizing: border-box;
min-width: 0;
}
+#files-btn {
+ position: absolute;
+ top: 50%;
+ right: 10px;
+ transform: translateY(-50%);
+ height: 28px;
+ padding: 0 10px;
+ font-size: 0.9rem;
+ line-height: 28px;
+
+ display: flex;
+ align-items: center;
+ gap: 4px;
+
+ border: 1px solid #444;
+ border-radius: 6px;
+ background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
+ color: #ffdc7d;
+ cursor: pointer;
+}
+#files-btn:hover {
+ background: #333;
+ box-shadow: 0 0 6px #00ff0044;
+}
input[type="text"]:focus {
border-color: #00ffcc;
box-shadow: 0 0 5px #00ffcc44;
}
-
button {
padding: 10px 16px;
background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
@@ -106,144 +89,181 @@ button {
white-space: nowrap;
transition: background 0.2s ease, box-shadow 0.2s;
}
+button#files-btn {
+ padding: 0 10px; /* override */
+ font-size: 0.9rem; /* override */
+}
button:hover {
background: #333;
box-shadow: 0 0 6px #00ff0044;
}
/* History */
-#history-title {
- margin: 4px 0 0 0;
- font-size: 1rem;
- display: none;
- flex-shrink: 0;
-}
-
+#history-title { margin: 4px 0 0 0; font-size: 1rem; display: none; flex-shrink: 0; }
.history-area {
- display: flex;
- flex-wrap: nowrap;
- gap: 6px;
- white-space: nowrap;
- padding-bottom: 4px;
- flex-shrink: 0;
- width: 100%;
- max-width: 100%;
- overflow-x: auto;
- overflow-y: hidden;
- box-sizing: border-box;
- min-width: 0;
+ display: flex; flex-wrap: nowrap; gap: 6px; white-space: nowrap; padding-bottom: 4px;
+ flex-shrink: 0; width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; min-width: 0;
-webkit-overflow-scrolling: touch;
}
-.history-area::-webkit-scrollbar {
- width: 0;
- height: 0;
-}
-.history-area button:hover {
- background: #2a2a2a;
+.history-area::-webkit-scrollbar { width: 0; height: 0; }
+.history-area button:hover { background: #2a2a2a; }
+.history-area::-webkit-scrollbar { height: 6px; }
+.history-area::-webkit-scrollbar-thumb { background-color: #444; border-radius: 4px; }
+.history-area::-webkit-scrollbar-track { background-color: #222; }
+.history-area button {
+ flex: 0 0 auto; background: #1a1a1a; color: #00ff00; border: 1px solid #333; border-radius: 6px;
+ padding: 6px 10px; font-size: 0.85em; transition: background 0.2s ease;
}
-.history-area::-webkit-scrollbar {
- height: 6px;
+
+/* Popup (WS Lost) */
+.popup {
+ position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
+ background: #222; color: #ff5555; padding: 12px 18px; border: 1px solid #444; border-radius: 8px;
+ box-shadow: 0 0 8px #000; z-index: 9999; font-size: 0.95rem; max-width: 90vw;
+ display: flex; align-items: center; justify-content: center; gap: 10px; white-space: nowrap; overflow: hidden;
}
-.history-area::-webkit-scrollbar-thumb {
- background-color: #444;
- border-radius: 4px;
+.popup a { color: #00ffcc; text-decoration: underline; }
+.popup a:hover { color: #00ffff; }
+
+/* File Panel */
+.fp-overlay {
+ position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 9000;
+ backdrop-filter: blur(2px);
}
-.history-area::-webkit-scrollbar-track {
- background-color: #222;
+.fp {
+ position: fixed; right: 12px; bottom: 12px; width: min(560px, 92vw); height: min(70vh, 560px);
+ background: #1a1a1a; border: 1px solid #333; border-radius: 10px; z-index: 9010;
+ box-shadow: 0 8px 24px rgba(0,0,0,0.6);
+ display: flex; flex-direction: column; gap: 8px; padding: 10px;
+ /* for Firefox */
+ scrollbar-width: thin;
+ scrollbar-color: #666 #1a1a1a;
+ }
+.fp::-webkit-scrollbar {
+ width: 8px;
}
-
-.history-area button {
- flex: 0 0 auto;
+.fp::-webkit-scrollbar-track {
background: #1a1a1a;
- color: #00ff00;
- border: 1px solid #333;
- border-radius: 6px;
- padding: 6px 10px;
- font-size: 0.85em;
- transition: background 0.2s ease;
+ border-radius: 10px;
}
-
-.popup {
- position: fixed;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- background: #222;
- color: #ff5555;
- padding: 12px 18px;
- border: 1px solid #444;
+.fp::-webkit-scrollbar-thumb {
+ background-color: #666;
+ border-radius: 10px;
+ border: 2px solid #1a1a1a;
+}
+.fp::-webkit-scrollbar-thumb:hover {
+ background-color: #888;
+}
+.fp-header { display:flex; align-items:center; justify-content: space-between; }
+.fp-header h2 { font-size: 1.05rem; }
+.fp-close {
+ background:#2a2a2a;
+ color:#ccc;
+ border:1px solid #444;
+ border-radius:50%;
+ width:28px;
+ height:28px;
+ font-size:1rem;
+ display:flex;
+ align-items:center;
+ justify-content:center;
+ padding:0;
+}
+.fp-close:hover { background:#333; color:#fff; }
+.fp-drop {
+ display:flex; flex-direction: column; align-items:center; justify-content:center; gap:6px;
+ border: 1px dashed #444; border-radius: 8px; padding: 14px; text-align:center; color:#bbb;
+ background: #161616;
+}
+.fp-drop.drag { border-color: #00ffcc; box-shadow: 0 0 6px #00ffcc44; }
+.fp-upload-btn {
+ display:inline-block; padding: 8px 10px; background:#2a2a2a; border:1px solid #444; border-radius:8px; cursor:pointer; color:#00ff00;
+}
+.fp-upload-btn input { display:none; }
+.fp-refresh { padding:6px 10px; }
+.fp-list {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
+ gap: 10px;
+ overflow: auto;
+ flex: 1;
+ border: 1px solid #222;
border-radius: 8px;
- box-shadow: 0 0 8px #000;
- z-index: 9999;
- font-size: 0.95rem;
- max-width: 90vw;
+ padding: 10px;
+ background:#121212;
+ grid-auto-rows: 150px;
+}
+/* File item */
+.fp-item {
display: flex;
- align-items: center;
- justify-content: center;
- gap: 10px;
-
- white-space: nowrap;
- overflow: hidden;
+ flex-direction: column;
+ justify-content: space-between;
+ gap: 6px;
+ background:#181818;
+ border:1px solid #2a2a2a;
+ border-radius:8px;
+ padding:8px;
+ height: 100%;
+ min-height: 0;
}
-
-.popup-text {
- overflow: hidden;
+.fp-icon {
+ font-size: 28px;
+ text-align:center;
+}
+.fp-name {
+ font-size: 0.9rem;
+ text-align:center;
+ color:#e0e0e0;
+ overflow:hidden;
text-overflow: ellipsis;
white-space: nowrap;
+ padding: 5px 0;
}
-
-.popup a {
- color: #00ffcc;
- text-decoration: underline;
- flex-shrink: 0;
+.fp-meta {
+ font-size: 0.8rem;
+ text-align:center;
+ color:#aaa;
}
-.popup a:hover {
- color: #00ffff;
+/* File actions (Download, Delete) */
+.fp-actions {
+ display: flex;
+ gap: 6px;
+ justify-content: center;
+ margin-top: 4px;
}
-
+.fp-dl {
+ padding: 6px 8px;
+ font-size: 0.85rem;
+ color:#7dd3fc; /* bleu clair */
+ border:1px solid #264653; /* cadre bleu */
+ background:#10222b; /* fond sombre bleu */
+ border-radius:6px;
+}
+.fp-dl:hover { filter: brightness(1.1); }
+.fp-del {
+ align-self: center;
+ padding: 6px 8px;
+ font-size: 0.85rem;
+ color:#ff6666;
+ border:1px solid #553;
+ background:#2a1515;
+ border-radius: 6px;
+}
+.fp-del:hover { filter: brightness(1.1); }
+
/* Responsive */
@media (max-width: 600px), (max-height: 600px) {
- main {
- padding: 8px;
- gap: 6px;
- }
-
- .popup {
- font-size: 0.8rem;
- }
-
-
- #output {
- font-size: 0.8rem;
- padding: 8px;
- }
-
- .input-area {
- flex-direction: column;
- gap: 6px;
- }
-
- input[type="text"] {
- font-size: 0.95rem;
- width: 100%;
- }
-
- .input-area button {
- width: 100%;
- font-size: 0.95rem;
- }
-
- .history-area {
- gap: 4px;
- }
-
- .history-area button {
- font-size: 0.75em;
- padding: 5px 8px;
- }
+ main { padding: 8px; gap: 6px; }
+ #output { font-size: 0.8rem; padding: 8px; }
+ .input-area { flex-direction: column; gap: 6px; }
+ input[type="text"] { font-size: 0.95rem; width: 100%; }
+ .input-area button:not(#files-btn) { width: 100%; font-size: 0.95rem; }
+ .history-area { gap: 4px; }
+ .history-area button { font-size: 0.75em; padding: 5px 8px; }
+ .fp { right: 8px; left: 8px; width: auto; height: min(70vh, 520px); }
+ .fp-list { grid-auto-rows: 150px; }
}
-
)rawliteral";