fix(web-clipper): bouton rond transparent draggable + toggle affichage + refresh auto sidebar + fix bloc bookmark (v6.2.1)
- bouton flottant rond (44px), semi-transparent blur, hover plus fonce, deplacable souris (pos persistee storage) - option afficher/cacher dans popup extension (showButton) - clipper: notification instantanee des onglets FlowDeck via tabs.sendMessage + polling 15s + BroadcastChannel + visibilitychange - fix bookmark template literal '+title+' -> \/\/\/\/\ (_page_editor_scripts.html) - sync static/extension + zip
This commit is contained in:
+24
-1
@@ -4,7 +4,9 @@ const DEFAULT_SERVER = "http://localhost:8080";
|
||||
|
||||
async function getConfig() {
|
||||
const data = await chrome.storage.local.get(STORAGE_KEY);
|
||||
return data[STORAGE_KEY] || { serverUrl: DEFAULT_SERVER, token: "", deviceId: "" };
|
||||
const cfg = data[STORAGE_KEY] || { serverUrl: DEFAULT_SERVER, token: "", deviceId: "" };
|
||||
if (cfg.showButton === undefined) cfg.showButton = true;
|
||||
return cfg;
|
||||
}
|
||||
|
||||
async function setConfig(cfg) {
|
||||
@@ -85,9 +87,30 @@ async function handleClip(data) {
|
||||
if (!resp.ok) {
|
||||
return { error: body.detail || body.error || "clip_failed", status: resp.status, ...body };
|
||||
}
|
||||
// Notify open FlowDeck tabs so the sidebar refreshes instantly without manual reload
|
||||
try {
|
||||
notifyFlowDeckTabs(body);
|
||||
} catch (_e) {}
|
||||
return body;
|
||||
}
|
||||
|
||||
async function notifyFlowDeckTabs(clipResult) {
|
||||
try {
|
||||
const cfg = await getConfig();
|
||||
const serverUrl = (cfg.serverUrl || DEFAULT_SERVER).replace(/\/$/, "");
|
||||
let origin = "";
|
||||
try { origin = new URL(serverUrl).origin; } catch (_e) { origin = serverUrl; }
|
||||
const tabs = await chrome.tabs.query({});
|
||||
for (const t of tabs) {
|
||||
if (!t.id || !t.url) continue;
|
||||
// Only notify tabs that look like FlowDeck (same origin or localhost variants)
|
||||
const isFlowDeck = t.url.startsWith(origin) || t.url.includes("flowdeck") || t.url.includes("localhost");
|
||||
if (!isFlowDeck) continue;
|
||||
chrome.tabs.sendMessage(t.id, { action: "fdRefreshTree", data: clipResult }).catch(() => {});
|
||||
}
|
||||
} catch (_e) {}
|
||||
}
|
||||
|
||||
async function handleAuth() {
|
||||
// Token is set via popup; verify it
|
||||
const cfg = await getConfig();
|
||||
|
||||
Reference in New Issue
Block a user