← back to Bertha
chore(alshi-dash): update 1 file (.js) [+46]
abc207cb395153a42d8f573d476554f5b353c0d4 · 2026-02-24 20:34:01 +0000 · DW Commit Agent
Files touched
Diff
commit abc207cb395153a42d8f573d476554f5b353c0d4
Author: DW Commit Agent <commit-agent@dw-agents.com>
Date: Tue Feb 24 20:34:01 2026 +0000
chore(alshi-dash): update 1 file (.js) [+46]
---
kalshi-dash/server.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/kalshi-dash/server.js b/kalshi-dash/server.js
index 5360827..9646c9f 100644
--- a/kalshi-dash/server.js
+++ b/kalshi-dash/server.js
@@ -4277,6 +4277,19 @@ const server = http.createServer(async (req, res) => {
return;
}
+ // ── PortFAUXlios Dashboard ──
+ if (urlPath === '/portfauxlios' || urlPath === '/portfauxlios/') {
+ try {
+ const dashHtml = fs.readFileSync('/root/DW-Agents/ken-portfauxlios-dashboard.html', 'utf8');
+ res.writeHead(200, { 'Content-Type': 'text/html', 'Cache-Control': 'no-cache' });
+ res.end(dashHtml);
+ } catch (e) {
+ res.writeHead(500);
+ res.end('Dashboard not found: ' + e.message);
+ }
+ return;
+ }
+
// ── Serve Static Files / SPA Routing ──
let filePath = path.join(DIST, urlPath === '/' ? 'index.html' : urlPath);
@@ -8111,6 +8124,39 @@ server.listen(PORT, '0.0.0.0', () => {
fetchNOAAWeatherIntel().catch(() => {});
}, 15000);
+ // Weekly portfolio auto-refill: $100/portfolio every Monday (4-week trial)
+ // Checks every hour, only refills on Mondays between 0:00-0:59 UTC
+ const WEEKLY_REFILL_CENTS = 10000; // $100
+ const REFILL_WEEKS_REMAINING_KEY = 'ken_refill_weeks';
+ setInterval(async () => {
+ try {
+ const now = new Date();
+ if (now.getUTCDay() !== 1 || now.getUTCHours() !== 0) return; // Monday 0:00 UTC only
+ // Check if we already refilled this week
+ const { rows: [config] } = await kenQ(
+ `SELECT value FROM ken_config WHERE key = 'last_refill_date'`
+ ).catch(() => ({ rows: [] }));
+ const today = now.toISOString().split('T')[0];
+ if (config && config.value === today) return; // Already refilled today
+ // Check weeks remaining
+ const { rows: [weeksRow] } = await kenQ(
+ `SELECT value FROM ken_config WHERE key = $1`, [REFILL_WEEKS_REMAINING_KEY]
+ ).catch(() => ({ rows: [] }));
+ const weeksLeft = weeksRow ? parseInt(weeksRow.value) : 4;
+ if (weeksLeft <= 0) { console.log('[Ken] Weekly refill: 0 weeks remaining, skipping'); return; }
+ // Refill all portfolios
+ const { rowCount } = await kenQ(
+ `UPDATE ken_portfolios SET balance_cents = balance_cents + $1`, [WEEKLY_REFILL_CENTS]
+ );
+ // Update tracking (value column is jsonb, so wrap in JSON.stringify)
+ await kenQ(`INSERT INTO ken_config (key, value) VALUES ('last_refill_date', $1::jsonb)
+ ON CONFLICT (key) DO UPDATE SET value = $1::jsonb, updated_at = NOW()`, [JSON.stringify(today)]);
+ await kenQ(`INSERT INTO ken_config (key, value) VALUES ($1, $2::jsonb)
+ ON CONFLICT (key) DO UPDATE SET value = $2::jsonb, updated_at = NOW()`, [REFILL_WEEKS_REMAINING_KEY, JSON.stringify(String(weeksLeft - 1))]);
+ console.log(`[Ken] Weekly refill: +$${WEEKLY_REFILL_CENTS/100} to ${rowCount} portfolios. ${weeksLeft - 1} weeks remaining.`);
+ } catch (e) { console.error('[Ken] Weekly refill error:', e.message); }
+ }, 60 * 60 * 1000); // Check every hour
+
// Cleanup old data every 24 hours
setInterval(() => {
cleanupOldData().catch(e => console.error('[Ken] Cleanup error:', e.message));
← 997ac4e chore(alshi-dash,kalshi-dash): update 7 files (.js) [+472/-2
·
back to Bertha
·
chore(alshi-dash): update 1 file (.js) [+147] a77b8b4 →