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
*.example
.env
env
labels
subscriptions.json

View File

@@ -4,12 +4,15 @@
# Generate using: npx web-push generate-vapid-keys
VAPID_PUBLIC_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 ---
PORT=3000 # Internal port for the Node.js app
SUBSCRIPTIONS_FILE=subscriptions.json # Path inside the container
DEFAULT_BUTTON_NAME=game-button # Default button name to use when not specified
# Internal port for the Node.js app
PORT=3000
# Path inside the container
SUBSCRIPTIONS_FILE=/app/subscriptions.json
# Default button name to use when not specified
DEFAULT_BUTTON_NAME=game-button
# --- Authentication (Optional) ---
# 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
# --- Web Push Retry Configuration (Optional) ---
MAX_NOTIFICATION_RETRIES=3 # Number of retries on failure (e.g., DNS issues)
INITIAL_RETRY_DELAY_MS=1000 # Initial delay in milliseconds
# Number of retries on failure (e.g., DNS issues)
MAX_NOTIFICATION_RETRIES=3
# Initial delay in milliseconds
INITIAL_RETRY_DELAY_MS=1000
# --- Network Configuration (Optional) ---
DNS_TIMEOUT_MS=5000 # Timeout for DNS lookups (ms)
HTTP_TIMEOUT_MS=10000 # Timeout for outgoing HTTP requests (ms)
# Timeout for DNS lookups (ms)
DNS_TIMEOUT_MS=5000
# Timeout for outgoing HTTP requests (ms)
HTTP_TIMEOUT_MS=10000
# --- Logging ---
# Controls log verbosity: error, warn, info, debug

2
.gitignore vendored
View File

@@ -9,7 +9,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
.env
env
# OS generated files
.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.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
if (!click_type) {

View File

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