Skip to content

Natak-Mesh/NomadNet

Repository files navigation

NomadNet Forum System - Linode Cloud Instance

System Overview

This NomadNet cloud node provides a hierarchical forum system with user authentication and administrative tools. The system operates on three layers: Micron frontend pages, Python backend modules, and msgpack data storage.

Forum System

Architecture

  • Hierarchy: Boards → Threads → Posts
  • Backend: storage/forum.py handles all data operations (create/read/update threads and posts)
  • Frontend: Micron pages render dynamic content and forms
  • Storage: msgpack format in storage/forum_data

Key Files

  • storage/pages/forum_index.mu - Main forum page listing all boards
  • storage/pages/board.mu - Board page showing threads, handles board_id parameter
  • storage/pages/thread.mu - Thread page showing posts, handles board_id and thread_id parameters
  • storage/pages/create_thread.mu - Processes new thread creation from form data
  • storage/pages/add_post.mu - Processes reply creation from form data

Data Flow

Users navigate via links with embedded parameters (board_id, thread_id). Form submissions pass data to handler pages which call forum.py functions to modify storage.

Authentication System

Architecture

  • Backend: storage/users.py (account management), storage/sessions.py (session lifecycle)
  • Frontend: Authentication pages integrate with forum pages
  • Security: pbkdf2_hmac password hashing (100k iterations, unique salts), UUID4 session tokens
  • Session Management: 1-hour expiration, URL-based token propagation

Key Files

  • storage/users.py - User registration, password verification, account storage
  • storage/sessions.py - Session creation, validation, automatic cleanup
  • storage/pages/register.mu - User registration form and processing
  • storage/pages/login.mu - Login form, session creation, redirect handling
  • storage/pages/logout.mu - Session invalidation and cleanup

Operation Modes

  • Guest Mode: Auto-generated guest#### usernames, no registration required
  • Authenticated Mode: Persistent usernames, session-based identity

Session Propagation

Session tokens append to all forum page URLs as |session=TOKEN parameter. Each forum page checks for session token, validates it, and includes it in all outbound links to maintain authentication state.

Admin Tool

Functionality

Command-line interface (admin_tool.py) for system management:

  • Forum Management: List boards, view/delete threads and posts, search by author, pin/unpin threads
  • User Management: List users, view details, delete accounts, reset passwords
  • Session Management: View active sessions, force logout, clear all sessions

Key Features

  • Interactive navigation with numbered selections
  • Confirmation prompts for destructive operations
  • Real-time data display with color-coded output
  • Automatic session cleanup integration

File Reference

Backend Modules

  • storage/forum.py - Forum data operations, thread/post management
  • storage/users.py - User account management, password hashing
  • storage/sessions.py - Session lifecycle management, token validation
  • storage/messageboard.py - Legacy message board (backward compatibility)

Frontend Pages

  • storage/pages/forum_index.mu - Forum homepage
  • storage/pages/board.mu - Board view (dynamic, takes board_id)
  • storage/pages/thread.mu - Thread view (dynamic, takes board_id + thread_id)
  • storage/pages/create_thread.mu - Thread creation handler
  • storage/pages/add_post.mu - Post creation handler
  • storage/pages/register.mu - User registration
  • storage/pages/login.mu - User login
  • storage/pages/logout.mu - User logout

Administrative

  • admin_tool.py - Interactive command-line admin interface
  • init_forum.py - Forum system initialization
  • test_auth_backend.py - Authentication system test suite

Data Storage

Format

All data stored in msgpack binary format for efficiency and type preservation.

Files

  • storage/users - User accounts (password hashes, salts, creation timestamps)
  • storage/sessions - Active user sessions (tokens, expiration times, usernames)
  • storage/forum_data - Forum content (boards, threads, posts in hierarchical structure)

Integration

Authentication + Forum

Forum pages check for session tokens, validate them, and resolve usernames. Logged-in users see "Logged in as [username] | Logout" while guests see "Login | Register". Session tokens automatically append to all navigation links.

Guest Mode

Users can browse and post without registration. Guest usernames generate as guest#### with random 4-digit numbers. New guest names generate on each page load, providing temporary identity for post attribution.

Data Flow Summary

  1. User visits forum page with optional session token in URL
  2. Page validates session token (if present) via sessions.py
  3. Username resolved (authenticated user or guest####)
  4. Content rendered with appropriate authentication UI
  5. All links include session token to maintain state
  6. Form submissions process data via backend modules and redirect with session maintained