[Contribution] v2.6.0 — CII Expansion to 54 Countries, Architecture Optimization, Security Hardening & Multilingual Documentation #1050
sjkncs
started this conversation in
Show and tell
Replies: 1 comment
-
|
Dear @sjkncs Thank you - you should submit multiple PRs so we review , this is great work |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @koala73 👋
First of all, thank you so much for creating and maintaining World Monitor. It is truly one of the most impressive open-source OSINT platforms we've ever seen — the depth of the architecture (60+ edge functions, Proto-first API contracts, tri-variant system, Tauri desktop app) is remarkable. We've been using it extensively and are deeply grateful for your work.
We've been working on a set of contributions that we'd love to share with the project. We took great care to follow the existing code style, architecture patterns, and testing conventions. All changes pass
tsc --noEmit(zero errors), the existing 12 unit tests, and the Vite production build.Below is a detailed summary of what we've done. We'd be honored if you'd consider any of these for upstream inclusion.
🌍 1. CII Expansion: 22 → 54 Countries + Adaptive Weights
What changed
The Country Instability Index now monitors 54 nations
(up from 22), organized into 5 geopolitical categories:
adaptive weights
A new
getAdaptiveWeights()function dynamically adjusts CII component weights per country based on baseline risk and event multiplier:Files modified
src/config/countries.ts—TIER1_COUNTRIESexpanded from 22 → 54src/services/country-instability.ts— All data tables expanded (COUNTRY_KEYWORDS,BASELINE_RISK,EVENT_MULTIPLIER,ISO3_TO_ISO2,COUNTRY_BOUNDS,ZONE_COUNTRY_MAP,HOTSPOT_COUNTRY_MAP) +getAdaptiveWeights()function + integration intocalculateCII()andgetCountryScore()src/App.ts— Deep link?country=XXnow resolves against 54 countriesData gap found & fixed
During automated testing, we discovered that
COUNTRY_BOUNDSwas missing entries for UAE (AE) and Qatar (QA). Added:AE: [22, 26, 51, 56]andQA: [24, 27, 50, 52].🏗️ 2. RefreshScheduler Module Extraction
Motivation
App.tscontained inline refresh scheduling logic with a standaloneinFlight: Set<string>that could overlap with periodic refreshes. We extracted this into a dedicated module.What changed
Created
src/services/refresh-scheduler.tswith:schedule()— register periodic tasks with jittered intervals (±10%)runGuarded()— unified in-flight deduplication shared between initial loads and periodic refreshesflushStale()— staggered re-triggers on tab re-focus after background periodmarkInFlight()/clearInFlight()/isRunning()— external integration APIdestroy()— clean shutdownModified
src/App.ts:private inFlight = new Set<string>()withprivate readonly scheduler = new RefreshScheduler()loadAllData()now usesscheduler.runGuarded()for all data tasksloadDataForLayer()now usesscheduler.markInFlight()/clearInFlight()📊 3. CII ↔ Market Cross-Validation Service
What it does
New service (
src/services/cii-market-crosscheck.ts) that correlates CII scores with country ETF and stock index performance to validate signals:MarketServiceClientconfirmed— CII rising + market falling → instability confirmedmarket_leading— Market falling but CII stable → market sees risk firstnoise— CII rising but market calm → possible news noiserecovery— CII falling + market rising → recovery confirmedstable— Both calm → no signal📺 4. YouTube Availability Detection
Problem
In regions where YouTube is blocked (China or other countries mainland behind GFW, some corporate networks), the dashboard showed broken iframes for LiveNews and Webcam panels.
Solution
Created
src/services/youtube-availability.ts:youtube.com/favicon.icowithno-corsmode and 5-second timeoutonlinenetwork change events (VPN toggle)LiveNewsPanel.tsandLiveWebcamsPanel.tsto show localizedyoutube_blocked/youtube_checkingmessagesen.json🔒 5. Security Hardening
validateFeedUrl()enforces domain allowlist on redirect targetsapi/rss-proxy.jsJSON.stringify()for safe parameter injectionapi/youtube/embed.jsRetry-Afterheaders, fail-open on Redis errorsapi/_rate-limit.js/api/healthendpoint probing Redis + external sources (BBC, GitHub, YouTube), returns 200/503api/health.jsmiddleware.ts🗺️ 6. MapContainer Async DeckGL Import
Modified
src/components/MapContainer.tsto dynamically import DeckGLMap:readyPromise resolves once the async import completeswithDeck()buffers callbacks in a deferred queue during import, replays them once loaded🌐 7. Multilingual Documentation
Created
docs/i18n/directory with 10 files:README.zh.mdREADME.ja.mdREADME.ko.mdREADME.ar.mdREADME.de.mdREADME.it.mdREADME.fr.mdCHANGELOG.zh.mdSECURITY.zh.mdINDEX.mdAlso added an 8-language navigation header to the main
README.md.🧪 8. Testing & Verification
tsc --noEmit— exit 0, zero errorstests/verify-cii-data.mjs): 15/15 pass — verifies 54-country coverage across all 5 CII data tables, adaptive weights integration, RefreshScheduler API, service module exports, and API endpoint security featuresSummary of Files
New files (6 source + 10 docs)
src/services/refresh-scheduler.tssrc/services/youtube-availability.tssrc/services/cii-market-crosscheck.tsapi/health.jsapi/_rate-limit.jstests/verify-cii-data.mjsdocs/i18n/*.mdModified files (12)
src/App.tssrc/config/countries.tssrc/services/country-instability.tssrc/components/MapContainer.tssrc/components/LiveNewsPanel.tssrc/components/LiveWebcamsPanel.tssrc/locales/en.jsonapi/rss-proxy.jsapi/youtube/embed.jsapi/youtube/embed.test.mjsmiddleware.tsREADME.mdCHANGELOG.mdOur Approach
noUncheckedIndexedAccess, etc.)We would be happy to submit this as a PR if you're interested, or to break it into smaller focused PRs per area. We're also very open to feedback — if any of the approaches don't align with your vision for the project, we're glad to adjust.
Thank you again for this incredible project. It's a privilege to contribute. 🙏
This contribution was developed with AI-assisted pair programming (Cascade/Claude) for code generation and review, following the project's AI-Assisted Development guidelines.
Beta Was this translation helpful? Give feedback.
All reactions