Update samy.js
This commit is contained in:
13
samy.js
13
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.");
|
||||
|
||||
Reference in New Issue
Block a user