No description
Find a file
Deco Vander 45a8d67362 Refactor: Extract UTC parsing logic to parseUTCDate helper function
- Add parseUTCDate helper function to handle timestamp UTC parsing consistently
- Eliminates code duplication across getTimeAgo, getTimeRemaining, and expiry functions
- Applied to admin.js, app-mapbox.js, app-google.js, and app.js
- Ensures consistent UTC timezone handling throughout all frontend JavaScript
- Addresses Copilot AI feedback for better code maintainability and DRY principles

The parseUTCDate function handles the logic:
timestamp.includes('T') ? timestamp : timestamp + 'Z'

This ensures all timestamp parsing uses the same UTC interpretation logic.
2025-07-04 13:16:33 -04:00
.github/workflows Update deploy scripts to create a PR 2025-07-03 22:53:53 -04:00
public Refactor: Extract UTC parsing logic to parseUTCDate helper function 2025-07-04 13:16:33 -04:00
routes feat: isolate profanity filter with separate database 2025-07-04 00:03:24 -04:00
scripts Update HTML files to use Bunny.net CDN for static assets 2025-07-03 20:44:16 -04:00
tests feat: isolate profanity filter with separate database 2025-07-04 00:03:24 -04:00
.env.example Update HTML files to use Bunny.net CDN for static assets 2025-07-03 20:44:16 -04:00
.gitignore Initial commit: ICE Watch Michigan community safety tool 2025-07-02 23:27:22 -04:00
jest.config.js feat: isolate profanity filter with separate database 2025-07-04 00:03:24 -04:00
original-style.css Remove unused Sass/SCSS setup 2025-07-03 21:56:26 -04:00
package-lock.json feat: isolate profanity filter with separate database 2025-07-04 00:03:24 -04:00
package.json feat: isolate profanity filter with separate database 2025-07-04 00:03:24 -04:00
profanity-filter.js feat: isolate profanity filter with separate database 2025-07-04 00:03:24 -04:00
README.md Update deployment URLs 2025-07-04 02:55:36 +00:00
s3-bucket-policy.json Update HTML files to use Bunny.net CDN for static assets 2025-07-03 20:44:16 -04:00
server.js feat: isolate profanity filter with separate database 2025-07-04 00:03:24 -04:00

Great Lakes Ice Report

A community-driven web application for tracking winter road conditions and icy hazards in the Great Lakes region. Reports automatically expire after 48 hours to maintain current information.

Features

  • 🗺️ Interactive Map - Real-time location tracking centered on Grand Rapids
  • Fast Geocoding - Lightning-fast address lookup with MapBox API
  • 🔄 Auto-Expiration - Reports automatically removed after 24 hours
  • 👨‍💼 Admin Panel - Manage and moderate location reports
  • 📱 Responsive Design - Works on desktop and mobile devices
  • 🔒 Privacy-Focused - No user tracking, community safety oriented

Quick Start

Prerequisites

  • Node.js 18+
  • MapBox API token (free tier available)

Local Development

  1. Clone the repository:

    git clone git@github.com:deco/great-lakes-ice-report.git
    cd great-lakes-ice-report
    
  2. Install dependencies:

    npm install
    
  3. Configure environment variables:

    cp .env.example .env
    # Edit .env with your MapBox token
    
  4. Start the server:

    npm start
    
  5. Visit the application:

    http://localhost:3000
    

Environment Variables

# Required for fast geocoding
MAPBOX_ACCESS_TOKEN=pk.your_mapbox_token_here

# Admin panel access
ADMIN_PASSWORD=your_secure_password

# Server configuration
PORT=3000

Deployment

Automated Deployment (Debian 12 ARM64)

  1. Run the deployment script on your server:

    curl -sSL https://ice-puremichigan-lol.s3.amazonaws.com/scripts/deploy.sh | bash
    
  2. Deploy your application:

    git clone git@github.com:deco/great-lakes-ice-report.git /opt/great-lakes-ice-report
    cd /opt/great-lakes-ice-report
    npm install
    
  3. Configure environment:

    cp .env.example .env
    nano .env  # Add your API keys
    
  4. Start services:

    sudo systemctl enable great-lakes-ice-report
    sudo systemctl start great-lakes-ice-report
    sudo systemctl enable caddy
    sudo systemctl start caddy
    

Manual Deployment

See docs/deployment.md for detailed manual deployment instructions.

API Endpoints

  • GET /api/locations - Get active location reports
  • POST /api/locations - Submit new location report
  • GET /api/config - Get API configuration
  • GET /admin - Admin panel (password protected)

Technology Stack

  • Backend: Node.js, Express.js, SQLite
  • Frontend: Vanilla JavaScript, Leaflet.js
  • Geocoding: MapBox API (with Nominatim fallback)
  • Reverse Proxy: Caddy (automatic HTTPS)
  • Database: SQLite (lightweight, serverless)

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

Security

  • API keys are stored in environment variables
  • Admin routes are password protected
  • Database queries use parameterized statements
  • HTTPS enforced in production

License

MIT License - see LICENSE file for details

Support

This is a community safety tool. For issues or questions:

  • Create a GitHub issue
  • Check existing documentation
  • Review security guidelines

⚠️ Safety Notice: This tool is for community awareness. Always prioritize personal safety and know your rights.