waitad 0.0.1 → 0.0.3
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 +10 -2
- package/dist/cli.js.map +1 -1
- package/package.json +5 -2
package/dist/cli.js
CHANGED
|
@@ -15493,6 +15493,8 @@ CONFIG="$HOME/.waitad/config.json"
|
|
|
15493
15493
|
CREATIVE=""
|
|
15494
15494
|
CAMPAIGN_ID=""
|
|
15495
15495
|
|
|
15496
|
+
TARGET_URL=""
|
|
15497
|
+
|
|
15496
15498
|
if command -v jq &>/dev/null; then
|
|
15497
15499
|
# Check expiry
|
|
15498
15500
|
EXPIRES_AT=$(jq -r '.expires_at // empty' "$CACHE" 2>/dev/null)
|
|
@@ -15511,16 +15513,22 @@ if command -v jq &>/dev/null; then
|
|
|
15511
15513
|
fi
|
|
15512
15514
|
CREATIVE=$(jq -r '.creative_text // empty' "$CACHE" 2>/dev/null)
|
|
15513
15515
|
CAMPAIGN_ID=$(jq -r '.campaign_id // empty' "$CACHE" 2>/dev/null)
|
|
15516
|
+
TARGET_URL=$(jq -r '.target_url // empty' "$CACHE" 2>/dev/null)
|
|
15514
15517
|
else
|
|
15515
15518
|
# Fallback without jq (no expiry check)
|
|
15516
15519
|
CREATIVE=$(grep -o '"creative_text":"[^"]*"' "$CACHE" 2>/dev/null | cut -d'"' -f4)
|
|
15517
15520
|
CAMPAIGN_ID=$(grep -o '"campaign_id":"[^"]*"' "$CACHE" 2>/dev/null | cut -d'"' -f4)
|
|
15521
|
+
TARGET_URL=$(grep -o '"target_url":"[^"]*"' "$CACHE" 2>/dev/null | cut -d'"' -f4)
|
|
15518
15522
|
fi
|
|
15519
15523
|
|
|
15520
15524
|
[ -z "$CREATIVE" ] && exit 0
|
|
15521
15525
|
|
|
15522
|
-
# Print ad text (no trailing newline \u2014 Claude Code renders whatever stdout contains)
|
|
15523
|
-
|
|
15526
|
+
# Print ad text with optional URL (no trailing newline \u2014 Claude Code renders whatever stdout contains)
|
|
15527
|
+
if [ -n "$TARGET_URL" ]; then
|
|
15528
|
+
printf '%s \u2014 %s' "$CREATIVE" "$TARGET_URL"
|
|
15529
|
+
else
|
|
15530
|
+
printf '%s' "$CREATIVE"
|
|
15531
|
+
fi
|
|
15524
15532
|
|
|
15525
15533
|
# Queue impression event (append-only; POSIX append is atomic for small writes)
|
|
15526
15534
|
EVENT_ID=""
|