mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-21 11:09:30 -07:00
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
This commit is contained in:
@@ -22,6 +22,9 @@
|
||||
<link rel="prefetch" href="fonts/Star4000 Extended.woff" as="font" type="font/woff" crossorigin>
|
||||
<link rel="prefetch" href="fonts/Star4000 Large.woff" as="font" type="font/woff" crossorigin>
|
||||
<link rel="prefetch" href="fonts/Star4000 Small.woff" as="font" type="font/woff" crossorigin>
|
||||
<% if (typeof serverAvailable !== 'undefined' && serverAvailable) { %>
|
||||
<script>window.WS4KP_SERVER_AVAILABLE=true;</script>
|
||||
<% } %>
|
||||
|
||||
<% if (production) { %>
|
||||
<link rel="stylesheet" type="text/css" href="resources/ws.min.css?_=<%=production%>" />
|
||||
|
||||
Reference in New Issue
Block a user