Commit graph

141 commits

Author SHA1 Message Date
Claude Code
8b1787ec47 Add comprehensive internationalization (i18n) with Spanish language support
This major feature introduces complete internationalization architecture with Spanish (Mexico) as the first additional language:

## New Features:
- **I18n Architecture**: Complete client-side and server-side internationalization system
- **Spanish (Mexico) Support**: Full es-MX translations for all user-facing text
- **Language Selector**: Dynamic language switching UI component in header
- **API Endpoints**: RESTful endpoints for serving translations (/api/i18n)
- **Progressive Enhancement**: Language detection via Accept-Language header and cookies

## Technical Implementation:
- **Frontend**: Client-side i18n.js with automatic DOM translation and language selector
- **Backend**: Server-side i18n service with locale detection middleware
- **Build Process**: Automated copying of translation files to dist/ directory
- **Responsive Design**: Language selector integrated into header controls layout

## Files Added:
- public/i18n.js - Client-side internationalization library
- src/i18n/index.ts - Server-side i18n service
- src/i18n/locales/en.json - English translations
- src/i18n/locales/es-MX.json - Spanish (Mexico) translations
- src/routes/i18n.ts - API endpoints for translations

## Files Modified:
- package.json - Updated build process to include i18n files
- public/index.html - Added i18n attributes and language selector
- public/app.js - Integrated dynamic translation updates
- src/server.ts - Added locale detection middleware
- src/scss/pages/_index.scss - Language selector styling

This implementation supports easy addition of future languages and maintains backward compatibility while providing a seamless multilingual experience.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-07 12:25:44 -04:00
Decobus
9b7325a9dd Merge pull request 'Improve table readability and fix single-point map zoom' (#19) from fix/table-readability-and-map-zoom into main
Reviewed-on: deco/ice#19
2025-07-07 18:54:41 +03:00
Claude Code
1cf3a09e20 Improve README deployment script documentation
- Add clear reference to local deployment script as recommended option
- Document contents of scripts/ directory at the start of deployment section
- Clarify that deploy.sh automates the entire setup process
- Make it easier for users to find and use the local deployment script

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-07 11:44:39 -04:00
Claude Code
e0eeb1e944 Improve table readability and fix single-point map zoom
- Increase font sizes in location table for better readability
- Center-align "Persistent" text in time remaining column
- Fix static map zoom level when displaying single location
- Use zoom level 13 for single points to show neighborhood context

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-07 10:15:43 -04:00
Claude Code
916deea68a Remove duplicate root-level JavaScript files
- Remove legacy JS files: models/, routes/, services/, server.js, profanity-filter.js
- Keep TypeScript source files in src/ as single source of truth
- Clean up project structure to eliminate confusion
- All functionality now properly contained in src/ directory

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 19:41:17 -04:00
Claude Code
dc6754a0fc Add Git installation to deployment script
- Install git package alongside Node.js and build-essential
- Ensures git is available for cloning the repository
- Prevents deployment failures on minimal server images

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 19:00:32 -04:00
Claude Code
c395183158 Sync all deployment documentation and remove manual database creation
- Align deploy.sh, deployment.md, and deployment-quickstart.md with consistent steps
- Remove manual database file creation (SQLite creates them automatically)
- Update all documents to use npm run build instead of npm run build:ts
- Add architecture support for both ARM64 and x86_64
- Include S3_BUCKET_NAME=none option for local-only deployment
- Fix step numbering after removing database creation step

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 18:37:48 -04:00
Claude Code
e2b3593c37 Fix database path issues and update deployment instructions
- Fix DatabaseService.ts to use correct relative paths (../../ instead of ../../../)
- Add npm run build step to deployment instructions
- Add database file creation step to deployment instructions
- Fix Caddyfile download to go directly to /etc/caddy/Caddyfile
- Update step numbering in deployment script

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 18:33:08 -04:00
Claude Code
429a5d4afc Update workflow to inject S3 bucket name into deployment script
- Workflow now updates deploy.sh with the actual S3 bucket name before uploading
- Add S3_BUCKET_NAME=none override option to README for local-only deployment
- Update README to show both ARM64 and x86_64 support

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 18:14:04 -04:00
Claude Code
70deab5bbf Update deployment script and documentation
- Add S3 bucket support with fallback to ice-puremichigan-lol
- Update deployment script to handle both S3 and local file copying
- Support custom S3 bucket via S3_BUCKET_NAME environment variable
- Update HTTPS clone URL in README and deploy.sh
- Improve CLAUDE.md with single test execution instructions
- Update deployment paths to use /opt/icewatch

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 18:08:44 -04:00
Claude Code
8f7c805cd9 Update deployment script to use /opt/icewatch directory
- Change app directory from /opt/great-lakes-ice-report to /opt/icewatch
- Update system user from great-lakes-ice-report to icewatch
- Update service file name to icewatch.service
- Update all paths and references throughout the script

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 17:40:34 -04:00
Claude Code
ad6cc45328 Add x86_64 support to deployment script
- Add architecture detection for both ARM64 and x86_64
- Dynamically download correct Go binary based on architecture
- Add debug output to show detected architecture
- Handle 32-bit ARM with clear error message
- Update script header to indicate multi-architecture support

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 17:31:10 -04:00
eaadf6e4b8 Update .forgejo/workflows/deploy-scripts.yml 2025-07-06 23:45:30 +03:00
Claude Code
08b1d37982 Switch from OIDC to access key authentication in deploy-scripts workflow
- Remove id-token write permission
- Replace role-to-assume with aws-access-key-id and aws-secret-access-key
- Remove role-session-name parameter

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 16:38:47 -04:00
f4d3f58f74 Merge pull request 'Add .forgejo/workflows/deploy-scripts.yml' (#18) from deco-patch-2 into main
Reviewed-on: deco/ice#18
2025-07-06 23:26:51 +03:00
d7dee6f8b4 Add .forgejo/workflows/deploy-scripts.yml 2025-07-06 23:26:00 +03:00
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