Replace raw PostgreSQL SQL with data-model approach using local-time:now
as suggested by easilok. This keeps the code database backend agnostic
instead of being tied to PostgreSQL-specific syntax.
- Update USERS table schema to use TIMESTAMP instead of integer
- Add migration 003 to convert existing integer timestamps to TIMESTAMP
- Remove timestamp-to-unix calls in playlist-management.lisp (use DB default)
- Update user-management.lisp to use postmodern:execute for last-login update
- All timestamp columns now consistently use PostgreSQL TIMESTAMP type
this is (hopefully) a write once run once utility, but we're moving
from sqlite to postgres, and I don't want to lose the users that have
already signed up for the site.
Major Changes:
- Convert all JavaScript files to Parenscript for better maintainability
- Move spectrum-analyzer to parenscript/ directory structure
- Add parenscript-utils.lisp for shared utilities
- Convert admin.js, player.js, front-page.js, auth-ui.js to Parenscript
- Convert profile.js, users.js, recently-played.js to Parenscript
Stream Reconnect Fixes (from merged PR):
- Add reset-spectrum-analyzer function to properly clean up Web Audio API
- Implement reconnect logic for pauses longer than 10 seconds
- Detect stale audio in 'playing' event and force stream reconnection
- Prevent 'Now Playing' updates while stream is paused
- Reduce reconnect delay to 200ms for faster response
- Add proper spectrum analyzer reset/reinit during reconnection
UX Improvements:
- Change live indicator from blink to smooth pulse (2s ease-in-out)
- Pulse animation like old PowerBook/MacBook sleep indicator
- Add MUTED indicator to spectrum analyzer when audio is muted
- Spectrum continues to flow even when muted (data still streaming)
- Red 'MUTED' text displayed in top-right corner of canvas
Technical Details:
- Parenscript files generate JavaScript via API endpoints
- All player modes updated: main player, front page, popout, frame player
- Improved audio context handling to only create once per element
- Added comprehensive error handling and logging
- Updated asteroid.asd to include parenscript module structure
Documentation:
- Updated all documentation dates to 2025-12-06
- Added PARENSCRIPT-EXPERIMENT.org documenting the conversion
- Updated PROJECT-HISTORY.org with Phase 9 (Visual Audio Features)
- Added comprehensive project statistics (408 commits, 9,300 LOC)
This conversion improves code maintainability by using Lisp throughout
the stack and makes it easier to share code between frontend and backend.
The previous commit used uri-path() which doesn't exist in Radiance.
This caused 'The function ASTEROID::URI-PATH is undefined' errors
when trying to authenticate.
Changed to use radiance:path() which is the correct Radiance API
function for extracting the path component from a URI object.
Fixes authentication in both require-authentication and require-role.
- Add user password change functionality in profile page
- Add admin password reset functionality in admin dashboard
- Fix listener count to show total from Icecast root tag
- Replace concatenate with format
- Add with-error-handling to API endpoints
- Make Icecast port binding configurable via ICECAST_BIND env var
- Add comprehensive docstrings to public functions
Note: Password reset has known issue with LambdaLite db:update
not updating password-hash field. Issue reported as an issue.
Core Features:
- Login redirects based on user role (admin -> /admin, users -> /profile)
- User registration redirects to /profile page
- Convert user management APIs to use define-api (Radiance standard)
- Add user statistics API endpoint
- Add create user API endpoint
- Add list users API endpoint
Authentication & Authorization:
- Update require-role to return proper JSON for API requests
- Fix password verification with debug logging
- Add reset-user-password function for admin use
API Endpoints (using define-api):
- /api/asteroid/users - Get all users (admin only)
- /api/asteroid/user-stats - Get user statistics (admin only)
- /api/asteroid/users/create - Create new user (admin only)
Bug Fixes:
- Fix JavaScript API path for user-stats endpoint
- Remove dependency on non-existent radiance:api-output
- Use api-output for proper JSON responses
Testing:
- Admin login redirects to /asteroid/admin ✓
- Regular user login redirects to /asteroid/profile ✓
- User creation working (testuser created successfully) ✓
- User statistics loading correctly ✓
Known Issues (non-blocking):
- User table display needs UI fixes
- Profile page needs additional API endpoints
- Session persistence on navigation needs investigation
✅ Solution:
- require-authentication returns T on success, api-output value on failure
- Endpoints check result: if T, execute body; else return api-output value
- api-output sets response data which gets returned to client
✅ Results:
- API routes return JSON errors (not HTML redirects)
- Page routes still redirect to login
- Player page handles auth errors gracefully
- Shows 'Error loading tracks' instead of crashing
✅ Pattern:
(let ((auth-result (require-authentication)))
(if (eq auth-result t)
;; authenticated - execute endpoint
...
;; not authenticated - return api-output value
auth-result))
Thanks to easilokx for the guidance on Radiance patterns!
- Remove handler-case that was catching api-output's condition
- Pass alist data structure instead of JSON string
- Use :status and :message keyword arguments as per Radiance docs
- Detection and formatting work correctly
- Issue: api-output doesn't stop execution from helper function
- Need Radiance-specific pattern (redirect works, api-output doesn't)
✅ Working:
- Auto-detects API requests from /api/ in URI
- Optional :api keyword parameter for explicit control
- Returns JSON for API requests, redirects for pages
- Page redirects work perfectly (admin page redirects to login)
- API detection logs show correct behavior
❌ Issue:
- API endpoints still execute after require-authentication returns JSON
- radiance:api-output doesn't stop execution like redirect does
- Need proper Radiance mechanism to halt request processing
Question for easilokx:
What's the correct way to stop execution and return JSON from a helper
function like require-authentication? We tried api-output but execution
continues. How does redirect actually stop execution?
- Add api-auth-error condition for API authentication failures
- Update require-authentication and require-role to detect /api/ routes
- Add :api keyword parameter for explicit API/page mode
- Auto-detects API requests from URI path
- Returns JSON for API requests, redirects for page requests
- Issue: Execution continues after returning JSON, need Radiance-specific solution
## Docker Infrastructure Improvements
- **Liquidsoap Upgrade**: Updated to latest savonet/liquidsoap:792d8bf tag
- **Port Configuration**: Resolved port conflicts, standardized on port 8000 for streaming
- **Service Integration**: Docker Icecast (8000) + Asteroid web app (8080) architecture
- **Script Updates**: Fixed docker-compose commands for legacy compatibility
- **Documentation**: Comprehensive updates to setup-complete.org with correct URLs
## User Management System Fixes
- **Database Field Handling**: Fixed list vs string format inconsistencies in RADIANCE i-lambdalite
- **Authentication Flow**: Resolved "string designator" errors in user initialization
- **Admin Creation**: Fixed default admin user detection and creation logic
- **Session Management**: Proper handling of user ID storage and retrieval
## Web Interface Improvements
- **Navigation Routes**: Fixed /player/ → /player route mismatch
- **Link Consistency**: All navigation links now match defined routes
- **Template Integration**: Proper CLIP template processing with corrected data types
## Configuration Management
- **RADIANCE Config**: Fixed r-simple-wsessions typo in startup modules
- **Domain Setup**: Added "asteroid" domain to RADIANCE configuration
- **Service Dependencies**: Proper module loading order and error handling
## System Integration
- **Dual-Port Architecture**: Streaming (8000) + Web Interface (8080) separation
- **Service Status**: Integration points for Docker service monitoring
- **Audio Pipeline**: Liquidsoap → Icecast → Web Player workflow established
## Testing & Validation
- **Stream Verification**: Confirmed http://localhost:8000/asteroid.mp3 streaming
- **Web Access**: Validated http://localhost:8080/asteroid/ interface
- **User Authentication**: Tested login/logout and admin panel access
- **Database Operations**: Verified track metadata and user management
This commit establishes a fully functional internet radio streaming platform
with containerized audio services and integrated web management interface.
- Fixed find-user-by-id to handle BIT type database IDs
- Updated user-has-role-p to extract role from list format
- Enhanced API endpoint to return properly formatted JSON data
- Added comprehensive debugging for authentication flow
- Created login.chtml template with CLIP data binding
- Resolved 'Error loading users' issue in admin panel
- Fix database query syntax for RADIANCE hash table returns
- Handle RADIANCE field storage format (lists instead of strings)
- Configure r-simple-sessions module for session management
- Update login page styling to match main site theme
- Implement working authentication with admin/asteroid123
- Add proper error handling and debug logging
- Ensure session persistence and redirects work correctly