Update samy.js

This commit is contained in:
2025-12-08 16:20:55 -05:00
parent 33259348c7
commit e5da914b51

13
samy.js
View File

@@ -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.");