Skip to content

Commit f18862b

Browse files
CopilotMrAlders0n
andcommitted
Update connection bar layout and remove auth POST
- Remove status indicator dot from connection bar - Simplify layout: "Disconnected Device: Location: Slots:" - Remove postAuthRequest() function (not needed for preflight-only) - Remove GEO_AUTH_POST_URL constant (only zones/status needed) - Clean up 74 lines of unnecessary auth code Focus on preflight functionality only per requirements. Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
1 parent 191158f commit f18862b

2 files changed

Lines changed: 10 additions & 84 deletions

File tree

‎content/wardrive.js‎

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const MESHMAPPER_RX_LOG_API_URL = "https://yow.meshmapper.net/wardriving-api.php
111111

112112
// Geo-Fenced Auth API Configuration (Placeholder URLs)
113113
const GEO_AUTH_ZONES_STATUS_URL = "{{API_URL}}/zones/status"; // Preflight: Check zone status before connect
114-
const GEO_AUTH_POST_URL = "{{API_URL}}/auth"; // Auth: Request connection token after BLE pairing
114+
115115

116116
// Static for now; will be made dynamic later.
117117
const WARDIVE_IATA_CODE = "YOW";
@@ -723,18 +723,12 @@ function setConnectButton(connected) {
723723
*/
724724
function setConnStatus(text, color) {
725725
const connectionStatusEl = document.getElementById("connectionStatus");
726-
const statusIndicatorEl = document.getElementById("statusIndicator");
727726

728727
if (!connectionStatusEl) return;
729728

730729
debugLog(`[UI] Connection status: "${text}"`);
731730
connectionStatusEl.textContent = text;
732731
connectionStatusEl.className = `font-medium ${color}`;
733-
734-
// Update status indicator dot color to match
735-
if (statusIndicatorEl) {
736-
statusIndicatorEl.className = `text-lg ${color}`;
737-
}
738732
}
739733

740734
/**
@@ -1332,59 +1326,6 @@ async function checkZoneStatus() {
13321326
}
13331327
}
13341328

1335-
/**
1336-
* Post auth request (placeholder - actual implementation commented out)
1337-
* This will be called after BLE pairing to request a session token
1338-
*
1339-
* See docs/GEO_AUTH_DESIGN.md for full auth flow specification.
1340-
* To enable: uncomment fetch() call and remove console.debug() simulation.
1341-
*
1342-
* @param {object} coords - GPS coordinates {lat, lon, accuracy, timestamp}
1343-
* @returns {Promise<boolean>} True if auth successful (currently simulated)
1344-
*/
1345-
async function postAuthRequest(coords) {
1346-
debugLog("[GEOFENCE] postAuthRequest called (commented out implementation)");
1347-
1348-
const payload = {
1349-
public_key: state.devicePublicKey,
1350-
who: getDeviceIdentifier(),
1351-
ver: APP_VERSION,
1352-
reason: "connect",
1353-
coords: {
1354-
lat: coords.lat,
1355-
lng: coords.lon,
1356-
accuracy_m: coords.accuracy,
1357-
timestamp: Math.floor(coords.timestamp / 1000)
1358-
}
1359-
};
1360-
1361-
console.debug(`[GEOFENCE] Auth POST payload (simulated):`, payload);
1362-
console.debug(`[GEOFENCE] Auth POST target URL: ${GEO_AUTH_POST_URL}`);
1363-
1364-
/* Uncomment when backend is ready:
1365-
const response = await fetch(GEO_AUTH_POST_URL, {
1366-
method: "POST",
1367-
headers: { "Content-Type": "application/json" },
1368-
body: JSON.stringify(payload)
1369-
});
1370-
1371-
if (!response.ok) throw new Error(`Auth API returned status ${response.status}`);
1372-
1373-
const data = await response.json();
1374-
if (data.allowed) {
1375-
state.authToken = data.token;
1376-
state.wardriveSessionId = data.session_id;
1377-
debugLog(`[GEOFENCE] Auth successful: session_id=${data.session_id}`);
1378-
return true;
1379-
}
1380-
debugWarn(`[GEOFENCE] Auth denied: ${data.reason || 'unknown'}`);
1381-
return false;
1382-
*/
1383-
1384-
debugLog("[GEOFENCE] Simulated auth success (actual request commented out)");
1385-
return true;
1386-
}
1387-
13881329
// ---- Key Derivation ----
13891330
/**
13901331
* Derives a 16-byte channel key from a hashtag channel name using SHA-256.

‎index.html‎

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,15 @@ <h1 class="flex items-center gap-2 text-lg sm:text-xl font-semibold truncate min
4747
<div>
4848
<!-- Connection Status Bar -->
4949
<div id="connectionBar" class="bg-slate-800/80 border border-slate-700 rounded-t-xl rounded-b-none px-4 py-0.5 flex items-center justify-between">
50-
<div class="flex items-center gap-4 text-sm flex-wrap">
51-
<!-- Connection Status -->
52-
<div class="flex items-center gap-2">
53-
<span id="statusIndicator" class="text-base">●</span>
54-
<span id="connectionStatus" class="font-medium text-red-300">Disconnected</span>
55-
</div>
56-
57-
<!-- Location Info -->
58-
<div class="flex items-center gap-2 text-xs text-slate-400">
59-
<span>Location:</span>
60-
<span id="locationInfo" class="text-slate-300">-</span>
61-
</div>
62-
63-
<!-- Slots Info -->
64-
<div class="flex items-center gap-2 text-xs text-slate-400">
65-
<span>Slots:</span>
66-
<span id="slotsInfo" class="text-slate-300">-</span>
67-
</div>
68-
69-
<!-- Device Info -->
70-
<div class="flex items-center gap-2 text-xs text-slate-400">
71-
<span>Device:</span>
72-
<span id="deviceInfo" class="text-slate-300">-</span>
73-
</div>
50+
<div class="flex items-center gap-2 text-sm flex-wrap">
51+
<!-- Connection Status and Info in single line -->
52+
<span id="connectionStatus" class="font-medium text-red-300">Disconnected</span>
53+
<span class="text-slate-500">Device:</span>
54+
<span id="deviceInfo" class="text-slate-300">-</span>
55+
<span class="text-slate-500">Location:</span>
56+
<span id="locationInfo" class="text-slate-300">-</span>
57+
<span class="text-slate-500">Slots:</span>
58+
<span id="slotsInfo" class="text-slate-300">-</span>
7459
</div>
7560
<button id="settingsGearBtn" class="p-0 text-slate-400 hover:text-slate-200 transition-colors" aria-label="Toggle settings">
7661
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">

0 commit comments

Comments
 (0)