Compare commits

...
Author SHA1 Message Date
Antigravity AI 3ac36446bf chore(ci): add prisma generate to pipeline [Patch] 2026-04-18 14:04:51 +12:00
Antigravity AI ac95a64115 feat(plugins): implement marketplace updates and fix SDK global injection [Minor]
- add /check-updates mechanism to check with marketplace [Minor]
- inject zustand into WWV_HOST to prevent plugin crashes [Patch]
- fix next.config.ts sentry schema [Patch]
2026-04-18 13:39:46 +12:00
Antigravity AI 1d07698df7 feat(plugins): surface dynamic plugin loading failures to UI toast 2026-04-17 19:43:21 +12:00
Antigravity AI 583622f091 fix(plugins): reject fallback unknown-package manifests in validator 2026-04-17 19:41:35 +12:00
Antigravity AI bfdbd0313d feat(marketplace): add explicit server-side error logging for rejected manifests 2026-04-17 17:03:07 +12:00
Antigravity AI a70f93af0a fix(plugins): allow CDNs for dynamic plugin bundles and add marketplace debug logs 2026-04-17 16:59:15 +12:00
Antigravity AI 26970e6adc build: remove plugin packages from core workspace 2026-04-17 13:41:11 +12:00
Antigravity AI 63bc49949a refactor: decouple frontend from specific plugin logic 2026-04-17 13:04:49 +12:00
Antigravity AI ce45f2d4b6 fix(osm): force IPv4 resolution in proxy to bypass docker IPv6 dropouts 2026-04-16 20:17:37 +12:00
Antigravity AI bec1080cb8 chore(osm): instrument osm proxy error handler for docker debugging 2026-04-16 20:06:37 +12:00
Antigravity AI ed4826484c fix(osm): replace native Next.js fetch with node https client to bypass IPv6 timeout crashes in docker environment 2026-04-16 19:50:37 +12:00
Antigravity AI 77e6bf1d55 fix(ws): normalize engine URL to always include /stream path and wss:// protocol 2026-04-16 19:21:45 +12:00
Antigravity AI fa6413e953 fix(build): sync pnpm-lock.yaml after dependency updates to fix frozen lockfile crash [Patch] 2026-04-16 18:26:43 +12:00
Antigravity AI 53a9931e94 feat(plugins): refactor all plugins to fetch directly from data engine
Updated wildfires, surveillance-satellites, satellite, iranwarlive,
international-sanctions, maritime, military-aviation, gps-jamming,
cyber-attacks, civil-unrest, and earthquakes to bypass Next.js rewrites.
2026-04-16 17:23:20 +12:00
Antigravity AI 055ead345a feat(config): remove legacy REST proxy, point plugins directly at engine
Remove /api/external/ rewrite from next.config.ts.
Update Aviation plugin fetch() to call engine REST API directly
using NEXT_PUBLIC_DEFAULT_ENGINE_URL.
2026-04-16 17:21:22 +12:00
Antigravity AI 89c247e913 feat(ui): update DataBusSubscriber for multi-engine WsClient
Resolve engine URL per-plugin via resolveEngineUrl() before
subscribing. Remove eager wsClient.connect() — connections
are now lazy on first subscription.
2026-04-16 17:20:38 +12:00
Antigravity AI df7df20c46 feat(ws): refactor WsClient to multi-engine connection pool
Supports connecting to multiple Data Engines simultaneously.
Each plugin resolves its own engine URL. Connections are lazily
opened on first subscription and cleaned up after a 30s grace
period when all plugins unsubscribe.
2026-04-16 17:20:11 +12:00
Antigravity AI b738072e05 feat(data): add resolveEngineUrl utility for multi-engine support 2026-04-16 17:19:42 +12:00
Antigravity AI 414ac3b194 feat(sdk): add streamUrl to ServerPluginConfig and DataSourceConfig 2026-04-16 17:19:20 +12:00
Antigravity AI f3b48ac302 refactor(data-engine): extract wwv-data-engine into standalone repo [Minor]
- Bump version to 1.11.0 [Minor]
- Remove wwv-data-engine code, docker-compose and package.json scripts [Patch]
2026-04-16 15:13:59 +12:00
SilvertakanaandAntigravity AI bea39455e6 feat(sanctions,conflict-zones): enable selection and hover intel for sanctioned countries and conflict zones [Minor] (#28)
- Attach _wwvEntity to Resium Entity refs via bindWwvEntity() so InteractionHandler picks them [Minor]
- Build synthetic GeoEntity payloads from static ConflictZone data for conflict-zones plugin [Minor]
- Add sanctions-specific hover fields (country, severity, OFAC count) to EntityInfoCard [Minor]
- Add conflict zone hover intel (escalation score, status, trend) to EntityInfoCard [Minor]
- Bump wwv-plugin-international-sanctions 1.0.0 → 1.1.0 [Minor]
- Bump wwv-plugin-conflict-zones 1.0.0 → 1.1.0 [Minor]
- Bump root 1.9.1 → 1.10.0 [Minor]

Closes #27

Co-authored-by: Antigravity AI <[email protected]>
2026-04-16 15:01:17 +12:00
Antigravity AI 1a984251b6 chore(core): update configurations and roadmap [Patch]
- set default edition back to local in .env [Patch]

- add AI & Sharing feature stage to ROADMAP [Patch]

- configure workspace limits in tsconfig and rootDir for osm-search [Patch]

- add superpowers documentation for expanding chips and plugin versioning [Patch]
2026-04-16 01:26:00 +12:00
SilvertakanaandAntigravity AI 67ca2abdbc feat: configure demo defaults via env vars (#26)
* feat(core): configure default demo plugins via env vars [Minor]

- parse NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS in AppShell [Minor]

- inject defaultEnabled in layersSlice initLayer [Patch]

- document demo defaults in .env.example [Patch]

* fix(core): enable plugin polling on boot and fix gps ID string [Patch]

---------

Co-authored-by: Antigravity AI <[email protected]>
2026-04-16 01:20:05 +12:00
SilvertakanaandAntigravity AI b10e7d0a7f fix(core): resolve generic TS errors and update type definitions across plugins [Patch] (#24)
- add npx prisma generate to CI action before type checks [Patch]

- fix missing globSync import in workspace type tests [Patch]

- fix GlobeView undefined indexing for entity rendering [Patch]

- fix OSMSearchPlugin zoom property to flyToBaseDistance [Patch]

- allow getSidebarComponent to accept an optional plugin prop [Patch]

- map categories for embassies and spaceports [Patch]

Co-authored-by: Antigravity AI <[email protected]>
2026-04-16 00:57:03 +12:00
SilvertakanaandAntigravity AI 6be56b9966 feat: Expand OSM Search Plugin with curated chips and live Taginfo autocomplete (#23)
* feat(osm-search): expand quick preset tags with OSINT categories

* feat(osm-search): add live Taginfo autocomplete for unlisted tags

* chore: bump version to 1.2.0 for osm autocomplete feature

* fix(osm-search): align tsconfig to prevent TS6059 in CI

---------

Co-authored-by: Antigravity AI <[email protected]>
2026-04-16 00:23:44 +12:00
SilvertakanaandAntigravity AI 4951a2d047 feat(osm-search): implement OSM Search plugin with Bellingcat-style proximity (#21)
* feat(osm): setup plugin shell and state

* feat(osm): implement locking b-box overlay

* feat(api): overpass dumb proxy

* feat(osm): implement sidebar and search query builder

* feat(osm): register osm search plugin

* feat(osm-search): implement OSM Search plugin with Bellingcat-style proximity [Minor]

- implement @worldwideview/wwv-plugin-osm-search package [Minor]
- add Next.js proxy route for Overpass API with mirror fallback [Patch]
- implement real-time bounding box selection with dynamic updates [Patch]
- implement advanced proximity intersection mode using 'around' queries [Minor]
- fix core rendering issues (visibility, depth-test, eyeOffset) [Patch]
- refactor viewer initialization for instant plugin loading [Patch]
- align Cesium/Resium versions and fix JSDOM localStorage tests [Patch]

---------

Co-authored-by: Antigravity AI <[email protected]>
2026-04-15 17:04:05 +12:00
SilvertakanaandAntigravity AI 3fa1aeb80c chore: update repo tooling (#19)
* chore(core): add ci workflow and update gitignore [Patch]

- add github actions CI pipeline [Patch]

- update gitignore for scripts and IDEs [Patch]

* chore(core): add worktree testing script [Patch]

---------

Co-authored-by: Antigravity AI <[email protected]>
2026-04-15 01:06:52 +12:00
SilvertakanaandAntigravity AI c6b27a6079 feat: Conditional loading of Google 3D Tiles via custom API key (#15)
* feat(core): conditionally load Google 3D Tiles via custom API key [Minor]

- change default baseLayerId to bing-aerial [Patch]
- useViewerInit skips Google 3D layer unless key present [Minor]
- add reload prompt to ApiKeysTab on Google Maps key save [Patch]

* fix(map): implement persistent user layer intent and ui fallback highlighting

---------

Co-authored-by: Antigravity AI <[email protected]>
2026-04-15 00:56:10 +12:00
SilvertakanaandAntigravity AI c8c619210f chore: update repo tooling and worktree testing (#17)
* chore(core): add ci workflow and update gitignore [Patch]

- add github actions CI pipeline [Patch]

- update gitignore for scripts and IDEs [Patch]

* chore(core): add worktree testing script [Patch]

---------

Co-authored-by: Antigravity AI <[email protected]>
2026-04-15 00:13:07 +12:00
SilvertakanaandAntigravity AI 01f923b806 chore: change pull_request to pull_request_target for fork PR security scopes (#16)
Co-authored-by: Antigravity AI <[email protected]>
2026-04-14 22:25:06 +12:00
111r1ck 487cb46f03 feat: implement USGS earthquakes layer pipeline (#12) 2026-04-14 22:12:01 +12:00
d05f93e610 chore: add agentic Claude workflow comment to globals.css (#7)
* chore: add agentic Claude workflow comment

Add a marker comment at the top of src/app/globals.css documenting
the active agentic Claude workflow as of April 2026.

Co-Authored-By: Claude Haiku 4.5 <[email protected]>

* chore: duplicate agentic Claude workflow comment at top of globals.css

Co-authored-by: Silvertakana <[email protected]>

* fix(data-engine): restore Prisma schema URL and fix TypeScript strict mode error [Patch]

- Restore url = env("SUPABASE_DATABASE_URL") to prisma/schema.prisma (regressed in 76243e0)
- Delete invalid prisma.config.ts that Prisma cannot parse
- Fix TS18046 strict mode error in seeders/cyberAttacks.ts by narrowing unknown error type
- Bump version to 1.2.1

---------

Co-authored-by: Antigravity AI <[email protected]>
Co-authored-by: Claude Haiku 4.5 <[email protected]>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Silvertakana <[email protected]>
2026-04-14 18:13:12 +12:00
Silvertakana 701b7b3b23 Merge pull request #5 from silvertakana/add-claude-github-actions-1776077011251
Add Claude Code GitHub Workflow
2026-04-14 11:51:37 +12:00
Antigravity AI 1eff015bbb Add symlink from claude.md to agents.md 2026-04-13 22:49:26 +12:00
Silvertakana 84129f1d9e "Claude Code Review workflow" 2026-04-13 22:43:36 +12:00
Silvertakana 60dbc5af66 "Claude PR Assistant workflow" 2026-04-13 22:43:34 +12:00
Antigravity AIandClaude Sonnet 4.6 8abc2ea2ef chore(repo): add /tmp/ to .gitignore for credential safety [Patch]
- prevent accidental commits of temporary credential files stored in /tmp/

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-12 22:39:42 +12:00
Antigravity AIandClaude Sonnet 4.6 76243e08c0 feat(core): custom entity camera tracking, shared plugin libs, GDELT civil unrest [Minor]
- add HeadingPitchRoll-based camera tracking with smooth zoom easing for locked entities [Minor]
- add high-res playback timing in AnimationLoop with store-throttled UI updates [Minor]
- add wwv-lib-aviation, wwv-lib-facilities, wwv-lib-incidents shared base class libraries [Minor]
- refactor plugins to extend shared base classes (airports, aviation, military, facilities) [Patch]
- migrate civil unrest seeder from ACLED to GDELT API [Minor]
- expand international sanctions seeder with full entity coverage [Patch]
- fix all workspace:* dependency references across monorepo package.json files [Patch]
- fix WebGL vertex buffer rewrite at 60fps by removing per-frame trail position reassignment [Patch]
- update AGENTS.md with dev commands, Docker volumes, and Claude Code context [Patch]
- remove database-incident-recovery-procedures skill [Patch]

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-12 22:37:31 +12:00
Antigravity AI 57d6bbbe02 fix(data-engine): revert ACLED API base URL to correct endpoint [Patch]
* Reverted ACLED API base URL to api.acleddata.com
* Kept OAuth token logic
* Version bumped to 1.1.5
2026-04-09 23:16:58 +12:00
Antigravity AI e1910011aa fix(data-engine): update ACLED seeder to use OAuth flow and bump version to 1.1.4 [Patch]
* Replaced ACLED_API_KEY with ACLED_PASSWORD in .env.example
* Refactored fetchAllACLEDEvents to request OAuth tokens since API keys are deprecated
* Updated ACLED base URL to the latest endpoint
2026-04-09 23:05:44 +12:00
Antigravity AI f81d9315e0 chore(civil-unrest): revert data engine polling schedule to daily 2026-04-09 22:55:28 +12:00
Antigravity AI 48cf43e68d chore(civil-unrest): adjust data engine polling to every 12 hours 2026-04-09 22:51:36 +12:00
Antigravity AI f30a539ebf chore(civil-unrest): increase frontend polling interval to 12 hours 2026-04-09 22:49:36 +12:00
Antigravity AI 57a602eb60 chore(civil-unrest): bump version to 1.1.0 for ACLED integration 2026-04-09 22:38:51 +12:00
Antigravity AI a2c8dd2f55 feat(civil-unrest): update frontend plugin for real ACLED data fields 2026-04-09 22:38:24 +12:00
Antigravity AI f272a9a617 feat(civil-unrest): enable ACLED civil unrest seeder 2026-04-09 22:37:54 +12:00
Antigravity AI 8fe71c637d feat(civil-unrest): replace mock seeder with ACLED API integration 2026-04-09 22:37:27 +12:00
Antigravity AI aee5154eaf feat(civil-unrest): add ACLED API env vars to .env.example 2026-04-09 22:36:38 +12:00
Antigravity AI ae8c422c2f fix(globe): Resolve 3D model entity LOD highlighting and label visibility
fix(data-engine): Prevent core engine crash when Supabase Postgres is unreachable (fallback to SQLite cache)
2026-04-09 19:15:37 +12:00
Antigravity AI e61928b2a1 docs(agents): add database incident recovery skill and migration rules 2026-04-09 18:34:58 +12:00
Antigravity AI 7749804365 chore(repo): hygiene, issue templates, and security scrubbing
- fix: scrub hardcoded AUTH_SECRET from public .env file
- docs: revamp README.md with OSINT and plugin quickstart guides
- feat: add GitHub Issue Templates (Bug, Feature, Plugin)
- chore: establish /local-scripts/ sandbox and remove root clutter
- chore: enforce rule 5.8 for Workspace Hygiene in AGENTS.md
- chore: bump version to 1.6.6
2026-04-09 18:31:09 +12:00
Antigravity AI c115058008 feat: add AdUnit component, undersea cable API route, GitHub issue templates, and update documentation 2026-04-09 16:07:30 +12:00
Antigravity AI 86c97ec191 fix(ads): add test mode attribute to bypass live bidding delays 2026-04-09 12:27:34 +12:00
Antigravity AI b5b925dd06 fix(globe): gracefully respond to Google 3D Tiles 404 errors by adding fallback to OsmBuildings
perf(config): drastically reduce Google Maps Tile API costs by caching more and bumping tile load tolerances
2026-04-09 12:25:05 +12:00
Antigravity AI 7488677f7a fix(wwv-data-engine): fix TS18046 error in strict mode and fastify typings 2026-04-09 00:09:03 +12:00
Antigravity AI 14a8bf5369 fix(core): disable satellite clustering and fix ws snapshot parsing 2026-04-08 23:28:21 +12:00
Antigravity AI 96e4a1c591 feat(gps-jamming): implement h3 hexagon grid visualization 2026-04-08 23:26:31 +12:00
Antigravity AI 6cb6dfd1d6 fix(maritime, cables): resolve trail rendering and missing generic paths 2026-04-08 23:25:26 +12:00
Antigravity AI c31871b321 feat(surveillance-satellites): UI parity and cone rendering implementation
- feat(wwv-plugin-sdk): add disableClustering entity option [Minor]

- feat(surveillance-satellites): implement dynamic SVGs, depth culling suppression, and filter engine definitions for UI parity [Minor]

- feat(globe): enable frustum cone sensor footprint hook for surveillance-satellite plugin class [Minor]
2026-04-08 23:20:41 +12:00
Antigravity AI 245118412f feat(cyber-attacks): rewrite plugin for AlienVault OTX threat intelligence 2026-04-08 22:58:39 +12:00
Antigravity AI a75a4f0f9a feat(data-engine): add cyber attacks history route for timeline playback 2026-04-08 22:56:28 +12:00
Antigravity AI f8664d8255 feat(data-engine): replace mock cyber attacks with AlienVault OTX feed 2026-04-08 22:54:14 +12:00
Antigravity AI dad91079b2 feat(data-engine): add geoip-lite helper and db index for cyber attacks 2026-04-08 22:47:34 +12:00
Antigravity AI 273112424c chore(ads): add public ads.txt file and CSS for AdSense requirement
- chore(ads): add Google AdSense publisher verification file
- fix(ui): adjust DemoAdStrip rendering styles
- chore(release): bump package version to 1.5.4
2026-04-06 22:19:05 +12:00
Antigravity AI 9cc51f483a fix(globe): resolve ship trail culling logic and primitive processor bugs
- fix(maritime): fix ship trail rendering and missing paths
- refactor(core): optimize chunked processor evaluation loops
- chore(release): bump package version to 1.5.3
2026-04-06 22:19:04 +12:00
Antigravity AI 0adef65616 docs(agents): strictly update versioning workflow constraints
- Require SemVer level tracking per individual change
- chore(release): bump package version to 1.5.2
2026-04-06 22:19:03 +12:00
Antigravity AI 5b2b8a0a8d fix(feedback): increase screenshot capture delay to prevent native UI ghosting 2026-04-06 19:57:29 +12:00
Antigravity AI f33e7efb8d feat(diagnostics): add multi-screenshot and global log catcher to feedback system 2026-04-06 11:10:44 +12:00
Antigravity AI 425dcbbc8e fix(camera): bypass auth on demo mode proxy and fix thumbnail mixed-content 2026-04-06 10:56:12 +12:00
Antigravity AI 484104a2b0 feat: add user feedback popup dialog to DataConfigPanel
Added a new FeedbackDialog component with state managed via uiSlice. Also updated AGENTS.md to enforce SemVer during our agentic workflow commits.
2026-04-06 10:22:06 +12:00
Antigravity AI 7e34ab6da0 fix(data-engine): resolve SQLite query timeout and 500 error in aviation/maritime routes
Removed expensive SQLite history trails from lookback REST paths since the frontend only uses lookback for freshness filtering on the Redis snapshot. Added ts-only indexes for playback queries and a daily data retention pruning job to prevent unbounded table growth.
2026-04-06 10:20:58 +12:00
Antigravity AI 5b45d79790 fix(deploy): map wwv-data-engine to coolify proxy network 2026-04-06 01:44:19 +12:00
Antigravity AI 7684d23398 fix(deploy): fix Coolify Next.js env var inlining, CSP, and Analytics 2026-04-06 01:33:20 +12:00
Antigravity AI a5610f0c8d feat(core): plugin stability fixes, UI enhancements, and ad integration 2026-04-05 21:03:06 +12:00
Antigravity AI 4d178544e5 fix(layout): adjust mobile header logo and search bar shrink behavior 2026-04-05 19:16:42 +12:00
Antigravity AI 8a58f4a732 fix(ads): handle unfilled layout, remove extra label, and add adsense verification tag 2026-04-05 19:02:52 +12:00
Antigravity AI 026eaae074 fix(components): track missing properties directory 2026-04-05 14:34:13 +12:00
Antigravity AI 6515b43711 fix(build): remove rootDir from plugin tsconfig to resolve TS6059 2026-04-05 14:24:49 +12:00
Antigravity AI 94a0ca4731 feat(demo): implement structural AdSense sidebar for demo environments 2026-04-05 13:50:18 +12:00
Antigravity AI de60ed3ffe perf(build): optimize Next.js docker build memory limits 2026-04-05 12:21:50 +12:00
Antigravity AI f5898b253a fix: Sync pnpm-lock.yaml and bypass Prisma CLI interactive prompts in Docker 2026-04-05 11:25:32 +12:00
silvertakana 561a44fe77 fix(build): ensure prisma client is generated in wwv-data-engine production stage 2026-04-04 13:00:54 +13:00
silvertakana b431fc526a fix(build): exclude plugin backends and data engine from next js typescript compilation 2026-04-04 12:26:28 +13:00
silvertakana 3deefc9607 fix(build): remove disabled mock plugins from transpilePackages 2026-04-04 10:03:16 +13:00
silvertakana 20363d509b feat(plugins): disable mock data plugins for live demo, bump to 1.2.0 2026-04-03 20:48:02 +13:00
silvertakana 134c3a5443 chore: bump version to 1.1.0 and restrict backend scripts to wwv-data-engine 2026-04-03 17:43:53 +13:00
silvertakana ab4cb2553a feat(plugins): implement international sanctions plugin and seeder 2026-04-03 17:42:20 +13:00
silvertakana 3bc3b3461f feat(plugins): implement cyber attacks plugin and seeder 2026-04-03 17:36:14 +13:00
silvertakana 11a75b6458 feat: implement military aviation plugin and data engine integration with adsb.fi polling and storage 2026-04-02 23:10:39 +13:00
silvertakana 62b8436353 feat(websocket): instantly push live cached snapshot to frontend upon successful subscription 2026-04-02 22:18:29 +13:00
silvertakana 875eda7ea2 fix(globe): resolve dynamic spiderifier clustering flicker and add mobile sizing responsive layout 2026-04-02 22:18:21 +13:00
silvertakana 82246daab0 fix(data-engine): properly copy seedData into production image 2026-04-02 21:38:04 +13:00
silvertakana 7513ff9dfa fix(data-engine): move fallback seed out of docker ignored namespace to enable self healing in coolify 2026-04-02 21:29:34 +13:00
silvertakana 96b032c2d0 perf(redis): fix maritime interval leak and batch snapshots to 15s 2026-04-02 21:12:12 +13:00
silvertakana de4f77d250 fix: exposing port 5001 for wwv-data-engine 2026-04-02 20:46:31 +13:00
silvertakana 7c59ba4dc3 fix(deploy): resolve docker context bloat and fix data engine ESM imports 2026-04-02 20:25:44 +13:00
silvertakana 951e070466 fix(redis): remove HSET pipelining for setLiveSnapshot 2026-04-02 18:12:11 +13:00
silvertakana adadce06b1 fix: remove prisma/config wrapper dependency to prevent Next standalone docker container from crashing 2026-04-02 15:32:35 +13:00
silvertakana 2341409bb4 fix: remove dotenv/config from prisma config causing container runtime crashes 2026-04-02 15:12:01 +13:00
silvertakana 7fee8e9fcf chore: remove accidentally tracked node_modules from workspace packages 2026-04-02 14:52:21 +13:00
silvertakana 682c21296c fix(docker): remove redundant node_modules copy, fix prisma generate env, fix hydrate script typings 2026-04-02 13:46:01 +13:00
silvertakana aec6f20edc chore: optimize dockerfiles for faster deployments via layer caching and BuildKit 2026-04-02 12:31:14 +13:00
silvertakana c89b55884f chore: migrate data engine to port 5001 and expose via docker-compose 2026-04-02 11:49:21 +13:00
silvertakana ded3ae9416 fix(docker): inject pnpm workspaces to build step 2026-04-01 22:55:39 +13:00
silvertakana 0808326967 feat: consolidate backends into dual-tier data engine 2026-04-01 22:43:58 +13:00
silvertakana 889bd5aade fix(iranwarlive): switch default api fetch url to use public tracking domain directly 2026-04-01 16:54:12 +13:00
silvertakana a17aafa6f6 feat(deployment): prefix iranwarlive routes and shift internal port to 5001 2026-04-01 16:21:39 +13:00
silvertakana 18da3a492c fix(deployment): resolve backend port collision by proxying traffic through next.js rewrites 2026-04-01 15:49:55 +13:00
silvertakana 2fd3f84b2f fix: add jose as explicit dependency for Docker build 2026-04-01 14:43:40 +13:00
silvertakana 68d350572f fix: use Next.js-provided webpack instance instead of direct import 2026-04-01 14:36:42 +13:00
silvertakana 7660e707f7 fix: commit missing IranWarLive backend files for deployment 2026-04-01 14:25:34 +13:00
silvertakana f510c7de34 feat: enhance globe visuals, clustering, and add IranWarLive plugin
Changes include:
- Style spiderifier background circles and fix clipping
- Implement horizon occlusion mapping for datapoints
- Stabilize spiderifier grouping persistence and smooth zooming scaling behavior
- Format intel panel timestamps and selection box UI
- Add backend and plugin for IranWarLive data scraping and historical events
2026-03-31 23:10:07 +13:00
silvertakana 35e9e7d70d fix(video): add balticlivecam.com as known video platform provider 2026-03-31 22:37:06 +13:00
silvertakana 74f3793313 fix(globe): make dynamic stack clustering update instantly on zoom without debounce 2026-03-31 13:34:12 +13:00
silvertakana 913e25ccac Feat: Add multi-touch pinch-to-zoom and pan support for mobile devices 2026-03-31 13:26:42 +13:00
silvertakana 2ec151c68b Feat: Add zoom/pan support for popped-out images 2026-03-31 13:19:23 +13:00
silvertakana cf49eef883 Style: Overlay popout button on top of intel images 2026-03-31 13:14:47 +13:00
silvertakana b56dacf04f Feat: Add support for popping out photos in IntelTab to floating windows 2026-03-31 13:05:26 +13:00
silvertakana 22bb77492e Fix: Make DataConfig panels scrollable 2026-03-31 12:27:41 +13:00
silvertakana ca1447f26a feat(globe): Dynamic camera-distance based icon clustering 2026-03-30 23:05:29 +13:00
silvertakana 7f1bf00ef7 feat: display timestamp, type, and casualties in entity hover card 2026-03-30 19:36:54 +13:00
silvertakana aeb9ddb96b fix: immediately request scene render when selection anchor state changes 2026-03-30 19:32:37 +13:00
silvertakana 3852e1175d feat: hide boxed reticle when camera is locked to entity 2026-03-30 19:21:39 +13:00
silvertakana 1474e28de0 feat: add boxed reticle effect for selected entities 2026-03-30 19:16:40 +13:00
silvertakana 8a5ace61b2 feat(security): apply marketplace admin registry remediations
- Use timingSafeEqual for demo admin secret (C1)
- Add isDemoAdmin session check to mutating marketplace routes (H2)
- Overwrite plugin trust blindly during install to prevent bypass (M2)
- Add rate limiting and CORS to disabled-builtins endpoint (H1)
- Reduce marketplace JWT expiry to 4h and implement JTI checking (H3)
- Drop private IP space from grant-token redirect allowlist (M3)
- Demote Bearer token parsing strictly to startsWith+slice (L4)
- Strip dataSource.headers on load endpoint for anon demo traffic (M4)
- Document LB trust considerations for IP rate limiting header extraction (M1)
2026-03-30 14:42:24 +13:00
silvertakana 932713e7a2 docs: sync public docs to current implementation
- SETUP.md: npm  pnpm, remove internal .agents/ from folder tree, replace webpack HMR note with DB tip
- ARCHITECTURE.md: fix 'Abstration' typo
- creating-a-plugin.md: replace 'edit knownPlugins.ts' step (internal) with correct npm submission flow, npm  pnpm commands, update flow diagram to match actual marketplace arch
2026-03-30 14:17:15 +13:00
silvertakana 50228a43c8 chore: update Dockerfiles to use pnpm for installation 2026-03-29 22:33:00 +13:00
silvertakana 326c69e92f fix(globe): default all entities to depth-tested (disableDepthTestDistance: 0) 2026-03-28 18:49:29 +13:00
silvertakana e3225d4dab fix(globe): enable depthTestAgainstTerrain and use disableDepthTestDistance: 0 for aviation 2026-03-28 18:37:23 +13:00
silvertakana 23d1538ea2 fix(globe): enable depth testing for airplanes to prevent rendering through globe 2026-03-28 18:27:52 +13:00
silvertakana 5f89715ee6 fix(plugins): enable click-to-filter for aviation and wildfire bands 2026-03-26 23:13:35 +13:00
silvertakana 22f22ead37 feat(plugins): implement getLegend in maritime, military-aviation, and wildfire plugins 2026-03-26 22:56:12 +13:00
silvertakana 5eff117972 feat(ui): implement legend API and interactive layer filtering via Intel Tab 2026-03-26 22:50:47 +13:00
silvertakana b92e5b3683 feat: add satellite tracking plugin 2026-03-26 22:24:04 +13:00
silvertakana b79f0f025d docs: update all setup instructions to use npm run setup 2026-03-26 17:45:42 +13:00
silvertakana f40615ee21 feat: add npm run setup to auto-generate .env.local for local hosting
- scripts/setup.mjs: generates .env.local from .env.example with a
  randomly generated AUTH_SECRET; skips if .env.local already exists
- package.json: adds 'setup' script as the first command new users run
- .gitignore: un-ignores scripts/setup.mjs while keeping rest of /scripts/ private
2026-03-26 17:41:59 +13:00
silvertakana 222ae0950e fix: make env_file optional for Coolify Docker Compose deployments 2026-03-26 17:30:33 +13:00
silvertakana afe89f8c0e fix: add VOLUME declaration for /app/data for Coolify/Dockerfile deployments 2026-03-26 17:29:02 +13:00
silvertakana 867e495353 fix: pass AUTH_SECRET to Docker and always run migrations on startup
- docker-compose.yml: inject AUTH_SECRET (fail-fast), WWV_DEMO_ADMIN_SECRET,
  and WWV_BRIDGE_TOKEN from host environment so JWT sessions survive restarts
- docker-entrypoint.sh: always run prisma migrate deploy (idempotent) instead
  of skipping when the DB file already exists; removes dead DB_PATH variable
- .env: document AUTH_SECRET as required for Docker deployments
- .env.example: add AUTH_SECRET field with generation instructions
2026-03-26 17:20:10 +13:00
silvertakana 6263f7766b fix(favicon): use Next.js native app/icon.svg to fix Docker cache 2026-03-26 17:00:25 +13:00
silvertakana d65600786f fix(docker): future-proof Prisma + Next.js standalone setup
- Add prisma package to serverExternalPackages in next.config.ts
- Replace manual node_modules cherry-picking with full production install
- Copy pre-built node_modules from deps stage and prune dev dependencies
- Ensures all Prisma CLI runtime dependencies are always available
2026-03-26 16:42:03 +13:00
silvertakana a3a04d84c0 fix: Resolve React update depth sequence errors 2026-03-26 15:36:31 +13:00
silvertakana f295609ea2 feat: Update header styling to match new design requirements 2026-03-26 15:36:31 +13:00
silvertakana 80064996e9 chore: Install favicon and update logos 2026-03-26 15:36:31 +13:00
silvertakana 973bef6386 UI: add hover delay to Tooltip component 2026-03-26 15:27:17 +13:00
silvertakana 4e2287aa5f UI: use React Portal Tooltip component for unverified plugin icon to fix clipping 2026-03-26 15:25:56 +13:00
silvertakana 17b8c7bb62 UI: add fast custom CSS tooltip to unverified plugin warning icon 2026-03-26 15:22:30 +13:00
silvertakana d10c68004a feat(docker): add persistent volume for sqlite db to retain installed plugins across restarts 2026-03-26 14:14:10 +13:00
silvertakana 10830efca5 UI: clean up plugin badges by showing simple warning icon for unverified plugins and removing category badge 2026-03-26 14:11:52 +13:00
silvertakana c3d9b2b536 feat: Introduce camera stream playback with mixed-content proxying and add a new volcanoes plugin. 2026-03-24 11:21:15 +13:00
silvertakana 3a04c64e79 perf(cesium): enable requestRenderMode, camera.changed sync, scratch allocs, GPU label fading
P0: Enable requestRenderMode for idle GPU savings (~50-90%)
P0: Switch camera sync from postRender to camera.changed w/ percentageChanged
P1: Stabilize sceneSettings with useMemo to prevent React re-renders
P1: Scratch HPR/Matrix4 in ModelManager and useModelRendering
P1: Add translucencyByDistance to labels for GPU-side fading
P2: Scratch Cartesian2 in searchPinAnimation
2026-03-22 14:38:33 +13:00
silvertakana eea424a826 fix: use dynamic lucide icon resolution for all 1700+ icons 2026-03-19 18:14:43 +13:00
silvertakana 4edcce2468 feat: add 5 static OSM plugins (volcanoes, airports, seaports, lighthouses, spaceports) 2026-03-19 16:00:22 +13:00
silvertakana d54d9a480c feat: skip auth on demo edition for marketplace/load so all visitors see installed plugins 2026-03-19 15:53:47 +13:00
silvertakana b7d76b5e58 fix: run prisma migrations at build time, remove runtime entrypoint 2026-03-19 15:36:59 +13:00
silvertakana e83e45e8b9 fix: use forwarded host headers for login redirect behind reverse proxy 2026-03-19 15:32:34 +13:00
silvertakana 86b7550c38 fix: skip database query on demo edition in setup-status 2026-03-19 15:15:29 +13:00
silvertakana 09b4b44c3e fix: pass --url flag to prisma migrate deploy to bypass TS config loading 2026-03-19 15:01:29 +13:00
silvertakana c6b26d20bc fix: add DATABASE_URL env and prisma deps to Docker runner stage 2026-03-19 14:40:52 +13:00
silvertakana 36ee84857b feat: DOD Phase 1 rendering optimizations
- Add color cache (getCachedColor) to eliminate per-entity Color.fromCssColorString allocations
- Add scratch Cartesian3 position to avoid heap alloc per entity in renderSingleEntity
- Add stable array cache (getStableAnimatables) to eliminate Array.from per render cycle
- Add renderEntity memoization (renderOptionsCache) for static entity options
- Refactor animation loop into dynamic/static batching for branchless iteration
- Extract modules: renderCaches.ts, animationHelpers.ts, primitiveOps.ts, renderOptionsCache.ts
- All files under 150 lines per project guidelines
2026-03-19 14:37:21 +13:00
silvertakana 25b19ec635 fix: update CSP headers to allow camera stream feeds from arbitrary origins
- Added http: https: to img-src for MJPEG camera streams and preview images
- Added http: https: to connect-src for HLS stream fetches
- Added media-src directive for video element sources
- Added frame-src directive for YouTube, Twitch, Vimeo, and other embed providers
- Fixes CSP violations that blocked camera plugin after npm plugin migration
2026-03-19 14:30:01 +13:00
silvertakana 614d3af796 fix: add error handling to setup-status and fix Dockerfile for Prisma 2026-03-19 14:28:12 +13:00
silvertakana bc05d93ce8 fix: add error handling to setup-status and fix Dockerfile for Prisma 2026-03-19 14:21:06 +13:00
silvertakana c0789f831c fix: externalize native modules and add prisma generate to Docker build 2026-03-18 23:11:16 +13:00
silvertakana 3be23a3ebc fix: resolve TypeScript build errors (NextRequest type, return type, Suspense boundary) 2026-03-18 23:05:53 +13:00
silvertakana abd40ede1b Merge branch 'main' of https://github.com/silvertakana/worldwideview 2026-03-18 22:54:07 +13:00
Silvertakana aab5e39aa3 Merge feature/marketplace-integration into main
Merge feature/marketplace-integration into main - includes marketplace plugins, bug fixes, core globe rendering, and entity management
2026-03-18 22:50:53 +13:00
476 changed files with 93820 additions and 351546 deletions

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
# Database Migrations & Schema Modification Rules
## 1. Defensive Migrations
When making database schema changes, you must ensure that generated migrations are resilient against environmental discrepancies.
- **Review Generated SQL**: Always review the `.sql` files generated by `npx prisma migrate dev`.
- **Add "IF EXISTS" clauses**: SQLite and Prisma can sometimes produce brittle drop statements (`DROP INDEX "my_index"`). To prevent migrations from crashing if a state desynchronization occurs (e.g., the index was already dropped or never created), manually edit the migration file to use `DROP INDEX IF EXISTS "my_index";` or `DROP TABLE IF EXISTS "table_name";`.
- **Data Preservation**: When dropping columns or renaming, SQLite does not cleanly support it and requires table recreation. Carefully review the `INSERT INTO "new_table" SELECT ...` clauses to ensure data is correctly mapped.
## 2. Managing Failed Migrations
If a migration fails in production:
- **Never blindly mark as resolved**: Do not run `prisma migrate resolve --applied <migration_name>` unless you have explicitly verified that the database schema precisely matches the expected state.
- If you use `resolve --applied`, Prisma will permanently skip that migration in the future, leaving your database structurally out of sync with your Prisma Client.
## 3. Backups Before DDL
Never perform direct DDL operations (ALTER, DROP, CREATE) on a production database (via Prisma or direct SQLite access) without first confirming an automated backup exists, or manually taking a backup of the `wwv.db` file.
+1
View File
@@ -0,0 +1 @@
.agents
+22 -4
View File
@@ -1,7 +1,25 @@
node_modules
.next
**/node_modules
**/dist
**/.next
.git
*.md
artifacts
# Database files at ANY depth
/data
packages/*/data
**/*.db
**/*.sqlite
**/*.sqlite3
**/*-journal
**/*.db-wal
**/*.db-shm
# Environment files
.env*
!.env.example
!*.env.example
# Non-build directories
artifacts/
performance/
tmp/
*.geojson
+12 -1
View File
@@ -1,4 +1,15 @@
DATABASE_URL=file:./data/wwv.db
# Default plugins enabled on boot for demo edition
# Comma-separated list of plugin IDs
NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS=iranwarlive,satellite,gps_jamming
# Edition: "local" | "cloud" | "demo"
NEXT_PUBLIC_WWV_EDITION=local
NEXT_PUBLIC_WWV_EDITION=local
# Auth Secret (REQUIRED for Docker — generate with: openssl rand -hex 32)
# Must be stable across container restarts to preserve sessions.
# [WARNING] NEVER commit real secrets here. Real secrets must ONLY go into .env.local!
AUTH_SECRET=changeme_d64c1f35b447da89cf6ed5a0988da1379b21904edb91a87c3f5a63942e3d23a4_changeme
+17
View File
@@ -13,6 +13,12 @@ DATABASE_URL=file:./data/wwv.db
# Copy everything below into a new file called .env.local
# .env.local is gitignored and overrides .env values.
# Auth Secret (REQUIRED — generate with: openssl rand -hex 32)
# Must remain stable across restarts to preserve sessions and tokens.
# For Docker: also set this in the host environment or a .env file
# at the project root so docker-compose can inject it.
AUTH_SECRET=
# Cesium Ion Access Token (optional — get one free at https://ion.cesium.com/)
NEXT_PUBLIC_CESIUM_ION_TOKEN=
@@ -25,16 +31,27 @@ NEXT_PUBLIC_BING_MAPS_KEY=
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=
SUPABASE_DATABASE_URL=
# OpenSky Network — multi-account credential rotation
# Comma-separated clientId:clientSecret pairs.
# Example: OPENSKY_CREDENTIALS=acct1-id:acct1-secret,acct2-id:acct2-secret
OPENSKY_CREDENTIALS=
# ACLED API — Civil Unrest & Conflict data (free for non-commercial use)
# Register at https://developer.acleddata.com/ to obtain credentials.
# Data is updated weekly (Mondays) with global protest, riot, and violence events.
ACLED_EMAIL=
ACLED_PASSWORD=
# Marketplace Bridge Token — shared secret for marketplace → WWV install requests
# Generate any random string, then set the same value in the marketplace instance config.
WWV_BRIDGE_TOKEN=
# Default plugins enabled on boot for demo edition
# Comma-separated list of plugin IDs
NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS=
# Edition: "local" | "cloud" | "demo"
NEXT_PUBLIC_WWV_EDITION=local
+17 -25
View File
@@ -1,37 +1,29 @@
---
name: Bug Report
about: Report something that isn't working correctly
about: Create a report to help us improve WorldWideView
title: '[BUG] '
labels: bug
assignees: ''
---
## Describe the Bug
**Describe the bug**
A clear and concise description of what the bug is.
## Steps to Reproduce
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '...'
3. See error
2. Click on '....'
3. Scroll down to '....'
4. See error
## Expected Behaviour
**Expected behavior**
A clear and concise description of what you expected to happen.
What you expected to happen.
**Screenshots/Logs**
If applicable, add screenshots or console output to help explain your problem.
## Actual Behaviour
What actually happened. Include screenshots or console errors if applicable.
## Environment
| | |
|---|---|
| OS | e.g. Windows 11 |
| Browser | e.g. Chrome 122 |
| Node.js | e.g. 20.x |
| Plugin(s) affected | e.g. ADS-B, AIS |
## Additional Context
Any other context about the problem — relevant config, data source URLs, Cesium Ion token issues, etc.
**Environment (please complete the following information):**
- OS: [e.g. Windows, macOS]
- Browser [e.g. chrome, safari, firefox]
- WorldWideView Edition [e.g. local, demo, cloud]
+11 -21
View File
@@ -1,29 +1,19 @@
---
name: Feature Request
about: Suggest a new feature or improvement
name: Core Feature Request
about: Suggest an idea for the core WorldWideView engine
title: '[FEATURE] '
labels: enhancement
assignees: ''
---
## Summary
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
A brief, one-line description of the feature.
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
## Motivation
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
Why is this needed? What problem does it solve or what use case does it enable?
## Proposed Solution
Describe your suggested approach. If this is a new **plugin**, describe:
- The data source (URL, format, update frequency)
- What it would render on the globe (icons, paths, primitives)
- Any external APIs or credentials required
## Alternatives Considered
Any other approaches you thought about and why you ruled them out.
## Additional Context
Screenshots, mockups, links to similar tools, or relevant documentation.
**Note:** If this is about adding a new data source (like mapping vessels or plotting weather), please use the **Plugin Proposal** template instead! This template is for core engine features (like camera logic, filtering, or rendering pipeline upgrades).
+25
View File
@@ -0,0 +1,25 @@
---
name: Plugin Proposal
about: Suggest a new real-time data source plugin
title: '[PLUGIN] '
labels: plugin-idea, help-wanted
assignees: ''
---
**What data source do you want to add?**
Please provide a brief description of the intelligence data (e.g., Global Earthquakes, Shipping Vessels, Weather Radar, Local Train Networks).
**Is there an available API?**
Please link to any public or authenticated APIs that provide this data.
*(e.g., USGS Earthquake API: https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php)*
**What should the plugin render?**
- What kind of marker? (e.g., dots, icons, 3D models)
- Does it require historical tracking (paths), or just current position?
**Would you be interested in building this?**
- [ ] Yes, I'd like to try building it!
- [ ] No, just putting the idea out there.
*(Looking to build it yourself? Check out the [Build a Plugin in 5 Minutes](https://github.com/silvertakana/worldwideview#build-a-plugin-in-5-minutes) guide in the README!)*
+59
View File
@@ -0,0 +1,59 @@
name: CI
on:
pull_request:
branches: [main]
jobs:
typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: npx prisma generate
- run: pnpm exec tsc --noEmit
test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: npx prisma generate
- run: pnpm test
build:
name: Build
runs-on: ubuntu-latest
needs: [typecheck, test]
env:
DATABASE_URL: file:./data/wwv.db
AUTH_SECRET: ci-placeholder-secret-not-used-in-tests
NEXT_PUBLIC_WWV_EDITION: local
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: npx prisma generate
- run: pnpm build
+44
View File
@@ -0,0 +1,44 @@
name: Claude Code Review
on:
pull_request_target:
types: [opened, synchronize, ready_for_review, reopened]
# Optional: Only run on specific file changes
# paths:
# - "src/**/*.ts"
# - "src/**/*.tsx"
# - "src/**/*.js"
# - "src/**/*.jsx"
jobs:
claude-review:
# Optional: Filter by PR author
# if: |
# github.event.pull_request.user.login == 'external-contributor' ||
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
plugins: 'code-review@claude-code-plugins'
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
+50
View File
@@ -0,0 +1,50 @@
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'
# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
# claude_args: '--allowed-tools Bash(gh pr:*)'
+28 -3
View File
@@ -1,7 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
node_modules/
/.pnp
.pnp.*
.yarn/*
@@ -20,17 +20,30 @@
# agents
/.agents/
# claude code IDE config
/.claude/
/.cline/
# performance
/performance/
# artifacts
/artifacts/
# scripts
/scripts/
# scripts (tracked, but temporary scratchpads should go in /local-scripts/)
# local database
/data/
packages/*/data/
*.db
*.sqlite
*.sqlite3
*.db-shm
*.db-wal
# temporary files and credentials
/tmp/
# generated prisma client
/src/generated/
@@ -61,3 +74,15 @@ next-env.d.ts
# Plugin build artifacts
packages/*/dist/
# Reference Reference Codebases
/worldmonitor/
# Developmental scripts & temporary sandbox
/local-scripts/
# git worktrees
/.worktrees/
# proprietary extracted services
packages/wwv-data-engine/
+36
View File
@@ -0,0 +1,36 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "pnpm run dev",
"cwd": "${workspaceFolder}"
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"sourceMapPathOverrides": {
"webpack://_N_E/*": "${webRoot}/*"
}
},
{
"name": "WWV Data Engine: debug",
"type": "node-terminal",
"request": "launch",
"command": "pnpm --filter wwv-data-engine run dev",
"cwd": "${workspaceFolder}"
},
{
"name": "Full Stack: debug",
"type": "node-terminal",
"request": "launch",
"command": "pnpm run dev:all",
"cwd": "${workspaceFolder}"
}
]
}
+20
View File
@@ -0,0 +1,20 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "npm: dev:all",
"type": "npm",
"script": "dev:all",
"problemMatcher": [],
"isBackground": true,
"presentation": {
"reveal": "always",
"panel": "new"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
+345
View File
@@ -0,0 +1,345 @@
# WorldWideView — Agent Rules
## 1. Project Identity
WorldWideView is a **real-time geospatial intelligence engine** that visualizes live global data on an interactive 3D globe. Built with **Next.js 16**, **CesiumJS**, **React 19**, and **Zustand**, it renders everything from live aircraft and maritime vessels to conflict events, satellites, and environmental data — all through a modular plugin architecture.
### Target Inspiration
Our primary design, feature-set, and operational layout goal is to mimic the structure and capabilities of `www.worldmonitor.app`.
- **Reference Codebase**: [GitHub - koala73/worldmonitor](https://github.com/koala73/worldmonitor)
---
## 2. Tech Stack
| Layer | Technology |
|---|---|
| Framework | Next.js 16 (App Router, `output: "standalone"`) |
| Language | TypeScript 5, strict mode |
| 3D Engine | CesiumJS + Resium (Google Photorealistic 3D Tiles) |
| State | Zustand (slice-based: globe, layers, timeline, UI, filters, data, config, favorites, geojson) |
| Event Bus | Custom typed `DataBus` (pub/sub singleton) |
| Styling | Vanilla CSS — **no Tailwind** |
| Database | SQLite via Prisma (local), PostgreSQL (cloud) |
| Auth | NextAuth v5 beta (Credentials provider, JWT sessions) |
| Package Manager | pnpm (monorepo with `pnpm-workspace.yaml`) |
| Testing | Vitest + jsdom + React Testing Library |
| Deployment | Docker multi-stage build → Coolify |
| Analytics | Vercel Analytics / custom `trackEvent` |
---
## 3. Directory Structure
```
worldwideview/
├── src/
│ ├── app/ # Next.js App Router (pages, API routes, layouts)
│ │ ├── api/ # Server-side API routes (auth, aviation, camera, etc.)
│ │ ├── login/ # Login page
│ │ ├── setup/ # First-time setup page
│ │ └── globals.css # Root stylesheet
│ ├── components/
│ │ ├── common/ # Shared UI: BootOverlay, FloatingWindow, PluginIcon
│ │ ├── layout/ # AppShell, Header, SearchBar, DataBusSubscriber
│ │ ├── panels/ # LayerPanel, EntityInfoCard, FilterPanel, GraphicsSettings
│ │ ├── timeline/ # Timeline component
│ │ ├── marketplace/ # Plugin install/unverified dialogs
│ │ ├── ui/ # Tooltip, ReloadToast
│ │ └── video/ # Floating video manager
│ ├── core/
│ │ ├── data/ # DataBus, PollingManager, CacheLayer, SmartFetcher
│ │ ├── filters/ # filterEngine (applies plugin filters to entities)
│ │ ├── globe/ # GlobeView, EntityRenderer, AnimationLoop, StackManager,
│ │ │ │ CameraController, InteractionHandler, SelectionHandler,
│ │ │ │ ModelManager, ImageryProviderFactory
│ │ │ └── hooks/ # useCameraActions, useEntityRendering, useModelRendering, etc.
│ │ ├── hooks/ # useBootSequence, useIsMobile, useMarketplaceSync
│ │ ├── plugins/ # PluginManager, PluginRegistry, PluginManifest,
│ │ │ │ loadPluginFromManifest, validateManifest, InstalledPluginsLoader
│ │ │ └── loaders/ # DeclarativePlugin, StaticDataPlugin, mapJsonToEntities
│ │ └── state/ # Zustand store + slices (config, data, globe, layers, timeline, ui, etc.)
│ ├── lib/ # auth, db, rateLimit, analytics, AIS stream, marketplace APIs
│ ├── plugins/ # GeoJSON plugin registrations
│ ├── styles/ # HUD animations CSS
│ ├── types/ # GeoJSON types, Umami types
│ └── generated/ # Prisma generated client (gitignored)
├── packages/ # pnpm monorepo workspace packages
│ ├── wwv-plugin-sdk/ # Plugin SDK: type definitions, manifest schema
│ ├── wwv-plugin-aviation/
│ ├── wwv-plugin-maritime/
│ ├── wwv-plugin-wildfire/
│ ├── wwv-plugin-borders/
│ ├── wwv-plugin-camera/
│ ├── wwv-plugin-military-aviation/
│ ├── wwv-plugin-satellite/
│ ├── wwv-plugin-iranwarlive/ # Includes standalone backend/ microservice
│ └── wwv-plugin-{airports,embassies,lighthouses,nuclear,seaports,spaceports,volcanoes}/
├── prisma/ # schema.prisma, migrations/
├── public/ # Static assets, Cesium workers, plugin GeoJSON data
├── scripts/ # Build scripts (copy-cesium, scaffold-osm-plugin, setup)
├── data/ # SQLite database (gitignored, Docker volume)
├── Dockerfile # Multi-stage production build
├── docker-compose.yml # Main app + microservice backends
└── .agents/ # Agent documentation, rules, skills, workflows
```
---
## 4. Architecture Patterns
### 4.1 Plugin System (Core Abstraction)
Every data source is a **plugin** implementing the `WorldPlugin` interface from `@worldwideview/wwv-plugin-sdk`. The lifecycle utilizes a real-time WebSocket Firehose pipeline:
```text
PluginRegistry.register() → PluginManager.registerPlugin()
→ plugin.initialize(context)
Visibility Toggle → DataBusSubscriber subscribes to layer via WsClient
→ Engine responds with instantaneous websocket snapshots over /stream
→ WsClient pipes to DataBus.emit("dataUpdated", WsStreamPayload)
→ Store → EntityRenderer → Globe
```
Four plugin architectures exist:
1. **Static** — GeoJSON file in `public/data/`, loaded by `StaticDataPlugin`
2. **Active Proxied** — Next.js API routes in `src/app/api/` as CORS proxy
3. **Microservice** — Standalone Fastify container with SQLite (e.g., `iranwarlive-backend`)
4. **Dynamic CDN Loaded (Bundle)** — Externally developed plugins dynamically imported at runtime via ES module CDNs (e.g., `unpkg.com` version-pinned URLs). Handled by `loadBundlePlugin` using `import(/* webpackIgnore: true */ entry)`.
Plugin types are re-exported from SDK through `src/core/plugins/PluginTypes.ts` and `PluginManifest.ts` — **source of truth is always `@worldwideview/wwv-plugin-sdk`**.
### 4.2 State Management
Zustand store with **nine slices**: `globe`, `layers`, `timeline`, `ui`, `filter`, `data`, `config`, `favorites`, `geojson`. Each slice is in its own file under `src/core/state/`.
- Access via `useStore` hook or `useStore.getState()` outside React
- Plugin settings stored in `configSlice.dataConfig.pluginSettings`
- Polling intervals stored in `configSlice.dataConfig.pollingIntervals`
### 4.3 Data Pipeline
```text
Engine push /stream → DataBusSubscriber WsClient router
→ WsClient.handleMessage() → DataBus.emit("websocketData")
→ DataBusSubscriber → _hydrateSnapshot() → Store.entitiesByPlugin
→ GlobeView (memoized visible entities)
→ EntityRenderer (billboard/point primitives)
→ AnimationLoop (horizon culling, hover/selection)
→ StackManager (co-located entity grouping)
```
### 4.4 Rendering Pipeline
- **Primitive-based**: Uses `PointPrimitiveCollection`, `BillboardCollection`, `LabelCollection` — NOT Cesium Entity API
- **Chunked processing**: Large datasets (10k+) rendered via `ChunkedProcessor`
- **LOD system**: Model-type entities promoted to 3D models at close range (`useModelRendering`)
- **Horizon culling**: Manual dot-product calculation against Earth radius (NOT depth testing)
- **Stack/Spiderifier**: `StackManager` groups co-located entities; `stackAnimation` handles expansion
### 4.5 Edition System
Three editions controlled by `NEXT_PUBLIC_WWV_EDITION`:
- **`local`** — Self-hosted, full features, auth enabled
- **`cloud`** — Managed cloud instance, full features
- **`demo`** — Public demo, auth disabled, optional admin via `WWV_DEMO_ADMIN_SECRET`
Feature flags derived from edition in `src/core/edition.ts`.
---
## 5. Critical Conventions
### 5.1 File Size
**Max 150 lines per file.** If a file grows beyond this, modularize it. Extract helpers, split components, use hooks.
### 5.2 Import Aliases
- `@/*` → `./src/*`
- `@worldwideview/wwv-plugin-sdk` → `./packages/wwv-plugin-sdk/src`
- Each plugin has its own alias in `tsconfig.json`
### 5.3 CSS Rules
- **Vanilla CSS only** — no Tailwind, no CSS-in-JS
- Global styles in `src/app/globals.css`
- Component-scoped styles use CSS Modules (`.module.css`) or co-located `.css` files
- HUD animations in `src/styles/hud-animations.css`
### 5.4 Rendering Entity Rules
When returning `CesiumEntityOptions` from `renderEntity()`:
- **Points**: Use `type: "point"` with `color`, `size`, `outlineColor`, `outlineWidth`
- **Billboards**: Use `type: "billboard"` with `iconUrl`, `color`, `iconScale`
- **NEVER mix**: Do not use `size`/`outlineWidth`/`outlineColor` on billboard entities — causes GPU clipping
### 5.5 Plugin Registration
Built-in plugins are instantiated in `AppShell.tsx` and registered via `PluginRegistry` → `PluginManager`. Marketplace-installed plugins are loaded from the database via `InstalledPluginsLoader`.
### 5.6 Workspace Rules
- Always run `pnpm install` from project root after creating new packages
- Plugin packages go in `packages/wwv-plugin-<name>/`
- Microservice backends go in `packages/wwv-plugin-<name>/backend/`
- Both globs (`packages/*` and `packages/*/backend`) are in `pnpm-workspace.yaml`
- Add new plugins to `transpilePackages` in `next.config.ts` and `paths` in `tsconfig.json`
### 5.7 AI Meta-Directives: Antigravity Standard (Claude Code)
> [!NOTE]
> This repository is orchestrated via the **Antigravity open standard** using **Claude Code** as the active agent. The entry point for Claude Code is `CLAUDE.md` at the project root.
> [!WARNING]
> - **Always** use standard `.md` file extensions for rules, skills, and workflows.
> - **Never** use proprietary `.mdc` extensions.
> - **Never** reference Cursor IDE rules; we use the open `.agents/` standard.
> - **MUST**: You MUST update Semantic Versioning numbering inside the relevant `package.json` file prior to executing any code commits, adhering strictly to the `[/commit]` workflow rules (`feat:` -> Minor, `fix/refactor/perf:` -> Patch).
> - **MUST Detail Commit Levels & Bumps**: On description changes or release notes, you must detail the level of commit (Major/Minor/Fix) for *each* individual change. If there are multiple accumulated changes, you MUST EITHER commit them individually and bump the version each time, OR commit them all at once and bump the version multiple times.
> - **MUST Explain Complex Concepts Simply**: Whenever providing a complicated technical explanation to the user, you MUST include a simple explanation below it. Use an analogy comparing the concept to something from everyday life to ensure the user easily understands it.
### 5.8 Workspace Hygiene
Whenever agents generate temporary debugging scripts, test REST endpoints via `.mjs`, or dump traces/JSON outputs, they **MUST** save these exclusively inside `/local-scripts/`. The root directory is strictly for production configuration files.
---
## 6. Environment Variables
| Variable | Required | Description |
|---|---|---|
| `DATABASE_URL` | Yes | SQLite: `file:./data/wwv.db` |
| `AUTH_SECRET` | Yes | JWT signing secret (generate with `openssl rand -hex 32`) |
| `NEXT_PUBLIC_CESIUM_ION_TOKEN` | No | Cesium Ion access token |
| `NEXT_PUBLIC_BING_MAPS_KEY` | No | Bing Maps imagery |
| `NEXT_PUBLIC_GOOGLE_MAPS_API_KEY` | No | Google 3D Tiles |
| `NEXT_PUBLIC_WWV_EDITION` | No | `local` / `cloud` / `demo` (default: `local`) |
| `OPENSKY_CREDENTIALS` | No | Comma-separated `id:secret` pairs for credential rotation |
| `WWV_BRIDGE_TOKEN` | No | Shared secret for marketplace → WWV install bridge |
| `WWV_DEMO_ADMIN_SECRET` | No | Demo edition admin password |
| `IRANWARLIVE_BACKEND_URL` | No | Override for IranWarLive microservice URL |
Secrets go in `.env.local` (gitignored). Non-secrets go in `.env` (committed).
---
## 7. Development Commands
```bash
pnpm install # Install all workspace dependencies
pnpm run setup # Generate .env.local with AUTH_SECRET (first-time setup)
pnpm dev # Next.js frontend only (auto-runs prisma migrate deploy + copy-cesium)
pnpm dev:all # Frontend + wwv-data-engine concurrently (normal development)
pnpm dev:backends # Run only the data engine in dev mode
pnpm build # Production build
pnpm test # Run all Vitest tests (scoped to src/lib, src/core, src/plugins)
pnpm db:reset # Reset and re-migrate the frontend SQLite database (destructive)
pnpm start:backends # Start all plugin microservice backends in parallel
pnpm clean:backends # Wipe all plugin SQLite databases
pnpm run scaffold-osm-plugin <name> # Generate a new plugin from scaffold
```
Frontend runs at `http://localhost:3000`.
---
## 8. Deployment
- **Docker**: Multi-stage Dockerfile using the Extractor Pattern (`deps` → `builder` → `runner`). The `node_modules` folders must be explicitly untracked in from `git` across the workspace to prevent corrupted BuildKit contextual cache overlaps during the `COPY . .` stage.
- **Standalone output**: `next.config.ts` uses `output: "standalone"`.
- **Cesium assets**: Copied to `public/cesium/` via `scripts/copy-cesium.mjs` at build time, excluded from output tracing.
- **Prisma Configuration**: `prisma.config.ts` must export a native javascript object instead of dynamically importing CLI wrapper binaries (`prisma/config` or `dotenv`). The standalone Next.js tracer strips CLI devDependencies during the build, which will cause fatal runtime container crashes if imported.
- **Microservices**: Separate containers defined in `docker-compose.yml`, proxied via `next.config.ts` rewrites.
- **Coolify**: Deployed via Dockerfile builder natively mapping environment variables continuously into the container shell. Persistent storage mount required at `/app/data` for the SQLite root node database.
- **Docker volumes**: Mount `/app/data` (frontend SQLite), `/app/packages/wwv-data-engine/data` (data engine SQLite), `/data` (Redis)
---
## 9. Testing Strategy
- **Framework**: Vitest with jsdom environment
- **Coverage**: `src/lib/**`, `src/core/**`, `src/plugins/**`
- **Run**: `pnpm test` (or `vitest run`)
- **Key test files**: `rateLimit.test.ts`, `edition.test.ts`, `demoAdmin.test.ts`, `DeclarativePlugin.test.ts`, `cors.test.ts`, `repository.test.ts`, `marketplaceToken.test.ts`
---
## 10. Security Headers
Configured in `next.config.ts` `headers()`:
- **CSP**: Restrictive with exceptions for CesiumJS (`unsafe-eval`, `unsafe-inline`), camera streams (`http: https:`), and analytics
- **X-Frame-Options**: DENY
- **X-Content-Type-Options**: nosniff
- **Referrer-Policy**: strict-origin-when-cross-origin
- **Permissions-Policy**: camera/microphone disabled, geolocation self-only
---
## 11. Related Repositories
| Repo | Purpose |
|---|---|
| `worldwideview` | Main application (this repo) |
| `worldwideview-marketplace` | Plugin marketplace web app |
| `worldwideview-web` | Marketing / landing page |
---
## 12. On-Demand Rules
Read the relevant rule file when working in that domain:
| Rule | When to use | Path |
|---|---|---|
| `monorepo-workflow` | pnpm commands, adding packages, workspace config | `.agents/rules/monorepo-workflow.md` |
| `plugin-architecture` | Creating/modifying plugins, lifecycle, registration | `.agents/rules/plugin-architecture.md` |
| `cesium-rendering` | Globe rendering, entity types, primitives, LOD, culling | `.agents/rules/cesium-rendering.md` |
| `state-management` | Zustand slices, store access, plugin settings | `.agents/rules/state-management.md` |
| `database-migrations` | Prisma schema changes, migrations, SQLite/Postgres | `.agents/rules/database-migrations.md` |
| `continuous-improvement` | When to create/update rules, skills, or workflows | `.agents/rules/continuous-improvement.md` |
| `context-and-memory` | How to orient and maintain project context between sessions | `.agents/rules/context-and-memory.md` |
---
## 13. Slash Commands / Workflows
Invoke by name. Read the skill/workflow file and follow its steps.
| Command | Description | File |
|---|---|---|
| `/commit` | **Required before every commit** — bump semver + conventional commit | `.agents/skills/commit/SKILL.md` |
| `/remember` | Save a lesson, constraint, or fact into `.agents/` permanent memory | `.agents/skills/remember/SKILL.md` |
| `/pr-review` | 6-role comprehensive pull request review | `.agents/skills/pr-review/SKILL.md` |
| `/update-context` | Sync `.agents/context/` with current project state | Global skill |
| `/local-dev` | Check, start, and troubleshoot local dev environment | `.agents/workflows/local-dev.md` |
| `/data-engine-cli` | Use the wwv-data-engine CLI wrapper | `.agents/workflows/data-engine-cli.md` |
| `/debugging-coolify` | Troubleshoot deployed apps on Coolify via MCP/SSH | `.agents/workflows/debugging-coolify.md` |
| `/five` | Five Whys root cause analysis | `.agents/workflows/five.md` |
| `/stitch-to-nextjs` | Generate UI with Stitch MCP, port into Next.js | `.agents/workflows/stitch-to-nextjs.md` |
| `/bing-news-hydration` | Hydrate event attributes with Bing RSS news | `.agents/workflows/bing-news-hydration.md` |
| `/generate-user-roadmap` | Generate updated user-facing roadmap | `.agents/workflows/generate-user-roadmap.md` |
---
## 14. Agent Skills Reference
Refer to these skill documents for specialized tasks:
### Project Skills (`.agents/skills/`)
| Skill | When to Use |
|---|---|
| `worldwideview-plugin-creation` | **Use when creating any plugin** — strict architectural checklist |
| `plugin-creation-master-guide.md` | Decision matrix for choosing plugin architecture |
| `osm-static-plugin-creation.md` | Creating static GeoJSON plugins from OpenStreetMap |
| `microservice-plugin-creation.md` | Building standalone Fastify microservice backends |
| `database-operations.md` | Prisma schema changes, migrations, database queries |
| `database-incident-recovery-procedures.md` | Authoritative protocol for safely restoring a broken production database |
| `index-documentation.md` | Maintaining project documentation index |
| `context7` | Fetch up-to-date library docs via Context7 API |
| `cesium-context7` | CesiumJS-specific documentation lookup |
### Global Skills
52 skills are available across all projects. See `.agents/global-skills-index.md` for the full list and invocation paths.
+2 -2
View File
@@ -32,9 +32,9 @@ This project is licensed under the [Elastic License 2.0](./LICENSE). By submitti
```bash
npm install
```
4. **Copy the environment file** and fill in your API keys:
4. **Generate environment file** (auto-creates `.env.local` with `AUTH_SECRET`):
```bash
cp .env.example .env.local
npm run setup
```
5. **Start the dev server**:
```bash
+58 -12
View File
@@ -1,32 +1,78 @@
# Stage 1: Install dependencies
FROM node:22-alpine AS deps
# Stage 0: Extract package.json files for layer caching
FROM alpine AS extractor
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
# Stage 2: Build the application
FROM node:22-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
RUN find . -type f \! -name 'package.json' \! -name 'pnpm-workspace.yaml' \! -name 'pnpm-lock.yaml' -delete && \
find . -type d -empty -delete
# Stage 1: Install ALL dependencies (needed for build)
FROM node:22-alpine AS deps
RUN corepack enable pnpm
RUN apk add --no-cache python3 make g++
WORKDIR /app
# Copy only the extracted package.jsons
COPY --from=extractor /app ./
# Install dependencies with cache mount for pnpm store
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile
# Stage 3: Build the application
FROM deps AS builder
# Copy full source code
COPY . .
RUN DATABASE_URL="file:./data/wwv.db" npx prisma generate
# Create an empty SQLite database with all tables applied
RUN mkdir -p ./data && DATABASE_URL=file:./data/wwv.db npx prisma migrate deploy
# Next.js inlines NEXT_PUBLIC_* vars at build time — must be declared as ARGs
ARG NEXT_PUBLIC_CESIUM_ION_TOKEN
ARG NEXT_PUBLIC_GOOGLE_MAPS_API_KEY
ARG NEXT_PUBLIC_BING_MAPS_KEY
ARG NEXT_PUBLIC_WWV_EDITION
ARG NEXT_PUBLIC_WS_ENGINE_URL
ARG NEXT_PUBLIC_ADSENSE_CLIENT_ID
ARG NEXT_PUBLIC_SUPABASE_URL
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
# Run Next.js build with Webpack cache mounted
RUN --mount=type=cache,target=/app/.next/cache NODE_OPTIONS="--max_old_space_size=3072" pnpm run build
RUN node scripts/copy-cesium.mjs
# Stage 3: Production runner
# Stage 4: Production runner
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0
ENV PORT=3000
ENV DATABASE_URL=file:./data/wwv.db
ENV AUTH_TRUST_HOST=true
# Copy Prisma schema + migrations for runtime DB init
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
# Copy Prisma generated client
COPY --from=builder /app/src/generated ./src/generated
# Copy standalone server output
COPY --from=builder /app/.next/standalone ./
# We no longer copy proddeps/node_modules. Next.js standalone output
# already traces and copies all the exact node_modules needed for production.
# Copy static assets that standalone mode does NOT include
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
# Entrypoint: migrate DB on first run, then start server
COPY docker-entrypoint.sh ./docker-entrypoint.sh
RUN chmod +x ./docker-entrypoint.sh
# Declare /app/data as a persistent volume mount point.
VOLUME ["/app/data"]
EXPOSE 3000
CMD ["node", "server.js"]
ENTRYPOINT ["./docker-entrypoint.sh"]
+69 -16
View File
@@ -1,38 +1,91 @@
# WorldWideView
<div align="center">
**WorldWideView** is a modular, real-time geospatial intelligence engine built on top of a CesiumJS 3D globe. It is designed to ingest live data streams, transform them through a generalized plugin system, and render them as high-performance visual layers.
# WorldWideView 🌍
As a real-time situational awareness platform, it turns raw geospatial signals—such as aircraft positions, maritime AIS, or satellite orbits—into interactive, cinematic layers on a high-fidelity 3D globe.
**The Open-Source, Plugin-Driven Geospatial Intelligence Engine**
## Key Philosophies
[![License: Elastic 2.0](https://img.shields.io/badge/License-Elastic%202.0-blue.svg)](LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
- **Modular Intelligence**: Every data source is a plugin. The core engine is data-agnostic.
- **High-Performance Rendering**: Engineered for scale using Cesium primitives to handle 100,000+ objects smoothly.
- **Situational Awareness**: Designed for real-time updates and cinematic visualization (orientated icons, smooth tracking).
- **Extensible & Open**: Add new intelligence layers without touching the core architecture.
*A modular situational awareness platform designed to ingest live data streams and render them as interactive, cinematic layers on a high-fidelity CesiumJS 3D globe.*
## Quick Start
<!-- 📸 Replace with a high-res GIF or screenshot of the platform running with multiple layers enabled -->
![WorldWideView Interface](docs/assets/screenshot.png)
</div>
---
## ⚡ Build a Plugin in 5 Minutes
WorldWideView’s architecture means **everything is a plugin**. The core engine is completely data-agnostic. Rather than touching complex 3D rendering code, you can build a plugin that simply pipes a REST API into GeoJSON, and the engine handles the rest!
Ready to add a new intelligence layer (like Earthquakes, Weather, or Satellites)? We have a scaffold generator ready for you:
```bash
# 1. Generate the boilerplate plugin from a template
pnpm run scaffold-osm-plugin my-new-data-source
# 2. Add your data fetching logic in the generated files
# 3. Reload the dev server and watch it map on the globe!
```
📖 **[Read the Full Plugin Guide](docs/PLUGIN_GUIDE.md)** for a deep dive into hooking up websockets or static datasets.
---
## 🚀 Installation & Setup (Local Development)
```bash
git clone https://github.com/silvertakana/worldwideview.git
cd worldwideview
npm install
npm run dev
pnpm install
pnpm run setup # generates .env.local with AUTH_SECRET
pnpm run dev:all # starts the app, data engine, and marketplace concurrently
```
Visit `http://localhost:3000` to see the live globe.
## Fair-Use Notice
---
This application may contain copyrighted material the use of which has not always been specifically authorized by the copyright owner. Such material is made available for educational purposes, situational awareness, and to advance understanding of global events. It is believed that this constitutes a "fair use" of any such copyrighted material as provided for in section 107 of the US Copyright Law.
## 🐋 Production Deployment (Docker & Coolify)
## Key Documentation Sections
WorldWideView uses a multi-stage Dockerfile designed for standalone output, natively supporting deployment via Coolify or standard Docker Compose. The `docker-compose.yml` spins up the front-end application alongside the high-performance Data Engine and Redis cache.
```bash
# Start the core app, Redis cache, and Data Engine microservice in production mode
docker compose up -d
```
**Persistent Storage Requirements:**
When deploying to production, ensure you mount the following volumes to prevent data loss:
- Mount `/app/data` to persist the core SQLite database.
- Mount `/app/packages/wwv-data-engine/data` to persist the custom plugin microservices SQLite layer.
- Mount `/data` to persist the standalone Redis container.
---
## 🧠 Core Architecture & Philosophies
- **Dynamic, Decentralized Plugins**: The plugin ecosystem uses a decentralized architecture fetching ES module CDN bundles (e.g., from unpkg) at runtime. The core engine is a lightweight shell that loads data providers dynamically via the marketplace.
- **High-Performance Rendering**: Engineered for scale using raw Cesium primitives to smoothly handle upwards of 100,000+ objects simultaneously without GPU stalls.
- **Cinematic Situational Awareness**: Implements horizon culling, smooth camera tracking, orientation-locked billboarding, and stack spiderification for dense locations.
---
## 📚 Documentation Index
- **[Setup & Installation Guide](docs/SETUP.md)**: Detailed environment and local development setup.
- **[Architecture (Engineering Depth)](docs/ARCHITECTURE.md)**: Deep dive into the Cesium rendering pipeline, event data bus, and performance optimizations.
- **[Plugin System Guide](docs/PLUGIN_GUIDE.md)**: How to build and register custom data layers.
- **[Contributions Guide](CONTRIBUTING.md)**: How to help out, coding standards, and commit conventions.
- **[User Guide](docs/USER_GUIDE.md)**: Application features and navigation tips.
---
For a full list of resources, see the **[Documentation Index](docs/index.md)**.
## 🤝 Contributing & Community
We are actively looking for contributors to help build new data plugins and optimize the core 3D engine!
- Found a bug or have an idea? Search the [Issue Tracker](https://github.com/silvertakana/worldwideview/issues) and submit a report.
- Want to build something? Check out our **[Pinned Plugin Wishlist](https://github.com/silvertakana/worldwideview/issues)** for great first issues!
> **Fair-Use Notice:** This application may contain copyrighted material the use of which has not always been specifically authorized by the copyright owner. Such material is made available for educational purposes, situational awareness, and to advance understanding of global events under "fair use" (Section 107 of the US Copyright Law).
+161
View File
@@ -0,0 +1,161 @@
# WorldWideView — Implementation Roadmap
Each stage is **self-contained and demo-able**. Any stage can be shipped independently.
---
## Stage 1: Plugin SDK & Manifest Schema ✅
**Demo:** "Here's the schema that defines a plugin. Our existing aviation plugin has a manifest file."
- [x] `plugin.json` manifest files for each existing plugin
- [x] Manifest validation logic (`validateManifest()`)
- [x] `type` field on `WorldPlugin` interface (`"data-layer" | "extension"`)
- [x] `capabilities` field on `WorldPlugin` interface
- [x] `@worldwideview/wwv-plugin-sdk` npm package — shared types published to npm
---
## Stage 2: Marketplace Browse UI (Static Catalog) ✅
**Demo:** "Open the marketplace, see all available plugins with categories and search."
- [x] `worldwideview-marketplace` repo (Next.js)
- [x] Browse page — grid of plugin cards with icons, descriptions, categories
- [x] Search + category filter
- [x] Plugin detail page (readme, version history, install count)
---
## Stage 3: Prisma ORM & Local Database ✅
**Demo:** "Run `pnpm run dev` on a fresh clone. SQLite auto-creates. App works with zero config."
- [x] Prisma (`prisma` + `@prisma/client`)
- [x] Schema: `InstalledPlugin`, `Setting`, `User`, `AviationHistory`, `NpmCache`
- [x] SQLite default: `DATABASE_URL=file:./data/wwv.db`
- [x] `predev` script: `prisma migrate deploy`
- [x] DB auto-creates on first run — zero manual setup
---
## Stage 4: Bridge API & One-Click Install ✅
**Demo:** "Click 'Install' on marketplace → plugin appears in your local WWV instance."
- [x] `GET /api/marketplace/install-redirect` — session-based redirect install flow
- [x] `GET /api/marketplace/grant-token` — issues marketplace JWT without install
- [x] `GET /api/marketplace/status` — list installed plugins (session or JWT auth)
- [x] `POST /api/marketplace/uninstall` — delete installed plugin record
- [x] `GET /api/marketplace/load` — serve valid manifests to client at startup
- [x] `GET /api/auth/setup-status` — CORS-enabled connection test endpoint
- [x] `src/lib/marketplace/marketplaceToken.ts` — `issueMarketplaceToken()` / `verifyMarketplaceToken()`
- [x] `src/lib/marketplace/auth.ts` — `validateMarketplaceAuth()` (session → JWT → legacy token)
- [x] `src/lib/marketplace/registryClient.ts` — Ed25519 registry verification + 5-min cache
- [x] Marketplace: `InstanceConfig`, `InstallButton`, `useInstalledPlugins`, `InstalledPluginCard`, Manage page
- [x] NPM-driven submission: Admin enters package name → marketplace fetches + parses `"worldwideview"` block from `package.json`
- [x] `NpmCache` table — decouples marketplace from live NPM registry
---
## Stage 5: AI & Sharing Features (Immediate User Value)
**Demo:** "Chat with the AI to explore the globe, record a narrated briefing, and share the view via a URL."
- [ ] Unified Data Format schema (WWVDocument) with snapshot radius bounding
- [ ] Base64url view link sharing (`#v=...`)
- [ ] Shared `ActionExecutor` core for Animation & Copilot
- [ ] Animation Engine (TrackScheduler, Player, overlays, TTS voice)
- [ ] MCP Server (tools wrapping the action vocabulary)
- [ ] Hybrid Spatial Awareness (Pre-computed summaries + MCP spatial query tools)
---
## Stage 6: Publisher Workflow
**Demo:** "A plugin author submits their plugin. After review, it appears in the catalog."
- [ ] Marketplace user accounts (Supabase Auth — email/password + GitHub OAuth)
- [ ] Publisher submission form (upload bundle, fill metadata, declare capabilities)
- [ ] Admin review queue (approve/reject with notes)
- [ ] Version management (semver, changelogs)
- [ ] Publisher dashboard (install counts, download analytics)
- [ ] Publisher namespaces (`publisher.plugin-name`)
---
## Stage 7: Cloud Platform & Accounts
**Demo:** "User registers, gets [user].app.worldwideview.dev, installs plugins from marketplace."
- [ ] `app.worldwideview.dev` — auth/register/dashboard
- [ ] Auto-provisioning on signup (tenant DB row → instance live immediately)
- [ ] RLS tenant isolation in PostgreSQL
- [ ] Cloud edition adapters (`auth.ts`, `storage.ts`, `tenant.ts`)
- [ ] Runtime settings store + setup wizard
- [ ] License key validation with RSA public key
- [ ] Tier gating (free/pro/enterprise feature flags)
- [ ] Cloudflare Turnstile + nginx rate limiting for bot prevention
- [ ] SSO: marketplace redirects to `app.worldwideview.dev` for login
---
## Stage 8: Built-In Data Services
**Demo:** "Aviation and maritime data with full history, served from api.worldwideview.dev."
- [ ] `api.worldwideview.dev` — aviation/maritime polling + persistence
- [ ] Redesign aviation as declarative plugin pointing to `api.worldwideview.dev`
- [ ] Redesign maritime the same way
- [ ] History/timeline with `%t` parameter substitution
- [ ] Snapshot capture (pro tier — counts toward storage quota)
- [ ] API key proxy with per-tenant-per-plugin rate limiting and response caching
---
## Stage 9: Trust Tiers, Extensions & Polish
**Demo:** "Install a verified extension plugin that adds cockpit view to aviation."
- [x] Ed25519-signed plugin registry (`GET /api/registry` on marketplace)
- [x] Server-side trust stamping at install time
- [x] Trust tier badges (`TrustBadge` component — Official / Verified / Unverified)
- [x] Unverified plugin warning dialog (`UnverifiedPluginDialog` + `useMarketplaceSync`)
- [ ] Extension plugin type support in `PluginManager`
- [ ] Activation events and contribution points
- [ ] Capability enforcement at runtime (`PluginPermissionError`)
- [ ] Web Worker sandboxing for unverified plugins (`comlink`)
- [ ] Reviews & ratings system
- [ ] Extension packs (bundles of related plugins)
- [ ] Auto-update mechanism (local: manual opt-in; cloud: automatic CDN swap)
- [ ] Plausible/Umami self-hosted analytics
---
## Stage 10: Infrastructure & Monetization
**Demo:** "Buy Pro, paste license key, unlock snapshot history and higher rate limits."
- [ ] Coolify on ThinkPad T480s — deploy all services
- [ ] Uptime Kuma monitoring (all subdomains)
- [ ] Stripe Checkout for license purchase
- [ ] Storage quota enforcement (cloud only)
- [ ] Stripe Connect for marketplace revenue split on paid plugins
- [ ] Cloudflare R2 as CDN for plugin bundles (`cdn.worldwideview.dev`)
---
## Resolved Architectural Decisions
| Decision | Resolution |
|---|---|
| **License** | EL2.0 for WorldWideView core; Open Source for marketplace |
| **Shared types** | `@worldwideview/plugin-sdk` npm package (MIT) |
| **Hosting** | Coolify (ThinkPad T480s). Landing page on Vercel (static export) |
| **Database** | Supabase PostgreSQL (cloud), SQLite (local), Prisma ORM |
| **Tenant isolation** | Row-Level Security (RLS) in shared PostgreSQL |
| **User settings** | Runtime settings store in DB, not `.env` |
| **Bot prevention** | Email verification + Cloudflare Turnstile + rate limiting |
| **Plugin execution** | Client-side (browser), not server-side |
| **Plugin architecture** | VS Code model — activation events, contribution points, namespaces |
| **Server-side compute** | Not supported — third-party backends handle compute |
| **Auth** | Auth.js on `app.worldwideview.dev`. `Credentials` (local), `@auth/supabase-adapter` (cloud). Marketplace uses SSO redirect |
| **Instance provisioning** | Auto-provision on signup — just a DB row insert |
| **API proxy** | `apikey` plugins routed through cached proxy, per-tenant-per-plugin rate limits |
| **History** | Third-party `historyUrl` with `%t` (all tiers), WWV snapshot capture (pro only) |
| **Built-in data** | Aviation/maritime → declarative plugins → `api.worldwideview.dev` |
| **CI/CD** | GitHub Actions → GHCR → Coolify webhook |
| **Plugin trust registry** | Ed25519-signed JSON, public key hardcoded in WWV, trust stamped server-side at install |
| **Package manager** | pnpm workspaces (migrated from npm) |
| **NPM submission flow** | Admin enters package name → marketplace infers manifest from `"worldwideview"` block in `package.json` |
| **NPM caching** | `NpmCache` table decouples marketplace from live NPM registry |
Symlink
+1
View File
@@ -0,0 +1 @@
C:/dev/worldwideview/agents.md
+1
View File
@@ -0,0 +1 @@
{"message":"fix(aviation): implement exponential backoff for rate limits","tree":"55c74a09dac7ce178ecf94d5cb48b2502e57e759","parents":["e25ddc0b648b757ea32b7376bab50d8e75d6d330"]}
+54
View File
@@ -0,0 +1,54 @@
const fs = require("fs");
const { execSync } = require("child_process");
const uuidsToDelete = [
"i331gbc1zzytx7via8lntdm6",
"pow71xsobdas7etf5r3hy5ug",
"l79dyd03lhtcpgi7swkoxm55",
"ry6160tpy4gh2xjfwr011no0",
"gfe78t8jm53lltentz19ze60",
"e1cg7q8khyvpti5rkp351559",
"c35cvvqxhdbslk8yc24g04wk",
"ijj9pqkavlusy2wmzsbjtc74",
"ghe6bzlr6ex6j51lgxzyhd46",
"h3v45w2u1essulzeg56i27a3",
"oxk05amog4fla0lskmkfx64x",
"yxm4mn60lfp9qah0q4yf2hij",
"ezjxo4ehs96lv0ji1n2r0auw",
"t12x7pgptsqiu5gbvv35gun5",
"urq1ll00a3vv9on6pulmpofe",
"eb5zgw5wlgvio2gggbiphpam",
"ld1h3pody4nxj3b44pbskl53",
"x111xfygqxrlbf5wqlx59f6d",
"se1weqr4dj7thp4p1l055wfc",
"cqses6urxff0n94i0u6lktzt",
"nvcir33nyuvzk5niy3s7eg9w",
"s63onga2s6v8r3k10lrdwzth",
"cf3uedqnjmwv48h7tm91d95r",
"o9124dnnieau9wxoefyxvfgu",
"kxzobc8qlvigbsk1d35dpiyi",
"eh8lzjbsy2c9kwj2emztcmf6",
"umfsos2vcmotfk2cfpqdoycc",
"yn1mdh0fngiati6r4625qvv9"
];
const token = "1|vPZPgvB8vVi8ZD5ZKS8lrCrwNlPofVv4I8Tjmqmyd01f92d2";
const baseUrl = "https://coolify.worldwideview.dev/api/v1";
const appUuid = "nmn55t4io3myfubs72worn7k";
async function run() {
for (const id of uuidsToDelete) {
console.log("Deleting", id);
try {
const res = await fetch(`${baseUrl}/applications/${appUuid}/envs/${id}`, {
method: "DELETE",
headers: { "Authorization": `Bearer ${token}` }
});
console.log(id, res.status);
} catch(e) {
console.error(e);
}
}
}
run();
+21
View File
@@ -0,0 +1,21 @@
services:
wwv:
build: .
ports:
- "3000:3000"
volumes:
- wwv-data:/app/data
env_file:
- path: .env
required: false
environment:
- "AUTH_SECRET=${AUTH_SECRET:-default_secret_for_local_dev}"
- "WWV_DEMO_ADMIN_SECRET=${WWV_DEMO_ADMIN_SECRET:-}"
- "WWV_BRIDGE_TOKEN=${WWV_BRIDGE_TOKEN:-}"
volumes:
wwv-data:
networks:
coolify:
external: true
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
# ─── Docker Entrypoint ───────────────────────────────────────
# Ensures the SQLite database exists and is migrated before
# starting the application. On first run with a fresh volume
# the DB file won't exist yet, so we run prisma migrate deploy.
set -e
mkdir -p ./data
echo "[entrypoint] Running database migrations..."
npx -y prisma migrate deploy
echo "[entrypoint] Migrations complete."
exec node server.js
+5 -3
View File
@@ -4,7 +4,9 @@ WorldWideView is a high-performance, event-driven geospatial intelligence engine
## Module Breakdown
1. **`src/core/plugins`**: The registration and lifecycle management layer. Defines how plugins are booted and destroyed.
1. **`src/core/plugins`**: The registration and lifecycle management layer.
- **PluginManager**: Orchestrator for enabling/disabling plugins.
- **InstalledPluginsLoader**: Dynamically discovers and loads external marketplace plugins at runtime via CDN bundles (e.g. UNPKG).
2. **`src/core/data`**: The "Heartbeat" of the system.
- **DataBus**: Decentralized event pipeline for all system actions.
- **PollingManager**: Intelligent scheduler for external API calls with backoff logic.
@@ -12,7 +14,7 @@ WorldWideView is a high-performance, event-driven geospatial intelligence engine
3. **`src/core/globe`**: The Rendering Engine.
- **Cesium Integration**: Low-level control over the Cesium Viewer.
- **EntityRenderer**: High-performance "Primitive" renderer.
4. **`src/plugins`**: Domain-specific logic (Aviation, Maritime, etc.).
4. **`packages/wwv-plugin-*`**: Monorepo plugin packages, externalized into standalone dynamically loaded CDNs.
## Performance: Primitives vs. Entities
@@ -20,7 +22,7 @@ One of our core design decisions is using **Cesium Primitives** instead of the s
| Feature | Entity API | Primitive API (WWV) |
|---|---|---|
| **Abstration** | High (Easy to use) | Low (Direct GPU access) |
| **Abstraction** | High (Easy to use) | Low (Direct GPU access) |
| **Overhead** | Significant per-entity JS objects | Minimal (Batched rendering) |
| **Max Capacity** | ~1,000 entities | **100,000+ points/billboards** |
| **WWV Use Case** | Info window content | Live data point visualization |
+22 -28
View File
@@ -5,46 +5,40 @@ Follow these steps to set up your development environment and get WorldWideView
## Requirements
- **Node.js**: v18.17 or higher (tested on v20+)
- **NPM**: v9 or higher
- **pnpm**: v8 or higher (`npm install -g pnpm`)
- **Browser**: Chrome, Firefox, or Edge (CesiumJS requires WebGL support)
## Environment Setup
WorldWideView requires several API keys to function correctly. You can copy the provided `.env.example` file to `.env.local` and fill in the values:
Run the setup script to auto-generate `.env.local` with a secure `AUTH_SECRET`:
```bash
cp .env.example .env.local
pnpm run setup
```
Or manually create a `.env.local` file in the root directory:
This copies `.env.example` → `.env.local` and fills in `AUTH_SECRET` automatically. You can then optionally add API keys for enhanced features (Cesium Ion, Bing Maps, OpenSky, etc.).
```env
# Cesium Ion Access Token (Required for terrain and default imagery)
NEXT_PUBLIC_CESIUM_ION_TOKEN=your_token_here
# Bing Maps API Key (Optional, for high-res imagery)
NEXT_PUBLIC_BING_MAPS_KEY=your_key_here
# Supabase Configuration (Required for persistence and historical data)
NEXT_PUBLIC_SUPABASE_URL=your_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
```
> [!NOTE]
> `AUTH_SECRET` must remain stable across restarts. The setup script generates it once and writes it to `.env.local`. Never commit `.env.local` to git.
## Running Locally
1. **Install Dependencies**:
```bash
npm install
pnpm install
```
2. **Start Dev Server**:
2. **Generate environment file** (first time only):
```bash
npm run dev
pnpm run setup
```
*Note: Our `dev` script automatically runs `predev` to copy Cesium assets to the public directory.*
3. **Open Browser**:
3. **Start Dev Server**:
```bash
pnpm run dev:all
```
4. **Open Browser**:
Navigate to [http://localhost:3000](http://localhost:3000).
## Folder Structure Explanation
@@ -53,9 +47,9 @@ Understanding the project layout:
```text
worldwideview/
├── .agents/ # Agentic AI workflows and memory
├── docs/ # Project documentation (Markdowns)
├── public/ # Static assets (Imagery, GeoJSON, Cesium dependencies)
├── docs/ # Project documentation
├── packages/ # Plugin packages (pnpm workspaces)
├── public/ # Static assets (GeoJSON data files, Cesium dependencies)
├── scripts/ # Build and utility scripts (e.g., copy-cesium.mjs)
└── src/
├── app/ # Next.js App Router (Layouts, Pages, API Routes)
@@ -64,8 +58,8 @@ worldwideview/
│ ├── data/ # Data management (DataBus, Polling, Cache)
│ ├── globe/ # Cesium-specific hooks and view logic
│ └── plugins/ # Plugin system base and registry
├── lib/ # Utility libraries and server-side polling
└── plugins/ # Feature-specific plugins (Aviation, Maritime, etc.)
├── lib/ # Utility libraries and server-side logic
└── plugins/ # Built-in plugins (Aviation, Maritime, etc.)
```
## Verification
@@ -77,5 +71,5 @@ To verify your setup:
---
> [!IMPORTANT]
> If you encounter issues with hot reloading (HMR), ensure you are running with the `--webpack` flag in the dev script (this is the default in our `package.json`).
> [!TIP]
> The database is created automatically on first run — no manual setup is required. If you need to reset it, delete `data/wwv.db` and restart the dev server.
Binary file not shown.

After

Width:  |  Height:  |  Size: 816 KiB

+59 -75
View File
@@ -21,7 +21,8 @@ There are **three plugin formats**:
## Prerequisites
- Node.js ≥ 18
- npm account (for publishing)
- pnpm (`npm install -g pnpm`)
- A npm account (for publishing to the npm registry)
- The WorldWideView monorepo cloned locally
---
@@ -61,10 +62,23 @@ Create `package.json`:
"author": "WorldWideView",
"peerDependencies": {
"@worldwideview/wwv-plugin-sdk": "*"
},
"worldwideview": {
"id": "my-data",
"icon": "MapPin",
"category": "Custom",
"format": "bundle"
}
}
```
> [!IMPORTANT]
> The `"worldwideview"` object block is strictly required if you intend to publish your plugin to the WorldWideView Marketplace. The marketplace uses this internal manifest to determine how to categorize and display your plugin automatically.
> * `id`: The unique string identifier.
> * `icon`: The Lucide React icon name (e.g. `MapPin`, `Satellite`, `Plane`).
> * `category`: Must match an existing category (e.g. `Aviation`, `Maritime`, `Natural Disaster`, `Custom`).
> * `format`: Either `bundle`, `static`, or `declarative`.
> [!IMPORTANT]
> The SDK is declared as a **peer dependency**, not a direct dependency. The host application provides it at runtime.
@@ -176,72 +190,39 @@ export class MyDataPlugin implements WorldPlugin {
```bash
cd packages/wwv-plugin-my-data
npm publish --access public
pnpm publish --access public
```
> [!NOTE]
> The marketplace pulls metadata (version, description, keywords) directly from the npm registry at runtime. You do not need to duplicate this metadata in the marketplace.
> The marketplace pulls metadata (version, description, keywords, readme) directly from the npm registry. You do not need to duplicate this information anywhere else.
---
## Step 4 — Register in the Marketplace
## Step 4 — Submit to the Marketplace
### 4a. Add to `knownPlugins.ts`
Once your package is published to npm, submit it for listing in the WorldWideView Marketplace:
Open `worldwideview-marketplace/src/data/knownPlugins.ts` and add your plugin:
1. Go to [marketplace.worldwideview.dev/submit](https://marketplace.worldwideview.dev/submit) (or open the Admin UI on a local marketplace instance)
2. Enter your **npm package name** (e.g. `@worldwideview/wwv-plugin-my-data`)
3. The marketplace automatically fetches your metadata from npm and reads the `"worldwideview"` block from your `package.json`
4. Your plugin enters a **pending** state for review
5. Once approved, it appears in the browse catalog
```typescript
{
id: "my-data",
npmPackage: "@worldwideview/wwv-plugin-my-data",
icon: "MapPin", // Lucide icon name
category: "Custom", // Must match a value in CATEGORIES
format: "static", // "static" | "bundle"
trust: "verified", // "built-in" | "verified" | "unverified"
capabilities: ["data:own"],
longDescription:
"Description shown on the plugin detail page in the marketplace.",
changelog:
"v1.0.0 — Initial release.",
},
```
> [!IMPORTANT]
> The `"worldwideview"` block in your `package.json` is required for submission. Make sure `id`, `icon`, `category`, and `format` are correctly set before publishing.
### 4b. Add a manifest (static plugins only)
### For static format plugins
For **static** format plugins, open `worldwideview-marketplace/src/data/pluginManifests.ts` and add:
If your plugin uses `"format": "static"`, your **GeoJSON file** must be hosted and accessible at a public URL, or included in the `public/data/` folder of the host WorldWideView application. The `dataFile` path in your manifest should point to that URL.
```typescript
"my-data": {
id: "my-data",
name: "My Data Layer",
version: "1.0.0",
description: "My custom data layer",
type: "data-layer",
format: "static",
trust: "verified",
capabilities: ["data:own"],
category: "Custom",
icon: "MapPin",
dataFile: "/data/my_data.geojson", // Path to GeoJSON in public/
rendering: {
entityType: "point",
color: "#3b82f6",
labelField: "name",
clusterEnabled: true,
clusterDistance: 50,
maxEntities: 5000,
},
},
```
Bundle plugins do **not** need a manifest entry here — their code is loaded via dynamic import.
If you are contributing a plugin for inclusion in the official WorldWideView release, place the GeoJSON at `public/data/<name>.geojson` and open a pull request.
---
## Step 5 — Test Locally
1. Start the WorldWideView app: `npm run dev` (in the `worldwideview` directory)
2. Start the marketplace: `npm run dev` (in the `worldwideview-marketplace` directory)
1. Start all WorldWideView services: `pnpm run dev:all` (in the monorepo root)
2. (Wait for both the main app and marketplace to start)
3. Open the marketplace at `http://localhost:3001/browse`
4. Find your plugin and click **Install**
5. Verify the data appears on the globe at `http://localhost:3000`
@@ -350,29 +331,32 @@ A static GeoJSON plugin where the npm package is just metadata:
Developer writes plugin
│
▼
Publish to npm ──────────────────────────────────► npm registry
│ │
▼ │
Add to knownPlugins.ts ──► Marketplace ◄────────────┘
(+ pluginManifests.ts shows plugin (fetches version,
for static plugins) in browse grid description, etc.)
│
▼
User clicks "Install"
│
▼
Marketplace sends manifest
to WorldWideView instance
│
▼
InstalledPluginsLoader saves
manifest to database (Prisma)
│
▼
loadPluginFromManifest() routes
by format: static → StaticDataPlugin
bundle → dynamic import
│
▼
Plugin renders on the 3D globe
Publish to npm ► npm registry (stores version, description, keywords, readme)
│
▼
Submit npm package name to Marketplace
│
▼
Marketplace fetches metadata from npm ← npm registry
and reads the "worldwideview" block from package.json
│
▼
Review → Plugin appears in browse catalog
│
▼
User clicks "Install"
│
▼
Marketplace sends manifest to WorldWideView instance
│
▼
Plugin saved to database (Prisma) → loaded on next startup
│
▼
loadPluginFromManifest() routes by format:
static → StaticDataPlugin (GeoJSON loader)
bundle → dynamic import()
│
▼
Plugin renders on the 3D globe
```
@@ -0,0 +1,216 @@
# Plugin Architecture Migration Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Migrate the WorldWideView plugin architecture from compile-time hardcoded imports to a dynamic, runtime-loaded ecosystem where external developers can build, host, and distribute plugins without touching the core repository.
**Architecture:** We will introduce a bundler (`tsup`) to the SDK to compile `bundle` plugins into browser-ready ECMAScript Modules (ESM). We will expose shared dependencies (`react`, `cesium`, `lucide-react`) via a global `window.__WWV_SHARED__` object. Finally, we will refactor `AppShell.tsx` to dynamically load all plugins at runtime via `import(/* webpackIgnore: true */)`, removing the hardcoded imports, and we will update `loadPluginFromManifest.ts` to seamlessly handle the global dependency injection.
**Tech Stack:** Next.js, React, CesiumJS, tsup.
---
## User Review Required
> [!WARNING]
> **Breaking Change**: This migration will decouple your built-in plugins from `AppShell.tsx`. They will now act as true "external" plugins that are loaded at runtime. During the transition, if the build steps aren't executed, the plugins will temporarily stop appearing on the globe. We will mitigate this by ensuring the build step runs before `next dev`.
> [!IMPORTANT]
> **Static GeoJSON Files**: Since static `.geojson` files currently live in `public/data`, we will leave them there during phase 1 of this migration to ensure the app doesn't break, but we will point the plugin manifests to load them via absolute or absolute-relative URLs (`/data/...`). In phase 2, we will introduce a symlink script to move them out of `public` entirely.
## Open Questions
1. **Build Tool Choice**: I am proposing `tsup` because it requires zero configuration to output multiple formats, automatically externalizes dependencies, and natively transpiles TypeScript/React. Are you comfortable adding `tsup` to the `wwv-plugin-sdk` package?
2. **Local Serving**: To test "built-in" plugins using the dynamic loading method, we need the Next.js app to serve their compiled `plugin.js` bundles. My plan adds a quick copy script to the root `package.json` that copies their `dist` folders into `public/builtin-plugins/` so they can be fetched locally via HTTP. Does this sound good?
## Proposed Changes
### Task 1: Initialize Global Shared Dependencies
**Files:**
- Modify: `c:\dev\worldwideview\src\components\layout\AppShell.tsx`
- Create: `c:\dev\worldwideview\src\core\plugins\PluginGlobals.ts`
- [ ] **Step 1: Create the PluginGlobals initializer**
```typescript
import React from "react";
import ReactDOM from "react-dom";
import * as ReactDomServer from "react-dom/server";
import { Plane, Ship, Camera, Shield, Flame, Map, Swords, Atom, Landmark, Mountain, PlaneTakeoff, Anchor, Lamp, Rocket, SunMoon, Cable, Pickaxe, ShieldAlert, Crosshair, SatelliteDish, Hand, Radar, Scale } from "lucide-react";
import * as Cesium from "cesium";
import * as WWVPluginSDK from "@worldwideview/wwv-plugin-sdk";
export function initPluginGlobals() {
if (typeof window === "undefined") return;
// Create a registry of Lucide icons commonly used by plugins to prevent them from bundling the massive icon library
const lucideIcons = {
Plane, Ship, Camera, Shield, Flame, Map, Swords, Atom, Landmark, Mountain,
PlaneTakeoff, Anchor, Lamp, Rocket, SunMoon, Cable, Pickaxe, ShieldAlert,
Crosshair, SatelliteDish, Hand, Radar, Scale
};
(window as any).__WWV_SHARED__ = {
"react": React,
"react-dom": ReactDOM,
"react-dom/server": ReactDomServer,
"cesium": Cesium,
"@worldwideview/wwv-plugin-sdk": WWVPluginSDK,
"lucide-react": lucideIcons
};
}
```
- [ ] **Step 2: Inject globals in AppShell before anything loads**
In `AppShell.tsx`, import and call `initPluginGlobals()` at the top of the file, outside of any React components.
```tsx
import { initPluginGlobals } from "@/core/plugins/PluginGlobals";
import dynamic from "next/dynamic";
// Initialize globals immediately so they exist before any dynamic imports
if (typeof window !== "undefined") {
initPluginGlobals();
}
//... rest of the file
```
### Task 2: Configure SDK Build Tool (`tsup`)
**Files:**
- Modify: `c:\dev\worldwideview\packages\wwv-plugin-sdk\package.json`
- Create: `c:\dev\worldwideview\packages\wwv-plugin-sdk\bin\wwv-plugin-build.js`
- [ ] **Step 1: Add tsup dependency**
Run: `pnpm --filter @worldwideview/wwv-plugin-sdk add -D tsup`
- [ ] **Step 2: Create the wwv-plugin-build CLI wrapper**
Add this to `wwv-plugin-sdk/bin/wwv-plugin-build.js`:
```javascript
#!/usr/bin/env node
const { build } = require("tsup");
const path = require("path");
async function run() {
const cwd = process.cwd();
await build({
entry: ["src/index.ts"],
outDir: "dist",
format: ["esm"],
target: "es2022",
clean: true,
dts: false,
minify: false,
sourcemap: true,
// Mark all these as externals so they aren't bundled
external: ["react", "react-dom", "cesium", "@worldwideview/wwv-plugin-sdk", "lucide-react"],
// Provide a shim that converts bare imports into global lookups
esbuildPlugins: [{
name: "wwv-globals",
setup(build) {
build.onResolve({ filter: /^(react|react-dom|cesium|@worldwideview\/wwv-plugin-sdk|lucide-react)$/ }, args => {
return { path: args.path, namespace: "wwv-global" };
});
build.onLoad({ filter: /.*/, namespace: "wwv-global" }, args => {
let globalKey = args.path;
if (args.path === "lucide-react") return { contents: `module.exports = window.__WWV_SHARED__["lucide-react"];` };
return { contents: `module.exports = window.__WWV_SHARED__["${globalKey}"];` };
});
}
}]
});
}
run();
```
- [ ] **Step 3: Update SDK package.json to expose the bin**
```json
"bin": {
"wwv-plugin-build": "./bin/wwv-plugin-build.js"
},
```
### Task 3: Refactor Plugins to use Build Tool and Manifests
**Files:**
- Modify: `wwv-plugin-aviation/package.json`
- Modify: `wwv-plugin-aviation/plugin.json` (Create)
- [ ] **Step 1: Add build script to aviation plugin**
```json
"scripts": {
"build": "wwv-plugin-build"
},
```
- [ ] **Step 2: Create plugin.json for aviation**
```json
{
"id": "aviation",
"name": "Aviation",
"version": "1.0.7",
"type": "data-layer",
"format": "bundle",
"trust": "built-in",
"capabilities": ["data:own", "network:fetch"],
"category": "aviation",
"icon": "Plane",
"entry": "/builtin-plugins/aviation/index.mjs"
}
```
*(Repeat for all other built-in plugins)*
### Task 4: Dynamic Initial Loader
**Files:**
- Modify: `c:\dev\worldwideview\src\components\layout\AppShell.tsx`
- Modify: `c:\dev\worldwideview\package.json`
- [ ] **Step 1: Remove Hardcoded Plugins**
In `AppShell.tsx`, delete the `builtIns` array and `import` statements at the top.
- [ ] **Step 2: Fetch and load all plugins via manifest**
Modify `AppShell.tsx` `startPlatform`:
```typescript
// Fetch the unified list of ALL installed plugins (both built-in and dynamic)
const res = await fetch("/api/marketplace/load");
if (res.ok) {
const data = await res.json();
for (const manifest of data.manifests) {
if (disabledIds.has(manifest.id)) continue;
try {
await pluginManager.loadFromManifest(manifest);
initLayer(manifest.id);
} catch (e) {
console.error("Failed to load plugin", manifest.id, e);
}
}
}
```
- [ ] **Step 3: Add predev copy-script**
Modify `package.json` to copy compiled plugin `dist` folders to `public/builtin-plugins` so the Next.js server can serve them at the `/builtin-plugins/...` path.
## Verification Plan
### Automated Tests
- Run `pnpm --filter wwv-plugin-aviation build` to ensure `tsup` generates a valid ES Module with no bundled React.
- Verify `dist/index.mjs` contains `window.__WWV_SHARED__["react"]` lookups.
### Manual Verification
- Start the Next.js server.
- Open network tab in browser and verify `GET /builtin-plugins/aviation/index.mjs` succeeds.
- Verify the Aviation plugin appears on the globe and renders planes successfully, indicating that it successfully retrieved Cesium and React from the global shared context.
@@ -0,0 +1,475 @@
# Demo Google AdSense Panel Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Add a Google AdSense vertical ad strip to the right side of the demo instance, with a dismissible banner explaining it's temporary to fund hosting.
**Architecture:** Three layers: (1) load the AdSense script conditionally in the root layout only when `isDemo` is true, (2) a reusable `AdUnit` client component that calls `adsbygoogle.push({})`, (3) a `DemoAdStrip` shell component that wraps the ad unit + a "why ads?" dismissible message, positioned as a fixed vertical strip on the right edge. CSP headers in `next.config.ts` must be updated to allow the AdSense domains.
**Tech Stack:** Next.js 16 (App Router, `next/script`), Google AdSense, vanilla CSS, Vitest
---
## File Structure
| File | Action | Responsibility |
|---|---|---|
| `src/app/layout.tsx` | MODIFY | Conditionally load AdSense `<Script>` for demo |
| `next.config.ts` | MODIFY | Add AdSense domains to CSP `script-src` and `frame-src` |
| `.env` | MODIFY | Add `NEXT_PUBLIC_ADSENSE_CLIENT_ID` placeholder |
| `src/components/ads/AdUnit.tsx` | CREATE | Generic reusable AdSense unit component |
| `src/components/ads/DemoAdStrip.tsx` | CREATE | Demo-only vertical strip: ad + "why ads?" message |
| `src/components/ads/DemoAdStrip.css` | CREATE | Styles for the vertical ad strip |
| `src/components/layout/AppShell.tsx` | MODIFY | Import and render `<DemoAdStrip />` |
| `src/types/adsense.d.ts` | CREATE | TypeScript ambient declaration for `window.adsbygoogle` |
---
> [!IMPORTANT]
> **Before starting:** You need a Google AdSense publisher ID (`ca-pub-XXXXXXXXXXXXXXXX`) and an ad slot ID. These go into `.env` as `NEXT_PUBLIC_ADSENSE_CLIENT_ID` and are passed to the ad unit component. You can get these from [Google AdSense](https://www.google.com/adsense/). Without them the ads will not render, but the component framework will still work.
---
### Task 1: TypeScript Ambient Declaration for AdSense
**Files:**
- Create: `src/types/adsense.d.ts`
- [ ] **Step 1: Create the ambient type declaration**
```ts
// src/types/adsense.d.ts
interface Window {
adsbygoogle: Array<Record<string, unknown>>;
}
```
- [ ] **Step 2: Commit**
```bash
git add src/types/adsense.d.ts
git commit -m "chore: add adsense ambient type declaration"
```
---
### Task 2: Environment Variable
**Files:**
- Modify: `.env`
- [ ] **Step 1: Add the AdSense client ID placeholder**
Add the following line to the end of `.env`:
```
# Google AdSense — only used on demo edition
NEXT_PUBLIC_ADSENSE_CLIENT_ID=
```
The actual value (`ca-pub-XXXXXXXXXXXXXXXX`) should be set in `.env.local` for local testing or in the deployment environment. The ad slot IDs will be hardcoded in the component since there's only one placement.
- [ ] **Step 2: Commit**
```bash
git add .env
git commit -m "chore: add NEXT_PUBLIC_ADSENSE_CLIENT_ID env var"
```
---
### Task 3: CSP Headers Update
**Files:**
- Modify: `next.config.ts:29-52`
- [ ] **Step 1: Update CSP in next.config.ts**
In the `headers()` function, modify the `script-src` and `frame-src` directives to allow AdSense domains.
```ts
// Change this line (line 39):
"script-src 'self' 'unsafe-eval' 'unsafe-inline' blob: https://analytics.worldwideview.dev https://va.vercel-scripts.com",
// To this:
"script-src 'self' 'unsafe-eval' 'unsafe-inline' blob: https://analytics.worldwideview.dev https://va.vercel-scripts.com https://pagead2.googlesyndication.com https://adservice.google.com https://www.googletagservices.com",
```
```ts
// Change this line (line 49):
"frame-src 'self' *.youtube.com *.youtube-nocookie.com *.twitch.tv *.vimeo.com *.webcamera.pl *.ivideon.com *.rtsp.me *.bnu.tv",
// To this:
"frame-src 'self' *.youtube.com *.youtube-nocookie.com *.twitch.tv *.vimeo.com *.webcamera.pl *.ivideon.com *.rtsp.me *.bnu.tv https://googleads.g.doubleclick.net https://tpc.googlesyndication.com",
```
- [ ] **Step 2: Commit**
```bash
git add next.config.ts
git commit -m "feat: add Google AdSense domains to CSP headers"
```
---
### Task 4: AdSense Script in Root Layout
**Files:**
- Modify: `src/app/layout.tsx:24-39`
- [ ] **Step 1: Conditionally load AdSense script for demo edition**
Add the AdSense `<Script>` tag inside `<head>`, using the `NEXT_PUBLIC_` env var for the client ID and the `NEXT_PUBLIC_WWV_EDITION` env var to gate loading.
```tsx
// src/app/layout.tsx — updated <head> section
<head>
{/* Load CesiumJS base styles (optional, but helps with UI widgets if used later) */}
<link rel="stylesheet" href="/cesium/Widgets/widgets.css" />
</head>
<body suppressHydrationWarning>
{children}
<Analytics />
<Script
src="https://analytics.worldwideview.dev/script.js"
data-website-id="2c8f6c09-2651-4a2a-af99-b8cee1612b9a"
strategy="afterInteractive"
/>
{process.env.NEXT_PUBLIC_WWV_EDITION === "demo" &&
process.env.NEXT_PUBLIC_ADSENSE_CLIENT_ID && (
<Script
src={`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${process.env.NEXT_PUBLIC_ADSENSE_CLIENT_ID}`}
crossOrigin="anonymous"
strategy="afterInteractive"
/>
)}
</body>
```
> **Note:** We use the raw env var at the layout level (Server Component) rather than importing `isDemo` which uses `process.env.NEXT_PUBLIC_WWV_EDITION` anyway. This avoids importing the edition module into the root layout.
- [ ] **Step 2: Commit**
```bash
git add src/app/layout.tsx
git commit -m "feat: conditionally load AdSense script on demo edition"
```
---
### Task 5: Reusable AdUnit Component
**Files:**
- Create: `src/components/ads/AdUnit.tsx`
- [ ] **Step 1: Create the generic AdSense unit component**
```tsx
// src/components/ads/AdUnit.tsx
"use client";
import { useEffect, useRef } from "react";
interface AdUnitProps {
adSlot: string;
adFormat?: string;
style?: React.CSSProperties;
className?: string;
}
export function AdUnit({ adSlot, adFormat = "auto", style, className }: AdUnitProps) {
const pushed = useRef(false);
const clientId = process.env.NEXT_PUBLIC_ADSENSE_CLIENT_ID;
useEffect(() => {
if (pushed.current || !clientId) return;
try {
(window.adsbygoogle = window.adsbygoogle || []).push({});
pushed.current = true;
} catch (err) {
console.error("[AdUnit] AdSense push error:", err);
}
}, [clientId]);
if (!clientId) return null;
return (
<div className={className} style={style}>
<ins
className="adsbygoogle"
style={{ display: "block" }}
data-ad-client={clientId}
data-ad-slot={adSlot}
data-ad-format={adFormat}
data-full-width-responsive="false"
/>
</div>
);
}
```
> **Key detail:** The `pushed` ref prevents double-push on React strict mode / hot reload. `data-full-width-responsive="false"` prevents the ad from expanding beyond the container — critical for a fixed-width vertical strip.
- [ ] **Step 2: Commit**
```bash
git add src/components/ads/AdUnit.tsx
git commit -m "feat: add reusable AdUnit component"
```
---
### Task 6: DemoAdStrip Component + Styles
**Files:**
- Create: `src/components/ads/DemoAdStrip.tsx`
- Create: `src/components/ads/DemoAdStrip.css`
- [ ] **Step 1: Create the CSS for the vertical ad strip**
```css
/* src/components/ads/DemoAdStrip.css */
.demo-ad-strip {
position: fixed;
right: 0;
top: 0;
bottom: 0;
width: 160px;
z-index: 45;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: var(--space-md);
padding: var(--space-sm);
pointer-events: none;
transition: transform var(--duration-slow) var(--ease-smooth),
opacity var(--duration-slow) var(--ease-smooth);
}
.demo-ad-strip--hidden {
transform: translateX(200px);
opacity: 0;
}
.demo-ad-strip__ad {
pointer-events: auto;
width: 160px;
min-height: 600px;
}
.demo-ad-strip__banner {
pointer-events: auto;
display: flex;
flex-direction: column;
align-items: center;
gap: var(--space-xs);
padding: var(--space-sm) var(--space-md);
background: var(--bg-glass);
backdrop-filter: blur(var(--glass-blur));
-webkit-backdrop-filter: blur(var(--glass-blur));
border: 1px solid var(--border-subtle);
border-radius: var(--radius-md);
max-width: 160px;
text-align: center;
cursor: pointer;
transition: all var(--duration-fast) var(--ease-smooth);
}
.demo-ad-strip__banner:hover {
border-color: rgba(var(--accent-rgb), 0.3);
box-shadow: var(--glow-cyan);
}
.demo-ad-strip__banner-label {
font-size: 9px;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--text-muted);
}
.demo-ad-strip__banner-text {
font-size: 11px;
line-height: 1.4;
color: var(--text-secondary);
}
.demo-ad-strip__close {
position: absolute;
top: var(--space-xs);
right: var(--space-xs);
width: 20px;
height: 20px;
border-radius: 50%;
background: transparent;
border: none;
color: var(--text-muted);
font-size: 12px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: color var(--duration-fast) var(--ease-smooth);
}
.demo-ad-strip__close:hover {
color: var(--text-primary);
}
/* Hide on mobile — ads shouldn't overlay the full-screen globe */
@media (max-width: 768px) {
.demo-ad-strip {
display: none;
}
}
```
- [ ] **Step 2: Create the DemoAdStrip component**
```tsx
// src/components/ads/DemoAdStrip.tsx
"use client";
import { useState } from "react";
import { isDemo } from "@/core/edition";
import { AdUnit } from "./AdUnit";
import { X } from "lucide-react";
import "./DemoAdStrip.css";
/** The ad slot ID for the vertical skyscraper unit — set this in AdSense dashboard. */
const VERTICAL_AD_SLOT = "REPLACE_WITH_YOUR_AD_SLOT_ID";
export function DemoAdStrip() {
const [showMessage, setShowMessage] = useState(false);
const [closed, setClosed] = useState(false);
if (!isDemo || closed) return null;
return (
<aside className="demo-ad-strip" aria-label="Sponsored content">
<AdUnit
adSlot={VERTICAL_AD_SLOT}
adFormat="vertical"
className="demo-ad-strip__ad"
/>
<div
className="demo-ad-strip__banner"
onClick={() => setShowMessage((prev) => !prev)}
role="button"
tabIndex={0}
onKeyDown={(e) => { if (e.key === "Enter") setShowMessage((prev) => !prev); }}
>
<button
className="demo-ad-strip__close"
onClick={(e) => { e.stopPropagation(); setClosed(true); }}
aria-label="Dismiss ad panel"
>
<X size={12} />
</button>
<span className="demo-ad-strip__banner-label">Why ads?</span>
{showMessage ? (
<span className="demo-ad-strip__banner-text">
This isn&apos;t permanent — it&apos;s temporary because I&apos;m a single
dev and need to cover hosting costs. Thank you for understanding.
</span>
) : (
<span className="demo-ad-strip__banner-text">
Click to learn more
</span>
)}
</div>
</aside>
);
}
```
- [ ] **Step 3: Commit**
```bash
git add src/components/ads/DemoAdStrip.tsx src/components/ads/DemoAdStrip.css
git commit -m "feat: add DemoAdStrip with Google AdSense vertical unit"
```
---
### Task 7: Integrate into AppShell
**Files:**
- Modify: `src/components/layout/AppShell.tsx:8-9,168`
- [ ] **Step 1: Add import**
After the existing `CameraStatsPanel` import (line 8), add:
```tsx
import CameraStatsPanel from "@/components/panels/CameraStatsPanel";
import { DemoAdStrip } from "@/components/ads/DemoAdStrip"; // ADD THIS
import { Timeline } from "@/components/timeline/Timeline";
```
- [ ] **Step 2: Add the JSX**
After `<EntityInfoCard />` (line 168), add:
```tsx
<EntityInfoCard />
<DemoAdStrip />
<Timeline />
```
- [ ] **Step 3: Commit**
```bash
git add src/components/layout/AppShell.tsx
git commit -m "feat: integrate DemoAdStrip into AppShell"
```
---
### Task 8: ads.txt for AdSense Verification
**Files:**
- Create: `public/ads.txt`
- [ ] **Step 1: Create ads.txt**
```
google.com, ca-pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
```
> Replace `ca-pub-XXXXXXXXXXXXXXXX` with your actual publisher ID. This file is required by AdSense for domain verification.
- [ ] **Step 2: Commit**
```bash
git add public/ads.txt
git commit -m "chore: add ads.txt for AdSense domain verification"
```
---
## Open Questions
> [!IMPORTANT]
> **Do you have a Google AdSense publisher ID yet?** If not, you'll need to sign up at https://www.google.com/adsense/ and get your `ca-pub-XXXX` ID and create a 160x600 "Wide Skyscraper" ad unit to get the slot ID. The code will render nothing gracefully until these are configured.
> [!WARNING]
> **CSP changes are required for AdSense to work.** The current CSP is restrictive and blocks `pagead2.googlesyndication.com` and `googleads.g.doubleclick.net`. Task 3 adds them. Without this, ads will be silently blocked by the browser.
---
## Verification Plan
### Manual Verification
1. Set `NEXT_PUBLIC_WWV_EDITION=demo` and `NEXT_PUBLIC_ADSENSE_CLIENT_ID=ca-pub-XXXX` in `.env.local`
2. Run `pnpm dev`
3. Verify: A 160px vertical strip appears on the right edge of the screen
4. Verify: The "Why ads?" banner is clickable and toggles the explanation message
5. Verify: Clicking the X dismisses the entire strip
6. Verify: On mobile viewport widths (< 768px), the strip is hidden
7. Verify: Set `NEXT_PUBLIC_WWV_EDITION=local` → strip does not render at all
8. Verify: Browser console shows no CSP violations related to AdSense domains
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,145 @@
# Expand OSM Chips Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Expand the available OSM search chips to include a curated list of ~30 pre-loaded OSINT-relevant tags, and add a live Taginfo API autocomplete search to dynamically find and select any of the millions of other OSM tags.
**Architecture:** We will replace the current small `COMMON_TAGS` array with a richer, categorized list inside the `OSMSidebar` file. To allow access to "all" tags without crashing the UI, we will add a debounced fetch hook that hits `https://taginfo.openstreetmap.org/api/4/tags/popular` (or the equivalent search endpoint) when the user types in the filter box. These dynamically fetched tags will temporarily populate the chip list.
**Tech Stack:** React, TypeScript, Taginfo API
---
### Task 1: Update Pre-Loaded COMMON_TAGS
**Files:**
- Modify: `c:\dev\worldwideview\packages\wwv-plugin-osm-search\src\components\OSMSidebar.tsx:6-11`
- [ ] **Step 1: Replace existing COMMON_TAGS array**
```tsx
const COMMON_TAGS = [
// Military & Security
"military=base", "military=bunker", "amenity=police", "amenity=prison",
// Aviation & Maritime
"aeroway=aerodrome", "aeroway=helipad", "aeroway=hangar", "man_made=pier", "harbour=yes",
// Infrastructure & Utilities
"power=plant", "power=substation", "telecom=antenna", "man_made=communications_tower", "man_made=water_tower",
// Transport
"highway=bus_stop", "railway=station", "amenity=fuel", "amenity=parking",
// Medical & Emergency
"amenity=hospital", "amenity=fire_station", "amenity=clinic",
// General Commercial & Industrial
"shop=supermarket", "tourism=hotel", "industrial=factory", "landuse=industrial",
// Education & Amenities
"amenity=school", "amenity=university", "amenity=cafe", "building=house"
];
```
- [ ] **Step 2: Commit**
```bash
git add packages/wwv-plugin-osm-search/src/components/OSMSidebar.tsx
git commit -m "feat(osm-search): expand quick preset tags with OSINT categories"
```
### Task 2: Implement Taginfo Dynamic Autocomplete
**Files:**
- Modify: `c:\dev\worldwideview\packages\wwv-plugin-osm-search\src\components\OSMSidebar.tsx`
- [ ] **Step 1: Add state and debounced fetch logic inside OSMSidebar component**
```tsx
const [searchText, setSearchText] = useState("");
const [activeTags, setActiveTags] = useState<string[]>([]);
const [dynamicTags, setDynamicTags] = useState<string[]>([]);
const [isSearchingApi, setIsSearchingApi] = useState(false);
// Add this useEffect below the useState hooks
React.useEffect(() => {
if (searchText.length < 3) {
setDynamicTags([]);
return;
}
const timer = setTimeout(async () => {
setIsSearchingApi(true);
try {
// Fetch tags matching the search term from OSM Taginfo
const res = await fetch(`https://taginfo.openstreetmap.org/api/4/search/by_keyword?query=${encodeURIComponent(searchText)}`);
const data = await res.json();
if (data && data.data) {
// Extract exact key=value pairs or just keys, format as "key=value"
const tags = data.data
.filter((item: any) => item.key && item.value)
.map((item: any) => `${item.key}=${item.value}`)
.slice(0, 15); // Limit to top 15 results
setDynamicTags(tags);
}
} catch (err) {
console.error("Taginfo fetch failed", err);
} finally {
setIsSearchingApi(false);
}
}, 500); // 500ms debounce
return () => clearTimeout(timer);
}, [searchText]);
```
- [ ] **Step 2: Update rendering logic to merge static and dynamic tags**
Look for the `renderedTags` definition and replace it:
```tsx
// Combine filtered common tags with newly fetched dynamic tags, removing duplicates
const filteredCommon = searchText
? COMMON_TAGS.filter(t => t.toLowerCase().includes(searchText.toLowerCase()))
: COMMON_TAGS;
const renderedTags = Array.from(new Set([...filteredCommon, ...dynamicTags]));
```
- [ ] **Step 3: Add loading indicator to the search input area**
Look for the `<input>` element for `searchText` and wrap it/add a loading indicator:
```tsx
<div style={{ position: "relative" }}>
<input
style={{
width: "100%",
padding: "8px",
paddingRight: "24px",
backgroundColor: "rgba(0,0,0,0.3)",
color: "#fff",
border: "1px solid var(--border-subtle)",
borderRadius: "4px",
fontSize: "13px"
}}
placeholder="Filter or search OSM for tags..."
value={searchText}
onChange={e => setSearchText(e.target.value)}
/>
{isSearchingApi && (
<span style={{
position: "absolute",
right: "8px",
top: "50%",
transform: "translateY(-50%)",
fontSize: "10px",
color: "var(--text-muted)"
}}>
⏳
</span>
)}
</div>
```
- [ ] **Step 4: Commit**
```bash
git add packages/wwv-plugin-osm-search/src/components/OSMSidebar.tsx
git commit -m "feat(osm-search): add live Taginfo autocomplete for unlisted tags"
```
@@ -0,0 +1,139 @@
# Plugin Versioning Streamlining Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Refactor all WorldWideView plugin classes to derive their `version` property dynamically from their local `package.json` file rather than hardcoding string literals.
**Architecture:** We will replace the hardcoded `version = "x.y.z"` strings in the core `WorldPlugin` interface implementations across all monorepo packages. We will utilize TypeScript's JSON module resolution feature to `import pkg from "../package.json"` and map `version = pkg.version`. This ensures that `pnpm version patch` is the single source of truth and eliminates the double-bookkeeping that previously made CI fixes tedious.
**Tech Stack:** TypeScript, Next.js / bundler (JSON module resolution), pnpm workspaces.
---
## Task 1: Verify TypeScript Configuration
**Files:**
- Modify: N/A (Verification step)
- [ ] **Step 1: Check `tsconfig.json` for JSON resolution**
Run: `cat tsconfig.json | grep resolveJsonModule`
Expected: `"resolveJsonModule": true`
- [ ] **Step 2: Check compiler compatibility**
Run: `pnpm exec tsc --noEmit`
Expected: PASS (exit code 0)
## Task 2: Refactor Group A Plugins (Core Infrastructure)
**Files:**
- Modify: `packages/wwv-plugin-aviation/src/index.ts`
- Modify: `packages/wwv-plugin-maritime/src/index.ts`
- Modify: `packages/wwv-plugin-military-aviation/src/index.ts`
- [ ] **Step 1: Update plugin classes**
For each file above, modify the imports and the class body:
```typescript
import pkg from "../package.json";
// ...
export class AviationPlugin implements WorldPlugin { // (or extends BasePlugin)
// ...
version = pkg.version;
```
- [ ] **Step 2: Verify compilation**
Run: `pnpm exec tsc --noEmit`
Expected: PASS
- [ ] **Step 3: Commit**
```bash
git commit -am "refactor(plugins): derive version dynamically for core infrastructure plugins [Patch]"
```
## Task 3: Refactor Group B Plugins (Facilities & Infrastructure)
**Files:**
- Modify: `packages/wwv-plugin-airports/src/index.ts`
- Modify: `packages/wwv-plugin-seaports/src/index.ts`
- Modify: `packages/wwv-plugin-spaceports/src/index.ts`
- Modify: `packages/wwv-plugin-embassies/src/index.ts`
- Modify: `packages/wwv-plugin-lighthouses/src/index.ts`
- Modify: `packages/wwv-plugin-nuclear/src/index.ts`
- Modify: `packages/wwv-plugin-undersea-cables/src/index.ts`
- Modify: `packages/wwv-plugin-mineral-mines/src/index.ts`
- [ ] **Step 1: Update plugin classes**
For each file above, replace `version = "..."` with `version = pkg.version` and add `import pkg from "../package.json";`.
- [ ] **Step 2: Verify compilation**
Run: `pnpm exec tsc --noEmit`
Expected: PASS
- [ ] **Step 3: Commit**
```bash
git commit -am "refactor(plugins): derive version dynamically for facility plugins [Patch]"
```
## Task 4: Refactor Group C Plugins (Hazards & Events)
**Files:**
- Modify: `packages/wwv-plugin-earthquakes/src/index.ts`
- Modify: `packages/wwv-plugin-volcanoes/src/index.ts`
- Modify: `packages/wwv-plugin-wildfire/src/index.ts`
- Modify: `packages/wwv-plugin-conflict-events/src/index.tsx`
- Modify: `packages/wwv-plugin-conflict-zones/src/index.tsx`
- Modify: `packages/wwv-plugin-civil-unrest/src/index.tsx`
- Modify: `packages/wwv-plugin-cyber-attacks/src/index.tsx`
- Modify: `packages/wwv-plugin-international-sanctions/src/index.tsx`
- [ ] **Step 1: Update plugin classes**
For each file above, replace `version = "..."` with `version = pkg.version` and add `import pkg from "../package.json";`. Note that some files are `.tsx`.
- [ ] **Step 2: Verify compilation**
Run: `pnpm exec tsc --noEmit`
Expected: PASS
- [ ] **Step 3: Commit**
```bash
git commit -am "refactor(plugins): derive version dynamically for event and hazard plugins [Patch]"
```
## Task 5: Refactor Group D Plugins (Misc & Utilities)
**Files:**
- Modify: `packages/wwv-plugin-satellite/src/index.ts`
- Modify: `packages/wwv-plugin-surveillance-satellites/src/index.tsx`
- Modify: `packages/wwv-plugin-osm-search/src/index.ts`
- Modify: `packages/wwv-plugin-iranwarlive/src/index.ts`
- Modify: `packages/wwv-plugin-daynight/src/index.ts`
- Modify: `packages/wwv-plugin-camera/src/index.ts`
- Modify: `packages/wwv-plugin-borders/src/index.ts`
- Modify: `packages/wwv-plugin-gps-jamming/src/index.tsx`
- Modify: `packages/wwv-plugin-air-defense/src/index.tsx`
- [ ] **Step 1: Update plugin classes**
For each file above, replace `version = "..."` with `version = pkg.version` and add `import pkg from "../package.json";`.
- [ ] **Step 2: Verify compilation and tests**
Run: `pnpm exec tsc --noEmit`
Run: `pnpm test`
Expected: PASS
- [ ] **Step 3: Commit**
```bash
git commit -am "refactor(plugins): derive version dynamically for utility plugins [Patch]"
```
@@ -0,0 +1,124 @@
# Demo Default Plugins Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Enable specific plugins by default on the demo edition via environment variables so the user is immediately impressed.
**Architecture:** Update `layersSlice.ts` to accept an optional `defaultEnabled` parameter in `initLayer`. In `AppShell.tsx`, look up `NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS` when the edition is `demo`, and pass the flag true to `initLayer` for matching plugins during registration. Document the variable in `.env.example`.
**Tech Stack:** Next.js, Zustand, TypeScript.
---
### Task 1: Update layer slice definition
**Files:**
- Modify: `src/core/state/layersSlice.ts`
- [ ] **Step 1: Write the implementation**
Update `initLayer` in `src/core/state/layersSlice.ts` to accept a second parameter:
```typescript
// Add defaultEnabled parameter to the interface
export interface LayersSlice {
// ...
initLayer: (pluginId: string, defaultEnabled?: boolean) => void;
}
// ...
// Use the parameter in the state updater
initLayer: (pluginId, defaultEnabled = false) =>
set((state) => ({
layers: {
...state.layers,
[pluginId]: state.layers[pluginId] || { enabled: defaultEnabled, entityCount: 0, loading: false },
},
})),
```
- [ ] **Step 2: Commit**
```bash
git add src/core/state/layersSlice.ts
npm run commit -- "feat: add defaultEnabled param to initLayer in layers slice"
```
### Task 2: Apply default configuration in AppShell
**Files:**
- Modify: `src/components/layout/AppShell.tsx`
- [ ] **Step 1: Write the implementation**
Add `isDemo` import at the top of `src/components/layout/AppShell.tsx`:
```typescript
import { isDemo } from "@/core/edition";
```
In `AppShell.tsx`, around line 71, inside `startPlatform()`, fetch the value from the environment if the instance is demo:
```typescript
// Fetch disabled built-in plugins before registration
let disabledIds = new Set<string>();
// ... (keep existing try/catch block)
// Setup demo defaults
const demoDefaultPlugins = new Set<string>();
if (isDemo) {
const envVar = process.env.NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS || "";
envVar.split(",").forEach(s => {
const clean = s.trim();
if (clean) demoDefaultPlugins.add(clean);
});
}
```
Then update the `pluginManager` registration loop to inject the boolean for `initLayer`:
```typescript
for (const plugin of pluginRegistry.getAll()) {
await pluginManager.registerPlugin(plugin);
initLayer(plugin.id, demoDefaultPlugins.has(plugin.id));
}
```
- [ ] **Step 2: Run test to verify it passes**
Run type checks to verify no compilation issues:
`npx tsc --noEmit`
- [ ] **Step 3: Commit**
```bash
git add src/components/layout/AppShell.tsx
npm run commit -- "feat: parse and apply default demo plugins via NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS"
```
### Task 3: Document environment definitions
**Files:**
- Modify: `.env.example`
- Modify: `.env`
- [ ] **Step 1: Write the implementation**
Update `.env.example` and `.env` around the `NEXT_PUBLIC_WWV_EDITION=local` definition:
```dotenv
# Default plugins enabled on boot for demo edition
# Comma-separated list of plugin IDs (e.g. aviation,maritime,iranwarlive)
NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS=
# Edition: "local" | "cloud" | "demo"
NEXT_PUBLIC_WWV_EDITION=local
```
- [ ] **Step 2: Commit**
```bash
git add .env.example .env
npm run commit -- "docs: add NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS to env templates"
```
@@ -0,0 +1,177 @@
# Decouple Plugin Proxies Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Strip out hardcoded proxy endpoints from the `worldwideview` core repository to enforce a fully decoupled plugin ecosystem, replacing them with direct browser fetching or a universal CORS proxy.
**Architecture:** Remove preferential API routes (`/api/earthquake`, `/api/undersea-cables`, `/api/camera/*`) from the `worldwideview` core app. Promote the existing camera proxy to a universal `/api/proxy` with strict SSRF defenses. Provide direct browser-fetch code for the `wwv-plugin-earthquakes` where CORS permits, and migrate traffic camera fetchers directly into the `wwv-plugin-camera` package to fetch via the universal proxy.
**Tech Stack:** Next.js 16 (App Router), TypeScript, pnpm workspace
---
### Task 1: Promote Universal Proxy in Core Repository
**Files:**
- Create (Move): `src/app/api/proxy/route.ts`
- Delete: `src/app/api/camera/proxy/route.ts`
- [ ] **Step 1: Relocate the proxy route and update logs**
Move the existing camera proxy to act as a system-wide universal proxy.
Run: `mkdir -p src/app/api/proxy`
Run: `mv src/app/api/camera/proxy/route.ts src/app/api/proxy/route.ts`
- [ ] **Step 2: Update the error logging prefix in the new file**
Modify `src/app/api/proxy/route.ts` near line 97:
```json
{
"instruction": "Update the error logging prefix",
"replace_chunks": [
{
"start_line": 96,
"end_line": 98,
"target_content": " } catch (error: any) {\n console.error(\"[CameraProxy] Error fetching target URL:\", error);\n return NextResponse.json(",
"replacement_content": " } catch (error: any) {\n console.error(\"[UniversalProxy] Error fetching target URL:\", error);\n return NextResponse.json("
}
]
}
```
- [ ] **Step 3: Commit the Universal Proxy**
```bash
git add src/app/api/proxy/route.ts src/app/api/camera/proxy/route.ts
git commit -m "refactor: promote camera proxy to universal proxy"
```
### Task 2: Strip Preferential Proxy Routes From Core Application
**Files:**
- Delete: `src/app/api/earthquake/route.ts`
- Delete: `src/app/api/undersea-cables/route.ts`
- Delete: everything in `src/app/api/camera` codebase (`caltrans`, `extract`, `gdot`, `test`, `tfl`, `traffic`)
- [ ] **Step 1: Delete all plugin-specific Next.js API routes**
Run: `rm -rf src/app/api/earthquake`
Run: `rm -rf src/app/api/undersea-cables`
**WAIT**: For `src/app/api/camera`, we must physically copy the fetchers into `worldwideview-plugins` before we delete them.
Run: `cp -r src/app/api/camera/caltrans ../worldwideview-plugins/packages/wwv-plugin-camera/src/`
Run: `cp -r src/app/api/camera/gdot ../worldwideview-plugins/packages/wwv-plugin-camera/src/`
Run: `cp -r src/app/api/camera/tfl ../worldwideview-plugins/packages/wwv-plugin-camera/src/`
Run: `rm -rf src/app/api/camera`
- [ ] **Step 2: Commit the deleted API routes**
```bash
git add src/app/api/earthquake src/app/api/undersea-cables src/app/api/camera
git commit -m "refactor!: strip preferential plugin APIs from core"
```
### Task 3: Migrate Earthquakes and Undersea Cables Plugins
**Files:**
- Modify: `../worldwideview-plugins/packages/wwv-plugin-earthquakes/src/index.ts`
- Modify: `../worldwideview-plugins/packages/wwv-plugin-undersea-cables/src/index.ts`
- [ ] **Step 1: Update Earthquakes plugin to direct browser fetch (Option A)**
In `../worldwideview-plugins/packages/wwv-plugin-earthquakes/src/index.ts`, replace the `/api/earthquake` fetch with the USGS direct URL.
```json
{
"instruction": "Replace the API fetch with direct USGS fetch and remove apiBasePath",
"replace_chunks": [
{
"start_line": 38,
"end_line": 40,
"target_content": " try {\n const res = await globalThis.fetch(`/api/earthquake`);\n if (!res.ok) {",
"replacement_content": " try {\n const res = await globalThis.fetch(`https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson`);\n if (!res.ok) {"
},
{
"start_line": 94,
"end_line": 96,
"target_content": " getServerConfig(): ServerPluginConfig {\n return { apiBasePath: \"/api/earthquake\", pollingIntervalMs: 120000, historyEnabled: false };\n }",
"replacement_content": " getServerConfig(): ServerPluginConfig {\n return { pollingIntervalMs: 120000, historyEnabled: false };\n }"
}
]
}
```
- [ ] **Step 2: Update Undersea Cables plugin to use Universal Proxy (Option B)**
In `../worldwideview-plugins/packages/wwv-plugin-undersea-cables/src/index.ts`:
```json
{
"instruction": "Proxy route to universal proxy",
"replace_chunks": [
{
"start_line": 35,
"end_line": 37,
"target_content": " // Proxy route to bypass CORS for Telegeography submarine cable map API\n const url = \"/api/undersea-cables\";\n ",
"replacement_content": " // Proxy route to bypass CORS for Telegeography submarine cable map API\n const targetUrl = encodeURIComponent(\"https://www.submarinecablemap.com/api/v3/cable/cable-geo.json\");\n const url = `/api/proxy?url=${targetUrl}`;\n "
}
]
}
```
- [ ] **Step 3: Commit the plugin migrations**
```bash
cd ../worldwideview-plugins
git add packages/wwv-plugin-earthquakes/src/index.ts packages/wwv-plugin-undersea-cables/src/index.ts
git commit -m "refactor: transition earthquake and undersea cables to decoupled fetching"
cd ../worldwideview
```
### Task 4: Refactor Camera Plugin to Fetch Natively
**Files:**
- Modify: `../worldwideview-plugins/packages/wwv-plugin-camera/src/index.ts`
- Delete: `caltrans`, `gdot`, `tfl` previously copied components (combine into `trafficFetchers.ts`)
- [ ] **Step 1: Consolidate the camera fetchers**
Create `../worldwideview-plugins/packages/wwv-plugin-camera/src/trafficFetchers.ts`.
Migrate the code from the `caltransFetcher.ts`, `gdotFetcher.ts`, and `tflFetcher.ts` files that we copied in Task 2.
Crucially, when doing `fetch(...)` in these fetchers, if the endpoint doesn't support CORS, wrap it in `/api/proxy?url=${encodeURIComponent(...) }` so the browser can fetch it. Ensure the data models align.
- [ ] **Step 2: Update `wwv-plugin-camera/src/index.ts` to call the fetchers natively**
In `../worldwideview-plugins/packages/wwv-plugin-camera/src/index.ts` function `loadTrafficCameras()`:
```json
{
"instruction": "Replace API fetch with native client-side parallel fetching",
"replace_chunks": [
{
"start_line": 106,
"end_line": 118,
"target_content": " private async loadTrafficCameras(): Promise<void> {\n try {\n const res = await fetch(\"/api/camera/traffic\");\n if (!res.ok) throw new Error(`API returned ${res.status}`);\n const data = await res.json();\n if (data.cameras && Array.isArray(data.cameras)) {\n this.sourceBuckets[\"default\"] = data.cameras.map(\n (f: unknown, i: number) => mapGeoJsonFeature(f, i, \"traffic\"),\n );\n }\n } catch (err) {\n console.warn(\"[CameraPlugin] Traffic cameras API failed:\", err);\n }",
"replacement_content": " private async loadTrafficCameras(): Promise<void> {\n try {\n const { fetchCaltrans, fetchGdot, fetchTfl } = await import(\"./trafficFetchers\");\n const [caltrans, gdot, tfl] = await Promise.allSettled([\n fetchCaltrans(), fetchGdot(), fetchTfl()\n ]);\n \n const cameras = [];\n if (caltrans.status === \"fulfilled\") cameras.push(...caltrans.value);\n if (gdot.status === \"fulfilled\") cameras.push(...gdot.value);\n if (tfl.status === \"fulfilled\") cameras.push(...tfl.value);\n\n if (cameras.length > 0) {\n this.sourceBuckets[\"default\"] = cameras.map(\n (f: unknown, i: number) => mapGeoJsonFeature(f, i, \"traffic\"),\n );\n }\n } catch (err) {\n console.warn(\"[CameraPlugin] Traffic cameras API failed:\", err);\n }"
}
]
}
```
- [ ] **Step 3: Remove the extra node API files from the plugin source tree**
Run: `rm -rf ../worldwideview-plugins/packages/wwv-plugin-camera/src/caltrans`
Run: `rm -rf ../worldwideview-plugins/packages/wwv-plugin-camera/src/gdot`
Run: `rm -rf ../worldwideview-plugins/packages/wwv-plugin-camera/src/tfl`
- [ ] **Step 4: Commit Camera plugin refactoring**
```bash
cd ../worldwideview-plugins
git add packages/wwv-plugin-camera/src
git commit -m "feat: migrate traffic camera fetchers to client-side plugin bundle"
cd ../worldwideview
```
View File
Whitespace-only changes.
+45 -6
View File
@@ -1,8 +1,20 @@
import type { NextConfig } from "next";
import webpack from "webpack";
const nextConfig: NextConfig = {
output: "standalone",
serverExternalPackages: ["better-sqlite3", "@prisma/adapter-better-sqlite3", "@prisma/client", "prisma"],
transpilePackages: ["@worldwideview/wwv-plugin-sdk","resium",
"react-player",
"satellite.js"
],
experimental: {
memoryBasedWorkersCount: true,
cpus: 2,
optimizePackageImports: ["lucide-react"],
},
typescript: {
ignoreBuildErrors: true,
},
async headers() {
return [
{
@@ -13,11 +25,17 @@ const nextConfig: NextConfig = {
value: [
"default-src 'self'",
// CesiumJS requires unsafe-eval (worker compilation) and unsafe-inline (styles)
"script-src 'self' 'unsafe-eval' 'unsafe-inline' blob:",
"script-src 'self' 'unsafe-eval' 'unsafe-inline' blob: https://cdn.jsdelivr.net https://analytics.worldwideview.dev https://va.vercel-scripts.com https://pagead2.googlesyndication.com https://adservice.google.com https://www.googletagservices.com https://ep2.adtrafficquality.google https://static.cloudflareinsights.com",
"style-src 'self' 'unsafe-inline' fonts.googleapis.com",
"font-src 'self' fonts.gstatic.com",
"img-src 'self' data: blob: *.tile.openstreetmap.org *.arcgisonline.com *.virtualearth.net *.bing.com *.googleapis.com",
"connect-src 'self' *.supabase.co *.worldwideview.dev *.cesium.com *.arcgisonline.com *.virtualearth.net *.googleapis.com *.vercel-scripts.com",
// Camera streams load images/MJPEG from arbitrary IPs worldwide — http: https: required
"img-src 'self' data: blob: http: https:",
// Camera HLS streams and external data fetches need arbitrary origins
"connect-src 'self' http: https: ws: wss:",
// HLS video streams from arbitrary camera sources
"media-src 'self' blob: http: https:",
// Embeddable video platforms for camera iframes
"frame-src 'self' *.youtube.com *.youtube-nocookie.com *.twitch.tv *.vimeo.com *.webcamera.pl *.ivideon.com *.rtsp.me *.bnu.tv https://googleads.g.doubleclick.net https://tpc.googlesyndication.com https://ep2.adtrafficquality.google https://*.google.com",
"worker-src 'self' blob:",
"frame-ancestors 'none'",
].join("; "),
@@ -34,13 +52,14 @@ const nextConfig: NextConfig = {
},
];
},
outputFileTracingExcludes: {
"*": ["./public/cesium/**"],
},
env: {
CESIUM_BASE_URL: "/cesium",
},
webpack: (config, { isServer }) => {
webpack: (config, { isServer, webpack }) => {
if (!isServer) {
// Define CESIUM_BASE_URL for Cesium's worker resolution
config.plugins?.push(
@@ -65,4 +84,24 @@ const nextConfig: NextConfig = {
},
};
export default nextConfig;
import { withSentryConfig } from "@sentry/nextjs";
export default withSentryConfig(nextConfig, {
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
sentryUrl: process.env.GLITCHTIP_SERVER_URL,
authToken: process.env.SENTRY_AUTH_TOKEN,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
// Hides source maps from generated client bundles
sourcemaps: {
disable: true,
},
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
});
-8122
View File
File diff suppressed because it is too large. Load diff
+28 -12
View File
@@ -1,43 +1,44 @@
{
"name": "worldwideview",
"version": "0.1.0",
"version": "1.12.0",
"private": true,
"workspaces": ["packages/*"],
"scripts": {
"setup": "node scripts/setup.mjs",
"test-worktree": "node scripts/test-worktree.mjs",
"clean": "node -e \"const fs=require('fs');fs.rmSync('.next',{recursive:true,force:true})\"",
"dev": "next dev --webpack",
"dev:all": "concurrently -n \"next,backends\" -c \"magenta,blue\" \"pnpm dev\" \"pnpm dev:backends\"",
"dev:backends": "cd ../wwv-data-engine && pnpm dev",
"predev": "npx prisma migrate deploy && node scripts/copy-cesium.mjs",
"copy-cesium": "node scripts/copy-cesium.mjs",
"build": "next build --webpack",
"start": "next start",
"test": "vitest run"
"test": "vitest run",
"db:reset": "npx prisma migrate reset --force"
},
"dependencies": {
"@worldwideview/wwv-plugin-sdk": "*",
"@worldwideview/wwv-plugin-aviation": "*",
"@worldwideview/wwv-plugin-maritime": "*",
"@worldwideview/wwv-plugin-wildfire": "*",
"@worldwideview/wwv-plugin-borders": "*",
"@worldwideview/wwv-plugin-camera": "*",
"@worldwideview/wwv-plugin-military-aviation": "*",
"@auth/prisma-adapter": "^2.11.1",
"@prisma/adapter-better-sqlite3": "^7.5.0",
"@prisma/client": "^7.5.0",
"@sentry/nextjs": "^10.48.0",
"@supabase/supabase-js": "^2.98.0",
"@vercel/analytics": "^1.6.1",
"@worldwideview/wwv-plugin-sdk": "workspace:*",
"bcryptjs": "^3.0.3",
"cesium": "^1.139.0",
"cheerio": "^1.2.0",
"hls.js": "^1.6.15",
"insecam-api": "^0.0.3",
"jose": "^6.2.2",
"lucide-react": "^0.576.0",
"next": "16.1.6",
"next": "16.2.3",
"next-auth": "^5.0.0-beta.30",
"prisma": "^7.5.0",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-player": "^3.4.0",
"resium": "^1.19.4",
"resium": "1.19.4",
"satellite.js": "^7.0.0",
"tslib": "^2.8.1",
"ws": "^8.14.2",
"zustand": "^5.0.11"
@@ -46,14 +47,29 @@
"@testing-library/dom": "^10.4.1",
"@testing-library/react": "^16.3.2",
"@types/bcryptjs": "^3.0.0",
"@types/cesium": "^1.70.4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/ws": "^8.18.1",
"@vitejs/plugin-react": "^5.1.4",
"concurrently": "^9.2.1",
"copy-webpack-plugin": "^14.0.0",
"jsdom": "^28.1.0",
"rollup-plugin-external-globals": "^0.13.0",
"typescript": "^5",
"vite": "^8.0.8",
"vitest": "^4.0.18"
},
"pnpm": {
"onlyBuiltDependencies": [
"@prisma/engines",
"better-sqlite3",
"esbuild",
"prisma",
"protobufjs",
"sharp",
"unrs-resolver"
]
}
}
-48
View File
@@ -1,48 +0,0 @@
# @worldwideview/wwv-plugin-aviation
[WorldWideView](https://github.com/silvertakana/worldwideview) plugin for **real-time commercial aircraft tracking** via the [OpenSky Network](https://opensky-network.org/) API.
## Features
- 🛩️ Live aircraft positions updated every 15 seconds
- 🎨 Altitude-based color coding (green → cyan → blue → purple → pink)
- ✈️ 3D airplane model rendering with heading-oriented rotation
- 🔍 Filters: country of origin, altitude range, on-ground status, callsign
- 📡 Flight trail rendering on entity selection
- ⏪ History playback mode support
## Installation
```bash
npm install @worldwideview/wwv-plugin-aviation
```
### Peer Dependencies
- `@worldwideview/wwv-plugin-sdk`
- `lucide-react` ≥ 0.576.0
## Usage
```ts
import { AviationPlugin } from "@worldwideview/wwv-plugin-aviation";
const plugin = new AviationPlugin();
```
Register the plugin with the WorldWideView plugin engine to start tracking aircraft on the globe.
## Data Source
Live data is fetched from the [OpenSky Network REST API](https://openskynetwork.github.io/opensky-api/). Requires server-side API route at `/api/aviation`.
## Changelog
- **v1.0.3** — Added README with feature list and usage docs.
- **v1.0.2** — Package metadata updates.
- **v1.0.1** — Package configuration fixes.
- **v1.0.0** — Initial release with live tracking, altitude coloring, and 3D model rendering.
## License
ISC
-20
View File
@@ -1,20 +0,0 @@
import type { WorldPlugin, GeoEntity, TimeRange, PluginContext, LayerConfig, CesiumEntityOptions, SelectionBehavior, ServerPluginConfig, FilterDefinition } from "@worldwideview/wwv-plugin-sdk";
export declare class AviationPlugin implements WorldPlugin {
id: string;
name: string;
description: string;
icon: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
category: "aviation";
version: string;
private context;
initialize(ctx: PluginContext): Promise<void>;
destroy(): void;
fetch(_timeRange: TimeRange): Promise<GeoEntity[]>;
getPollingInterval(): number;
getLayerConfig(): LayerConfig;
renderEntity(entity: GeoEntity): CesiumEntityOptions;
getSelectionBehavior(entity: GeoEntity): SelectionBehavior | null;
getServerConfig(): ServerPluginConfig;
getFilterDefinitions(): FilterDefinition[];
}
//# sourceMappingURL=index.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,WAAW,EACX,SAAS,EACT,SAAS,EACT,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EACnB,MAAM,+BAA+B,CAAC;AAqBvC,qBAAa,cAAe,YAAW,WAAW;IAC9C,EAAE,SAAc;IAChB,IAAI,SAAc;IAClB,WAAW,SAAqD;IAChE,IAAI,4IAAS;IACb,QAAQ,EAAG,UAAU,CAAU;IAC/B,OAAO,SAAW;IAClB,OAAO,CAAC,OAAO,CAA8B;IAEvC,UAAU,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IACnD,OAAO,IAAI,IAAI;IAET,KAAK,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IA0DxD,kBAAkB,IAAI,MAAM;IAC5B,cAAc,IAAI,WAAW;IAE7B,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,mBAAmB;IAWpD,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,GAAG,IAAI;IAKjE,eAAe,IAAI,kBAAkB;IAIrC,oBAAoB,IAAI,gBAAgB,EAAE;CAQ7C"}
-175
View File
@@ -1,175 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AviationPlugin = void 0;
var lucide_react_1 = require("lucide-react");
function altitudeToColor(altitude) {
if (altitude === null || altitude <= 0)
return "#4ade80";
if (altitude < 3000)
return "#22d3ee";
if (altitude < 8000)
return "#3b82f6";
if (altitude < 12000)
return "#a78bfa";
return "#f472b6";
}
var AviationPlugin = /** @class */ (function () {
function AviationPlugin() {
this.id = "aviation";
this.name = "Aviation";
this.description = "Real-time aircraft tracking via OpenSky Network";
this.icon = lucide_react_1.Plane;
this.category = "aviation";
this.version = "1.0.0";
this.context = null;
}
AviationPlugin.prototype.initialize = function (ctx) {
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
this.context = ctx;
return [2 /*return*/];
}); });
};
AviationPlugin.prototype.destroy = function () { this.context = null; };
AviationPlugin.prototype.fetch = function (_timeRange) {
return __awaiter(this, void 0, void 0, function () {
var time, res_1, historyData, res, data, err_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 6, , 7]);
if (!this.context.isPlaybackMode()) return [3 /*break*/, 3];
time = this.context.getCurrentTime().getTime();
return [4 /*yield*/, fetch("/api/aviation/history?time=".concat(time))];
case 1:
res_1 = _a.sent();
if (!res_1.ok)
throw new Error("History API returned ".concat(res_1.status));
return [4 /*yield*/, res_1.json()];
case 2:
historyData = _a.sent();
if (!historyData.records || !Array.isArray(historyData.records))
return [2 /*return*/, []];
return [2 /*return*/, historyData.records.map(function (s) { return ({
id: "aviation-history-".concat(s.icao24),
pluginId: "aviation",
latitude: s.latitude,
longitude: s.longitude,
altitude: (s.altitude || 0) * 10,
heading: s.heading || undefined,
speed: s.speed || undefined,
timestamp: new Date(s.timestamp),
label: s.callsign || s.icao24,
properties: { icao24: s.icao24, callsign: s.callsign, altitude_m: s.altitude, velocity_ms: s.speed, heading: s.heading, on_ground: s.altitude === null || s.altitude <= 0 },
}); })];
case 3: return [4 /*yield*/, fetch("/api/aviation")];
case 4:
res = _a.sent();
if (!res.ok)
throw new Error("Aviation API returned ".concat(res.status));
return [4 /*yield*/, res.json()];
case 5:
data = _a.sent();
if (data.error && !data.states)
return [2 /*return*/, []];
if (!data.states || !Array.isArray(data.states))
return [2 /*return*/, []];
return [2 /*return*/, data.states
.filter(function (s) { return s[6] !== null && s[5] !== null; })
.map(function (s) {
var _a;
var st = {
icao24: s[0], callsign: ((_a = s[1]) === null || _a === void 0 ? void 0 : _a.trim()) || null,
origin_country: s[2], time_position: s[3],
last_contact: s[4], longitude: s[5],
latitude: s[6], baro_altitude: s[7],
on_ground: s[8], velocity: s[9],
true_track: s[10], vertical_rate: s[11],
sensors: s[12], geo_altitude: s[13],
squawk: s[14], spi: s[15], position_source: s[16],
};
return {
id: "aviation-".concat(st.icao24), pluginId: "aviation",
latitude: st.latitude, longitude: st.longitude,
altitude: (st.baro_altitude || 0) * 10,
heading: st.true_track || undefined, speed: st.velocity || undefined,
timestamp: new Date((st.time_position || st.last_contact) * 1000),
label: st.callsign || st.icao24,
properties: { icao24: st.icao24, callsign: st.callsign, origin_country: st.origin_country, altitude_m: st.baro_altitude, velocity_ms: st.velocity, heading: st.true_track, vertical_rate: st.vertical_rate, on_ground: st.on_ground, squawk: st.squawk },
};
})];
case 6:
err_1 = _a.sent();
console.error("[AviationPlugin] Fetch error:", err_1);
return [2 /*return*/, []];
case 7: return [2 /*return*/];
}
});
});
};
AviationPlugin.prototype.getPollingInterval = function () { return 15000; };
AviationPlugin.prototype.getLayerConfig = function () { return { color: "#3b82f6", clusterEnabled: true, clusterDistance: 40, maxEntities: 5000 }; };
AviationPlugin.prototype.renderEntity = function (entity) {
var alt = entity.properties.altitude_m;
var isAirborne = !entity.properties.on_ground;
return {
type: "model", iconUrl: "/plane-icon.svg", size: isAirborne ? 8 : 5,
modelUrl: "/airplane/scene.gltf", modelScale: 75, modelMinPixelSize: 16, modelHeadingOffset: 180,
color: altitudeToColor(alt), rotation: entity.heading,
labelText: entity.label || undefined, labelFont: "11px JetBrains Mono, monospace",
};
};
AviationPlugin.prototype.getSelectionBehavior = function (entity) {
if (entity.properties.on_ground)
return null;
return { showTrail: true, trailDurationSec: 60, trailStepSec: 5, trailColor: "#00fff7", flyToOffsetMultiplier: 3, flyToBaseDistance: 30000 };
};
AviationPlugin.prototype.getServerConfig = function () {
return { apiBasePath: "/api/aviation", pollingIntervalMs: 5000, requiresAuth: true, historyEnabled: true, availabilityEnabled: true };
};
AviationPlugin.prototype.getFilterDefinitions = function () {
return [
{ id: "origin_country", label: "Country", type: "select", propertyKey: "origin_country", options: [{ value: "United States", label: "United States" }, { value: "China", label: "China" }, { value: "United Kingdom", label: "United Kingdom" }, { value: "Germany", label: "Germany" }, { value: "France", label: "France" }, { value: "Japan", label: "Japan" }, { value: "Australia", label: "Australia" }, { value: "Canada", label: "Canada" }, { value: "India", label: "India" }, { value: "Brazil", label: "Brazil" }, { value: "Russia", label: "Russia" }, { value: "Turkey", label: "Turkey" }, { value: "South Korea", label: "South Korea" }, { value: "Indonesia", label: "Indonesia" }, { value: "Mexico", label: "Mexico" }] },
{ id: "altitude", label: "Altitude (m)", type: "range", propertyKey: "altitude_m", range: { min: 0, max: 15000, step: 500 } },
{ id: "on_ground", label: "On Ground", type: "boolean", propertyKey: "on_ground" },
{ id: "callsign", label: "Callsign", type: "text", propertyKey: "callsign" },
];
};
return AviationPlugin;
}());
exports.AviationPlugin = AviationPlugin;
-36
View File
@@ -1,36 +0,0 @@
{
"name": "@worldwideview/wwv-plugin-aviation",
"version": "1.0.4",
"description": "WorldWideView plugin for real-time commercial aircraft tracking via the OpenSky Network API. Renders 3D aircraft models with altitude-based coloring, flight trails, and country/altitude/callsign filters",
"main": "src/index.ts",
"types": "src/index.ts",
"files": [
"src"
],
"keywords": [
"worldwideview",
"worldwideview-plugin",
"wwv-plugin-aviation",
"aviation",
"aircraft-tracking",
"opensky",
"flight-tracker",
"cesium",
"globe"
],
"repository": {
"type": "git",
"url": "https://github.com/silvertakana/worldwideview.git",
"directory": "packages/wwv-plugin-aviation"
},
"homepage": "https://github.com/silvertakana/worldwideview#readme",
"bugs": {
"url": "https://github.com/silvertakana/worldwideview/issues"
},
"license": "ISC",
"author": "WorldWideView",
"peerDependencies": {
"@worldwideview/wwv-plugin-sdk": "*",
"lucide-react": ">=0.576.0"
}
}
-134
View File
@@ -1,134 +0,0 @@
import { Plane } from "lucide-react";
import type {
WorldPlugin,
GeoEntity,
TimeRange,
PluginContext,
LayerConfig,
CesiumEntityOptions,
SelectionBehavior,
ServerPluginConfig,
FilterDefinition,
} from "@worldwideview/wwv-plugin-sdk";
interface OpenSkyState {
icao24: string; callsign: string | null; origin_country: string;
time_position: number | null; last_contact: number;
longitude: number | null; latitude: number | null;
baro_altitude: number | null; on_ground: boolean;
velocity: number | null; true_track: number | null;
vertical_rate: number | null; sensors: number[] | null;
geo_altitude: number | null; squawk: string | null;
spi: boolean; position_source: number;
}
function altitudeToColor(altitude: number | null): string {
if (altitude === null || altitude <= 0) return "#4ade80";
if (altitude < 3000) return "#22d3ee";
if (altitude < 8000) return "#3b82f6";
if (altitude < 12000) return "#a78bfa";
return "#f472b6";
}
export class AviationPlugin implements WorldPlugin {
id = "aviation";
name = "Aviation";
description = "Real-time aircraft tracking via OpenSky Network";
icon = Plane;
category = "aviation" as const;
version = "1.0.0";
private context: PluginContext | null = null;
async initialize(ctx: PluginContext): Promise<void> { this.context = ctx; }
destroy(): void { this.context = null; }
async fetch(_timeRange: TimeRange): Promise<GeoEntity[]> {
try {
// Use PluginContext instead of direct useStore access
if (this.context!.isPlaybackMode()) {
const time = this.context!.getCurrentTime().getTime();
const res = await fetch(`/api/aviation/history?time=${time}`);
if (!res.ok) throw new Error(`History API returned ${res.status}`);
const historyData = await res.json();
if (!historyData.records || !Array.isArray(historyData.records)) return [];
return historyData.records.map((s: Record<string, unknown>): GeoEntity => ({
id: `aviation-history-${s.icao24}`,
pluginId: "aviation",
latitude: s.latitude as number,
longitude: s.longitude as number,
altitude: ((s.altitude as number) || 0) * 10,
heading: (s.heading as number) || undefined,
speed: (s.speed as number) || undefined,
timestamp: new Date(s.timestamp as string),
label: (s.callsign as string) || (s.icao24 as string),
properties: { icao24: s.icao24, callsign: s.callsign, altitude_m: s.altitude, velocity_ms: s.speed, heading: s.heading, on_ground: (s.altitude as number) === null || (s.altitude as number) <= 0 },
}));
}
const res = await fetch("/api/aviation");
if (!res.ok) throw new Error(`Aviation API returned ${res.status}`);
const data = await res.json();
if (data.error && !data.states) return [];
if (!data.states || !Array.isArray(data.states)) return [];
return data.states
.filter((s: unknown[]) => s[6] !== null && s[5] !== null)
.map((s: unknown[]): GeoEntity => {
const st: OpenSkyState = {
icao24: s[0] as string, callsign: (s[1] as string)?.trim() || null,
origin_country: s[2] as string, time_position: s[3] as number | null,
last_contact: s[4] as number, longitude: s[5] as number | null,
latitude: s[6] as number | null, baro_altitude: s[7] as number | null,
on_ground: s[8] as boolean, velocity: s[9] as number | null,
true_track: s[10] as number | null, vertical_rate: s[11] as number | null,
sensors: s[12] as number[] | null, geo_altitude: s[13] as number | null,
squawk: s[14] as string | null, spi: s[15] as boolean, position_source: s[16] as number,
};
return {
id: `aviation-${st.icao24}`, pluginId: "aviation",
latitude: st.latitude!, longitude: st.longitude!,
altitude: (st.baro_altitude || 0) * 10,
heading: st.true_track || undefined, speed: st.velocity || undefined,
timestamp: new Date((st.time_position || st.last_contact) * 1000),
label: st.callsign || st.icao24,
properties: { icao24: st.icao24, callsign: st.callsign, origin_country: st.origin_country, altitude_m: st.baro_altitude, velocity_ms: st.velocity, heading: st.true_track, vertical_rate: st.vertical_rate, on_ground: st.on_ground, squawk: st.squawk },
};
});
} catch (err) {
console.error("[AviationPlugin] Fetch error:", err);
return [];
}
}
getPollingInterval(): number { return 15000; }
getLayerConfig(): LayerConfig { return { color: "#3b82f6", clusterEnabled: true, clusterDistance: 40, maxEntities: 5000 }; }
renderEntity(entity: GeoEntity): CesiumEntityOptions {
const alt = entity.properties.altitude_m as number | null;
const isAirborne = !entity.properties.on_ground;
return {
type: "model", iconUrl: "/plane-icon.svg", size: isAirborne ? 8 : 5,
modelUrl: "/airplane/scene.gltf", modelScale: 75, modelMinPixelSize: 16, modelHeadingOffset: 180,
color: altitudeToColor(alt), rotation: entity.heading,
labelText: entity.label || undefined, labelFont: "11px JetBrains Mono, monospace",
};
}
getSelectionBehavior(entity: GeoEntity): SelectionBehavior | null {
if (entity.properties.on_ground) return null;
return { showTrail: true, trailDurationSec: 60, trailStepSec: 5, trailColor: "#00fff7", flyToOffsetMultiplier: 3, flyToBaseDistance: 30000 };
}
getServerConfig(): ServerPluginConfig {
return { apiBasePath: "/api/aviation", pollingIntervalMs: 5000, requiresAuth: true, historyEnabled: true, availabilityEnabled: true };
}
getFilterDefinitions(): FilterDefinition[] {
return [
{ id: "origin_country", label: "Country", type: "select", propertyKey: "origin_country", options: [{ value: "United States", label: "United States" }, { value: "China", label: "China" }, { value: "United Kingdom", label: "United Kingdom" }, { value: "Germany", label: "Germany" }, { value: "France", label: "France" }, { value: "Japan", label: "Japan" }, { value: "Australia", label: "Australia" }, { value: "Canada", label: "Canada" }, { value: "India", label: "India" }, { value: "Brazil", label: "Brazil" }, { value: "Russia", label: "Russia" }, { value: "Turkey", label: "Turkey" }, { value: "South Korea", label: "South Korea" }, { value: "Indonesia", label: "Indonesia" }, { value: "Mexico", label: "Mexico" }] },
{ id: "altitude", label: "Altitude (m)", type: "range", propertyKey: "altitude_m", range: { min: 0, max: 15000, step: 500 } },
{ id: "on_ground", label: "On Ground", type: "boolean", propertyKey: "on_ground" },
{ id: "callsign", label: "Callsign", type: "text", propertyKey: "callsign" },
];
}
}
@@ -1,10 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"outDir": "dist",
"noEmit": false
},
"exclude": ["**/*.test.*"]
}
@@ -1,8 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"noEmit": true
},
"include": ["src"]
}
-40
View File
@@ -1,40 +0,0 @@
# @worldwideview/wwv-plugin-borders
[WorldWideView](https://github.com/silvertakana/worldwideview) plugin that displays **political borders and country labels** as a globe overlay.
## Features
- 🗺️ Country border outlines rendered on the 3D globe
- 🏷️ Country name labels
- ⚡ Zero-polling — static layer with no data fetching overhead
## Installation
```bash
npm install @worldwideview/wwv-plugin-borders
```
### Peer Dependencies
- `@worldwideview/wwv-plugin-sdk`
## Usage
```ts
import { BordersPlugin } from "@worldwideview/wwv-plugin-borders";
const plugin = new BordersPlugin();
```
Register the plugin with the WorldWideView plugin engine to display borders on the globe. Border rendering is managed by the host application's `BordersManager`.
## Changelog
- **v1.0.3** — Added README with feature list and usage docs.
- **v1.0.2** — Package metadata updates.
- **v1.0.1** — Package configuration fixes.
- **v1.0.0** — Initial release with GeoJSON-based political boundaries.
## License
ISC
-16
View File
@@ -1,16 +0,0 @@
import type { WorldPlugin, GeoEntity, TimeRange, PluginContext, LayerConfig, CesiumEntityOptions } from "@worldwideview/wwv-plugin-sdk";
export declare class BordersPlugin implements WorldPlugin {
id: string;
name: string;
description: string;
icon: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
category: "custom";
version: string;
initialize(_ctx: PluginContext): Promise<void>;
destroy(): void;
fetch(_timeRange: TimeRange): Promise<GeoEntity[]>;
getPollingInterval(): number;
getLayerConfig(): LayerConfig;
renderEntity(_entity: GeoEntity): CesiumEntityOptions;
}
//# sourceMappingURL=index.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,WAAW,EACX,SAAS,EACT,SAAS,EACT,aAAa,EACb,WAAW,EACX,mBAAmB,EACtB,MAAM,+BAA+B,CAAC;AAEvC,qBAAa,aAAc,YAAW,WAAW;IAC7C,EAAE,SAAa;IACf,IAAI,SAAsB;IAC1B,WAAW,SAA+D;IAC1E,IAAI,4IAAO;IACX,QAAQ,EAAG,QAAQ,CAAU;IAC7B,OAAO,SAAW;IAEZ,UAAU,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IACpD,OAAO,IAAI,IAAI;IAET,KAAK,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAKxD,kBAAkB,IAAI,MAAM;IAE5B,cAAc,IAAI,WAAW;IAI7B,YAAY,CAAC,OAAO,EAAE,SAAS,GAAG,mBAAmB;CAGxD"}
-73
View File
@@ -1,73 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BordersPlugin = void 0;
var lucide_react_1 = require("lucide-react");
var BordersPlugin = /** @class */ (function () {
function BordersPlugin() {
this.id = "borders";
this.name = "Borders & Labels";
this.description = "Displays political borders and country labels on the map.";
this.icon = lucide_react_1.Map;
this.category = "custom";
this.version = "1.0.0";
}
BordersPlugin.prototype.initialize = function (_ctx) {
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/];
}); });
};
BordersPlugin.prototype.destroy = function () { };
BordersPlugin.prototype.fetch = function (_timeRange) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
// Rendering is managed by BordersManager in GlobeView
return [2 /*return*/, []];
});
});
};
BordersPlugin.prototype.getPollingInterval = function () { return 9999999; };
BordersPlugin.prototype.getLayerConfig = function () {
return { color: "#00ffff", clusterEnabled: false, clusterDistance: 0, maxEntities: 0 };
};
BordersPlugin.prototype.renderEntity = function (_entity) {
return { type: "point" };
};
return BordersPlugin;
}());
exports.BordersPlugin = BordersPlugin;
-34
View File
@@ -1,34 +0,0 @@
{
"name": "@worldwideview/wwv-plugin-borders",
"version": "1.0.4",
"description": "WorldWideView plugin that displays political borders and country labels as a globe overlay",
"main": "src/index.ts",
"types": "src/index.ts",
"files": [
"src"
],
"keywords": [
"worldwideview",
"worldwideview-plugin",
"wwv-plugin-borders",
"borders",
"countries",
"geopolitical",
"cesium",
"globe"
],
"repository": {
"type": "git",
"url": "https://github.com/silvertakana/worldwideview.git",
"directory": "packages/wwv-plugin-borders"
},
"homepage": "https://github.com/silvertakana/worldwideview#readme",
"bugs": {
"url": "https://github.com/silvertakana/worldwideview/issues"
},
"license": "ISC",
"author": "WorldWideView",
"peerDependencies": {
"@worldwideview/wwv-plugin-sdk": "*"
}
}
-36
View File
@@ -1,36 +0,0 @@
import { Map } from "lucide-react";
import type {
WorldPlugin,
GeoEntity,
TimeRange,
PluginContext,
LayerConfig,
CesiumEntityOptions,
} from "@worldwideview/wwv-plugin-sdk";
export class BordersPlugin implements WorldPlugin {
id = "borders";
name = "Borders & Labels";
description = "Displays political borders and country labels on the map.";
icon = Map;
category = "custom" as const;
version = "1.0.0";
async initialize(_ctx: PluginContext): Promise<void> { }
destroy(): void { }
async fetch(_timeRange: TimeRange): Promise<GeoEntity[]> {
// Rendering is managed by BordersManager in GlobeView
return [];
}
getPollingInterval(): number { return 9999999; }
getLayerConfig(): LayerConfig {
return { color: "#00ffff", clusterEnabled: false, clusterDistance: 0, maxEntities: 0 };
}
renderEntity(_entity: GeoEntity): CesiumEntityOptions {
return { type: "point" };
}
}
@@ -1,10 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"outDir": "dist",
"noEmit": false
},
"exclude": ["**/*.test.*"]
}
@@ -1,8 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"noEmit": true
},
"include": ["src"]
}
-54
View File
@@ -1,54 +0,0 @@
# @worldwideview/wwv-plugin-camera
[WorldWideView](https://github.com/silvertakana/worldwideview) plugin for displaying **public live cameras and traffic cameras** on the 3D globe.
## Features
- 📷 Multiple data sources: default camera database, traffic cameras, custom URL, file upload
- 🌍 GeoJSON support for custom camera datasets
- 🎥 Live camera detail view with stream embedding
- ⚙️ Built-in settings component for source selection
- 🔍 Filters: country, city, popular cameras
- 📍 Clustered point rendering with labels
## Installation
```bash
npm install @worldwideview/wwv-plugin-camera
```
### Peer Dependencies
- `@worldwideview/wwv-plugin-sdk`
- `react` ≥ 18
- `lucide-react` ≥ 0.576.0
## Usage
```ts
import { CameraPlugin } from "@worldwideview/wwv-plugin-camera";
const plugin = new CameraPlugin();
```
Register the plugin with the WorldWideView plugin engine. The plugin includes a settings component for switching between camera data sources and a detail component for viewing individual camera streams.
## Data Sources
| Source | Description |
|---|---|
| `default` | Built-in public camera GeoJSON database |
| `traffic` | Traffic cameras via `/api/camera/traffic` endpoint |
| `url` | Custom JSON URL providing camera data |
| `file` | User-uploaded JSON file with camera data |
## Changelog
- **v1.0.3** — Added README with feature list and usage docs.
- **v1.0.2** — Package metadata updates.
- **v1.0.1** — Package configuration fixes.
- **v1.0.0** — Initial release with curated public camera feeds.
## License
ISC
-8
View File
@@ -1,8 +0,0 @@
import React from "react";
import type { GeoEntity } from "@worldwideview/wwv-plugin-sdk";
interface CameraDetailProps {
entity: GeoEntity;
}
export declare const CameraDetail: React.FC<CameraDetailProps>;
export {};
//# sourceMappingURL=CameraDetail.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"CameraDetail.d.ts","sourceRoot":"","sources":["../src/CameraDetail.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,UAAU,iBAAiB;IAAG,MAAM,EAAE,SAAS,CAAC;CAAE;AAElD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAmCpD,CAAC"}
-37
View File
@@ -1,37 +0,0 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CameraDetail = void 0;
var react_1 = require("react");
var CameraStream_1 = require("@/components/video/CameraStream");
var CameraDetail = function (_a) {
var entity = _a.entity;
var properties = entity.properties;
var stream = properties.stream;
var previewUrl = properties.preview_url;
var city = properties.city;
var region = properties.region;
var country = properties.country;
var isIframe = !!properties.is_iframe;
var categories = properties.categories || [];
return (<div className="flex flex-col gap-4">
<CameraStream_1.CameraStream id={entity.id} streamUrl={stream} previewUrl={previewUrl} isIframe={isIframe} label={city || country}/>
<div className="intel-panel__props">
<div className="intel-panel__prop" style={{ flexDirection: "column", alignItems: "flex-start", gap: "var(--space-xs)", borderBottom: "1px solid var(--border-subtle)", padding: "var(--space-sm) 0" }}>
<span className="intel-panel__prop-key">Location</span>
<span className="intel-panel__prop-value" style={{ textAlign: "left", width: "100%", whiteSpace: "normal", lineHeight: "1.4", fontSize: "12px", color: "var(--text-primary)" }}>
{[city, region, country].filter(Boolean).join(", ")}
</span>
</div>
{categories.length > 0 && (<div className="intel-panel__prop" style={{ flexDirection: "column", alignItems: "flex-start", gap: "var(--space-sm)", borderBottom: "none", padding: "var(--space-sm) 0" }}>
<span className="intel-panel__prop-key">Categories</span>
<div style={{ display: "flex", flexWrap: "wrap", gap: "6px" }}>
{categories.map(function (cat) { return (<span key={cat} style={{ borderRadius: "12px", backgroundColor: "var(--bg-tertiary)", padding: "2px 8px", fontSize: "10px", fontWeight: 500, color: "var(--text-secondary)", border: "1px solid var(--border-subtle)" }}>
{cat}
</span>); })}
</div>
</div>)}
</div>
</div>);
};
exports.CameraDetail = CameraDetail;
-5
View File
@@ -1,5 +0,0 @@
import React from "react";
export declare const CameraSettings: React.FC<{
pluginId: string;
}>;
//# sourceMappingURL=CameraSettings.d.ts.map
@@ -1 +0,0 @@
{"version":3,"file":"CameraSettings.d.ts","sourceRoot":"","sources":["../src/CameraSettings.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAQ3C,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CA+FzD,CAAC"}
-176
View File
@@ -1,176 +0,0 @@
"use client";
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CameraSettings = void 0;
var react_1 = require("react");
var store_1 = require("@/core/state/store");
var lucide_react_1 = require("lucide-react");
var PluginManager_1 = require("@/core/plugins/PluginManager");
var cameraSettingsStyles_1 = require("./cameraSettingsStyles");
var CameraSettings = function (_a) {
var pluginId = _a.pluginId;
var settingsRaw = (0, store_1.useStore)(function (s) { return s.dataConfig.pluginSettings[pluginId]; });
var settings = __assign({ sourceType: "default" }, (settingsRaw || {}));
var updatePluginSettings = (0, store_1.useStore)(function (s) { return s.updatePluginSettings; });
var setHighlightLayerId = (0, store_1.useStore)(function (s) { return s.setHighlightLayerId; });
var _b = react_1.default.useState(false), isLoading = _b[0], setIsLoading = _b[1];
var handleSourceTypeChange = function (type) {
updatePluginSettings(pluginId, { sourceType: type });
setHighlightLayerId(null);
};
var triggerFetch = function () { return __awaiter(void 0, void 0, void 0, function () {
var managed;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
managed = PluginManager_1.pluginManager.getPlugin(pluginId);
if (!(managed && managed.enabled)) return [3 /*break*/, 2];
return [4 /*yield*/, PluginManager_1.pluginManager.fetchForPlugin(pluginId, managed.context.timeRange)];
case 1:
_a.sent();
_a.label = 2;
case 2: return [2 /*return*/];
}
});
}); };
var handleLoadData = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
setIsLoading(true);
updatePluginSettings(pluginId, { action: "load", actionId: Date.now(), loaded: true });
setHighlightLayerId(null);
return [4 /*yield*/, triggerFetch()];
case 1:
_a.sent();
setIsLoading(false);
return [2 /*return*/];
}
});
}); };
var handleResetAll = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
updatePluginSettings(pluginId, { action: "reset", actionId: Date.now(), loaded: false, customUrl: "", customData: null });
setHighlightLayerId(null);
return [4 /*yield*/, triggerFetch()];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); };
var handleFileUpload = function (e) {
var _a;
var file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
if (!file)
return;
var reader = new FileReader();
reader.onload = function (event) { return __awaiter(void 0, void 0, void 0, function () {
var json, _a;
var _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_c.trys.push([0, 2, , 3]);
json = JSON.parse((_b = event.target) === null || _b === void 0 ? void 0 : _b.result);
updatePluginSettings(pluginId, { customData: json, action: "load", actionId: Date.now(), loaded: true });
setHighlightLayerId(null);
return [4 /*yield*/, triggerFetch()];
case 1:
_c.sent();
return [3 /*break*/, 3];
case 2:
_a = _c.sent();
alert("Invalid JSON file format.");
return [3 /*break*/, 3];
case 3: return [2 /*return*/];
}
});
}); };
reader.readAsText(file);
};
return (<div style={{ display: "flex", flexDirection: "column", gap: "var(--space-md)" }}>
<div style={{ fontSize: 11, color: "var(--text-muted)", marginBottom: "var(--space-xs)" }}>Data Source Configuration</div>
<div style={{ display: "flex", gap: "var(--space-xs)" }}>
{[["default", lucide_react_1.Database, "Default"], ["traffic", lucide_react_1.TrafficCone, "Traffic Cams"], ["url", lucide_react_1.Link, "URL"], ["file", lucide_react_1.Upload, "File"]].map(function (_a) {
var type = _a[0], Icon = _a[1], label = _a[2];
return (<button key={type} onClick={function () { return handleSourceTypeChange(type); }} style={(0, cameraSettingsStyles_1.sourceTabStyle)(settings.sourceType === type)}>
<Icon size={14}/><span style={{ fontSize: 10 }}>{label}</span>
</button>);
})}
</div>
{settings.sourceType === "default" && (<div style={cameraSettingsStyles_1.inputGroupStyle}>
<div style={{ fontSize: 11, color: "var(--text-secondary)" }}>Built-in camera dataset</div>
<button onClick={handleLoadData} disabled={isLoading} style={(0, cameraSettingsStyles_1.loadButtonStyle)(isLoading)}>{isLoading ? "Loading..." : settings.loaded ? "Reload" : "Load"}</button>
</div>)}
{settings.sourceType === "traffic" && (<div style={cameraSettingsStyles_1.inputGroupStyle}>
<div style={{ fontSize: 11, color: "var(--text-secondary)" }}>DOT traffic cameras (GDOT + more)</div>
<button onClick={handleLoadData} disabled={isLoading} style={(0, cameraSettingsStyles_1.loadButtonStyle)(isLoading)}>{isLoading ? "Loading..." : settings.loaded ? "Reload" : "Load"}</button>
</div>)}
{settings.sourceType === "url" && (<div style={cameraSettingsStyles_1.inputGroupStyle}>
<label style={cameraSettingsStyles_1.labelStyle}>URL</label>
<div style={{ display: "flex", gap: "var(--space-sm)", marginTop: "4px" }}>
<input type="text" placeholder="http://..." value={settings.customUrl || ""} onChange={function (e) { return updatePluginSettings(pluginId, { customUrl: e.target.value }); }} style={__assign(__assign({}, cameraSettingsStyles_1.inputStyle), { flex: 1 })}/>
<button onClick={handleLoadData} disabled={!settings.customUrl || isLoading} style={(0, cameraSettingsStyles_1.loadButtonStyle)(!settings.customUrl || isLoading)}>{isLoading ? "Loading..." : "Load"}</button>
</div>
</div>)}
{settings.sourceType === "file" && (<div style={cameraSettingsStyles_1.inputGroupStyle}>
<label style={cameraSettingsStyles_1.labelStyle}>JSON File</label>
<input type="file" accept=".json" onChange={handleFileUpload} style={__assign(__assign({}, cameraSettingsStyles_1.inputStyle), { width: "100%", marginTop: "4px", padding: "4px", fontSize: "10px" })}/>
{settings.customData && Array.isArray(settings.customData) && (<div style={{ fontSize: 10, color: "var(--accent-green)", marginTop: "4px" }}>✓ Data loaded ({settings.customData.length} cameras)</div>)}
</div>)}
<button onClick={handleResetAll} style={{ display: "flex", alignItems: "center", justifyContent: "center", gap: "6px", background: "transparent", border: "1px solid var(--border-subtle)", borderRadius: "var(--radius-sm)", padding: "6px var(--space-md)", fontSize: 11, color: "var(--text-muted)", cursor: "pointer", transition: "all 0.2s ease" }}>
<lucide_react_1.RotateCcw size={12}/> Reset All Sources
</button>
</div>);
};
exports.CameraSettings = CameraSettings;
-31
View File
@@ -1,31 +0,0 @@
/**
* Manages Cesium Entity polylines for camera frustum outlines.
*
* Draws 4 side-edge lines from the camera apex to the 4 far
* corners of the view pyramid. No far-plane rectangle is drawn
* (it would clip the earth surface).
*
* Architecture: corners come from frustumGeometry.ts so a future
* ground-projection step can replace the far-plane corners with
* terrain-intersection points without changing this renderer.
*/
import type { Viewer as CesiumViewer } from "cesium";
import type { GeoEntity } from "@worldwideview/wwv-plugin-sdk";
export declare class FrustumRenderer {
/** Map from entity id → array of 4 Cesium.Entity polylines */
private entityMap;
/**
* Sync frustum outlines with the current set of camera entities.
* Only draws for entities whose `properties` include heading.
*/
update(viewer: CesiumViewer, entities: GeoEntity[]): void;
/** Remove all frustum entities from the viewer. */
clear(viewer: CesiumViewer): void;
private resolveHeading;
private buildEdges;
private createNew;
private updateExisting;
private removeStale;
private addEdgeLine;
}
//# sourceMappingURL=FrustumRenderer.d.ts.map
@@ -1 +0,0 @@
{"version":3,"file":"FrustumRenderer.d.ts","sourceRoot":"","sources":["../src/FrustumRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAW/D,qBAAa,eAAe;IACxB,8DAA8D;IAC9D,OAAO,CAAC,SAAS,CAA+B;IAEhD;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI;IAuBzD,mDAAmD;IACnD,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAejC,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,WAAW;CAiBtB"}
-150
View File
@@ -1,150 +0,0 @@
"use strict";
/**
* Manages Cesium Entity polylines for camera frustum outlines.
*
* Draws 4 side-edge lines from the camera apex to the 4 far
* corners of the view pyramid. No far-plane rectangle is drawn
* (it would clip the earth surface).
*
* Architecture: corners come from frustumGeometry.ts so a future
* ground-projection step can replace the far-plane corners with
* terrain-intersection points without changing this renderer.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.FrustumRenderer = void 0;
var cesium_1 = require("cesium");
var frustumGeometry_1 = require("./frustumGeometry");
var FRUSTUM_COLOR = cesium_1.Color.fromCssColorString("#00ccff").withAlpha(0.6);
var EDGE_WIDTH = 2;
var FrustumRenderer = /** @class */ (function () {
function FrustumRenderer() {
/** Map from entity id → array of 4 Cesium.Entity polylines */
this.entityMap = new Map();
}
/**
* Sync frustum outlines with the current set of camera entities.
* Only draws for entities whose `properties` include heading.
*/
FrustumRenderer.prototype.update = function (viewer, entities) {
if (!viewer || viewer.isDestroyed())
return;
var activeIds = new Set();
for (var _i = 0, entities_1 = entities; _i < entities_1.length; _i++) {
var geo = entities_1[_i];
if (geo.pluginId !== "camera")
continue;
var heading = this.resolveHeading(geo);
if (heading === undefined)
continue;
activeIds.add(geo.id);
var edges = this.buildEdges(geo, heading);
if (this.entityMap.has(geo.id)) {
this.updateExisting(viewer, geo.id, edges);
}
else {
this.createNew(viewer, geo.id, edges);
}
}
this.removeStale(viewer, activeIds);
};
/** Remove all frustum entities from the viewer. */
FrustumRenderer.prototype.clear = function (viewer) {
if (!viewer || viewer.isDestroyed()) {
this.entityMap.clear();
return;
}
for (var _i = 0, _a = this.entityMap; _i < _a.length; _i++) {
var _b = _a[_i], lines = _b[1];
for (var _c = 0, lines_1 = lines; _c < lines_1.length; _c++) {
var line = lines_1[_c];
viewer.entities.remove(line);
}
}
this.entityMap.clear();
};
// ─── Private helpers ─────────────────────────────────────
FrustumRenderer.prototype.resolveHeading = function (geo) {
var p = geo.properties;
if (typeof p.heading === "number")
return p.heading;
if (typeof p.azimuth === "number")
return p.azimuth;
if (typeof p.heading === "string") {
return parseFloat(p.heading) || undefined;
}
return geo.heading;
};
FrustumRenderer.prototype.buildEdges = function (geo, heading) {
var p = geo.properties;
return (0, frustumGeometry_1.computeFrustumEdges)({
lat: geo.latitude,
lon: geo.longitude,
alt: toNum(p.altitude, toNum(p.alt, frustumGeometry_1.FRUSTUM_DEFAULTS.alt)),
headingDeg: heading,
pitchDeg: toNum(p.pitch, frustumGeometry_1.FRUSTUM_DEFAULTS.pitchDeg),
hFovDeg: toNum(p.fov, toNum(p.hFov, frustumGeometry_1.FRUSTUM_DEFAULTS.hFovDeg)),
vFovDeg: toNum(p.vFov, frustumGeometry_1.FRUSTUM_DEFAULTS.vFovDeg),
rangeMtrs: toNum(p.range, frustumGeometry_1.FRUSTUM_DEFAULTS.rangeMtrs),
});
};
FrustumRenderer.prototype.createNew = function (viewer, id, edges) {
var _this = this;
var corners = [edges.topLeft, edges.topRight, edges.bottomLeft, edges.bottomRight];
var lines = corners.map(function (corner) {
return _this.addEdgeLine(viewer, id, edges.apex, corner);
});
this.entityMap.set(id, lines);
};
FrustumRenderer.prototype.updateExisting = function (viewer, id, edges) {
var corners = [edges.topLeft, edges.topRight, edges.bottomLeft, edges.bottomRight];
var existing = this.entityMap.get(id);
for (var i = 0; i < 4; i++) {
existing[i].polyline.positions = toPositions(edges.apex, corners[i]);
}
};
FrustumRenderer.prototype.removeStale = function (viewer, activeIds) {
for (var _i = 0, _a = this.entityMap; _i < _a.length; _i++) {
var _b = _a[_i], id = _b[0], lines = _b[1];
if (!activeIds.has(id)) {
for (var _c = 0, lines_2 = lines; _c < lines_2.length; _c++) {
var line = lines_2[_c];
viewer.entities.remove(line);
}
this.entityMap.delete(id);
}
}
};
FrustumRenderer.prototype.addEdgeLine = function (viewer, parentId, from, to) {
return viewer.entities.add({
id: "frustum-".concat(parentId, "-").concat(Math.random().toString(36).slice(2, 8)),
polyline: {
positions: toPositions(from, to),
width: EDGE_WIDTH,
material: new cesium_1.PolylineGlowMaterialProperty({
glowPower: 0.15,
color: FRUSTUM_COLOR,
}),
clampToGround: false,
},
});
};
return FrustumRenderer;
}());
exports.FrustumRenderer = FrustumRenderer;
// ─── Utilities ───────────────────────────────────────────────
function toPositions(a, b) {
return [
cesium_1.Cartesian3.fromDegrees(a.lon, a.lat, a.alt),
cesium_1.Cartesian3.fromDegrees(b.lon, b.lat, b.alt),
];
}
function toNum(val, fallback) {
if (typeof val === "number" && !Number.isNaN(val))
return val;
if (typeof val === "string") {
var n = parseFloat(val);
if (!Number.isNaN(n))
return n;
}
return fallback;
}
-4
View File
@@ -1,4 +0,0 @@
import type { GeoEntity } from "@worldwideview/wwv-plugin-sdk";
export declare function mapRawCamera(cam: Record<string, unknown>, index: number, prefix: string): GeoEntity;
export declare function mapGeoJsonFeature(feature: unknown, index: number, prefix: string): GeoEntity;
//# sourceMappingURL=cameraMapper.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"cameraMapper.d.ts","sourceRoot":"","sources":["../src/cameraMapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI/D,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAWnG;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAc5F"}
-45
View File
@@ -1,45 +0,0 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapRawCamera = mapRawCamera;
exports.mapGeoJsonFeature = mapGeoJsonFeature;
var DEFAULT_CAMERA_ALT = 8;
function mapRawCamera(cam, index, prefix) {
var _a, _b;
return {
id: "camera-".concat(prefix, "-").concat(index),
pluginId: "camera",
latitude: cam.latitude,
longitude: cam.longitude,
altitude: (_b = (_a = cam.altitude) !== null && _a !== void 0 ? _a : cam.elevation) !== null && _b !== void 0 ? _b : DEFAULT_CAMERA_ALT,
timestamp: new Date(),
label: cam.city || cam.country || "Unknown Camera",
properties: __assign({}, cam),
};
}
function mapGeoJsonFeature(feature, index, prefix) {
var _a, _b, _c;
var f = feature;
var _d = (_b = (_a = f.geometry) === null || _a === void 0 ? void 0 : _a.coordinates) !== null && _b !== void 0 ? _b : [0, 0], lon = _d[0], lat = _d[1];
var props = (_c = f.properties) !== null && _c !== void 0 ? _c : {};
return {
id: "camera-".concat(prefix, "-").concat(index),
pluginId: "camera",
latitude: lat,
longitude: lon,
altitude: DEFAULT_CAMERA_ALT,
timestamp: new Date(),
label: props.city || props.country || "Unknown Camera",
properties: __assign({}, props),
};
}
@@ -1,7 +0,0 @@
import type React from "react";
export declare const inputGroupStyle: React.CSSProperties;
export declare const labelStyle: React.CSSProperties;
export declare const inputStyle: React.CSSProperties;
export declare const loadButtonStyle: (disabled: boolean) => React.CSSProperties;
export declare const sourceTabStyle: (active: boolean) => React.CSSProperties;
//# sourceMappingURL=cameraSettingsStyles.d.ts.map
@@ -1 +0,0 @@
{"version":3,"file":"cameraSettingsStyles.d.ts","sourceRoot":"","sources":["../src/cameraSettingsStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAwE,CAAC;AAC7G,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,aAAkI,CAAC;AAClK,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,aAAyO,CAAC;AACzQ,eAAO,MAAM,eAAe,GAAI,UAAU,OAAO,KAAG,KAAK,CAAC,aAA0S,CAAC;AACrW,eAAO,MAAM,cAAc,GAAI,QAAQ,OAAO,KAAG,KAAK,CAAC,aAAya,CAAC"}
-10
View File
@@ -1,10 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sourceTabStyle = exports.loadButtonStyle = exports.inputStyle = exports.labelStyle = exports.inputGroupStyle = void 0;
exports.inputGroupStyle = { display: "flex", flexDirection: "column", gap: "4px" };
exports.labelStyle = { fontSize: 10, fontWeight: 600, color: "var(--text-muted)", textTransform: "uppercase", letterSpacing: "0.05em" };
exports.inputStyle = { background: "var(--bg-tertiary)", border: "1px solid var(--border-subtle)", color: "var(--text-primary)", padding: "var(--space-xs) var(--space-sm)", borderRadius: "var(--radius-sm)", fontSize: 12, outline: "none" };
var loadButtonStyle = function (disabled) { return ({ background: "var(--accent-cyan)", color: "var(--bg-primary)", border: "none", borderRadius: "var(--radius-sm)", padding: "0 var(--space-md)", fontSize: 12, fontWeight: 500, cursor: disabled ? "not-allowed" : "pointer", opacity: disabled ? 0.5 : 1, transition: "all 0.2s ease" }); };
exports.loadButtonStyle = loadButtonStyle;
var sourceTabStyle = function (active) { return ({ flex: 1, display: "flex", flexDirection: "column", alignItems: "center", gap: "4px", padding: "8px", borderRadius: "var(--radius-md)", background: active ? "var(--accent-cyan-subtle)" : "var(--bg-tertiary)", border: active ? "1px solid var(--accent-cyan)" : "1px solid var(--border-subtle)", cursor: "pointer", color: active ? "var(--accent-cyan)" : "var(--text-secondary)", transition: "all 0.2s ease" }); };
exports.sourceTabStyle = sourceTabStyle;
-58
View File
@@ -1,58 +0,0 @@
/**
* Pure math for computing 3D camera frustum edges.
* No Cesium dependency — fully unit-testable.
*
* The frustum is a pyramid with:
* - apex at the camera position
* - 4 corner rays extending outward at `range` meters
* - orientation defined by heading, pitch, and FOV
*
* Architecture note: returns raw corner positions so that
* a future ground-projection step can raycast these rays
* onto the terrain surface.
*/
export interface Point3D {
lat: number;
lon: number;
alt: number;
}
/** The 4 far-plane corners + the apex, ready for rendering. */
export interface FrustumEdges {
apex: Point3D;
topLeft: Point3D;
topRight: Point3D;
bottomLeft: Point3D;
bottomRight: Point3D;
}
export interface FrustumParams {
lat: number;
lon: number;
alt: number;
headingDeg: number;
pitchDeg: number;
hFovDeg: number;
vFovDeg: number;
rangeMtrs: number;
}
export declare const FRUSTUM_DEFAULTS: {
readonly alt: 8;
readonly headingDeg: 0;
readonly pitchDeg: -10;
readonly hFovDeg: 50;
readonly vFovDeg: 35;
readonly rangeMtrs: 200;
};
/**
* Compute the 4 frustum corner points at `range` distance
* from the camera, given orientation and FOV.
*
* Returns edges that can be drawn as 4 polylines from apex
* to each corner, or passed to a ground-projection step.
*/
export declare function computeFrustumEdges(params: FrustumParams): FrustumEdges;
/**
* Convert a cardinal direction string to degrees.
* Returns `undefined` if not recognised.
*/
export declare function cardinalToHeading(dir: string): number | undefined;
//# sourceMappingURL=frustumGeometry.d.ts.map
@@ -1 +0,0 @@
{"version":3,"file":"frustumGeometry.d.ts","sourceRoot":"","sources":["../src/frustumGeometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,MAAM,WAAW,OAAO;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACf;AAED,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACrB;AAID,eAAO,MAAM,gBAAgB;;;;;;;CAOnB,CAAC;AAIX;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAwBvE;AAeD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjE"}
-113
View File
@@ -1,113 +0,0 @@
"use strict";
/**
* Pure math for computing 3D camera frustum edges.
* No Cesium dependency — fully unit-testable.
*
* The frustum is a pyramid with:
* - apex at the camera position
* - 4 corner rays extending outward at `range` meters
* - orientation defined by heading, pitch, and FOV
*
* Architecture note: returns raw corner positions so that
* a future ground-projection step can raycast these rays
* onto the terrain surface.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.FRUSTUM_DEFAULTS = void 0;
exports.computeFrustumEdges = computeFrustumEdges;
exports.cardinalToHeading = cardinalToHeading;
var DEG2RAD = Math.PI / 180;
var EARTH_RADIUS = 6371000; // metres
// ─── Defaults ────────────────────────────────────────────────
exports.FRUSTUM_DEFAULTS = {
alt: 8,
headingDeg: 0,
pitchDeg: -10,
hFovDeg: 50,
vFovDeg: 35,
rangeMtrs: 200,
};
// ─── Core computation ────────────────────────────────────────
/**
* Compute the 4 frustum corner points at `range` distance
* from the camera, given orientation and FOV.
*
* Returns edges that can be drawn as 4 polylines from apex
* to each corner, or passed to a ground-projection step.
*/
function computeFrustumEdges(params) {
var lat = params.lat, lon = params.lon, alt = params.alt, headingDeg = params.headingDeg, pitchDeg = params.pitchDeg, hFovDeg = params.hFovDeg, vFovDeg = params.vFovDeg, rangeMtrs = params.rangeMtrs;
var apex = { lat: lat, lon: lon, alt: alt };
var halfH = (hFovDeg / 2) * DEG2RAD;
var halfV = (vFovDeg / 2) * DEG2RAD;
var heading = headingDeg * DEG2RAD;
var pitch = pitchDeg * DEG2RAD;
// For each corner we compute horizontal bearing offset ± halfH
// and vertical pitch offset ± halfV, then project to a destination.
var corners = [
[-halfH, halfV], // topLeft
[halfH, halfV], // topRight
[-halfH, -halfV], // bottomLeft
[halfH, -halfV], // bottomRight
];
var _a = corners.map(function (_a) {
var hOff = _a[0], vOff = _a[1];
return projectCorner(lat, lon, alt, heading, pitch, hOff, vOff, rangeMtrs);
}), topLeft = _a[0], topRight = _a[1], bottomLeft = _a[2], bottomRight = _a[3];
return { apex: apex, topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight };
}
// ─── Cardinal direction helper ───────────────────────────────
var CARDINAL_MAP = {
n: 0, north: 0, nb: 0, northbound: 0,
ne: 45, northeast: 45, neb: 45,
e: 90, east: 90, eb: 90, eastbound: 90,
se: 135, southeast: 135, seb: 135,
s: 180, south: 180, sb: 180, southbound: 180,
sw: 225, southwest: 225, swb: 225,
w: 270, west: 270, wb: 270, westbound: 270,
nw: 315, northwest: 315, nwb: 315,
};
/**
* Convert a cardinal direction string to degrees.
* Returns `undefined` if not recognised.
*/
function cardinalToHeading(dir) {
return CARDINAL_MAP[dir.trim().toLowerCase()];
}
// ─── Internal math ───────────────────────────────────────────
/**
* Project a single frustum corner from the camera position.
*
* 1. Compute the bearing = heading + horizontal offset
* 2. Compute the ground distance = range * cos(pitch + vOff)
* 3. Compute the altitude delta = range * sin(pitch + vOff)
* 4. Use haversine destination formula for the ground position
*/
function projectCorner(latDeg, lonDeg, altM, headingRad, pitchRad, hOffRad, vOffRad, range) {
var bearing = headingRad + hOffRad;
var elevation = pitchRad + vOffRad;
var groundDist = range * Math.cos(elevation);
var altDelta = range * Math.sin(elevation);
var dest = destinationPoint(latDeg, lonDeg, Math.abs(groundDist), bearing);
return {
lat: dest.lat,
lon: dest.lon,
alt: Math.max(0, altM + altDelta),
};
}
/**
* Haversine destination point given start coords (deg),
* distance (m), and bearing (rad).
*/
function destinationPoint(latDeg, lonDeg, distMetres, bearingRad) {
var lat1 = latDeg * DEG2RAD;
var lon1 = lonDeg * DEG2RAD;
var angularDist = distMetres / EARTH_RADIUS;
var sinLat1 = Math.sin(lat1);
var cosLat1 = Math.cos(lat1);
var sinD = Math.sin(angularDist);
var cosD = Math.cos(angularDist);
var lat2 = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(bearingRad));
var lon2 = lon1 + Math.atan2(Math.sin(bearingRad) * sinD * cosLat1, cosD - sinLat1 * Math.sin(lat2));
return { lat: lat2 / DEG2RAD, lon: lon2 / DEG2RAD };
}
-254
View File
@@ -1,254 +0,0 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CameraPlugin = void 0;
var lucide_react_1 = require("lucide-react");
var CameraDetail_1 = require("./CameraDetail");
var CameraSettings_1 = require("./CameraSettings");
var cameraMapper_1 = require("./cameraMapper");
var analytics_1 = require("@/lib/analytics");
var CameraPlugin = /** @class */ (function () {
function CameraPlugin() {
this.id = "camera";
this.name = "Cameras";
this.description = "Public live cameras from across the globe";
this.icon = lucide_react_1.Camera;
this.category = "infrastructure";
this.version = "1.0.0";
this.context = null;
this.sourceBuckets = {};
this.lastActionId = null;
}
CameraPlugin.prototype.initialize = function (ctx) {
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
this.context = ctx;
return [2 /*return*/];
}); });
};
CameraPlugin.prototype.destroy = function () { this.context = null; };
CameraPlugin.prototype.requiresConfiguration = function (settingsRaw) {
var _a;
var s = settingsRaw;
var sourceType = (_a = s === null || s === void 0 ? void 0 : s.sourceType) !== null && _a !== void 0 ? _a : "default";
if (sourceType === "default" || sourceType === "traffic")
return false;
if (sourceType === "url" && !(s === null || s === void 0 ? void 0 : s.customUrl))
return true;
if (sourceType === "file" && !(s === null || s === void 0 ? void 0 : s.customData))
return true;
return false;
};
CameraPlugin.prototype.getAllEntities = function () { return Object.values(this.sourceBuckets).flat(); };
CameraPlugin.prototype.pushUpdate = function () { var _a; (_a = this.context) === null || _a === void 0 ? void 0 : _a.onDataUpdate(this.getAllEntities()); };
CameraPlugin.prototype.fetch = function (_timeRange) {
return __awaiter(this, void 0, void 0, function () {
var rawSettings, settings, isAutoDefault, error_1;
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
rawSettings = this.context.getPluginSettings(this.id);
settings = __assign({ sourceType: "default", action: undefined, actionId: undefined, loaded: undefined, customUrl: undefined, customData: undefined }, (rawSettings || {}));
if (settings.action === "reset") {
this.sourceBuckets = {};
this.lastActionId = settings.actionId;
return [2 /*return*/, []];
}
isAutoDefault = (settings.sourceType === "default" || settings.sourceType === "traffic")
&& !this.lastActionId && !this.sourceBuckets["default"];
if (!isAutoDefault && (settings.action !== "load" || settings.actionId === this.lastActionId)) {
return [2 /*return*/, this.getAllEntities()];
}
this.lastActionId = (_a = settings.actionId) !== null && _a !== void 0 ? _a : -1;
_c.label = 1;
case 1:
_c.trys.push([1, 9, , 10]);
if (!(settings.sourceType === "default")) return [3 /*break*/, 3];
return [4 /*yield*/, this.loadDefaultSource()];
case 2:
_c.sent();
return [3 /*break*/, 8];
case 3:
if (!(settings.sourceType === "traffic")) return [3 /*break*/, 5];
return [4 /*yield*/, this.loadTrafficCameras()];
case 4:
_c.sent();
return [3 /*break*/, 8];
case 5:
if (!(settings.sourceType === "url")) return [3 /*break*/, 7];
return [4 /*yield*/, this.loadUrlSource(settings)];
case 6:
_c.sent();
return [3 /*break*/, 8];
case 7:
if (settings.sourceType === "file") {
this.loadFileSource(settings);
}
_c.label = 8;
case 8:
(0, analytics_1.trackEvent)("camera-source-load", { sourceType: settings.sourceType });
return [2 /*return*/, this.getAllEntities()];
case 9:
error_1 = _c.sent();
console.error("[CameraPlugin] Fetch error:", error_1);
(_b = this.context) === null || _b === void 0 ? void 0 : _b.onError(error_1 instanceof Error ? error_1 : new Error(String(error_1)));
return [2 /*return*/, this.getAllEntities()];
case 10: return [2 /*return*/];
}
});
});
};
CameraPlugin.prototype.loadDefaultSource = function () {
return __awaiter(this, void 0, void 0, function () {
var res, geojson;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, fetch("/public-cameras.json")];
case 1:
res = _a.sent();
if (!res.ok) return [3 /*break*/, 3];
return [4 /*yield*/, res.json()];
case 2:
geojson = _a.sent();
if (geojson && Array.isArray(geojson.features)) {
this.sourceBuckets["default"] = geojson.features.map(function (f, i) { return (0, cameraMapper_1.mapGeoJsonFeature)(f, i, "default"); });
}
_a.label = 3;
case 3:
this.pushUpdate();
return [2 /*return*/];
}
});
});
};
CameraPlugin.prototype.loadTrafficCameras = function () {
return __awaiter(this, void 0, void 0, function () {
var res, data, err_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 4]);
return [4 /*yield*/, fetch("/api/camera/traffic")];
case 1:
res = _a.sent();
if (!res.ok)
throw new Error("API returned ".concat(res.status));
return [4 /*yield*/, res.json()];
case 2:
data = _a.sent();
if (data.cameras && Array.isArray(data.cameras)) {
this.sourceBuckets["default"] = data.cameras.map(function (f, i) { return (0, cameraMapper_1.mapGeoJsonFeature)(f, i, "traffic"); });
}
return [3 /*break*/, 4];
case 3:
err_1 = _a.sent();
console.warn("[CameraPlugin] Traffic cameras API failed:", err_1);
return [3 /*break*/, 4];
case 4:
this.pushUpdate();
return [2 /*return*/];
}
});
});
};
CameraPlugin.prototype.loadUrlSource = function (settings) {
return __awaiter(this, void 0, void 0, function () {
var url, res, data;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!settings.customUrl)
return [2 /*return*/];
url = settings.customUrl;
if (!/^https?:\/\//i.test(url))
url = "http://".concat(url);
return [4 /*yield*/, fetch(url)];
case 1:
res = _a.sent();
if (!res.ok) return [3 /*break*/, 3];
return [4 /*yield*/, res.json()];
case 2:
data = _a.sent();
if (Array.isArray(data)) {
this.sourceBuckets["url"] = data.map(function (c, i) { return (0, cameraMapper_1.mapRawCamera)(c, i, "url"); });
}
_a.label = 3;
case 3: return [2 /*return*/];
}
});
});
};
CameraPlugin.prototype.loadFileSource = function (settings) {
if (!settings.customData || !Array.isArray(settings.customData))
return;
this.sourceBuckets["file"] = settings.customData.map(function (c, i) { return (0, cameraMapper_1.mapRawCamera)(c, i, "file"); });
};
CameraPlugin.prototype.getPollingInterval = function () { return 3600000; };
CameraPlugin.prototype.getLayerConfig = function () {
return { color: "#60a5fa", clusterEnabled: true, clusterDistance: 50, maxEntities: 10000 };
};
CameraPlugin.prototype.renderEntity = function (entity) {
return {
type: "point", color: "#60a5fa", size: 6,
outlineColor: "#ffffff", outlineWidth: 1.5,
labelText: entity.label, labelFont: "11px Inter, system-ui, sans-serif",
};
};
CameraPlugin.prototype.getDetailComponent = function () { return CameraDetail_1.CameraDetail; };
CameraPlugin.prototype.getSettingsComponent = function () { return CameraSettings_1.CameraSettings; };
CameraPlugin.prototype.getFilterDefinitions = function () {
return [
{ id: "country", label: "Country", type: "text", propertyKey: "country" },
{ id: "city", label: "City", type: "text", propertyKey: "city" },
{ id: "is_popular", label: "Popular Only", type: "boolean", propertyKey: "is_popular" },
];
};
return CameraPlugin;
}());
exports.CameraPlugin = CameraPlugin;
-37
View File
@@ -1,37 +0,0 @@
{
"name": "@worldwideview/wwv-plugin-camera",
"version": "1.0.4",
"description": "WorldWideView plugin for displaying public live cameras and traffic cameras on the globe. Supports custom data sources via URL, file upload, and GeoJSON",
"main": "src/index.ts",
"types": "src/index.ts",
"files": [
"src"
],
"keywords": [
"worldwideview",
"worldwideview-plugin",
"wwv-plugin-camera",
"camera",
"live-camera",
"traffic-camera",
"cctv",
"cesium",
"globe"
],
"repository": {
"type": "git",
"url": "https://github.com/silvertakana/worldwideview.git",
"directory": "packages/wwv-plugin-camera"
},
"homepage": "https://github.com/silvertakana/worldwideview#readme",
"bugs": {
"url": "https://github.com/silvertakana/worldwideview/issues"
},
"license": "ISC",
"author": "WorldWideView",
"peerDependencies": {
"@worldwideview/wwv-plugin-sdk": "*",
"react": ">=18",
"lucide-react": ">=0.576.0"
}
}
@@ -1,45 +0,0 @@
"use client";
import React from "react";
import { ExternalLink, MapPin, Tag } from "lucide-react";
import type { GeoEntity } from "@worldwideview/wwv-plugin-sdk";
import { CameraStream } from "@/components/video/CameraStream";
interface CameraDetailProps { entity: GeoEntity; }
export const CameraDetail: React.FC<CameraDetailProps> = ({ entity }) => {
const { properties } = entity;
const stream = properties.stream as string;
const previewUrl = properties.preview_url as string;
const city = properties.city as string;
const region = properties.region as string;
const country = properties.country as string;
const isIframe = !!properties.is_iframe;
const categories = (properties.categories as string[]) || [];
return (
<div className="flex flex-col gap-4">
<CameraStream id={entity.id} streamUrl={stream} previewUrl={previewUrl} isIframe={isIframe} label={city || country} />
<div className="intel-panel__props">
<div className="intel-panel__prop" style={{ flexDirection: "column", alignItems: "flex-start", gap: "var(--space-xs)", borderBottom: "1px solid var(--border-subtle)", padding: "var(--space-sm) 0" }}>
<span className="intel-panel__prop-key">Location</span>
<span className="intel-panel__prop-value" style={{ textAlign: "left", width: "100%", whiteSpace: "normal", lineHeight: "1.4", fontSize: "12px", color: "var(--text-primary)" }}>
{[city, region, country].filter(Boolean).join(", ")}
</span>
</div>
{categories.length > 0 && (
<div className="intel-panel__prop" style={{ flexDirection: "column", alignItems: "flex-start", gap: "var(--space-sm)", borderBottom: "none", padding: "var(--space-sm) 0" }}>
<span className="intel-panel__prop-key">Categories</span>
<div style={{ display: "flex", flexWrap: "wrap", gap: "6px" }}>
{categories.map((cat) => (
<span key={cat} style={{ borderRadius: "12px", backgroundColor: "var(--bg-tertiary)", padding: "2px 8px", fontSize: "10px", fontWeight: 500, color: "var(--text-secondary)", border: "1px solid var(--border-subtle)" }}>
{cat}
</span>
))}
</div>
</div>
)}
</div>
</div>
);
};
@@ -1,106 +0,0 @@
"use client";
import React, { ChangeEvent } from "react";
import { useStore } from "@/core/state/store";
import { Upload, Link as LinkIcon, Database, RotateCcw, TrafficCone } from "lucide-react";
import { pluginManager } from "@/core/plugins/PluginManager";
import { inputGroupStyle, labelStyle, inputStyle, loadButtonStyle, sourceTabStyle } from "./cameraSettingsStyles";
type SourceType = "default" | "traffic" | "url" | "file";
export const CameraSettings: React.FC<{ pluginId: string }> = ({ pluginId }) => {
const settingsRaw = useStore((s) => s.dataConfig.pluginSettings[pluginId]);
const settings = { sourceType: "default" as SourceType, ...(settingsRaw || {}) };
const updatePluginSettings = useStore((s) => s.updatePluginSettings);
const setHighlightLayerId = useStore((s) => s.setHighlightLayerId);
const [isLoading, setIsLoading] = React.useState(false);
const handleSourceTypeChange = (type: SourceType) => {
updatePluginSettings(pluginId, { sourceType: type });
setHighlightLayerId(null);
};
const triggerFetch = async () => {
const managed = pluginManager.getPlugin(pluginId);
if (managed && managed.enabled) {
await pluginManager.fetchForPlugin(pluginId, managed.context.timeRange);
}
};
const handleLoadData = async () => {
setIsLoading(true);
updatePluginSettings(pluginId, { action: "load", actionId: Date.now(), loaded: true });
setHighlightLayerId(null);
await triggerFetch();
setIsLoading(false);
};
const handleResetAll = async () => {
updatePluginSettings(pluginId, { action: "reset", actionId: Date.now(), loaded: false, customUrl: "", customData: null });
setHighlightLayerId(null);
await triggerFetch();
};
const handleFileUpload = (e: ChangeEvent<HTMLInputElement>) => {
const file = e.target.files?.[0];
if (!file) return;
const reader = new FileReader();
reader.onload = async (event) => {
try {
const json = JSON.parse(event.target?.result as string);
updatePluginSettings(pluginId, { customData: json, action: "load", actionId: Date.now(), loaded: true });
setHighlightLayerId(null);
await triggerFetch();
} catch { alert("Invalid JSON file format."); }
};
reader.readAsText(file);
};
return (
<div style={{ display: "flex", flexDirection: "column", gap: "var(--space-md)" }}>
<div style={{ fontSize: 11, color: "var(--text-muted)", marginBottom: "var(--space-xs)" }}>Data Source Configuration</div>
<div style={{ display: "flex", gap: "var(--space-xs)" }}>
{([["default", Database, "Default"], ["traffic", TrafficCone, "Traffic Cams"], ["url", LinkIcon, "URL"], ["file", Upload, "File"]] as const).map(
([type, Icon, label]) => (
<button key={type} onClick={() => handleSourceTypeChange(type)} style={sourceTabStyle(settings.sourceType === type)}>
<Icon size={14} /><span style={{ fontSize: 10 }}>{label}</span>
</button>
)
)}
</div>
{settings.sourceType === "default" && (
<div style={inputGroupStyle}>
<div style={{ fontSize: 11, color: "var(--text-secondary)" }}>Built-in camera dataset</div>
<button onClick={handleLoadData} disabled={isLoading} style={loadButtonStyle(isLoading)}>{isLoading ? "Loading..." : settings.loaded ? "Reload" : "Load"}</button>
</div>
)}
{settings.sourceType === "traffic" && (
<div style={inputGroupStyle}>
<div style={{ fontSize: 11, color: "var(--text-secondary)" }}>DOT traffic cameras (GDOT + more)</div>
<button onClick={handleLoadData} disabled={isLoading} style={loadButtonStyle(isLoading)}>{isLoading ? "Loading..." : settings.loaded ? "Reload" : "Load"}</button>
</div>
)}
{settings.sourceType === "url" && (
<div style={inputGroupStyle}>
<label style={labelStyle}>URL</label>
<div style={{ display: "flex", gap: "var(--space-sm)", marginTop: "4px" }}>
<input type="text" placeholder="http://..." value={(settings.customUrl as string) || ""} onChange={(e) => updatePluginSettings(pluginId, { customUrl: e.target.value })} style={{ ...inputStyle, flex: 1 }} />
<button onClick={handleLoadData} disabled={!settings.customUrl || isLoading} style={loadButtonStyle(!settings.customUrl || isLoading)}>{isLoading ? "Loading..." : "Load"}</button>
</div>
</div>
)}
{settings.sourceType === "file" && (
<div style={inputGroupStyle}>
<label style={labelStyle}>JSON File</label>
<input type="file" accept=".json" onChange={handleFileUpload} style={{ ...inputStyle, width: "100%", marginTop: "4px", padding: "4px", fontSize: "10px" }} />
{settings.customData && Array.isArray(settings.customData) && (
<div style={{ fontSize: 10, color: "var(--accent-green)", marginTop: "4px" }}>✓ Data loaded ({(settings.customData as unknown[]).length} cameras)</div>
)}
</div>
)}
<button onClick={handleResetAll} style={{ display: "flex", alignItems: "center", justifyContent: "center", gap: "6px", background: "transparent", border: "1px solid var(--border-subtle)", borderRadius: "var(--radius-sm)", padding: "6px var(--space-md)", fontSize: 11, color: "var(--text-muted)", cursor: "pointer", transition: "all 0.2s ease" }}>
<RotateCcw size={12} /> Reset All Sources
</button>
</div>
);
};
@@ -1,32 +0,0 @@
import type { GeoEntity } from "@worldwideview/wwv-plugin-sdk";
const DEFAULT_CAMERA_ALT = 8;
export function mapRawCamera(cam: Record<string, unknown>, index: number, prefix: string): GeoEntity {
return {
id: `camera-${prefix}-${index}`,
pluginId: "camera",
latitude: cam.latitude as number,
longitude: cam.longitude as number,
altitude: (cam.altitude as number) ?? (cam.elevation as number) ?? DEFAULT_CAMERA_ALT,
timestamp: new Date(),
label: (cam.city as string) || (cam.country as string) || "Unknown Camera",
properties: { ...cam },
};
}
export function mapGeoJsonFeature(feature: unknown, index: number, prefix: string): GeoEntity {
const f = feature as { geometry?: { coordinates?: number[] }; properties?: Record<string, unknown> };
const [lon, lat] = f.geometry?.coordinates ?? [0, 0];
const props = f.properties ?? {};
return {
id: `camera-${prefix}-${index}`,
pluginId: "camera",
latitude: lat,
longitude: lon,
altitude: DEFAULT_CAMERA_ALT,
timestamp: new Date(),
label: (props.city as string) || (props.country as string) || "Unknown Camera",
properties: { ...props },
};
}
@@ -1,7 +0,0 @@
import type React from "react";
export const inputGroupStyle: React.CSSProperties = { display: "flex", flexDirection: "column", gap: "4px" };
export const labelStyle: React.CSSProperties = { fontSize: 10, fontWeight: 600, color: "var(--text-muted)", textTransform: "uppercase", letterSpacing: "0.05em" };
export const inputStyle: React.CSSProperties = { background: "var(--bg-tertiary)", border: "1px solid var(--border-subtle)", color: "var(--text-primary)", padding: "var(--space-xs) var(--space-sm)", borderRadius: "var(--radius-sm)", fontSize: 12, outline: "none" };
export const loadButtonStyle = (disabled: boolean): React.CSSProperties => ({ background: "var(--accent-cyan)", color: "var(--bg-primary)", border: "none", borderRadius: "var(--radius-sm)", padding: "0 var(--space-md)", fontSize: 12, fontWeight: 500, cursor: disabled ? "not-allowed" : "pointer", opacity: disabled ? 0.5 : 1, transition: "all 0.2s ease" });
export const sourceTabStyle = (active: boolean): React.CSSProperties => ({ flex: 1, display: "flex", flexDirection: "column", alignItems: "center", gap: "4px", padding: "8px", borderRadius: "var(--radius-md)", background: active ? "var(--accent-cyan-subtle)" : "var(--bg-tertiary)", border: active ? "1px solid var(--accent-cyan)" : "1px solid var(--border-subtle)", cursor: "pointer", color: active ? "var(--accent-cyan)" : "var(--text-secondary)", transition: "all 0.2s ease" });
@@ -1,128 +0,0 @@
import { describe, it, expect } from "vitest";
import {
computeFrustumEdges,
cardinalToHeading,
FRUSTUM_DEFAULTS,
type FrustumParams,
} from "./frustumGeometry";
// ─── computeFrustumEdges ─────────────────────────────────────
describe("computeFrustumEdges", () => {
const baseParams: FrustumParams = {
lat: 40.0,
lon: -83.0,
alt: 8,
headingDeg: 0,
pitchDeg: 0,
hFovDeg: 50,
vFovDeg: 35,
rangeMtrs: 200,
};
it("returns apex at the camera position", () => {
const edges = computeFrustumEdges(baseParams);
expect(edges.apex.lat).toBe(40.0);
expect(edges.apex.lon).toBe(-83.0);
expect(edges.apex.alt).toBe(8);
});
it("produces 4 distinct corner points", () => {
const edges = computeFrustumEdges(baseParams);
const corners = [edges.topLeft, edges.topRight, edges.bottomLeft, edges.bottomRight];
// All corners should differ from each other
for (let i = 0; i < corners.length; i++) {
for (let j = i + 1; j < corners.length; j++) {
const same = corners[i].lat === corners[j].lat
&& corners[i].lon === corners[j].lon
&& corners[i].alt === corners[j].alt;
expect(same).toBe(false);
}
}
});
it("corners are roughly at the expected range from apex", () => {
const edges = computeFrustumEdges(baseParams);
const corners = [edges.topLeft, edges.topRight, edges.bottomLeft, edges.bottomRight];
for (const c of corners) {
const dLat = (c.lat - edges.apex.lat) * 111_320;
const dLon = (c.lon - edges.apex.lon) * 111_320 * Math.cos(edges.apex.lat * Math.PI / 180);
const dAlt = c.alt - edges.apex.alt;
const dist = Math.sqrt(dLat * dLat + dLon * dLon + dAlt * dAlt);
// Should be close to 200m (within 10% tolerance for spherical approx)
expect(dist).toBeGreaterThan(150);
expect(dist).toBeLessThan(250);
}
});
it("heading north means corners are north of the apex", () => {
const edges = computeFrustumEdges({ ...baseParams, headingDeg: 0, pitchDeg: 0 });
const corners = [edges.topLeft, edges.topRight, edges.bottomLeft, edges.bottomRight];
for (const c of corners) {
expect(c.lat).toBeGreaterThan(edges.apex.lat);
}
});
it("heading south means corners are south of the apex", () => {
const edges = computeFrustumEdges({ ...baseParams, headingDeg: 180, pitchDeg: 0 });
const corners = [edges.topLeft, edges.topRight, edges.bottomLeft, edges.bottomRight];
for (const c of corners) {
expect(c.lat).toBeLessThan(edges.apex.lat);
}
});
it("left corners are to the left of right corners (heading north)", () => {
const edges = computeFrustumEdges({ ...baseParams, headingDeg: 0, pitchDeg: 0 });
// Heading north: left = west (smaller lon), right = east (larger lon)
expect(edges.topLeft.lon).toBeLessThan(edges.topRight.lon);
expect(edges.bottomLeft.lon).toBeLessThan(edges.bottomRight.lon);
});
it("zero range produces corners at the apex", () => {
const edges = computeFrustumEdges({ ...baseParams, rangeMtrs: 0 });
const corners = [edges.topLeft, edges.topRight, edges.bottomLeft, edges.bottomRight];
for (const c of corners) {
expect(c.lat).toBeCloseTo(edges.apex.lat, 6);
expect(c.lon).toBeCloseTo(edges.apex.lon, 6);
}
});
it("corner altitudes clamp to 0 when pitch is steep enough", () => {
const edges = computeFrustumEdges({ ...baseParams, pitchDeg: -80, alt: 5 });
const corners = [edges.topLeft, edges.topRight, edges.bottomLeft, edges.bottomRight];
for (const c of corners) {
expect(c.alt).toBeGreaterThanOrEqual(0);
}
});
});
// ─── cardinalToHeading ───────────────────────────────────────
describe("cardinalToHeading", () => {
it("parses cardinal directions", () => {
expect(cardinalToHeading("N")).toBe(0);
expect(cardinalToHeading("E")).toBe(90);
expect(cardinalToHeading("S")).toBe(180);
expect(cardinalToHeading("W")).toBe(270);
});
it("parses abbreviations", () => {
expect(cardinalToHeading("NB")).toBe(0);
expect(cardinalToHeading("EB")).toBe(90);
expect(cardinalToHeading("SB")).toBe(180);
expect(cardinalToHeading("WB")).toBe(270);
});
it("parses full names case-insensitively", () => {
expect(cardinalToHeading("Northbound")).toBe(0);
expect(cardinalToHeading("SOUTHEAST")).toBe(135);
expect(cardinalToHeading(" west ")).toBe(270);
});
it("returns undefined for unknown strings", () => {
expect(cardinalToHeading("foo")).toBeUndefined();
expect(cardinalToHeading("")).toBeUndefined();
});
});
-161
View File
@@ -1,161 +0,0 @@
import { Camera } from "lucide-react";
import type {
WorldPlugin, GeoEntity, TimeRange, PluginContext,
LayerConfig, CesiumEntityOptions, FilterDefinition,
} from "@worldwideview/wwv-plugin-sdk";
import { CameraDetail } from "./CameraDetail";
import { CameraSettings as CameraSettingsComponent } from "./CameraSettings";
import { mapRawCamera, mapGeoJsonFeature } from "./cameraMapper";
import { trackEvent } from "@/lib/analytics";
type CameraSettings = {
sourceType: "default" | "traffic" | "url" | "file";
action?: string;
actionId?: number;
loaded?: boolean;
customUrl?: string;
customData?: unknown[] | null;
};
export class CameraPlugin implements WorldPlugin {
id = "camera";
name = "Cameras";
description = "Public live cameras from across the globe";
icon = Camera;
category = "infrastructure" as const;
version = "1.0.0";
private context: PluginContext | null = null;
private sourceBuckets: Record<string, GeoEntity[]> = {};
private lastActionId: number | null = null;
async initialize(ctx: PluginContext): Promise<void> { this.context = ctx; }
destroy(): void { this.context = null; }
requiresConfiguration(settingsRaw: unknown): boolean {
const s = settingsRaw as { sourceType?: string; customUrl?: string; customData?: unknown } | null;
const sourceType = s?.sourceType ?? "default";
if (sourceType === "default" || sourceType === "traffic") return false;
if (sourceType === "url" && !s?.customUrl) return true;
if (sourceType === "file" && !s?.customData) return true;
return false;
}
private getAllEntities(): GeoEntity[] { return Object.values(this.sourceBuckets).flat(); }
private pushUpdate(): void { this.context?.onDataUpdate(this.getAllEntities()); }
async fetch(_timeRange: TimeRange): Promise<GeoEntity[]> {
// Use context instead of direct useStore access
const rawSettings = this.context!.getPluginSettings<Record<string, unknown>>(this.id);
const settings = {
sourceType: "default" as "default" | "traffic" | "url" | "file",
action: undefined as string | undefined,
actionId: undefined as number | undefined,
loaded: undefined as boolean | undefined,
customUrl: undefined as string | undefined,
customData: undefined as unknown[] | null | undefined,
...((rawSettings as Record<string, unknown>) || {}),
};
if (settings.action === "reset") {
this.sourceBuckets = {};
this.lastActionId = settings.actionId as number;
return [];
}
const isAutoDefault = (settings.sourceType === "default" || settings.sourceType === "traffic")
&& !this.lastActionId && !this.sourceBuckets["default"];
if (!isAutoDefault && (settings.action !== "load" || settings.actionId === this.lastActionId)) {
return this.getAllEntities();
}
this.lastActionId = (settings.actionId as number) ?? -1;
try {
if (settings.sourceType === "default") {
await this.loadDefaultSource();
} else if (settings.sourceType === "traffic") {
await this.loadTrafficCameras();
} else if (settings.sourceType === "url") {
await this.loadUrlSource(settings);
} else if (settings.sourceType === "file") {
this.loadFileSource(settings);
}
trackEvent("camera-source-load", { sourceType: settings.sourceType });
return this.getAllEntities();
} catch (error) {
console.error("[CameraPlugin] Fetch error:", error);
this.context?.onError(error instanceof Error ? error : new Error(String(error)));
return this.getAllEntities();
}
}
private async loadDefaultSource(): Promise<void> {
const res = await fetch("/public-cameras.json");
if (res.ok) {
const geojson = await res.json();
if (geojson && Array.isArray(geojson.features)) {
this.sourceBuckets["default"] = geojson.features.map(
(f: unknown, i: number) => mapGeoJsonFeature(f, i, "default"),
);
}
}
this.pushUpdate();
}
private async loadTrafficCameras(): Promise<void> {
try {
const res = await fetch("/api/camera/traffic");
if (!res.ok) throw new Error(`API returned ${res.status}`);
const data = await res.json();
if (data.cameras && Array.isArray(data.cameras)) {
this.sourceBuckets["default"] = data.cameras.map(
(f: unknown, i: number) => mapGeoJsonFeature(f, i, "traffic"),
);
}
} catch (err) {
console.warn("[CameraPlugin] Traffic cameras API failed:", err);
}
this.pushUpdate();
}
private async loadUrlSource(settings: Record<string, unknown>): Promise<void> {
if (!settings.customUrl) return;
let url = settings.customUrl as string;
if (!/^https?:\/\//i.test(url)) url = `http://${url}`;
const res = await fetch(url);
if (res.ok) {
const data = await res.json();
if (Array.isArray(data)) {
this.sourceBuckets["url"] = data.map((c, i) => mapRawCamera(c, i, "url"));
}
}
}
private loadFileSource(settings: Record<string, unknown>): void {
if (!settings.customData || !Array.isArray(settings.customData)) return;
this.sourceBuckets["file"] = settings.customData.map((c: unknown, i: number) => mapRawCamera(c as Record<string, unknown>, i, "file"));
}
getPollingInterval(): number { return 3600000; }
getLayerConfig(): LayerConfig {
return { color: "#60a5fa", clusterEnabled: true, clusterDistance: 50, maxEntities: 10000 };
}
renderEntity(entity: GeoEntity): CesiumEntityOptions {
return {
type: "point", color: "#60a5fa", size: 6,
outlineColor: "#ffffff", outlineWidth: 1.5,
labelText: entity.label, labelFont: "11px Inter, system-ui, sans-serif",
};
}
getDetailComponent() { return CameraDetail; }
getSettingsComponent() { return CameraSettingsComponent; }
getFilterDefinitions(): FilterDefinition[] {
return [
{ id: "country", label: "Country", type: "text", propertyKey: "country" },
{ id: "city", label: "City", type: "text", propertyKey: "city" },
{ id: "is_popular", label: "Popular Only", type: "boolean", propertyKey: "is_popular" },
];
}
}
@@ -1,10 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"outDir": "dist",
"noEmit": false
},
"exclude": ["**/*.test.*"]
}
-8
View File
@@ -1,8 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"noEmit": true
},
"include": ["src"]
}
-28
View File
@@ -1,28 +0,0 @@
# @worldwideview/wwv-plugin-embassies
WorldWideView plugin — **Embassies & Consulates**.
## Data Source
- **Source:** OpenStreetMap via [Overpass Turbo](https://overpass-turbo.eu/)
- **Tag:** `amenity=embassy`
- **Format:** Static GeoJSON (17,266 features)
- **License:** [ODbL](https://opendatacommons.org/licenses/odbl/) (OpenStreetMap)
## Installation
```bash
npm install @worldwideview/wwv-plugin-embassies
```
## Peer Dependencies
- `@worldwideview/wwv-plugin-sdk`
## Changelog
- **v1.0.0** — Initial release with global diplomatic mission data from OSM.
## License
ISC
@@ -1,30 +0,0 @@
{
"name": "@worldwideview/wwv-plugin-embassies",
"version": "1.0.1",
"description": "WorldWideView plugin — Global embassies, consulates, and diplomatic missions from OpenStreetMap",
"main": "src/index.ts",
"types": "src/index.ts",
"files": [
"src"
],
"keywords": [
"worldwideview",
"worldwideview-plugin",
"wwv-plugin-embassies",
"embassies"
],
"repository": {
"type": "git",
"url": "https://github.com/silvertakana/worldwideview.git",
"directory": "packages/wwv-plugin-embassies"
},
"homepage": "https://github.com/silvertakana/worldwideview#readme",
"bugs": {
"url": "https://github.com/silvertakana/worldwideview/issues"
},
"license": "ISC",
"author": "WorldWideView",
"peerDependencies": {
"@worldwideview/wwv-plugin-sdk": "*"
}
}
@@ -1,32 +0,0 @@
import { Landmark } from "lucide-react";
import type {
WorldPlugin, GeoEntity, TimeRange, PluginContext,
LayerConfig, CesiumEntityOptions,
} from "@worldwideview/wwv-plugin-sdk";
export class EmbassiesConsulatesPlugin implements WorldPlugin {
id = "embassies";
name = "Embassies & Consulates";
description = "Global embassies, consulates, and diplomatic missions from OpenStreetMap";
icon = Landmark;
category = "custom" as const;
version = "1.0.0";
async initialize(_ctx: PluginContext): Promise<void> { }
destroy(): void { }
async fetch(_tr: TimeRange): Promise<GeoEntity[]> { return []; }
getPollingInterval(): number { return 0; }
getLayerConfig(): LayerConfig {
return {
color: "#a855f7",
clusterEnabled: true,
clusterDistance: 50,
maxEntities: 1000,
};
}
renderEntity(_e: GeoEntity): CesiumEntityOptions {
return { type: "point", color: "#a855f7", size: 8 };
}
}
-59
View File
@@ -1,59 +0,0 @@
# @worldwideview/wwv-plugin-maritime
[WorldWideView](https://github.com/silvertakana/worldwideview) plugin for **real-time vessel tracking** via AIS (Automatic Identification System) feeds.
## Features
- 🚢 Live vessel positions with heading and speed indicators
- 🎨 Color-coded by vessel type (cargo, tanker, passenger, fishing, military, sailing, tug)
- 🔍 Filters: vessel type, speed range
- 📍 Clustered point rendering with vessel name labels
- 🔄 Demo mode with realistic sample vessels when API is unavailable
## Installation
```bash
npm install @worldwideview/wwv-plugin-maritime
```
### Peer Dependencies
- `@worldwideview/wwv-plugin-sdk`
- `lucide-react` ≥ 0.576.0
## Usage
```ts
import { MaritimePlugin } from "@worldwideview/wwv-plugin-maritime";
const plugin = new MaritimePlugin();
```
Register the plugin with the WorldWideView plugin engine to start tracking vessels on the globe.
## Data Source
Vessel data is fetched from the `/api/maritime` endpoint. Falls back to demo data with 15 sample vessels when the API is unavailable.
## Vessel Colors
| Type | Color |
|---|---|
| Cargo | 🟡 `#f59e0b` |
| Tanker | 🔴 `#ef4444` |
| Passenger | 🔵 `#3b82f6` |
| Fishing | 🔵 `#22d3ee` |
| Military | 🟣 `#a78bfa` |
| Sailing | 🟢 `#4ade80` |
| Tug | 🟠 `#f97316` |
## Changelog
- **v1.0.3** — Added README with feature list and usage docs.
- **v1.0.2** — Package metadata updates.
- **v1.0.1** — Package configuration fixes.
- **v1.0.0** — Initial release with AIS-based vessel tracking and ship-type filtering.
## License
ISC
-18
View File
@@ -1,18 +0,0 @@
import type { WorldPlugin, GeoEntity, TimeRange, PluginContext, LayerConfig, CesiumEntityOptions, FilterDefinition } from "@worldwideview/wwv-plugin-sdk";
export declare class MaritimePlugin implements WorldPlugin {
id: string;
name: string;
description: string;
icon: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
category: "maritime";
version: string;
private context;
initialize(ctx: PluginContext): Promise<void>;
destroy(): void;
fetch(_timeRange: TimeRange): Promise<GeoEntity[]>;
getPollingInterval(): number;
getLayerConfig(): LayerConfig;
renderEntity(entity: GeoEntity): CesiumEntityOptions;
getFilterDefinitions(): FilterDefinition[];
}
//# sourceMappingURL=index.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,WAAW,EACX,SAAS,EACT,SAAS,EACT,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EACnB,MAAM,+BAA+B,CAAC;AAqDvC,qBAAa,cAAe,YAAW,WAAW;IAC9C,EAAE,SAAc;IAChB,IAAI,SAAc;IAClB,WAAW,SAAmC;IAC9C,IAAI,4IAAQ;IACZ,QAAQ,EAAG,UAAU,CAAU;IAC/B,OAAO,SAAW;IAClB,OAAO,CAAC,OAAO,CAA8B;IAEvC,UAAU,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IACnD,OAAO,IAAI,IAAI;IAET,KAAK,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAYxD,kBAAkB,IAAI,MAAM;IAE5B,cAAc,IAAI,WAAW;IAI7B,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,mBAAmB;IASpD,oBAAoB,IAAI,gBAAgB,EAAE;CAc7C"}
-171
View File
@@ -1,171 +0,0 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MaritimePlugin = void 0;
var lucide_react_1 = require("lucide-react");
var VESSEL_COLORS = {
cargo: "#f59e0b",
tanker: "#ef4444",
passenger: "#3b82f6",
fishing: "#22d3ee",
military: "#a78bfa",
sailing: "#4ade80",
tug: "#f97316",
other: "#94a3b8",
};
function getVesselColor(type) {
var lower = type.toLowerCase();
for (var _i = 0, _a = Object.entries(VESSEL_COLORS); _i < _a.length; _i++) {
var _b = _a[_i], key = _b[0], color = _b[1];
if (lower.includes(key))
return color;
}
return VESSEL_COLORS.other;
}
function generateDemoVessels() {
var vessels = [
{ name: "EVER GIVEN", mmsi: "353136000", type: "cargo", lat: 30.0, lon: 32.5, speed: 12.5, heading: 340 },
{ name: "MAERSK SEALAND", mmsi: "220417000", type: "cargo", lat: 51.9, lon: 1.2, speed: 15.0, heading: 210 },
{ name: "PACIFIC RUBY", mmsi: "538004561", type: "tanker", lat: 1.2, lon: 103.7, speed: 8.3, heading: 125 },
{ name: "QUEEN MARY 2", mmsi: "310627000", type: "passenger", lat: 40.6, lon: -74.0, speed: 22.0, heading: 90 },
{ name: "OCEAN EXPLORER", mmsi: "245390000", type: "fishing", lat: -33.8, lon: 18.4, speed: 4.2, heading: 180 },
{ name: "ARCTIC SUNRISE", mmsi: "246585000", type: "other", lat: 69.0, lon: 18.0, speed: 6.0, heading: 45 },
{ name: "BLUE MARLIN", mmsi: "244870698", type: "cargo", lat: 22.3, lon: 113.9, speed: 10.5, heading: 270 },
{ name: "STENA BULK", mmsi: "265548750", type: "tanker", lat: 57.7, lon: 11.9, speed: 12.0, heading: 300 },
{ name: "SPIRIT OF BRITAIN", mmsi: "235082198", type: "passenger", lat: 50.9, lon: 1.4, speed: 20.0, heading: 160 },
{ name: "DEEP BLUE", mmsi: "538006050", type: "fishing", lat: -4.0, lon: 39.6, speed: 3.5, heading: 95 },
{ name: "CRIMSON ACE", mmsi: "477558200", type: "tanker", lat: 26.2, lon: 56.3, speed: 14.0, heading: 200 },
{ name: "SAGA HORIZON", mmsi: "311000596", type: "passenger", lat: 35.3, lon: 139.6, speed: 18.0, heading: 0 },
{ name: "ATLANTIC GUARDIAN", mmsi: "219354000", type: "tug", lat: 56.1, lon: -3.2, speed: 7.5, heading: 245 },
{ name: "JADE STAR", mmsi: "636092783", type: "cargo", lat: -12.0, lon: -77.0, speed: 11.0, heading: 320 },
{ name: "NORTHERN SPIRIT", mmsi: "257038700", type: "fishing", lat: 62.4, lon: 6.1, speed: 5.0, heading: 170 },
];
return vessels.map(function (v) { return ({
id: "maritime-".concat(v.mmsi),
pluginId: "maritime",
latitude: v.lat + (Math.random() - 0.5) * 0.1,
longitude: v.lon + (Math.random() - 0.5) * 0.1,
heading: v.heading,
speed: v.speed,
timestamp: new Date(),
label: v.name,
properties: { mmsi: v.mmsi, vesselName: v.name, vesselType: v.type, speed_knots: v.speed, heading: v.heading },
}); });
}
var MaritimePlugin = /** @class */ (function () {
function MaritimePlugin() {
this.id = "maritime";
this.name = "Maritime";
this.description = "Vessel tracking via AIS feeds";
this.icon = lucide_react_1.Ship;
this.category = "maritime";
this.version = "1.0.0";
this.context = null;
}
MaritimePlugin.prototype.initialize = function (ctx) {
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
this.context = ctx;
return [2 /*return*/];
}); });
};
MaritimePlugin.prototype.destroy = function () { this.context = null; };
MaritimePlugin.prototype.fetch = function (_timeRange) {
return __awaiter(this, void 0, void 0, function () {
var res, data, vessels, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_b.trys.push([0, 3, , 4]);
return [4 /*yield*/, fetch("/api/maritime")];
case 1:
res = _b.sent();
if (!res.ok)
throw new Error("Maritime API returned ".concat(res.status));
return [4 /*yield*/, res.json()];
case 2:
data = _b.sent();
vessels = data.vessels || generateDemoVessels();
return [2 /*return*/, vessels.map(function (v) { return (__assign(__assign({}, v), { timestamp: new Date(v.timestamp) })); })];
case 3:
_a = _b.sent();
return [2 /*return*/, generateDemoVessels()];
case 4: return [2 /*return*/];
}
});
});
};
MaritimePlugin.prototype.getPollingInterval = function () { return 60000; };
MaritimePlugin.prototype.getLayerConfig = function () {
return { color: "#f59e0b", clusterEnabled: true, clusterDistance: 50 };
};
MaritimePlugin.prototype.renderEntity = function (entity) {
var vesselType = entity.properties.vesselType || "other";
return {
type: "point", color: getVesselColor(vesselType), size: 7,
rotation: entity.heading, outlineColor: "#000000", outlineWidth: 1,
labelText: entity.label || undefined, labelFont: "11px JetBrains Mono, monospace",
};
};
MaritimePlugin.prototype.getFilterDefinitions = function () {
return [
{
id: "vessel_type", label: "Vessel Type", type: "select", propertyKey: "vesselType",
options: [
{ value: "cargo", label: "Cargo" }, { value: "tanker", label: "Tanker" },
{ value: "passenger", label: "Passenger" }, { value: "fishing", label: "Fishing" },
{ value: "military", label: "Military" }, { value: "sailing", label: "Sailing" },
{ value: "tug", label: "Tug" }, { value: "other", label: "Other" },
],
},
{ id: "speed", label: "Speed (knots)", type: "range", propertyKey: "speed_knots", range: { min: 0, max: 30, step: 1 } },
];
};
return MaritimePlugin;
}());
exports.MaritimePlugin = MaritimePlugin;
-36
View File
@@ -1,36 +0,0 @@
{
"name": "@worldwideview/wwv-plugin-maritime",
"version": "1.0.4",
"description": "WorldWideView plugin for real-time vessel tracking via AIS feeds. Color-coded by vessel type with speed and heading indicators",
"main": "src/index.ts",
"types": "src/index.ts",
"files": [
"src"
],
"keywords": [
"worldwideview",
"worldwideview-plugin",
"wwv-plugin-maritime",
"maritime",
"vessel-tracking",
"ais",
"ships",
"cesium",
"globe"
],
"repository": {
"type": "git",
"url": "https://github.com/silvertakana/worldwideview.git",
"directory": "packages/wwv-plugin-maritime"
},
"homepage": "https://github.com/silvertakana/worldwideview#readme",
"bugs": {
"url": "https://github.com/silvertakana/worldwideview/issues"
},
"license": "ISC",
"author": "WorldWideView",
"peerDependencies": {
"@worldwideview/wwv-plugin-sdk": "*",
"lucide-react": ">=0.576.0"
}
}
-116
View File
@@ -1,116 +0,0 @@
import { Ship } from "lucide-react";
import type {
WorldPlugin,
GeoEntity,
TimeRange,
PluginContext,
LayerConfig,
CesiumEntityOptions,
FilterDefinition,
} from "@worldwideview/wwv-plugin-sdk";
const VESSEL_COLORS: Record<string, string> = {
cargo: "#f59e0b",
tanker: "#ef4444",
passenger: "#3b82f6",
fishing: "#22d3ee",
military: "#a78bfa",
sailing: "#4ade80",
tug: "#f97316",
other: "#94a3b8",
};
function getVesselColor(type: string): string {
const lower = type.toLowerCase();
for (const [key, color] of Object.entries(VESSEL_COLORS)) {
if (lower.includes(key)) return color;
}
return VESSEL_COLORS.other;
}
function generateDemoVessels(): GeoEntity[] {
const vessels = [
{ name: "EVER GIVEN", mmsi: "353136000", type: "cargo", lat: 30.0, lon: 32.5, speed: 12.5, heading: 340 },
{ name: "MAERSK SEALAND", mmsi: "220417000", type: "cargo", lat: 51.9, lon: 1.2, speed: 15.0, heading: 210 },
{ name: "PACIFIC RUBY", mmsi: "538004561", type: "tanker", lat: 1.2, lon: 103.7, speed: 8.3, heading: 125 },
{ name: "QUEEN MARY 2", mmsi: "310627000", type: "passenger", lat: 40.6, lon: -74.0, speed: 22.0, heading: 90 },
{ name: "OCEAN EXPLORER", mmsi: "245390000", type: "fishing", lat: -33.8, lon: 18.4, speed: 4.2, heading: 180 },
{ name: "ARCTIC SUNRISE", mmsi: "246585000", type: "other", lat: 69.0, lon: 18.0, speed: 6.0, heading: 45 },
{ name: "BLUE MARLIN", mmsi: "244870698", type: "cargo", lat: 22.3, lon: 113.9, speed: 10.5, heading: 270 },
{ name: "STENA BULK", mmsi: "265548750", type: "tanker", lat: 57.7, lon: 11.9, speed: 12.0, heading: 300 },
{ name: "SPIRIT OF BRITAIN", mmsi: "235082198", type: "passenger", lat: 50.9, lon: 1.4, speed: 20.0, heading: 160 },
{ name: "DEEP BLUE", mmsi: "538006050", type: "fishing", lat: -4.0, lon: 39.6, speed: 3.5, heading: 95 },
{ name: "CRIMSON ACE", mmsi: "477558200", type: "tanker", lat: 26.2, lon: 56.3, speed: 14.0, heading: 200 },
{ name: "SAGA HORIZON", mmsi: "311000596", type: "passenger", lat: 35.3, lon: 139.6, speed: 18.0, heading: 0 },
{ name: "ATLANTIC GUARDIAN", mmsi: "219354000", type: "tug", lat: 56.1, lon: -3.2, speed: 7.5, heading: 245 },
{ name: "JADE STAR", mmsi: "636092783", type: "cargo", lat: -12.0, lon: -77.0, speed: 11.0, heading: 320 },
{ name: "NORTHERN SPIRIT", mmsi: "257038700", type: "fishing", lat: 62.4, lon: 6.1, speed: 5.0, heading: 170 },
];
return vessels.map((v) => ({
id: `maritime-${v.mmsi}`,
pluginId: "maritime",
latitude: v.lat + (Math.random() - 0.5) * 0.1,
longitude: v.lon + (Math.random() - 0.5) * 0.1,
heading: v.heading,
speed: v.speed,
timestamp: new Date(),
label: v.name,
properties: { mmsi: v.mmsi, vesselName: v.name, vesselType: v.type, speed_knots: v.speed, heading: v.heading },
}));
}
export class MaritimePlugin implements WorldPlugin {
id = "maritime";
name = "Maritime";
description = "Vessel tracking via AIS feeds";
icon = Ship;
category = "maritime" as const;
version = "1.0.0";
private context: PluginContext | null = null;
async initialize(ctx: PluginContext): Promise<void> { this.context = ctx; }
destroy(): void { this.context = null; }
async fetch(_timeRange: TimeRange): Promise<GeoEntity[]> {
try {
const res = await fetch("/api/maritime");
if (!res.ok) throw new Error(`Maritime API returned ${res.status}`);
const data = await res.json();
const vessels = data.vessels || generateDemoVessels();
return vessels.map((v: GeoEntity) => ({ ...v, timestamp: new Date(v.timestamp) }));
} catch {
return generateDemoVessels();
}
}
getPollingInterval(): number { return 60000; }
getLayerConfig(): LayerConfig {
return { color: "#f59e0b", clusterEnabled: true, clusterDistance: 50 };
}
renderEntity(entity: GeoEntity): CesiumEntityOptions {
const vesselType = (entity.properties.vesselType as string) || "other";
return {
type: "point", color: getVesselColor(vesselType), size: 7,
rotation: entity.heading, outlineColor: "#000000", outlineWidth: 1,
labelText: entity.label || undefined, labelFont: "11px JetBrains Mono, monospace",
};
}
getFilterDefinitions(): FilterDefinition[] {
return [
{
id: "vessel_type", label: "Vessel Type", type: "select", propertyKey: "vesselType",
options: [
{ value: "cargo", label: "Cargo" }, { value: "tanker", label: "Tanker" },
{ value: "passenger", label: "Passenger" }, { value: "fishing", label: "Fishing" },
{ value: "military", label: "Military" }, { value: "sailing", label: "Sailing" },
{ value: "tug", label: "Tug" }, { value: "other", label: "Other" },
],
},
{ id: "speed", label: "Speed (knots)", type: "range", propertyKey: "speed_knots", range: { min: 0, max: 30, step: 1 } },
];
}
}
@@ -1,10 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"outDir": "dist",
"noEmit": false
},
"exclude": ["**/*.test.*"]
}
@@ -1,8 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"noEmit": true
},
"include": ["src"]
}
@@ -1,45 +0,0 @@
# @worldwideview/wwv-plugin-military
[WorldWideView](https://github.com/silvertakana/worldwideview) plugin for **real-time military aircraft tracking** via [adsb.fi](https://adsb.fi/).
## Features
- 🛡️ Live military aircraft positions updated every 60 seconds
- 🎨 Altitude-based coloring (green → orange → red → pink → yellow)
- ✈️ 3D airplane model rendering with heading-oriented rotation
- 📡 Flight trail rendering on entity selection
- 🔍 Filters: aircraft type, callsign, registration, altitude range, on-ground status
- 📋 Rich entity properties (hex, squawk, category, emergency status)
## Installation
```bash
npm install @worldwideview/wwv-plugin-military
```
### Peer Dependencies
- `@worldwideview/wwv-plugin-sdk`
- `lucide-react` ≥ 0.576.0
## Usage
```ts
import { MilitaryPlugin } from "@worldwideview/wwv-plugin-military";
const plugin = new MilitaryPlugin();
```
Register the plugin with the WorldWideView plugin engine to start tracking military aircraft on the globe.
## Data Source
Military aircraft data is fetched from [adsb.fi](https://adsb.fi/) via the `/api/military` endpoint. No authentication required.
## Changelog
- **v1.0.0** — Initial release. Renamed from wwv-plugin-military for clarity.
## License
ISC
@@ -1,36 +0,0 @@
{
"name": "@worldwideview/wwv-plugin-military-aviation",
"version": "1.0.1",
"description": "WorldWideView plugin for real-time military aircraft tracking via adsb.fi. Features altitude-based coloring, flight trail rendering, and aircraft type filters",
"main": "src/index.ts",
"types": "src/index.ts",
"files": [
"src"
],
"keywords": [
"worldwideview",
"worldwideview-plugin",
"wwv-plugin-military-aviation",
"military",
"military-aviation",
"adsb",
"aircraft-tracking",
"cesium",
"globe"
],
"repository": {
"type": "git",
"url": "https://github.com/silvertakana/worldwideview.git",
"directory": "packages/wwv-plugin-military-aviation"
},
"homepage": "https://github.com/silvertakana/worldwideview#readme",
"bugs": {
"url": "https://github.com/silvertakana/worldwideview/issues"
},
"license": "ISC",
"author": "WorldWideView",
"peerDependencies": {
"@worldwideview/wwv-plugin-sdk": "*",
"lucide-react": ">=0.576.0"
}
}
@@ -1,99 +0,0 @@
import { Shield } from "lucide-react";
import type {
WorldPlugin, GeoEntity, TimeRange, PluginContext,
LayerConfig, CesiumEntityOptions, SelectionBehavior,
ServerPluginConfig, FilterDefinition,
} from "@worldwideview/wwv-plugin-sdk";
interface AdsbFiAircraft {
hex: string; flight?: string; r?: string; t?: string;
lat?: number; lon?: number; alt_baro?: number | "ground";
alt_geom?: number; gs?: number; track?: number; squawk?: string;
dbFlags?: number; category?: string; emergency?: string;
seen?: number; seen_pos?: number;
}
function militaryAltitudeToColor(altFeet: number | null): string {
if (altFeet === null || altFeet <= 0) return "#39ff14";
if (altFeet < 10000) return "#ff6f00";
if (altFeet < 25000) return "#ff1744";
if (altFeet < 40000) return "#ff4081";
return "#ffea00";
}
function feetToMeters(feet: number): number { return feet * 0.3048; }
export class MilitaryPlugin implements WorldPlugin {
id = "military-aviation";
name = "Military Aviation";
description = "Real-time military aircraft tracking via adsb.fi";
icon = Shield;
category = "aviation" as const;
version = "1.0.0";
private context: PluginContext | null = null;
async initialize(ctx: PluginContext): Promise<void> { this.context = ctx; }
destroy(): void { this.context = null; }
async fetch(_timeRange: TimeRange): Promise<GeoEntity[]> {
try {
const res = await fetch("/api/military");
if (!res.ok) throw new Error(`Military API returned ${res.status}`);
const data = await res.json();
if (!data.ac || !Array.isArray(data.ac)) return [];
return data.ac
.filter((ac: AdsbFiAircraft) => ac.lat != null && ac.lon != null)
.map((ac: AdsbFiAircraft): GeoEntity => {
const altFeet = typeof ac.alt_baro === "number" ? ac.alt_baro : null;
const altMeters = altFeet !== null ? feetToMeters(altFeet) : null;
const isOnGround = ac.alt_baro === "ground";
return {
id: `military-aviation-${ac.hex}`, pluginId: "military-aviation",
latitude: ac.lat!, longitude: ac.lon!,
altitude: altMeters !== null ? altMeters * 10 : 0,
heading: ac.track ?? undefined, speed: ac.gs ?? undefined,
timestamp: new Date(),
label: ac.flight?.trim() || ac.r || ac.hex,
properties: { hex: ac.hex, callsign: ac.flight?.trim() || null, registration: ac.r || null, aircraft_type: ac.t || null, altitude_ft: altFeet, altitude_m: altMeters, ground_speed_kts: ac.gs ?? null, heading: ac.track ?? null, squawk: ac.squawk || null, on_ground: isOnGround, category: ac.category || null, emergency: ac.emergency || null },
};
});
} catch (err) {
console.error("[MilitaryPlugin] Fetch error:", err);
return [];
}
}
getPollingInterval(): number { return 60000; }
getLayerConfig(): LayerConfig { return { color: "#ff6f00", clusterEnabled: true, clusterDistance: 40, maxEntities: 3000 }; }
renderEntity(entity: GeoEntity): CesiumEntityOptions {
const altFeet = entity.properties.altitude_ft as number | null;
const isAirborne = !entity.properties.on_ground;
return {
type: "model", iconUrl: "/military-plane-icon.svg", size: isAirborne ? 8 : 5,
modelUrl: "/airplane/scene.gltf", modelScale: 75, modelMinPixelSize: 16, modelHeadingOffset: 180,
color: militaryAltitudeToColor(altFeet), rotation: entity.heading,
labelText: entity.label || undefined, labelFont: "11px JetBrains Mono, monospace",
};
}
getSelectionBehavior(entity: GeoEntity): SelectionBehavior | null {
if (entity.properties.on_ground) return null;
return { showTrail: true, trailDurationSec: 60, trailStepSec: 5, trailColor: "#ffea00", flyToOffsetMultiplier: 3, flyToBaseDistance: 30000 };
}
getServerConfig(): ServerPluginConfig {
return { apiBasePath: "/api/military", pollingIntervalMs: 60000, requiresAuth: false };
}
getFilterDefinitions(): FilterDefinition[] {
return [
{ id: "aircraft_type", label: "Aircraft Type", type: "text", propertyKey: "aircraft_type" },
{ id: "callsign", label: "Callsign", type: "text", propertyKey: "callsign" },
{ id: "registration", label: "Registration", type: "text", propertyKey: "registration" },
{ id: "altitude", label: "Altitude (ft)", type: "range", propertyKey: "altitude_ft", range: { min: 0, max: 60000, step: 1000 } },
{ id: "on_ground", label: "On Ground", type: "boolean", propertyKey: "on_ground" },
];
}
}
@@ -1,10 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"outDir": "dist",
"noEmit": false
},
"exclude": ["**/*.test.*"]
}
@@ -1,8 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"noEmit": true
},
"include": ["src"]
}
Loaded 100 of 476 files, more files were not shown because too many files have changed in this diff. Show more