fix(api): report writable the same way PUT decides, return backup path
- GET /api/projects now returns writable: canWrite(req) + token_required, so the backoffice no longer claims it can save when ADMIN_TOKEN is set (PUT answered 403) - PUT response exposes database + backup (forward-slash relative paths), drop the dead payload.backup assignment - fail fast with a Thai hint when the database cannot be opened (permissions or corrupt file) instead of an unhandled stack trace - AGENTS.md: document the two response fields
This commit is contained in:
1 parent
c2a2733172
commit
0fa0406770
4 files changed
+35
-9
No files matched your search
+5
-1
@@ -202,7 +202,11 @@ export async function probePublishApi() {
|
||||
const res = await fetch(API_URL, { method: "GET", cache: "no-store" });
|
||||
if (!res.ok) return { available: false, status: res.status, message: `HTTP ${res.status}` };
|
||||
const body = await res.json();
|
||||
return { available: true, writable: Boolean(body?.writable) };
|
||||
return {
|
||||
available: true,
|
||||
writable: Boolean(body?.writable),
|
||||
tokenRequired: Boolean(body?.token_required),
|
||||
};
|
||||
} catch (error) {
|
||||
return { available: false, status: 0, message: "เชื่อมต่อเซิร์ฟเวอร์ไม่ได้" };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user