Commit Graph

12 Commits

Author SHA1 Message Date
Eddy G
771ab37eaf Improve cache error handling in various edge cases
- Add null-safe operations and fallbacks for missing properties
- Simplify retry logic and enhance error logging
- Enable default retries and improve timeout handling
2025-07-07 12:43:32 -04:00
Eddy G
7f7cb96231 Add STATIC environment variable for browser-only deployment mode
Implement STATIC=1 environment variable to enable browser-only deployment
without proxy server infrastructure. Uses WS4KP_SERVER_AVAILABLE flag to
distinguish between server-backed and static deployments for proper URL
rewriting and User-Agent header handling.

- Add STATIC env var to skip proxy route registration at startup
- Inject WS4KP_SERVER_AVAILABLE flag via EJS template based on STATIC mode
- Update fetch.mjs to conditionally send User-Agent headers based on server availability
- Update url-rewrite.mjs to skip proxy rewriting when server is unavailable
- Use renderIndex helper for consistent template data across dev/prod modes
- Improve music playlist logging

Benefits of integrated approach:
- Single environment variable controls both server and client behavior
- Flag injection happens once at render time, not on every request
- No runtime HTML string manipulation overhead
- Clean separation between server-backed and static deployment logic
- Same codebase supports both deployment modes without duplication

Static mode (STATIC=1): Direct API calls to external services, no caching
Server mode (default): Local proxy with caching and API request observability
2025-06-26 20:10:11 -04:00
Eddy G
7a07c67e84 Replace CORS proxy with complete server-side cache
- Replace cors/ directory and cors.mjs utility with comprehensive
    HTTP caching proxy in proxy/ directory
- Implement RFC-compliant caching with cache-control headers,
    conditional requests, and in-flight deduplication
- Centralized error handling with "safe" fetch utilities
- Add unified proxy handlers for weather.gov, SPC, radar, and mesonet APIs
- Include cache management endpoint and extensive diagnostic logging
- Migrate client-side URL rewriting from cors.mjs to url-rewrite.mjs
2025-06-24 20:45:43 -04:00
Matt Walsh
7efd2e8db7 add scanlines 2025-05-29 17:03:50 -05:00
Matt Walsh
32aa43c5b1 update user-agent header, now allowed in some browsers 2025-05-29 14:18:49 -05:00
Matt Walsh
0baa31a92c local forecast silent refresh 2025-04-02 20:52:33 -05:00
Matt Walsh
e2d7a96971 linting cleanup 2024-10-21 19:21:05 -05:00
Matt Walsh
7be20490e8 remove localhost-specific protocol matching 2024-05-08 16:30:11 -05:00
Matt Walsh
3743c45de6 additional eslint rules 2023-01-06 14:39:39 -06:00
Matt Walsh
3078ae6ba1 remove unused code 2022-12-14 08:31:48 -06:00
Matt Walsh
5dd8f4bd62 auto-retry for some forecast data 2022-12-12 13:53:33 -06:00
Matt Walsh
cc61d2c6d1 weather displays complete 2022-11-22 16:19:10 -06:00