aboutsummaryrefslogtreecommitdiffstats
path: root/api/api.go
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-12 21:35:46 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-12 21:35:46 -0800
commitde96851d8eb0a0b45d7bf0cee67339fea54349f0 (patch)
treed9ca55835743e2254732ea68a674e7007f3554eb /api/api.go
parent8a8f516ebd1115eed6256cd1b60be6393fd42c26 (diff)
downloadneko-de96851d8eb0a0b45d7bf0cee67339fea54349f0.tar.gz
neko-de96851d8eb0a0b45d7bf0cee67339fea54349f0.tar.bz2
neko-de96851d8eb0a0b45d7bf0cee67339fea54349f0.zip
wip: tui updates (buggy)
Diffstat (limited to 'api/api.go')
-rw-r--r--api/api.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/api/api.go b/api/api.go
index b9e63ba..b6ecba2 100644
--- a/api/api.go
+++ b/api/api.go
@@ -88,7 +88,13 @@ func HandleItem(w http.ResponseWriter, r *http.Request) {
jsonError(w, "invalid json", http.StatusBadRequest)
return
}
- i.Id = id
+ if i.Id == 0 {
+ i.Id = id
+ }
+ if i.Id != id {
+ jsonError(w, "id mismatch", http.StatusBadRequest)
+ return
+ }
i.Save()
jsonResponse(w, i)
@@ -150,6 +156,10 @@ func HandleFeed(w http.ResponseWriter, r *http.Request) {
jsonError(w, "invalid json", http.StatusBadRequest)
return
}
+ if f.Id == 0 {
+ jsonError(w, "missing feed id", http.StatusBadRequest)
+ return
+ }
f.Update()
jsonResponse(w, f)