Build and push server image / build-and-push (push) Successful in 35s
Found by a thorough code review: - server/app/config.py's load()/save() each locked only their own file I/O, not the full read-modify-write cycle each route does around them. Since uvicorn dispatches sync routes to a thread pool, two concurrent requests (e.g. the device's own poll landing alongside a web UI edit) could each load() the same on-disk state and the second's save() silently clobber the first's changes. Added config.locked() (backed by an RLock, since load()/save() also take the lock internally) and wrapped every mutating route's load/mutate/save span in it -- kept outside the lock wherever a route also does slow Immich network I/O, re-loading fresh state right before the actual mutation instead. Verified with a new concurrency stress test (many concurrent /api/queue/promote and /api/config calls) alongside the existing scratch suite. - firmware/main/root.html's SSID/password/toolsserver/access-token inputs had no maxlength, so pasting something longer than the matching NVS buffer (wifi_provisioning.h's FRAME_CFG_*_MAX_LEN) was silently truncated with no indication why the device later can't connect or gets 401s. - frame_client.c's share_url buffer (256 bytes) could be too small in the worst case -- toolsserver (128) + "/frame/share/" + asset_id (47) + "?token=" + access_token (64) can reach ~266 bytes, silently dropping the token off a request that would then just 401 with no obvious cause. Widened to 320.
111 lines
3.4 KiB
HTML
111 lines
3.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>ESPRESSO Setup</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background-color: #f4f4f9;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
margin: 0;
|
|
}
|
|
.container {
|
|
background-color: white;
|
|
padding: 30px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
|
text-align: center;
|
|
width: 100%;
|
|
max-width: 320px;
|
|
}
|
|
h1 {
|
|
color: #333;
|
|
font-size: 24px;
|
|
margin-top: 0;
|
|
}
|
|
p {
|
|
color: #666;
|
|
font-size: 14px;
|
|
margin-bottom: 25px;
|
|
}
|
|
.input-group {
|
|
text-align: left;
|
|
margin-bottom: 15px;
|
|
}
|
|
label {
|
|
display: block;
|
|
font-size: 12px;
|
|
font-weight: bold;
|
|
color: #333;
|
|
margin-bottom: 5px;
|
|
}
|
|
input[type="text"],
|
|
input[type="password"] {
|
|
width: 100%;
|
|
padding: 10px;
|
|
box-sizing: border-box;
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
font-size: 14px;
|
|
}
|
|
button {
|
|
background-color: #007BFF;
|
|
color: white;
|
|
border: none;
|
|
padding: 12px;
|
|
width: 100%;
|
|
border-radius: 4px;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
margin-top: 10px;
|
|
}
|
|
button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container">
|
|
<h1>Welcome to ESPRESSO</h1>
|
|
<p>Please connect me to your local wifi network</p>
|
|
|
|
<!-- The action attribute should point to wherever your server handles the data -->
|
|
<!-- maxlength on each field below mirrors its NVS buffer size in
|
|
wifi_provisioning.h (FRAME_CFG_*_MAX_LEN) -- firmware silently
|
|
truncates past that length, so keep these in sync if those
|
|
change. -->
|
|
<form action="/save_config" method="POST">
|
|
|
|
<div class="input-group">
|
|
<label for="ssid">Wifi SSID</label>
|
|
<input type="text" id="ssid" name="ssid" placeholder="Network Name" maxlength="32" required>
|
|
</div>
|
|
|
|
<div class="input-group">
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" name="password" placeholder="Network Password" maxlength="64">
|
|
</div>
|
|
|
|
<div class="input-group">
|
|
<label for="toolsserver">Tools Server</label>
|
|
<input type="text" id="toolsserver" name="toolsserver" placeholder="e.g. 192.168.1.50:8080 or https://frame.example.com" maxlength="128" required>
|
|
</div>
|
|
|
|
<div class="input-group">
|
|
<label for="access_token">Access Token (optional)</label>
|
|
<input type="text" id="access_token" name="access_token" placeholder="only if the server's MANAGEMENT_TOKEN is set" maxlength="64">
|
|
</div>
|
|
|
|
<button type="submit">Submit</button>
|
|
|
|
</form>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |