Commit graph

72 commits

Author SHA1 Message Date
blankie
571a8fe406 add SECURITY.md 2026-06-09 03:11:43 +00:00
blankie
bddfb70fc0 README: add transparency sections, TOC, update project structure 2026-06-09 03:06:38 +00:00
blankie
dce16e313e split handlers.py into handlers/ package
- _helpers.py: CSRF, FTS sanitizer, pagination, response helpers, tag helpers
- search.py: BM25 + hybrid search, trusted/remote result rendering
- pages.py: add/edit/delete/bulk/bookmark handlers
- subscriptions.py: sync, share preview, API sites, subscription CRUD
- customize.py: settings form, about page
- tags.py: tag list and tag browse handlers
- data.py: export, import, semantic reindex handlers
- __init__.py: dispatch, re-exports, forum_plugin, _request_local

All 58 external symbols re-exported. No changes to app.py, conftest.py,
or any test file.
2026-06-09 02:34:04 +00:00
blankie
503ad787ae add .env.example for environment configuration 2026-06-09 02:14:17 +00:00
blankie
9707079deb point repo URLs to Codeberg instead of self-hosted Gitea 2026-06-09 01:41:41 +00:00
blankie
6b24c34056 clean up: remove unused start.sh/pyinstaller.spec, deduplicate constants, update .gitignore 2026-06-09 01:16:54 +00:00
blankie
8ccd8a5fd3 remove forgejo CI workflow (no releases) 2026-06-09 01:08:39 +00:00
blankie
dc484f1d60 threaded HTTP server, rate limiting, remove slow-web rhetoric 2026-06-09 01:07:36 +00:00
blankie
fa1f6ccc9e rewrite README — descriptive tone, remove releases/philosophy sections 2026-06-09 01:07:09 +00:00
blankie
86dbb6ac28 move forum layout CSS to main site template system
- Remove FORUM_CSS_DEFAULT/KODAMA2 and _forum_css() from forum handlers
- Add FORUM_CSS constant to templates.py with layout-only forum CSS
- Inject forum CSS into any template's <head> via wrap_page()
- Add forum layout styles to kodama2.html theme
- Update database custom template
2026-06-06 01:41:41 +00:00
blankie
ee20cc32d7 added tinyweb-site theme 2026-06-05 05:29:36 +00:00
blankie
c54c6c344e added site_name placeholder to templates 2026-06-05 05:29:36 +00:00
blankie
822fa6e055 hid forum link when disabled 2026-06-05 05:29:36 +00:00
blankie
086ea2eb0b updated forum README with auto-discovery 2026-06-05 05:29:36 +00:00
blankie
083ce6a11f integrated the forum plugin 2026-06-05 05:29:36 +00:00
blankie
6f3c79887c reworked to distribute via clone, not registry 2026-06-05 05:29:36 +00:00
blankie
c81f5a52b9 fixed Docker socket mount 2026-06-05 05:29:36 +00:00
blankie
b7c9a69c2d switched to host-mode Docker 2026-06-05 05:29:36 +00:00
blankie
24a4cadc70 fixed CI: Docker in container 2026-06-05 05:29:36 +00:00
blankie
ce24ff5f3c fixed CI: install jq for release 2026-06-05 05:29:36 +00:00
blankie
7942d537e3 fixed CI: --break-system-packages 2026-06-05 05:29:36 +00:00
blankie
57aa8b7b24 fixed CI: use apt-get for Python 2026-06-05 05:29:36 +00:00
blankie
feac42c5ad added pytest test suite (174 tests)
174 tests covering URL normalization, FTS5 query sanitization, SSRF/CSRF
guards, sharing-mode logic, DB schema and upsert paths, handler
end-to-end flows, and gateway body-size / mesh-whitelist guards. Each
recent bug-fix commit (6ffd38d, 1bc695f, 8dffd8c) has an explicit
regression test in test_regressions.py. One xfail documents a minor
latent bug in clean_url where port 80 is not stripped from upgraded
https URLs.
2026-06-05 05:29:36 +00:00
blankie
972d79ae5c added data-loss guards + first-run state
- Bulk delete now routes through a server-rendered confirmation page
  listing the selected titles; a `confirmed=1` form field is required
  before pages are actually deleted. Mirrors the single-delete flow.
- Reset-template button gains a JS confirm() so stray clicks don't wipe
  the custom template.
- Homepage shows a short, neutral empty-state block when the index has
  zero pages and no query — just names what tinyweb is and links to
  /add, /style, and /subscriptions as equal options.
- /about gains a "your data" section explaining what lives in
  ~/.tinyweb/ (identity file, index.db), what losing each costs, and
  how /export differs from a full backup.
- README gains a "Backups" subsection mirroring the /about copy.
2026-06-05 05:29:36 +00:00
blankie
602ab03e8f tightened network defaults, squashed bugs
Security:
- Bind HTTP gateway to 127.0.0.1 by default; add --bind for LAN opt-in
- Restrict Reticulum mesh surface to GET /api/sites only (CSRF cannot
  authenticate mesh callers, so gate by whitelist)
- Cap request body size at 16 MiB to prevent memory DoS
- Redact /bookmark query strings from request logs so the bookmark token
  and URLs do not land in stdout / docker / journal logs
- Tighten FTS5 sanitizer: strip colon, drop AND/OR/NOT/NEAR operator words
- Expand .dockerignore; document trust model in README

Features:
- Add sharing mode toggle (share everything except private vs share only
  public-tagged) with /share/preview so users can see what subscribers
  would receive before enabling sharing

Bugs:
- handle_export() crashed on every call (missing query kwarg)
- Dead float16 decompression branch in embeddings.py silently corrupted
  the HNSW index when compress_embeddings was on
- GATEWAY_PORT staleness: --port and find_available_port had no effect
  on the actual bind
- semantic_search default mismatched between db.py ("1") and the rest of
  the app ("0"), causing embeddings to be generated when the UI said off
- Connection pool returned connections with uncommitted transactions to
  the next consumer
- Gateway POST body decode 502'd on non-UTF-8 input
- ensure_rns_config clobbered user-edited ~/.reticulum/config; now only
  rewrites files it authored (sentinel-tagged)
2026-06-05 05:29:36 +00:00
blankie
cf19cbd9f8 added LoRa sync with settings UI
- Progressive retry in rns_client.py: fast timeout (15s) then slow (60s+)
  for LoRa/multi-hop links, with automatic fallback
- Background sync threads so subscriptions page returns immediately
  with syncing/error status indicators per subscription
- LoRa RNode configuration in settings page with serial port and
  expandable advanced radio settings (frequency, bandwidth, etc.)
- Internet transport now toggleable alongside LoRa — users can
  enable one, the other, or both
- Reticulum config auto-generated from settings on startup
2026-06-05 05:29:36 +00:00
blankie
c29ff59c4b fixed edge-case domains 2026-06-05 05:29:36 +00:00
blankie
6adc46e2ea added public/private toggle 2026-06-05 05:29:36 +00:00
blankie
3822722e9e optimized storage, updated readme 2026-06-05 05:29:36 +00:00
blankie
a76ce83b89 added Docker setup docs 2026-06-05 05:29:36 +00:00
blankie
3d198308a5 squashed a bunch of workflow build bugs 2026-06-05 05:29:36 +00:00
blankie
4cd5f71dd4 added bulk ops + orphaned tag cleanup
- Bulk delete and retag from browse page with checkboxes
- Select all / deselect all toggle
- Delete confirmation shows count of selected pages
- Auto-cleanup orphaned tags on delete, edit, and bulk actions
2026-06-05 05:29:36 +00:00
blankie
a636292082 privacy pass: degoogle, CSP, referrer
- Replace Google Fonts with system font stacks across all themes
- Add Referrer-Policy, X-Content-Type-Options, X-Frame-Options, CSP headers
- Add rel="noreferrer noopener" on all outbound links
- Add no-referrer and dns-prefetch-control meta tags to all themes
- Clean tracking params on outbound links from trusted/remote sources
- Remove Google domains from CSP whitelists
2026-06-05 05:29:36 +00:00
blankie
9fe671e912 added kodama2 theme
Adds pagination, meta, and success message styles, plus input
selectors for new form fields (edit page, manual entry, transport node).
2026-06-05 05:29:36 +00:00
blankie
b32aa7804f disabled semantic search by default 2026-06-05 05:29:36 +00:00
blankie
f59a68a02d added PyInstaller builds, AGPLv3, transport config
- Add pyinstaller.spec and GitHub/Forgejo CI workflows for cross-platform builds
- Add AGPLv3 license
- Move data storage to ~/.tinyweb/
- Add --version and --port CLI flags
- Add transport node selection in /style (smart regeneration preserves Reticulum config)
- Add discover more nodes link to rmap.world
2026-06-05 05:29:36 +00:00
blankie
6c1a04ad79 tightened up the add form spacing 2026-06-05 05:29:36 +00:00
blankie
74c686632d swapped to radio toggle for URL vs hash 2026-06-05 05:29:36 +00:00
blankie
c89e63f88d added dropdown to switch add/subscribe 2026-06-05 05:29:36 +00:00
blankie
63f7d401cd added reticulum hash option to add page 2026-06-05 05:29:36 +00:00
blankie
2aa24b812d added manual URL entry 2026-06-05 05:29:35 +00:00
blankie
821e45364b made semantic search optional, use meta snippets
- Add semantic_search setting to toggle AI-powered search on/off
- Skip embedding generation, hybrid search, and model preloading when disabled
- Use site owner's meta description as snippet instead of heuristic extraction
- Remove _generate_summary() and snippet() - no more generated snippets
- Show reranker/reindex controls grayed out when semantic search is off
- AI dependencies (onnxruntime, hnswlib, etc.) are now fully optional
2026-06-05 05:29:35 +00:00
blankie
0495f81a84 improved snippet extraction (heuristic)
- Case-insensitive meta description extraction (fixes sites like Lemmy
  with capitalized "Description" meta name)
- Strip aside and noscript tags for cleaner body text
- Extract paragraph text separately for better sentence quality
- Prefer sentences mentioning the site name, then first quality
  paragraph, then title as fallback
- Skip meta descriptions under 20 chars (e.g. just "Lemmy")
- Remove embedding/centroid dependency from summary generation
2026-06-05 05:29:35 +00:00
blankie
5d6c75a79a stripped noscript tags from pages
Lemmy and other JS-heavy sites include noscript fallback text like
"Javascript is disabled" that pollutes the stored body text and
generated snippets/summaries.
2026-06-05 05:29:35 +00:00
blankie
36676806d7 fixed reindex, preserved summaries
Previously reindex skipped pages that already had chunks, leaving stale
embeddings in place. It also overwrote good meta description summaries
with auto-generated ones. Now it clears all chunks first so everything
is re-embedded, and only generates summaries for pages missing one.
2026-06-05 05:29:35 +00:00
blankie
fa4a833f90 added junimo theme, bumped browse to 50 2026-06-05 05:29:35 +00:00
blankie
51e6bf2b72 added hybrid semantic search with reranking
Implements a three-stage search pipeline:
1. BM25 keyword search via FTS5 with column weights
2. Semantic search via Snowflake arctic-embed-s bi-encoder + HNSW index
3. Optional cross-encoder reranking (on by default, toggleable in settings)

Top 20 results are reranked for precision, next 10 appended from RRF
for coverage, giving 30 total results across 3 pages.

- New embeddings.py with ONNX Runtime inference, text chunking, HNSW
  index management, RRF fusion, and cross-encoder reranking
- Meta description extraction for authentic page snippets with centroid
  extractive fallback
- Stopword filtering in FTS5 queries to avoid overly strict matching
- /reindex page for batch embedding of existing pages
- Semantic embedding of remote pages during subscription sync
- ~125MB dependency footprint (onnxruntime, tokenizers, hnswlib, numpy)
- Models: 34MB bi-encoder + 22MB cross-encoder (downloaded on first use)
2026-06-05 05:29:35 +00:00
blankie
a708b753fa fixed navbar disappearing on save
Browser textarea submissions convert \n to \r\n, causing the template
comparison against DEFAULT_TEMPLATE to always fail. This saved the bare
skeleton as a custom template, overriding the default navbar.
2026-06-05 05:29:35 +00:00
blankie
e03b4c47cb redesigned subscriptions with card layout
Replace cramped table layout with card-based design that works
better in narrow viewports and across different themes.
2026-06-05 05:29:35 +00:00
blankie
f912bab3a5 disabled share_instance for reliable announces
With share_instance = Yes, announces weren't being sent over TCP
in Docker environments. Setting it to No ensures each TinyWeb
instance manages its own Reticulum interfaces directly.
2026-06-05 05:29:35 +00:00