Update samy.js
This commit is contained in:
13
samy.js
13
samy.js
@@ -265,7 +265,7 @@ async function fetchSites() {
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
let allPrinters = [];
|
let allPrinters = [];
|
||||||
|
|
||||||
// GET /getprinters with password from Devices tab (sent via SAMYPW header)
|
// POST /getprinters with password from Devices tab
|
||||||
async function fetchPrinters() {
|
async function fetchPrinters() {
|
||||||
const pwdInput = document.getElementById("PrinterPassword");
|
const pwdInput = document.getElementById("PrinterPassword");
|
||||||
const pwd = pwdInput?.value;
|
const pwd = pwdInput?.value;
|
||||||
@@ -290,8 +290,9 @@ async function fetchPrinters() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await fetch("/getprinters", {
|
const resp = await fetch("/getprinters", {
|
||||||
method: "GET",
|
method: "POST",
|
||||||
headers: { SAMYPW: pwd },
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({ password: pwd }),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!resp.ok) throw new Error("HTTP " + resp.status);
|
if (!resp.ok) throw new Error("HTTP " + resp.status);
|
||||||
@@ -441,10 +442,8 @@ async function installSelectedPrinters() {
|
|||||||
|
|
||||||
const result = await resp.json().catch(() => null);
|
const result = await resp.json().catch(() => null);
|
||||||
|
|
||||||
alert(
|
console.log("Printer install result:", result);
|
||||||
`Requested installation for ${selected.length} printer(s).` +
|
|
||||||
(result && result.Message ? "\n" + result.Message : "")
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("installSelectedPrinters error:", e);
|
console.error("installSelectedPrinters error:", e);
|
||||||
alert("Failed to trigger printer install.");
|
alert("Failed to trigger printer install.");
|
||||||
|
|||||||
Reference in New Issue
Block a user