Commit graph

275 commits

Author SHA1 Message Date
12f8364a61 Redeploy to pick up meta theme footer fix 2026-02-09 07:11:53 -05:00
7c85b6e77e Document theme system and deployment workflow in CLAUDE.md 2026-02-08 15:46:51 -05:00
f5c09d873e Pin setuptools<81 — version 82 removed pkg_resources
Pyramid imports pkg_resources which was removed in setuptools 82.
Pin across requirements, Makefile, and CI scripts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 12:19:33 -05:00
37bffe29aa Install setuptools directly in CI scripts before make targets
Belt-and-suspenders: ensure setuptools is in the cached venv
before any Make target runs. Shell executor preserves env/
between builds but Python 3.12+ venvs lack setuptools.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 12:16:01 -05:00
a2e574d6b9 Install setuptools before editable install, not just in venv target
The venv target is a no-op on cached CI runners where env/bin/activate
already exists. Move setuptools install into install-source-dev-and-test
and install-source-prod so it runs every time, regardless of venv cache.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 12:11:09 -05:00
568e8757fe Bump version to 1.0.6
Forces pip to re-resolve dependencies on cached CI venvs,
pulling in setuptools.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 12:04:27 -05:00
ef4d6da410 Install setuptools in venv creation step for Python 3.12+
The requirements.py3.txt change alone wasn't enough — pip treats
setuptools specially during editable installs and may not install
it as a runtime dependency. Installing it immediately after venv
creation ensures pkg_resources is available for Pyramid and theme
loading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 12:03:44 -05:00
8d64fa11e4 Add setuptools to requirements for Python 3.12+ compatibility
pkg_resources (used for theme entry point loading) lives in
setuptools, which Python 3.12+ no longer bundles in venvs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 11:57:26 -05:00
7575f74837 Add C SDK (rb.h + rb.c) with API download endpoint and namespace settings links. 2026-02-08 11:11:54 -05:00
f661938820 AJAX progressive enhancement for all action buttons.
Lock/unlock, watch/unwatch, disable/enable, verify, approve/deny
now return JSON for XHR requests and swap client-side without a
page reload. Falls back to normal POST + redirect when JS is off.
2026-02-08 08:38:27 -05:00
637f5a7073 Respect preview visibility preference on AJAX-inserted nodes. 2026-02-08 08:27:37 -05:00
0b22261b97 Fix preview layout: indent text column to stay right of avatar. 2026-02-08 06:44:59 -05:00
393151261d Add margin-right to preview avatar for proper text spacing. 2026-02-08 06:29:04 -05:00
48e17ad0f8 Fix preview avatar hidden by nested-avatar negative margin.
The dynamic CSS sets margin-left: -48px on .nested-avatar to hang
avatars into .node padding. In the preview container (no matching
padding, overflow:hidden), this pushed the avatar off-screen.
Use plain .avatar class for preview avatars instead.
2026-02-08 06:19:02 -05:00
14379cc364 Create preview avatar via DOM API instead of hidden template element.
Browsers do not render images inside display:none containers and
re-assigning src does not reliably trigger re-render. Store the
avatar URL in a data attribute and create the img element via
document.createElement after the container is already visible.
2026-02-08 06:00:08 -05:00
3c4f5998f2 Force avatar re-render after showing preview-author div.
Browsers skip rendering images inside display:none containers.
Re-assign the src attribute after making the div visible to force
the browser to render the SVG data URI.
2026-02-08 05:37:41 -05:00
e6af04bfc6 Add cache-busting version parameter to custom.js URL.
Prevents stale JS from running against new templates after deploys.
Uses the git commit hash as a query parameter on the script URL.
2026-02-08 04:48:29 -05:00
ac5970044e Fix preview avatar: use persistent DOM element instead of innerHTML manipulation.
Move the preview author header (avatar + name + timestamp) inside the
preview div as a persistent child element that JS shows/hides, rather
than serializing it via innerHTML which was failing to render the image.
2026-02-08 04:17:46 -05:00
a42ed0dc7a Switch preview header from <template> to hidden div.
<template>.innerHTML has DocumentFragment quirks. Use a plain
hidden div instead — its innerHTML is read directly from the
normal DOM to clone the avatar and author header for previews.
2026-02-07 20:05:03 -05:00
18cd870956 Use server-rendered template for preview avatar and author header.
Replace data-attribute approach with a <template> element inside the
reply form. The server renders the avatar img and author name once;
JS clones the HTML for each preview update. This fixes the missing
avatar in the live preview and handles anonymous name updates.
2026-02-07 19:29:53 -05:00
56163ffda3 Show live preview as a node with avatar, name, and timestamp.
Reply form preview now wraps rendered markdown in node-like markup
showing the author's avatar, display name, and "just now" timestamp.
Authenticated users see their real avatar; anonymous users see their
typed name. Edit form previews are unaffected.
2026-02-07 19:14:13 -05:00
7bb2f7fa31 Render AJAX replies server-side for seamless insertion.
Instead of building minimal DOM in JS, the reply handler now renders
the full node HTML using the same Jinja2 macros (avatar, author,
date, actions, edit/reply forms) and returns it as node_html.
The JS inserts the pre-rendered fragment directly.
2026-02-07 19:01:24 -05:00
20161094fc Make rb_sudo_otp migration idempotent to fix deploy.
init_db creates the table via metadata, so alembic upgrade must
check for its existence before issuing CREATE TABLE.
2026-02-07 18:22:54 -05:00
cc2da50569 Add tests for AJAX comment submission and capability-driven presentation.
17 new tests: template validation for noscript/js-only pattern,
functional tests for AJAX replies (JSON 201, rendered HTML, parent_id,
author name, database persistence, graceful fallback to redirect),
and anonymous AJAX reply tests.
2026-02-07 17:34:59 -05:00
f9a00708db Add AJAX comment submission with graceful fallback.
Reply forms now submit via fetch() when JS is available, inserting
the new comment into the DOM without a page reload. Falls back to
the traditional POST + redirect when JS is disabled or on any error.
Documents capability-driven presentation practice in CLAUDE.md.
2026-02-07 16:39:59 -05:00
e5693b61b0 Show recently active threads by last activity, not creation date.
A 7-year-old thread getting bumped is a sign of life.
2026-02-05 17:25:02 -05:00
28120caf48 Fix topsecret dashboard: limit all sections, show actually recent threads.
Pending requests capped at 25 with total count and "more" link.
Recent threads filtered to last 30 days ordered by created (not changed).
New users capped at 50.
2026-02-05 17:24:07 -05:00
f70dfc9ed2 Rebuild topsecret dashboard for community growth.
CSS grid layout with cards for: people waiting on us (pending
namespace requests), moderation queue, spam filter catches, new
humans this week, most alive namespaces, and recent threads.
Direct, honest copy throughout.
2026-02-05 17:00:42 -05:00
17a7b9df01 Limit topsecret dashboard root nodes to 1000. 2026-02-05 16:45:53 -05:00
9f3c7e9b3a Add topsecret dashboard with links to all admin features. 2026-02-05 16:36:32 -05:00
c7e624fdd7 Fix GDPR delete account test for two-step sudo OTP flow.
Update test to perform both steps: POST with DELETE to get OTP form,
then POST with OTP code to complete deletion. Add SMTP mock since
the OTP step now sends email.
2026-02-05 16:25:48 -05:00
0667917318 Add sudo OTP verification for destructive operations.
Gate superuser promote/demote, API node deletion, and account
deletion behind an 8-digit email OTP confirmation step.
2026-02-05 16:11:50 -05:00
efd2e9f8b4 Add missing list-namespaces.j2 template for topsecret route.
The topsecret-namespaces view referenced this template but it was
never created, causing 500 errors on /topsecret/namespaces.
2026-02-05 15:47:50 -05:00
af3132930d Fix view decorators missing functools.wraps
The super_fly_required decorator was missing functools.wraps, causing
Pyramid to fail to properly register topsecret views. Added wraps to
all three view decorators for consistency.
2026-02-05 12:41:36 -05:00
89644d2117 Fix embed overflow: add box-sizing border-box with padding
Padding without border-box caused content to overflow the iframe
since body has min-width: 100%.
2026-02-02 15:38:21 -05:00
a6ee451069 Add horizontal padding to embed mode body
Prevents content from sitting flush against the iframe edges.
2026-02-02 15:22:27 -05:00
3579c89d4c Replace AI with machine learning in UI labels, docs, and CLAUDE.md 2026-02-02 15:17:59 -05:00
timehexon
6916c92333 Replace "AI" with "machine learning" in CLAUDE.md
Machine learning is what we grow. "AI" is forbidden in all
permacomputer discourse, marketing, & documentation.
2026-02-02 19:57:12 +00:00
82316fb8f7 Fix spam_held reference in thread_uri code path after rebase 2026-02-02 14:14:48 -05:00
070a6b678d Add spam moderation UI, node spam fields, and namespace spam toggle
- spam_score and spam_reason columns on Node model (alembic migration)
- spam_filter_enabled column on Namespace (owners can disable Hermes)
- check_spam always returns full result dict with score/signals/reason
- Spam data stored on every node for moderation display
- "(spam)" label on flagged nodes with hover showing Hermes explanation
- Spam moderation page at /ns/{namespace}/nodes?spam with bulk actions
- Bulk approve/disable for spam nodes with checkboxes
- Hermes reason shown prominently on spam page for each flagged node
- Namespace settings checkbox: "Enable Spam Filter (Hermes AI)"
- Namespace.spam_filter_enabled respected by LLM check gate
- spam_nodes property on Namespace for querying flagged nodes
- Unit tests for spam scoring, LLM mocked tests, live Hermes integration
  tests covering embed mode, site mode, edge cases (44 new tests)
2026-02-02 14:13:47 -05:00
timehexon
5042a7d9f1 Use embed-identical root node creation when thread_uri is provided
When thread_uri is given to POST /api/v1/threads, the API now uses
get_or_create_node_by_uri (same as the embed iframe) to create the
root node, then posts the comment as a child reply. This ensures
threads created via the API are structurally identical to those
created by the embed, so the iframe can find and display them.

Without thread_uri, behavior is unchanged (standalone root node).
2026-02-02 18:47:38 +00:00
timehexon
a3e6c0b046 Fix failing API tests after namespace validation change
- Add trailing slash to URI lookup in test_create_thread_with_uri
  to match how get_or_create_uri stores the URL
- Create localhost namespace in TestAPIAuthenticatedEditing.setUp
  since api_create_thread no longer auto-creates namespaces
2026-02-02 18:29:51 +00:00
timehexon
bc751728f5 Link thread_uri to root node in POST /api/v1/threads
The API was creating orphan root nodes with no Uri record, so
the embed iframe could never find them. Now when thread_uri is
provided, a Uri record is created and linked to the node — same
association the embed uses via get_or_create_node_by_uri.

Returns 409 if a thread already exists for the given URI.
2026-02-02 18:22:41 +00:00
timehexon
df3f3d231e Reject thread creation on nonexistent namespaces
POST /api/v1/threads now returns 404 if the namespace doesn't already
exist, instead of auto-creating it. Prevents phantom namespaces from
accumulating when callers mistype the namespace name.

get_or_create_namespace is still used for read-only endpoints (GET)
where lazy creation is acceptable.
2026-02-02 18:04:53 +00:00
66964f736a Add spam prevention, superuser system, and LLM relevance checking
- Thread creation rate limit: 1 per 7 min per user/IP via API
- is_superuser column on User model with alembic migration
- Superusers bypass namespace-scoped is_moderator() checks
- super_fly_required now checks is_superuser instead of hardcoded names
- /topsecret/users admin page to promote/demote superusers
- Spam scoring module with 6 signals (link density, patterns, duplicates,
  new account velocity, IP reputation, content length)
- Hard threshold (0.8) rejects, soft threshold (0.5) holds for moderation
- LLM relevance checking via Hermes (hermes.ai.unturf.com) on every
  message when enabled, including embed mode parent page URL context
- Admin API endpoints: GET /api/v1/admin/namespaces, recent-nodes
- Spam hunting scripts: scan.py, disable_spam.py, promote_superuser.py
- Updated Python client with admin methods
2026-02-02 09:19:16 -05:00
8d836dae34 Make Alembic migrations idempotent for SQLite
Check if columns/tables exist before adding them so migrations
don't fail on re-run when schema was applied out of band.
2026-02-02 08:31:36 -05:00
b6739fff70 Fix thread search suggestions: navigate on click, fix duplicate ID
- Add explicit click handler on suggestions so clicking navigates
  to the existing thread instead of interacting with the form
- Fix duplicate id="thread_title_input" in forms.j2 edit macro
  (renamed to edit_title_input to avoid conflict with create form)
2026-02-02 08:13:05 -05:00
c038b649b2 Fix thread search: strip stop words, use OR matching for keywords
"Do you have an API?" now correctly matches "API testing journey"
by stripping stop words (do, you, have, an) and punctuation, then
matching remaining keywords with OR logic across titles and content.
2026-02-02 08:02:02 -05:00
165aff32e2 Improve thread search to keyword matching across titles and content
Search now splits query into keywords and matches each against both
title and data fields (not just title prefix). Also searches child
node content and returns parent threads for matches.
2026-02-01 21:52:31 -05:00
c93647e2b7 Resolve @mentions in markdown preview endpoint
Pass dbsession to markdown_to_html so @username mentions are
converted to profile links during live preview, not just on save.
2026-02-01 21:44:43 -05:00