Make the feed URL editable, with a copy button
Entries and history are keyed by feed id, so changing a URL keeps them -- the point being that a feed URL can carry an auth token that gets rotated. Changing it clears the stored ETag/Last-Modified, which belong to the old URL and could otherwise produce a bogus 304. The copy button cannot use navigator.clipboard: that needs a secure context and this is served over plain HTTP on a LAN address. Falls back to execCommand. Invalid input now returns 400 rather than 500. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RPyeapneuXrCdojsaiXGbe
This commit is contained in:
11
src/db.rs
11
src/db.rs
@@ -231,6 +231,17 @@ impl Db {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Forgets the cached ETag/Last-Modified. Those validators belong to the old URL, so
|
||||
/// keeping them across a URL change could produce a bogus 304 against the new one.
|
||||
pub fn clear_validators(&self, feed_id: &str) -> Result<()> {
|
||||
let conn = self.conn.lock().unwrap();
|
||||
conn.execute(
|
||||
"UPDATE feeds SET etag = NULL, last_modified = NULL, last_checked = NULL WHERE id = ?1",
|
||||
[feed_id],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_feed_error(&self, feed_id: &str, url: &str, msg: &str) -> Result<()> {
|
||||
let conn = self.conn.lock().unwrap();
|
||||
conn.execute(
|
||||
|
||||
Reference in New Issue
Block a user