add more stats to mobile and fix refresh stint
This commit is contained in:
16
server.js
16
server.js
@@ -371,6 +371,22 @@ app.get("/public-training/api/:shareToken", (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
app.post("/public-training/api/:shareToken/markers", (req, res) => {
|
||||
try {
|
||||
const stored = readStoredAppState();
|
||||
const marker = stored ? publicTrainingProfile.addPublicTrainingMarker(stored.state, String(req.params.shareToken || ""), req.body || {}) : null;
|
||||
if (!marker) {
|
||||
res.status(404).json({ error: "Profile or class not found" });
|
||||
return;
|
||||
}
|
||||
const nowIso = new Date().toISOString();
|
||||
db.prepare("INSERT INTO app_state (id, state_json, updated_at) VALUES (1, ?, ?) ON CONFLICT(id) DO UPDATE SET state_json = excluded.state_json, updated_at = excluded.updated_at").run(JSON.stringify(stored.state), nowIso);
|
||||
res.status(201).json({ ok: true, marker: { type: marker.type, timestamp: marker.timestamp, note: marker.note } });
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/public-training/qr/:shareToken", async (req, res) => {
|
||||
try {
|
||||
const stored = readStoredAppState();
|
||||
|
||||
Reference in New Issue
Block a user