Add WAL mode, connection pooling, pagination, and delta sync
WAL + pooling: - Enable WAL journal mode for concurrent read/write support - Add connection pool (size 4) with return_db() to reuse connections instead of opening/closing on every request Pagination: - Search results, /pages, and /tags/<name> now paginate at 50 per page - Prev/next navigation links appear when results exceed one page Delta sync: - Pages table gains last_modified timestamp, set on insert/update - /api/sites accepts ?since= param to return only changed pages - Subscription sync uses last_sync timestamp for incremental fetches - Remote pages upserted instead of delete-all/re-insert - Full sync includes all_urls list for detecting remote deletions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6981d39ddd
commit
f2e8dd042a
3 changed files with 193 additions and 69 deletions
|
|
@ -6,11 +6,11 @@ ASPECTS = ["server"]
|
|||
REQUEST_TIMEOUT = 30
|
||||
|
||||
|
||||
def fetch_remote_sites(dest_hash_hex):
|
||||
def fetch_remote_sites(dest_hash_hex, since=""):
|
||||
"""
|
||||
Connect to a remote TinyWeb instance over Reticulum and fetch its
|
||||
shared sites. Returns the response dict from /api/sites, or raises
|
||||
an exception on failure.
|
||||
an exception on failure. Pass `since` as ISO timestamp for delta sync.
|
||||
"""
|
||||
dest_hash = bytes.fromhex(dest_hash_hex)
|
||||
|
||||
|
|
@ -48,10 +48,11 @@ def fetch_remote_sites(dest_hash_hex):
|
|||
|
||||
try:
|
||||
# Request /api/sites
|
||||
query = {"since": [since]} if since else {}
|
||||
request_data = {
|
||||
"method": "GET",
|
||||
"path": "/api/sites",
|
||||
"query": {},
|
||||
"query": query,
|
||||
"body": {},
|
||||
"gateway_host": "",
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue