diff --git a/samy.js b/samy.js index 7ca598e..6831440 100644 --- a/samy.js +++ b/samy.js @@ -265,7 +265,7 @@ async function fetchSites() { // ======================================================================= let allPrinters = []; -// GET /getprinters with password from Devices tab (sent via SAMYPW header) +// POST /getprinters with password from Devices tab async function fetchPrinters() { const pwdInput = document.getElementById("PrinterPassword"); const pwd = pwdInput?.value; @@ -290,8 +290,9 @@ async function fetchPrinters() { try { const resp = await fetch("/getprinters", { - method: "GET", - headers: { SAMYPW: pwd }, + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ password: pwd }), }); if (!resp.ok) throw new Error("HTTP " + resp.status); @@ -441,10 +442,8 @@ async function installSelectedPrinters() { const result = await resp.json().catch(() => null); - alert( - `Requested installation for ${selected.length} printer(s).` + - (result && result.Message ? "\n" + result.Message : "") - ); + console.log("Printer install result:", result); + } catch (e) { console.error("installSelectedPrinters error:", e); alert("Failed to trigger printer install."); @@ -683,4 +682,4 @@ document.addEventListener("DOMContentLoaded", () => { // notify server on window close window.addEventListener("beforeunload", () => { fetch("/quit", { method: "GET", keepalive: true }); -}); +}); \ No newline at end of file