fix: TS build errors in cron.ts and CampaignDetail; serve at /magpie/
- cron.ts: cast split+map destructuring results to tuple types ([string,string,...] and [number,number]) — length guards already ensure these are safe; TypeScript just can't infer it from split() - CampaignDetail: api.posts.trigger → api.posts.triggerSingle (correct name) - .env.example: document sessions_dir + updated reddit_session_file default - manage.sh build now produces a clean zero-warning dist
This commit is contained in:
parent
e9b4cdd88e
commit
a19183ae92
3 changed files with 10 additions and 5 deletions
|
|
@ -16,8 +16,12 @@ DEBUG=false
|
|||
# Database location (default: ~/.local/share/magpie/magpie.db)
|
||||
# DB_PATH=/path/to/magpie.db
|
||||
|
||||
# Session file location (default: ~/.local/share/magpie/session.json)
|
||||
# REDDIT_SESSION_FILE=/path/to/session.json
|
||||
# Sessions directory (multi-user layout: alan_reddit.json, cf_reddit.json, etc.)
|
||||
# SESSIONS_DIR=/home/youruser/.local/share/magpie/sessions
|
||||
|
||||
# Default Reddit session file (backward compat; used by campaign scheduler)
|
||||
# Defaults to SESSIONS_DIR/alan_reddit.json — override if your setup differs.
|
||||
# REDDIT_SESSION_FILE=/home/youruser/.local/share/magpie/sessions/alan_reddit.json
|
||||
|
||||
# APScheduler
|
||||
SCHEDULER_ENABLED=true
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ onMounted(async () => {
|
|||
async function triggerSub(sub: string) {
|
||||
triggeringSub.value = sub
|
||||
try {
|
||||
await api.posts.trigger(campaignId, sub)
|
||||
await api.posts.triggerSingle(campaignId, sub)
|
||||
recentPosts.value = await api.posts.list(campaignId, undefined, 20)
|
||||
} catch (e: unknown) {
|
||||
toast.error(`Trigger failed for ${sub}: ${e instanceof Error ? e.message : 'Unknown error'}`)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ function parseDow(dow: string): string {
|
|||
}
|
||||
// Range: 1-5
|
||||
if (dow.includes('-')) {
|
||||
const [start, end] = dow.split('-').map(Number)
|
||||
const [start, end] = dow.split('-').map(Number) as [number, number]
|
||||
if (start === 1 && end === 5) return 'Weekdays'
|
||||
if (start === 0 && end === 6) return 'Every day'
|
||||
return `${DAYS[start]}-${DAYS[end]}`
|
||||
|
|
@ -45,7 +45,8 @@ export function humanizeCron(expr: string | null | undefined): string {
|
|||
const parts = expr.trim().split(/\s+/)
|
||||
if (parts.length !== 5) return expr
|
||||
|
||||
const [minute, hour, dom, month, dow] = parts
|
||||
// Cast to tuple — length guard above guarantees all five are present.
|
||||
const [minute, hour, dom, month, dow] = parts as [string, string, string, string, string]
|
||||
|
||||
const everyMinute = minute === '*'
|
||||
const everyHour = hour === '*'
|
||||
|
|
|
|||
Loading…
Reference in a new issue