waitad 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +19 -5
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -15551,19 +15551,33 @@ printf '{"event_id":"%s","user_id":"%s","campaign_id":"%s","ts":"%s","agent":"cl
|
|
|
15551
15551
|
|
|
15552
15552
|
exit 0
|
|
15553
15553
|
`;
|
|
15554
|
-
function makeSyncSh(
|
|
15554
|
+
function makeSyncSh() {
|
|
15555
15555
|
return `#!/usr/bin/env bash
|
|
15556
15556
|
# waitad sync \u2014 refreshes ad cache and flushes impression queue.
|
|
15557
15557
|
# Runs every 5 minutes via launchd (macOS) or cron (Linux).
|
|
15558
15558
|
set -uo pipefail
|
|
15559
15559
|
|
|
15560
|
-
|
|
15561
|
-
INSTALL_KEY="${installKey}"
|
|
15562
|
-
INSTALL_KEY_ID="${installKeyId}"
|
|
15560
|
+
CONFIG="$HOME/.waitad/config.json"
|
|
15563
15561
|
CACHE="$HOME/.waitad/cache.json"
|
|
15564
15562
|
QUEUE="$HOME/.waitad/queue.ndjson"
|
|
15565
15563
|
LOG="$HOME/.waitad/sync.log"
|
|
15566
15564
|
|
|
15565
|
+
# Read credentials from config at runtime so key rotations take effect immediately
|
|
15566
|
+
if ! command -v jq &>/dev/null; then
|
|
15567
|
+
printf '[%s] jq not found \u2014 cannot run sync\\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$LOG"
|
|
15568
|
+
exit 1
|
|
15569
|
+
fi
|
|
15570
|
+
[ -f "$CONFIG" ] || { printf '[%s] config not found\\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$LOG"; exit 1; }
|
|
15571
|
+
|
|
15572
|
+
API_BASE=$(jq -r '.api_base // "https://waitad.vercel.app"' "$CONFIG")
|
|
15573
|
+
INSTALL_KEY=$(jq -r '.install_key // empty' "$CONFIG")
|
|
15574
|
+
INSTALL_KEY_ID=$(jq -r '.install_key_id // empty' "$CONFIG")
|
|
15575
|
+
|
|
15576
|
+
if [ -z "$INSTALL_KEY" ] || [ -z "$INSTALL_KEY_ID" ]; then
|
|
15577
|
+
printf '[%s] Missing credentials in config \u2014 run waitad login\\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$LOG"
|
|
15578
|
+
exit 1
|
|
15579
|
+
fi
|
|
15580
|
+
|
|
15567
15581
|
log() { printf '[%s] %s\\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$*" >> "$LOG"; }
|
|
15568
15582
|
|
|
15569
15583
|
# \u2500\u2500 1. Refresh ad cache \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
@@ -15662,7 +15676,7 @@ var installCommand = new import_commander2.Command("install").description("Wire
|
|
|
15662
15676
|
console.warn(" Could not reach API \u2014 will retry on first sync.");
|
|
15663
15677
|
}
|
|
15664
15678
|
import_fs3.default.writeFileSync(STATUSLINE_SCRIPT, STATUSLINE_SH, { mode: 493 });
|
|
15665
|
-
import_fs3.default.writeFileSync(SYNC_SCRIPT, makeSyncSh(
|
|
15679
|
+
import_fs3.default.writeFileSync(SYNC_SCRIPT, makeSyncSh(), {
|
|
15666
15680
|
mode: 493
|
|
15667
15681
|
});
|
|
15668
15682
|
console.log(`\u2713 Scripts written to ~/.waitad/`);
|