This commit is contained in:
cpu
2025-03-28 20:38:27 +01:00
parent b9199cd964
commit 43cf8801a0
5 changed files with 19 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ Dockerfile
README.md README.md
*.example *.example
.env .env
env
labels labels
subscriptions.json subscriptions.json

View File

@@ -4,12 +4,15 @@
# Generate using: npx web-push generate-vapid-keys # Generate using: npx web-push generate-vapid-keys
VAPID_PUBLIC_KEY= VAPID_PUBLIC_KEY=
VAPID_PRIVATE_KEY= VAPID_PRIVATE_KEY=
VAPID_SUBJECT=mailto:mailto:admin@virtonline.eu # Contact email/URL for push service VAPID_SUBJECT=mailto:mailto:admin@virtonline.eu
# --- Server Configuration --- # --- Server Configuration ---
PORT=3000 # Internal port for the Node.js app # Internal port for the Node.js app
SUBSCRIPTIONS_FILE=subscriptions.json # Path inside the container PORT=3000
DEFAULT_BUTTON_NAME=game-button # Default button name to use when not specified # Path inside the container
SUBSCRIPTIONS_FILE=/app/subscriptions.json
# Default button name to use when not specified
DEFAULT_BUTTON_NAME=game-button
# --- Authentication (Optional) --- # --- Authentication (Optional) ---
# If both USERNAME and PASSWORD are set, Basic Auth will be enabled for: # If both USERNAME and PASSWORD are set, Basic Auth will be enabled for:
@@ -28,12 +31,16 @@ ALLOWED_METHODS=POST,GET,OPTIONS
ALLOWED_HEADERS=Content-Type,Authorization ALLOWED_HEADERS=Content-Type,Authorization
# --- Web Push Retry Configuration (Optional) --- # --- Web Push Retry Configuration (Optional) ---
MAX_NOTIFICATION_RETRIES=3 # Number of retries on failure (e.g., DNS issues) # Number of retries on failure (e.g., DNS issues)
INITIAL_RETRY_DELAY_MS=1000 # Initial delay in milliseconds MAX_NOTIFICATION_RETRIES=3
# Initial delay in milliseconds
INITIAL_RETRY_DELAY_MS=1000
# --- Network Configuration (Optional) --- # --- Network Configuration (Optional) ---
DNS_TIMEOUT_MS=5000 # Timeout for DNS lookups (ms) # Timeout for DNS lookups (ms)
HTTP_TIMEOUT_MS=10000 # Timeout for outgoing HTTP requests (ms) DNS_TIMEOUT_MS=5000
# Timeout for outgoing HTTP requests (ms)
HTTP_TIMEOUT_MS=10000
# --- Logging --- # --- Logging ---
# Controls log verbosity: error, warn, info, debug # Controls log verbosity: error, warn, info, debug

2
.gitignore vendored
View File

@@ -9,7 +9,7 @@ npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
.env .env
env
# OS generated files # OS generated files
.DS_Store .DS_Store
.DS_Store? .DS_Store?

View File

@@ -291,7 +291,7 @@ app.get('/webhook/:click_type', authenticateBasic, async (req, res) => {
logger.debug(` ${headerName}: ${req.headers[headerName]}`); logger.debug(` ${headerName}: ${req.headers[headerName]}`);
}); });
logger.info(`Received GET webhook: Button=${buttonName}, Type=${click_type}, Battery=${batteryLevel}, Timestamp=${timestamp || 'N/A'}`); logger.info(`Received GET webhook: Button=${buttonName}, Type=${click_type}, Battery=${batteryLevel}%, Timestamp=${timestamp || 'N/A'}`);
// Basic validation // Basic validation
if (!click_type) { if (!click_type) {

View File

@@ -18,7 +18,7 @@ ExecStart=/usr/bin/env docker run \
--name=virt-flic-webhook-webpush \ --name=virt-flic-webhook-webpush \
--log-driver=none \ --log-driver=none \
--network=traefik \ --network=traefik \
--env-file=${APP_PATH}/.env \ --env-file=${APP_PATH}/env \
--label-file=${APP_PATH}/labels \ --label-file=${APP_PATH}/labels \
--mount type=bind,src=${APP_PATH}/subscriptions.json,dst=/app/subscriptions.json \ --mount type=bind,src=${APP_PATH}/subscriptions.json,dst=/app/subscriptions.json \
flic-webhook-webpush flic-webhook-webpush