Commit graph

125 commits

Author SHA1 Message Date
5dba9a5f6c Add .forgejo/workflows/test.yml 2025-07-06 22:53:55 +03:00
ea870dd91f Merge pull request 'Fix deployment documentation for TypeScript setup' (#16) from fix/deployment-documentation into main
Reviewed-on: deco/ice#16
2025-07-06 22:51:44 +03:00
7a09abfcb3 Merge branch 'main' into fix/deployment-documentation 2025-07-06 20:10:28 +03:00
Claude Code
45bb95fd43 Update repository URLs to new Gitea location
- Update all git clone commands to use git.deco.sh/deco/ice
- Update API documentation contact URL to Gitea repository
- Change from github.com/derekslenk/ice to git.deco.sh/deco/ice
- Rebuild TypeScript to update compiled swagger.js

All documentation and scripts now point to the correct Gitea repository.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 13:09:00 -04:00
Claude Code
84b0fe9e93 Fix deployment documentation and scripts for TypeScript setup
- Update deployment instructions to properly compile TypeScript
- Fix systemd service to run dist/server.js instead of server.js
- Standardize on /opt/icewatch as installation directory
- Change icewatch user to have bash shell for easier management
- Add explicit database creation steps
- Create quick deployment guide for simplified setup
- Update README with corrected deployment steps
- Fix all references from various names to consistent 'icewatch'

This ensures the /table route and all TypeScript features work correctly
after deployment by running the compiled JavaScript output.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 12:56:48 -04:00
Deco Vander
457875ecef Merge pull request #15 from derekslenk/feature/pwa-support
Add Progressive Web App functionality
2025-07-06 00:49:51 -04:00
Deco Vander
6661fff1b9 Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-06 00:49:25 -04:00
Claude Code
c13b61cd03 Add Progressive Web App functionality
- Add web app manifest for home screen installation
- Implement service worker with offline caching strategy
- Create offline fallback page with auto-reconnect
- Generate PWA icons in multiple sizes (72px-512px)
- Add PWA meta tags and Apple Touch icons to all pages
- Register service worker with graceful degradation
- Update documentation with PWA installation instructions
- Add browserconfig.xml for Windows tile support

Features:
- Installable on mobile and desktop
- Offline functionality with cached resources
- App-like experience in standalone mode
- Automatic updates when online
- Works seamlessly with existing progressive enhancement

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 00:46:00 -04:00
Deco Vander
10c6e54062 Merge pull request #14 from derekslenk/feature/mapbox-static-maps
Add Mapbox static map generation for non-JavaScript users
2025-07-06 00:37:04 -04:00
Claude Code
536660e818 Fix inconsistent Mapbox capitalization
Standardized "MapBox" to "Mapbox" throughout the codebase
to match official branding. Updated:

- Documentation (CLAUDE.md, README.md)
- Source code comments and console logs
- API documentation and Swagger definitions

This ensures consistent branding and professional presentation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 00:36:36 -04:00
Claude Code
75cbd921b4 Remove duplicate inline styles from noscript
Moved .nojs-notice styles to main SCSS to eliminate duplication.
The styles are already properly defined in src/scss/main.scss,
so inline styles in <noscript> tags are redundant.

This follows DRY principles and reduces code duplication.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 00:34:10 -04:00
Deco Vander
47fe31e08e Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-06 00:31:51 -04:00
Claude Code
cb0cd30243 Fix security vulnerabilities and improve code quality
Security fixes:
- Add HTML escaping to prevent XSS in table view (address & description fields)
- Fix content-type mismatch in map image service error fallback

Code quality improvements:
- Standardize logging levels (console.info for informational messages)
- Remove unused legacy fetchMapboxStaticMap method
- Replace text error fallback with valid 1x1 transparent PNG

All 128 tests passing 

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 00:22:57 -04:00
Claude Code
5562a2386c Update documentation for Mapbox static maps and progressive enhancement
- Add MapImageService documentation to CLAUDE.md
- Update environment variable requirements for unrestricted Mapbox tokens
- Document new server-side routes (/table, /submit-report, /map-image.png)
- Add progressive enhancement section explaining JavaScript vs non-JavaScript modes
- Update technology stack to reflect accessibility-first approach
- Document auto-fit static map generation with color-coded pins

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 00:14:27 -04:00
Deco Vander
ebafb1fa5a Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-06 00:13:37 -04:00
Claude Code
96dc6bde42 Add Mapbox static map generation for non-JavaScript users
- Implement MapImageService using Mapbox Static Images API
- Add server-side /table route with HTML form submission
- Generate static map images with auto-fit positioning based on actual location coordinates
- Add progressive enhancement with noscript fallbacks and Basic View button
- Update map center coordinates to proper Grand Rapids location
- Add numbered pins with color coding (red for regular, orange for persistent reports)
- Remove server-side caching to ensure fresh map images
- Fix theme toggle icon centering in CSS mixins

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 00:09:23 -04:00
Deco Vander
6cb165a3c3 Merge pull request #13 from derekslenk/cleanup/remove-unused-imports
Clean up unused imports and variables
2025-07-05 22:42:34 -04:00
Claude Code
15e117d10c Clean up unused imports and variables to improve code quality
- Remove unused imports: LocationSubmission from types, Location/ProfanityWord from server
- Remove unused variables: wordText, detectedWords in profanity rejection
- Remove unused parameters: req in skip function, wordId/updates in fallback filter
- Fix regex escaping and destructuring patterns
- Remove unused response variables in tests
- Reduce ESLint issues from 45 to 22 (eliminated all 21 errors, keeping only warnings)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 22:41:14 -04:00
Deco Vander
44873b5b27 Merge pull request #12 from derekslenk/security/fix-public-delete-vulnerability
🚨 SECURITY: Fix critical vulnerabilities in location endpoints
2025-07-05 22:16:16 -04:00
Claude Code
5517d39e9c Fix destructuring pattern in location route
Consolidate request body destructuring into single line for better code style and ESLint compliance.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 22:14:43 -04:00
Claude Code
30fdd72cc5 Add coordinate validation and ESLint integration
- Add explicit latitude/longitude validation in location submissions
- Implement ESLint with TypeScript support and flat config
- Auto-fix 621 formatting issues across codebase
- Add comprehensive tests for coordinate validation
- Update documentation with lint scripts and validation rules
- Maintain 128 passing tests with enhanced security

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 22:12:37 -04:00
Claude Code
5176636f6d Add comprehensive documentation in docs/ directory
docs/deployment.md:
- Complete deployment guide for both automated and manual setup
- Step-by-step instructions for Debian 12 ARM64
- Custom Caddy build with rate limiting plugin
- Service configuration and security setup
- Troubleshooting and maintenance sections
- Performance tuning recommendations

docs/api.md:
- Comprehensive API documentation with examples
- All public and admin endpoints documented
- Request/response schemas and validation rules
- Authentication flows and error handling
- Rate limiting and security feature documentation
- Client library examples (JavaScript, curl)

Fixes README.md reference to non-existent docs/deployment.md.
Both files provide detailed technical documentation for:
- Deployment procedures and requirements
- API usage and integration
- Security features and limitations
- Troubleshooting and maintenance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 22:03:01 -04:00
Claude Code
1918217449 Update documentation with security and testing information
README.md:
- Add comprehensive API endpoint documentation with admin routes
- Update security section with detailed protections and limits
- Add rate limiting, input validation, and authentication details
- Include testing information (125+ tests, 76% coverage)
- Update technology stack with TypeScript and security features

CLAUDE.md:
- Add detailed testing coverage information
- Document security features in API endpoints section
- Update key design patterns with security-by-design and testing
- Include input validation limits and rate limiting details
- Clarify admin-only DELETE functionality

Both files now accurately reflect:
- Current security implementations
- Comprehensive test suite
- TypeScript architecture
- Rate limiting and input validation
- Admin authentication requirements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 21:58:18 -04:00
Claude Code
88f7e72501 Fix critical security vulnerabilities in location endpoints
SECURITY FIXES:
- Remove dangerous public DELETE /api/locations/:id endpoint
- Add rate limiting to POST /api/locations (10 requests per 15 minutes)
- Add input validation with length limits (500 chars address, 1000 chars description)
- Add suspicious activity logging for abuse detection
- Install express-rate-limit for protection against spam/DoS

CHANGES:
- Removed LocationDeleteRequest interface (no longer needed)
- Updated tests to expect new security validation behavior
- Added comprehensive tests for length validation
- Fixed test setup issue with undefined constants

Security Impact:
- CRITICAL: Prevents unauthorized deletion of location reports
- HIGH: Prevents spam submissions and DoS attacks
- MEDIUM: Prevents buffer overflow and injection attacks via oversized inputs

All 125 tests passing with new security validations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 21:54:23 -04:00
Deco Vander
22e4a9dc45 Merge pull request #11 from derekslenk/feature/comprehensive-testing
Add comprehensive TypeScript test suite with 123 passing tests
2025-07-05 21:48:12 -04:00
Deco Vander
cc96940362 Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-05 21:47:28 -04:00
Claude Code
cc5803ac63 Complete comprehensive test suite implementation
- Add integration tests for admin routes with authentication
- Add unit tests for DatabaseService with proper mocking
- Fix ProfanityFilterService tests to handle case variations
- Remove old JavaScript test files
- Add coverage reporting to gitignore
- All 123 tests passing with 76% overall coverage

Coverage achieved:
- Models: 69.5% statements
- Routes: 80.6% statements
- Services: 75% statements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 21:43:09 -04:00
Claude Code
4bcc99d44b Add comprehensive TypeScript test suite with Jest
- Configure Jest for TypeScript testing with ts-jest preset
- Create comprehensive unit tests for Location model (15 tests)
- Create comprehensive unit tests for ProfanityWord model (16 tests)
- Create comprehensive unit tests for ProfanityFilterService (30+ tests)
- Create integration tests for public API routes (18 tests)
- Add test database setup and teardown utilities
- Configure coverage reporting with 80% threshold
- Install testing dependencies (@types/jest, ts-jest, @types/supertest)

Test Coverage:
- Location model: Full CRUD operations, validation, cleanup
- ProfanityWord model: Full CRUD operations, constraints, case handling
- ProfanityFilterService: Text analysis, custom words, filtering
- Public API routes: Configuration, location reporting, error handling
- Request validation: JSON parsing, content types, edge cases

Features:
- In-memory SQLite databases for isolated testing
- Comprehensive test setup with proper cleanup
- Mock profanity filters for controlled testing
- Type-safe test implementations with TypeScript
- Detailed test scenarios for edge cases and error conditions

All tests passing: 67 total tests across models and integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 21:30:07 -04:00
Deco Vander
ba0c63d14a Merge pull request #10 from derekslenk/feature/openapi-documentation
Add comprehensive OpenAPI/Swagger API documentation
2025-07-05 21:23:13 -04:00
Claude Code
612475727e Add comprehensive OpenAPI/Swagger API documentation
- Install swagger-ui-express and swagger-jsdoc dependencies
- Create comprehensive OpenAPI 3.0 specification with detailed schemas
- Add interactive Swagger UI at /api-docs endpoint
- Document all public API endpoints (/api/config, /api/locations)
- Document admin authentication and management endpoints
- Include comprehensive request/response schemas and examples
- Add authentication documentation for admin endpoints
- Update CLAUDE.md with API documentation information

Features:
- Complete API specification with OpenAPI 3.0 standard
- Interactive documentation interface with Swagger UI
- Detailed request/response examples for all endpoints
- Authentication flows for admin functionality
- Error response documentation with examples
- Type-safe integration with existing TypeScript architecture

API Documentation available at: /api-docs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 21:21:31 -04:00
Deco Vander
13c0b8b457 Merge pull request #9 from derekslenk/feature/typescript-conversion
Add comprehensive TypeScript support and conversion
2025-07-05 21:16:23 -04:00
Claude Code
c4cf921a54 Add comprehensive TypeScript support and conversion
- Convert entire backend to TypeScript with strict type checking
- Add comprehensive type definitions and interfaces
- Create typed models for Location and ProfanityWord with database operations
- Convert all services to TypeScript (DatabaseService, ProfanityFilterService)
- Convert all API routes with proper request/response typing
- Add TypeScript build system and development scripts
- Update package.json with TypeScript dependencies and scripts
- Configure tsconfig.json with strict typing and build settings
- Update CLAUDE.md documentation for TypeScript development
- Add .gitignore rules for TypeScript build artifacts

Architecture improvements:
- Full type safety throughout the application
- Typed database operations and API endpoints
- Proper error handling with typed exceptions
- Strict optional property handling
- Type-safe dependency injection for routes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 21:15:29 -04:00
Deco Vander
1c0e0ba532 Merge pull request #8 from derekslenk/feature/architecture-improvements
Major Architecture Improvements: Models/Services Layer + Frontend Refactoring
2025-07-05 19:33:23 -04:00
Claude Code
515af29034 Merge main: Resolve theme conflicts and integrate latest improvements
- Accept main branch's superior inline theme detection approach
- Keep architecture improvements from feature branch
- Maintain all new models/services layer functionality
- Preserve frontend refactoring with MapBase class

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 19:30:39 -04:00
Claude Code
f12142b63f Fix theme flash between pages (FOUC)
- Add inline script to apply theme immediately in head
- Prevents flash of light mode before auto/dark theme applies
- Script runs before DOM parsing to avoid visual flicker
- Applied to all pages: index, admin, and privacy

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 19:27:16 -04:00
Claude Code
008201aa84 Fix dark mode auto theme detection
- Add CSS media query for prefers-color-scheme detection
- Auto theme now properly follows system dark/light preference
- Maintains 3-mode cycle: auto → light → dark → auto
- Rebuilds CSS with proper @media rules for [data-theme="auto"]

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 19:25:49 -04:00
Claude Code
a0fffcf4f0 Refactor architecture: Add models/services layer and refactor frontend
Major architectural improvements:
- Created models/services layer for better separation of concerns
  - Location model with async methods for database operations
  - ProfanityWord model for content moderation
  - DatabaseService for centralized database management
  - ProfanityFilterService refactored to use models
- Refactored frontend map implementations to share common code
  - MapBase class extracts 60-70% of duplicate functionality
  - Refactored implementations extend MapBase for specific features
  - Maintained unique geocoding capabilities per implementation
- Updated server.js to use new service architecture
- All routes now use async/await with models instead of raw queries
- Enhanced error handling and maintainability

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 19:21:51 -04:00
Deco Vander
f4e5a4b37c Merge pull request #7 from derekslenk/feature/css-optimization
CSS Optimization
2025-07-05 18:58:58 -04:00
Deco Vander
01b7186052 Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-05 18:51:48 -04:00
Deco Vander
d20ce03264 Fix theme transition flash on page navigation
- Add immediate theme application in <head> section for all pages
- Prevents light mode flash when navigating in dark mode
- Script executes before body renders to apply saved theme
- Fixes flash when going from privacy policy back to home
- Maintains consistent theme experience across all pages
- Supports auto theme detection based on system preference
2025-07-05 18:47:05 -04:00
Deco Vander
6347c1de40 Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-05 18:40:34 -04:00
Deco Vander
52836e4ff8 Add missing transition and box-shadow to theme-toggle-styles mixin 2025-07-05 18:36:50 -04:00
Deco Vander
6c90430ff6 Merge pull request #6 from derekslenk/feature/css-optimization
CSS Optimization and Styling Improvements
2025-07-05 18:28:31 -04:00
Deco Vander
c5356b611a Fix map display and auto theme detection
- Add missing #map CSS styles to fix map container display
- Fix auto theme detection by implementing proper system preference detection
- Update applyTheme function in all JS files to handle 'auto' theme correctly
- System theme changes are now properly detected and applied when in auto mode
2025-07-04 16:36:41 -04:00
Deco Vander
e1be90011e Consolidate theme toggle styles and update repository references
- Extract duplicated theme-toggle styles into shared mixin (theme-toggle-styles)
- Remove duplicate CSS across privacy.scss, admin.scss, index.scss, and main.scss
- Apply mixin consistently to .theme-toggle, .theme-toggle-admin classes
- Update git repository references from GitHub to git.deco.sh
- Update README.md, privacy.html, and deploy script URLs
- Build optimized CSS with consolidated styles
2025-07-04 16:25:25 -04:00
Deco Vander
ebee173f2c Refactor privacy page styles: eliminate duplication and !important
- Create shared back-link-styles mixin in _mixins.scss for reusable button component
- Remove all duplicate back-link styling from .privacy-content .back-link and a.back-link
- Eliminate 15+ instances of !important declarations throughout privacy styles
- Use proper SCSS variables instead of hardcoded values for consistent spacing
- Add focus state to back-link mixin for accessibility compliance
- Use existing card mixin and flex-center mixin for consistent styling
- Replace hardcoded colors with CSS custom properties for theme compatibility

Benefits:
- DRY principle: One mixin defines all back-link styles
- Better maintainability: Changes in one place affect all instances
- Improved accessibility: Focus states for keyboard navigation
- Cleaner CSS: No !important declarations needed
- Theme consistency: Uses proper color variables
2025-07-04 15:03:52 -04:00
Deco Vander
8d1d62288a Remove CSS source map from version control
- Remove public/style.css.map from git tracking with git rm --cached
- CSS source maps are generated artifacts like the CSS file itself
- Already excluded in .gitignore but was previously tracked
- Keeps local file for development debugging but excludes from repo
2025-07-04 14:51:36 -04:00
Deco Vander
0953f9210e Add focus state to button mixin for accessibility
- Add :focus pseudo-class to button mixin with outline styling
- Improves keyboard navigation accessibility for all buttons
- Uses currentColor for outline to adapt to different button styles
- Meets WCAG accessibility standards for focus visibility
- Update CSS source map after rebuild
2025-07-04 14:50:14 -04:00
Deco Vander
4f6b158022 Remove !important from table styles and improve selector specificity
- Remove all !important declarations from table cell styles in _index.scss
- Increase selector specificity by changing .location-cell to td.location-cell
- Change .details-cell to td.details-cell, .time-cell to td.time-cell, etc.
- This eliminates the need for !important while maintaining proper cascade order
- Follows CSS best practices for maintainable and readable stylesheets
2025-07-04 14:46:32 -04:00
Deco Vander
9716fe9f1d Configure CSS as generated asset, not committed to git
- Added public/style.css to .gitignore
- Removed style.css from git tracking (git rm --cached)
- Enhanced package.json scripts for better CSS workflow:
  - postinstall: Auto-builds CSS on npm install
  - build-css:dev: Development build with source maps
  - start: Now builds CSS before starting server
  - dev: Builds CSS before development mode
- Updated README with CSS development documentation
- Explains SCSS organization and build process
- Documents all CSS-related npm scripts

Benefits:
 Cleaner repository (no generated files)
 Prevents merge conflicts in generated CSS
 Automatic CSS generation on new machine setup
 Source of truth is SCSS files only
 Consistent build process across environments
2025-07-04 14:43:52 -04:00