fix: remove auth middleware — single-user pedal doesn't need it
CI / test (push) Has been cancelled

Auth was blocking all POST/PUT operations with 401.
Disabled per user request. PIN generation kept (harmless).
Frontend reverted to no-auth API helpers.
This commit is contained in:
2026-06-17 23:06:46 -04:00
parent 95029c6c8c
commit aa0bcf35fe
2 changed files with 8 additions and 73 deletions
+5 -11
View File
@@ -37,12 +37,6 @@ function _ch(url) {
}
// ── API helpers ────────────────────────────────────────────────
let _authPin = '';
function _authHeaders() {
return _authPin ? { 'X-Pedal-Auth': _authPin } : {};
}
async function apiGet(path) {
const r = await fetch(`${API}${_ch(path)}`);
if (!r.ok) throw new Error(`${path} => ${r.status}`);
@@ -51,7 +45,7 @@ async function apiGet(path) {
async function apiPost(path, data) {
const r = await fetch(`${API}${_ch(path)}`, {
method: 'POST', headers: { 'Content-Type': 'application/json', ..._authHeaders() },
method: 'POST', headers: { 'Content-Type': 'application/json' },
body: data != null ? JSON.stringify(data) : undefined,
});
if (!r.ok) throw new Error(`${path} => ${r.status}`);
@@ -60,7 +54,7 @@ async function apiPost(path, data) {
async function apiPut(path, data) {
const r = await fetch(`${API}${_ch(path)}`, {
method: 'PUT', headers: { 'Content-Type': 'application/json', ..._authHeaders() },
method: 'PUT', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
if (!r.ok) throw new Error(`${path} => ${r.status}`);
@@ -68,7 +62,7 @@ async function apiPut(path, data) {
}
async function apiDelete(path) {
const r = await fetch(`${API}${_ch(path)}`, { method: 'DELETE', headers: _authHeaders() });
const r = await fetch(`${API}${_ch(path)}`, { method: 'DELETE' });
if (!r.ok) throw new Error(`${path} => ${r.status}`);
return r.json();
}
@@ -76,7 +70,7 @@ async function apiDelete(path) {
async function apiUpload(path, file) {
const fd = new FormData();
fd.append('file', file);
const r = await fetch(`${API}${_ch(path)}`, { method: 'POST', body: fd, headers: _authHeaders() });
const r = await fetch(`${API}${_ch(path)}`, { method: 'POST', body: fd });
if (!r.ok) throw new Error(`${path} => ${r.status}`);
return r.json();
}
@@ -90,7 +84,7 @@ function usePedalState() {
useEffect(() => {
// Fetch initial state
apiGet('/api/state').then(s => { setState(s); setConnected(true); _authPin = s.auth_pin || ''; }).catch(() => { setConnected(false); });
apiGet('/api/state').then(s => { setState(s); setConnected(true); }).catch(() => { setConnected(false); });
// WebSocket for real-time updates
let reconnectTimer;