Compare commits
25
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17be0ca012 | ||
|
|
48a17bf3ee | ||
|
|
2e4c074f77 | ||
|
|
e2108f5049 | ||
|
|
b76067c0bb | ||
|
|
04e614e1ed | ||
|
|
0d14a63246 | ||
|
|
781fe9e790 | ||
|
|
f0c2d81e18 | ||
|
|
f86b7d1e94 | ||
|
|
28704e6fe1 | ||
|
|
01e291a40e | ||
|
|
909e150b3d | ||
|
|
1fe3a77383 | ||
|
|
998f98851e | ||
|
|
9c51cdb8a2 | ||
|
|
d74ae694a4 | ||
|
|
ec4c89fe51 | ||
|
|
44e8ff9b70 | ||
|
|
cc90d3c2a3 | ||
|
|
0e6268bf72 | ||
|
|
764af74d14 | ||
|
|
29269c668a | ||
|
|
c60a0c9d56 | ||
|
|
05b2dce394 |
No files matched your search
@@ -2,7 +2,7 @@ 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
|
||||
NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS=iranwarlive,satellite,gps-jamming
|
||||
|
||||
# Edition: "local" | "cloud" | "demo"
|
||||
NEXT_PUBLIC_WWV_EDITION=local
|
||||
@@ -12,4 +12,4 @@ NEXT_PUBLIC_WWV_EDITION=local
|
||||
# [WARNING] NEVER commit real secrets here. Real secrets must ONLY go into .env.local!
|
||||
AUTH_SECRET=changeme_d64c1f35b447da89cf6ed5a0988da1379b21904edb91a87c3f5a63942e3d23a4_changeme
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
name: Docker Build and Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main", "feat/docker-ci" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=sha
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -80,6 +80,7 @@ packages/*/dist/
|
||||
|
||||
# Developmental scripts & temporary sandbox
|
||||
/local-scripts/
|
||||
/public/plugins-local/
|
||||
|
||||
# git worktrees
|
||||
/.worktrees/
|
||||
|
||||
@@ -101,11 +101,13 @@ Visibility Toggle → DataBusSubscriber subscribes to layer via WsClient
|
||||
→ 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)`.
|
||||
Four plugin architectures exist (All-Bundle Model):
|
||||
1. **Data Engine Seeder** — Standalone Fastify container with SQLite microservice or unified seeders (e.g., `iranwarlive-backend`).
|
||||
2. **Dynamic CDN Loaded (Bundle)** — Externally developed plugins dynamically imported at runtime via ES module CDNs (e.g., `unpkg.com` version-pinned URLs).
|
||||
3. **Static Compiled (Bundle)** — Static GeoJSON data wrapped into JS bundles via `wwvStaticCompiler` during build/sync (previously `StaticDataPlugin`).
|
||||
4. **Active Proxied (Bundle)** — Next.js API routes bundled to provide frontend interactions (previously `DeclarativePlugin`).
|
||||
|
||||
All plugins are now dynamically imported at runtime as ES module bundles via `loadPluginFromManifest` utilizing `import(/* webpackIgnore: true */ entry)`. The legacy `StaticDataPlugin` and `DeclarativePlugin` runtimes are fully deprecated.
|
||||
|
||||
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`**.
|
||||
|
||||
@@ -129,6 +131,18 @@ Engine push /stream → DataBusSubscriber WsClient router
|
||||
→ StackManager (co-located entity grouping)
|
||||
```
|
||||
|
||||
### 4.3.1 Split-Routing (Cloud Fallback)
|
||||
|
||||
When a local engine is detected at `localhost:5001`, the frontend fetches its `/manifest` to discover available seeders. Per-plugin routing via `resolveEngineUrl`:
|
||||
- Plugin's seeder is in local manifest → `ws://localhost:5001/stream`
|
||||
- Plugin's seeder is NOT in local manifest → `wss://dataengine.worldwideview.dev/stream`
|
||||
|
||||
This enables core contributors running the public (community) engine locally to see local data for their seeders while proprietary sources (aviation, maritime) continue streaming from the cloud.
|
||||
|
||||
The data engine uses a **public upstream / private fork** model:
|
||||
- `wwv-data-engine` (public) — community seeders, contributors fork and PR here
|
||||
- `wwv-data-engine-internal` (private) — all seeders, deploys to Coolify via `git merge upstream/main`
|
||||
|
||||
### 4.4 Rendering Pipeline
|
||||
|
||||
- **Primitive-based**: Uses `PointPrimitiveCollection`, `BillboardCollection`, `LabelCollection` — NOT Cesium Entity API
|
||||
@@ -198,7 +212,7 @@ Built-in plugins are instantiated in `AppShell.tsx` and registered via `PluginRe
|
||||
> - **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.
|
||||
> - **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 with reference to the correct terminology, 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.
|
||||
@@ -215,6 +229,7 @@ Whenever agents generate temporary debugging scripts, test REST endpoints via `.
|
||||
| `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`) |
|
||||
| `NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL` | No | Override engine WebSocket URL (default: cloud) |
|
||||
| `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 |
|
||||
@@ -281,7 +296,10 @@ Configured in `next.config.ts` `headers()`:
|
||||
| Repo | Purpose |
|
||||
|---|---|
|
||||
| `worldwideview` | Main application (this repo) |
|
||||
| `wwv-data-engine` | Open-source data engine — community seeders (PUBLIC) |
|
||||
| `wwv-data-engine-internal` | Proprietary data engine — all seeders (PRIVATE, deployed to Coolify) |
|
||||
| `worldwideview-marketplace` | Plugin marketplace web app |
|
||||
| `worldwideview-plugins` | Published npm plugin packages |
|
||||
| `worldwideview-web` | Marketing / landing page |
|
||||
|
||||
---
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div align="center">
|
||||
|
||||
<!-- Generated: 2026-04-19 02:20:00 UTC -->
|
||||
# WorldWideView 🌍
|
||||
|
||||
**The Open-Source, Plugin-Driven Geospatial Intelligence Engine**
|
||||
@@ -16,42 +17,53 @@
|
||||
|
||||
---
|
||||
|
||||
## ⚡ 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.
|
||||
WorldWideView is a real-time geospatial engine visualizing live global data on an interactive 3D globe. Utilizing a dynamic "All-Bundle" plugin architecture, independent data sources—like live aircraft, satellites, or OSINT news clusters—are ingested and rendered decoupled from the core 3D viewer.
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Installation & Setup (Local Development)
|
||||
## 🛠 Prerequisites
|
||||
|
||||
```bash
|
||||
git clone https://github.com/silvertakana/worldwideview.git
|
||||
cd worldwideview
|
||||
pnpm install
|
||||
pnpm run setup # generates .env.local with AUTH_SECRET
|
||||
pnpm run dev:all # starts the app, data engine, and marketplace concurrently
|
||||
```
|
||||
Before starting, ensure you have the required tools installed based on how you want to use WorldWideView:
|
||||
- **For Self-Hosting:** You only need Docker.
|
||||
- **For Local Development/Contributing:** You need Node.js and `pnpm`.
|
||||
|
||||
Visit `http://localhost:3000` to see the live globe.
|
||||
### Installing Docker (For Self-Hosting)
|
||||
- **Windows / Mac:** Download and install [Docker Desktop](https://www.docker.com/products/docker-desktop/). *(Windows users: Ensure WSL 2 integration is enabled in Settings > Resources > WSL Integration).*
|
||||
- **Linux (Ubuntu/Debian):**
|
||||
```bash
|
||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||
sudo sh get-docker.sh
|
||||
```
|
||||
|
||||
### Installing pnpm (For Developers)
|
||||
If you want to contribute to the code, you'll need the `pnpm` package manager:
|
||||
- **Windows (PowerShell):** `iwr https://get.pnpm.io/install.ps1 -useb | iex`
|
||||
- **Mac / Linux:** `curl -fsSL https://get.pnpm.io/install.sh | sh -`
|
||||
- **Or via npm:** `npm install -g pnpm`
|
||||
|
||||
---
|
||||
|
||||
## 🐋 Production Deployment (Docker & Coolify)
|
||||
## 🐋 Self-Hosting & Production Deployment (Docker)
|
||||
|
||||
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.
|
||||
WorldWideView uses a multi-stage Dockerfile designed for standalone output, natively supporting deployment via Coolify or standard Docker Compose.
|
||||
|
||||
### Instant Self-Hosting (Recommended)
|
||||
Get the platform running on your own server instantly using our automated Docker Compose deployment scripts:
|
||||
|
||||
**Mac/Linux:**
|
||||
```bash
|
||||
mkdir worldwideview && cd worldwideview
|
||||
curl -fsSL https://raw.githubusercontent.com/silvertakana/worldwideview/main/setup.sh | bash
|
||||
```
|
||||
|
||||
**Windows (PowerShell):**
|
||||
```powershell
|
||||
mkdir worldwideview; cd worldwideview
|
||||
Invoke-WebRequest -Uri https://raw.githubusercontent.com/silvertakana/worldwideview/main/setup.ps1 -UseBasicParsing | Invoke-Expression
|
||||
```
|
||||
|
||||
### Manual Docker Deployment
|
||||
If you prefer to deploy manually:
|
||||
```bash
|
||||
# Start the core app, Redis cache, and Data Engine microservice in production mode
|
||||
docker compose up -d
|
||||
@@ -65,14 +77,123 @@ When deploying to production, ensure you mount the following volumes to prevent
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Installation & Setup (Local Development)
|
||||
|
||||
Get the source code running locally for contributing or modifying the core platform.
|
||||
|
||||
### Quick Start Scripts
|
||||
**Mac/Linux:**
|
||||
```bash
|
||||
git clone https://github.com/silvertakana/worldwideview.git
|
||||
cd worldwideview
|
||||
bash local-dev.sh
|
||||
```
|
||||
|
||||
**Windows (PowerShell):**
|
||||
```powershell
|
||||
git clone https://github.com/silvertakana/worldwideview.git
|
||||
cd worldwideview
|
||||
.\local-dev.ps1
|
||||
```
|
||||
|
||||
### Manual Setup
|
||||
```bash
|
||||
git clone https://github.com/silvertakana/worldwideview.git
|
||||
cd worldwideview
|
||||
pnpm install
|
||||
pnpm run setup # generates .env.local with AUTH_SECRET
|
||||
pnpm run dev:all # boots the UI, cache layers, and the marketplace engine
|
||||
```
|
||||
Visit `http://localhost:3000` to see the live globe.
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Plugin Development Quick Start
|
||||
|
||||
WorldWideView’s architecture means **everything is a plugin**. The core engine is completely data-agnostic. You can build your own WorldWideView plugins using the officially supported CLI toolchain.
|
||||
|
||||
### 1. Scaffold your plugin
|
||||
The plugin folder is pure code. It contains no Docker boilerplate.
|
||||
```bash
|
||||
npx @worldwideview/create-plugin my-layer
|
||||
cd my-layer
|
||||
npm install
|
||||
```
|
||||
|
||||
### 2. Sideload the plugin into your platform
|
||||
The CLI acts as a bridge, injecting your compiled plugin directly into your running WorldWideView instance.
|
||||
|
||||
**If you are running the platform via Docker:**
|
||||
Ensure your Docker Compose file has a volume mount exposing the plugin directory:
|
||||
`volumes: [ "./my-local-plugins:/app/public/plugins-local" ]`
|
||||
And set the environment variable: `WWV_PLUGIN_DEV=true`
|
||||
|
||||
Then, tell the CLI where that exposed folder is:
|
||||
```bash
|
||||
# Save the path so you only have to type it once
|
||||
npx wwv config set wwv-path /absolute/path/to/my-local-plugins
|
||||
|
||||
# Start the dev server and link the plugin!
|
||||
npm run link
|
||||
```
|
||||
|
||||
**If you cloned the platform repository (`pnpm dev`):**
|
||||
```bash
|
||||
npx wwv config set wwv-path ../worldwideview
|
||||
npm run link
|
||||
```
|
||||
|
||||
The CLI will start Vite in watch mode. Every time you save a file, it compiles in milliseconds and pushes the update directly into your WorldWideView instance. Refresh your browser to see changes!
|
||||
|
||||
### 3. Validate & Publish
|
||||
If you are building a simple, static data layer and don't need local testing:
|
||||
```bash
|
||||
npm run validate
|
||||
npm run build
|
||||
npm publish
|
||||
```
|
||||
|
||||
📖 **[Read the Full Plugin Guide](docs/PLUGIN_GUIDE.md)** for a deep dive into hooking up websockets or static datasets.
|
||||
|
||||
---
|
||||
|
||||
## 🧠 Core Architecture & Philosophies
|
||||
|
||||
- **Open-Core Data Engine**: The real-time backend data pipeline operates on a public/private split-routing model. Community seeders (like ISS tracking) live in the open-source `wwv-data-engine`, while proprietary sources seamlessly interleave via our internal cloud endpoints.
|
||||
- **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.
|
||||
|
||||
---
|
||||
|
||||
## 🏛 Repository Ecosystem
|
||||
|
||||
WorldWideView follows an **Open-Core** philosophy distributed across several independent, specialized repositories:
|
||||
|
||||
1. **[worldwideview](https://github.com/silvertakana/worldwideview)** *(This Repo)*
|
||||
The main Next.js frontend, CesiumJS rendering engine, and core plugin loading framework.
|
||||
2. **[wwv-data-engine](https://github.com/silvertakana/wwv-data-engine)**
|
||||
The open-source community data backend. It polls public APIs (like ISS tracking or USGS earthquakes) and streams them to the frontend via WebSocket.
|
||||
*(Note: The official production deployment uses a proprietary internal fork of this engine that includes additional restricted seeders like aviation and maritime).*
|
||||
3. **[worldwideview-plugins](https://github.com/silvertakana/worldwideview-plugins)**
|
||||
Our first-party maintained plugins (borders, nuclear sites, military bases, etc.) developed directly by the core team.
|
||||
4. **[worldwideview-marketplace](https://github.com/silvertakana/worldwideview-marketplace)**
|
||||
The web application driving the plugin directory and community submissions.
|
||||
5. **[worldwideview-web](https://github.com/silvertakana/worldwideview-web)**
|
||||
The marketing, documentation, and landing site.
|
||||
|
||||
---
|
||||
|
||||
## 🏗 Development & Code Map
|
||||
|
||||
### Key Entry Points
|
||||
- UI Loader: `src/components/layout/AppShell.tsx`
|
||||
- Dynamic Plugin Ingestion: `src/core/plugins/loadPluginFromManifest.ts`
|
||||
- Global WebSocket Event Loop: `src/core/data/DataBus.ts`
|
||||
- Environment Config: `.env.local` alongside `src/core/edition.ts`
|
||||
|
||||
---
|
||||
|
||||
## 📚 Documentation Index
|
||||
|
||||
- **[Setup & Installation Guide](docs/SETUP.md)**: Detailed environment and local development setup.
|
||||
@@ -80,6 +201,13 @@ When deploying to production, ensure you mount the following volumes to prevent
|
||||
- **[Contributions Guide](CONTRIBUTING.md)**: How to help out, coding standards, and commit conventions.
|
||||
- **[User Guide](docs/USER_GUIDE.md)**: Application features and navigation tips.
|
||||
|
||||
### Internal Engineering Docs
|
||||
- **[Build System](docs/build-system.md)**: Find compile targets for UI bundles and internal `wwvStaticCompiler` plugin bundling.
|
||||
- **[Testing Overview](docs/testing.md)**: Understanding Vitest strategies and isolated typing execution targets.
|
||||
- **[Development Patterns](docs/development.md)**: View standard hook approaches, Zustand architecture rules, and snippet targets.
|
||||
- **[Deployment Workflows](docs/deployment.md)**: Detailed insights on Next.js standalone execution and persistent database volume arrays.
|
||||
- **[Source File Catalog](docs/files.md)**: High-level mappings of core ingestion controllers to rendering context interfaces.
|
||||
|
||||
---
|
||||
|
||||
## 🤝 Contributing & Community
|
||||
|
||||
+19
-58
@@ -1,64 +1,25 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# System Architecture
|
||||
|
||||
WorldWideView is a high-performance, event-driven geospatial intelligence engine. It is designed to ingest live, fast-moving signals—such as aviation ADS-B, maritime AIS, or satellite feeds—and transform them into cinematic, real-time visual layers on a 3D globe.
|
||||
WorldWideView operates on a decoupled Core-and-Plugin architecture. The central platform provides the 3D globe, HUD, timeline, and rendering optimizations, while separate intelligence domains are entirely handled by external plugin packages that are bundled and ingested at runtime.
|
||||
|
||||
## Module Breakdown
|
||||
The underlying data backbone uses a WebSocket Firehose, streaming continuous high-frequency metrics from standalone data engine microservices perfectly isolated from the visualization layer.
|
||||
|
||||
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.
|
||||
- **CacheLayer**: 2-stage persistent caching (In-Memory + IndexedDB).
|
||||
3. **`src/core/globe`**: The Rendering Engine.
|
||||
- **Cesium Integration**: Low-level control over the Cesium Viewer.
|
||||
- **EntityRenderer**: High-performance "Primitive" renderer.
|
||||
4. **`packages/wwv-plugin-*`**: Monorepo plugin packages, externalized into standalone dynamically loaded CDNs.
|
||||
## Component Map
|
||||
- **UI Platform:** `src/components/layout/AppShell.tsx`
|
||||
- **3D Visualizer:** `src/core/globe/GlobeView.tsx`
|
||||
- **State Store:** `src/core/state/globeSlice.ts` and peers.
|
||||
- **Event Bus:** `src/core/data/DataBus.ts`
|
||||
- **Microservice Connectors:** `packages/wwv-plugin-sdk/src/PluginManifest.ts`
|
||||
|
||||
## Performance: Primitives vs. Entities
|
||||
## Key Files
|
||||
- `src/core/globe/GlobeView.tsx` (lines 60-150): The central CesiumJS ingestion point and scene orchestrator.
|
||||
- `src/core/globe/EntityRenderer.tsx` (lines 45-120): High-performance batched Primitive mapping for geometric entities.
|
||||
- `src/core/plugins/PluginManager.ts` (lines 20-100): Validates and bootstraps compiled ES Modules from CDN/local sources.
|
||||
|
||||
One of our core design decisions is using **Cesium Primitives** instead of the standard high-level **Entity API** for high-count datasets.
|
||||
|
||||
| Feature | Entity API | Primitive API (WWV) |
|
||||
|---|---|---|
|
||||
| **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 |
|
||||
|
||||
**Why?** The Entity API in Cesium is great for rich features but triggers significant CPU overhead when managing thousands of moving objects. By using `PointPrimitiveCollection` and `BillboardCollection`, WorldWideView batches these draw calls, ensuring 60FPS even with dense global data.
|
||||
|
||||
## Data Pipeline (Example: Aviation)
|
||||
|
||||
The following diagram trace the journey of a single data point from a remote sensor to the user's screen:
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant S as Remote API (e.g. OpenSky)
|
||||
participant P as Plugin (AviationPlugin)
|
||||
participant D as DataBus
|
||||
participant R as EntityRenderer
|
||||
participant G as GPU (Cesium)
|
||||
|
||||
Note over S, P: Polling Interval (e.g. 30s)
|
||||
S->>P: raw JSON data
|
||||
rect rgb(200, 230, 255)
|
||||
Note right of P: Mapping to GeoEntity
|
||||
P->>P: parse, filter, sanitize
|
||||
end
|
||||
P->>D: emit("dataUpdated", { entities })
|
||||
D->>R: trigger render cycle
|
||||
rect rgb(255, 230, 200)
|
||||
Note right of R: Batch Update Primitives
|
||||
R->>G: update collection buffer
|
||||
end
|
||||
G-->>G: 60FPS visualization
|
||||
```
|
||||
|
||||
## Design Principles
|
||||
|
||||
- **Single Responsibility (SRP)**: Plugins only handle data mapping; they don't know about the UI or the Cache.
|
||||
- **Dependency Inversion**: The `PluginManager` communicates with plugins through the `WorldPlugin` interface, allowing new plugins to be added without modifying core code.
|
||||
- **Event-Driven Architecture**: The system is reactive. Components subscribe to what they need, reducing prop-drilling and unnecessary re-renders.
|
||||
- **Defensive Programming**: All external API calls in plugins are wrapped in error boundaries and handled by the `PollingManager`'s backoff logic to prevent system-wide failures.
|
||||
## Data Flow
|
||||
The real-time data flow triggers globally via WebSockets:
|
||||
1. `src/lib/WsClient.ts` captures the socket frame from `dataengine.worldwideview.dev`.
|
||||
2. Emits payload through `src/core/data/DataBus.ts` (lines 30-50).
|
||||
3. The `DataBusSubscriber.tsx` hook catches the event, sanitizing and merging the data into `src/core/state/dataSlice.ts`.
|
||||
4. `EntityRenderer` automatically reacts to State changes, triggering low-level Cesium Primitive re-draws against the GPU.
|
||||
@@ -0,0 +1,20 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Build System
|
||||
|
||||
WorldWideView operates using a strict `pnpm` monorepo workspace to manage the core Next.js application alongside its surrounding plugin ecosystem.
|
||||
|
||||
The build relies heavily on Next.js standalone output tracing optimization, allowing minimal-footprint Docker images via Multi-stage resolution.
|
||||
|
||||
## Key Files
|
||||
- `pnpm-workspace.yaml`: Governs the inclusion of `packages/*` elements.
|
||||
- `next.config.ts` (lines 10-45): Implements `output: "standalone"` and strict Content-Security-Policy headers.
|
||||
- `Dockerfile` (lines 1-110): Executes the multi-stage Extractor Pattern (`deps` → `builder` → `runner`).
|
||||
|
||||
## Build Workflows
|
||||
- **Dependency Install:** `pnpm install` must be run from the root directory to respect strict workspace hoisting natively.
|
||||
- **Development Proxy:** `pnpm dev` triggers the frontend server locally with active HMR, while executing pre-build scripts like `copy-cesium.mjs`.
|
||||
- **Plugin Compilation:** Run `pnpm -r build` inside `packages/worldwideview-plugins/` to trigger Vite bundle execution mapped to `dist/frontend.mjs`.
|
||||
|
||||
## Platform Setup
|
||||
- **Cesium Resources:** Required assets (Workers, Assets, Widgets) are structurally bound into the `public/cesium/` folder during the pre-build pipeline initialized by `scripts/copy-cesium.mjs` (lines 10-38).
|
||||
- **SQLite Engine:** `prisma.config.ts` must export native javascript objects (free of dev CLI wrappers) for Next.js to trace correctly in the final standalone Node build.
|
||||
+27
-45
@@ -21,63 +21,45 @@ There are **three plugin formats**:
|
||||
## Prerequisites
|
||||
|
||||
- Node.js ≥ 18
|
||||
- pnpm (`npm install -g pnpm`)
|
||||
- A npm account (for publishing to the npm registry)
|
||||
- The WorldWideView monorepo cloned locally
|
||||
- An NPM account (for publishing)
|
||||
- A running WorldWideView instance (local clone or Docker container)
|
||||
|
||||
---
|
||||
|
||||
## Step 1 — Create Your Plugin Package
|
||||
## Step 1 — Scaffold Your Plugin
|
||||
|
||||
All plugins live under `packages/` in the monorepo.
|
||||
WorldWideView plugins are strictly decoupled from the core application. You do **not** build them inside the WorldWideView monorepo. Instead, use the official CLI tool:
|
||||
|
||||
```bash
|
||||
mkdir packages/wwv-plugin-my-data
|
||||
cd packages/wwv-plugin-my-data
|
||||
npx @worldwideview/create-plugin@latest my-data-layer
|
||||
cd my-data-layer
|
||||
npm install
|
||||
```
|
||||
|
||||
Create `package.json`:
|
||||
This will generate a ready-to-use template including your `package.json`, `plugin.json`, and Vite build configuration.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "@worldwideview/wwv-plugin-my-data",
|
||||
"version": "1.0.0",
|
||||
"description": "WorldWideView plugin — my custom data layer",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"files": ["src"],
|
||||
"keywords": [
|
||||
"worldwideview",
|
||||
"worldwideview-plugin",
|
||||
"geojson",
|
||||
"cesium",
|
||||
"globe"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/silvertakana/worldwideview.git",
|
||||
"directory": "packages/wwv-plugin-my-data"
|
||||
},
|
||||
"license": "ISC",
|
||||
"author": "WorldWideView",
|
||||
"peerDependencies": {
|
||||
"@worldwideview/wwv-plugin-sdk": "*"
|
||||
},
|
||||
"worldwideview": {
|
||||
"id": "my-data",
|
||||
"icon": "MapPin",
|
||||
"category": "Custom",
|
||||
"format": "bundle"
|
||||
}
|
||||
}
|
||||
```
|
||||
### Linking During Development
|
||||
|
||||
To see your plugin live on the globe while you develop:
|
||||
|
||||
1. Configure your CLI to point to your running WorldWideView instance:
|
||||
```bash
|
||||
npx wwv config set wwv-path C:\path\to\your\worldwideview
|
||||
```
|
||||
2. Link the plugin:
|
||||
```bash
|
||||
npm run link
|
||||
```
|
||||
3. Run the dev watcher to rebuild on save:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
*Note: If you are running WorldWideView via Docker, ensure `WWV_PLUGIN_DEV=true` is set in your environment variables and mount your plugin's `dist/` folder into the container's `/app/plugins-local/` directory.*
|
||||
|
||||
> [!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.
|
||||
> The `worldwideview` object block inside your `package.json` is strictly required for the CLI link command and 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.
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Deployment
|
||||
|
||||
WorldWideView is container-first. The codebase relies entirely on Dockerizing the Next.js `output: "standalone"` artifact and its localized Prisma SQLite core to enable horizontal orchestration.
|
||||
|
||||
Deployments are coordinated directly via Coolify natively compiling the Docker configurations.
|
||||
|
||||
## Package Types
|
||||
- **Next.js Core Bundle:** Built directly via `pnpm build`, extracting into `<root>/.next/standalone`.
|
||||
- **Plugin Microservices:** Hosted alongside the Next.js router natively using Fastify images (defined in `docker-compose.yml`), enabling real-time Python/Node scraping backends exclusively connected via docker network aliases.
|
||||
- **CDN ESM Bundles:** Independent frontend plugins run via Vite rollup configurations (`vite.config.ts`), generating `dist/frontend.mjs` payloads published to the public NPM registry.
|
||||
|
||||
## Platform Deployment
|
||||
- **Dockerfile:** `Dockerfile` explicitly targets `node:22-alpine` instances to restrict vulnerability surface areas while mapping the necessary system volume at `/app/data` to capture the `wwv.db` SQLite instantiation safely out-of-container (lines 80-112).
|
||||
- **Environment Hydration:** Coolify directly passes the active environment headers `.env` values at runtime, utilizing `.env.local` natively for credentials like `AUTH_SECRET` and `DATABASE_URL`.
|
||||
|
||||
## Reference
|
||||
The core production mapping operates cleanly off HTTP port `3000`. Refer to `next.config.ts` (lines 5-15) for strict caching strategies utilized globally across deployments.
|
||||
@@ -0,0 +1,26 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Development
|
||||
|
||||
Development on WorldWideView leverages modern, rigid structural constraints to ensure cross-plugin consistency, extreme browser optimization, and a minimal global footprint.
|
||||
|
||||
New features are designed within isolated workspaces, using SDK structures rather than forcing logic into the core engine.
|
||||
|
||||
## Code Style
|
||||
- **TypeScript Strictness:** Strict types are enforced across all domains (`tsconfig.json` lines 4-20). Any use of `any` inside platform routers is forbidden.
|
||||
- **Styling constraints:** All CSS is strictly limited to Vanilla CSS via CSS Modules (`.module.css`). Tailwind is prohibited to prevent styling collisions natively with dynamically loaded elements from third-party plugins. (`src/app/globals.css`).
|
||||
|
||||
## Common Patterns
|
||||
- **Env Variable Injection:** Plugins read remote contexts generically instantiated via the SDK.
|
||||
```typescript
|
||||
// From wwv-plugin-aviation/src/index.ts:60-70
|
||||
let engineBase = this.context?.env?.DATA_ENGINE_URL || "https://dataengine.worldwideview.dev";
|
||||
```
|
||||
- **Zustand Slices:** The store is heavily splintered based on structural domain, keeping the hook listeners granular so mapping updates don't aggressively trigger `AppShell` root rerenders. (`src/core/state/globeSlice.ts`).
|
||||
|
||||
## Workflows
|
||||
- **Local Database Setup:** Run `pnpm db:reset` to nuke and redeploy the standard Prisma schema across `data/wwv.db`.
|
||||
- **Generating Plugins:** Use the global CLI `npx @worldwideview/create-plugin@latest <name>` to initialize a decoupled plugin outside of the monorepo.
|
||||
- **Linking Plugins:** Use `npm run link` in the plugin directory after setting `npx wwv config set wwv-path <path>`.
|
||||
|
||||
## Reference
|
||||
File size is constrained to a 150-line soft cap. Hooks and computational math helpers must be rigorously offloaded (e.g. `src/core/globe/hooks/useModelRendering.ts`).
|
||||
@@ -0,0 +1,25 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Files Catalog
|
||||
|
||||
WorldWideView maps rigid structural directories to manage its layered microservice architecture, distinguishing tightly between UI layout routing, system memory, 3D visualization, and microservice ingestion mechanisms.
|
||||
|
||||
Every major component is siloed deeply to ensure the monolithic main engine remains perfectly isolated and agnostic to individual data sources.
|
||||
|
||||
## Core Source Files
|
||||
- `src/app/` - The Next.js 16 core routing platform, housing layout constraints, `api/` backends, and full-screen auth portals.
|
||||
- `src/components/` - Segmented React JSX components handling overlay panels, timeline UI, and floating popups.
|
||||
- `src/core/plugins/` - Essential bridge scripts that validate manifested metadata parameters before dynamically allocating JS module environments to run external logic. (`PluginManager.ts`)
|
||||
|
||||
## Platform Implementation
|
||||
- `src/core/globe/GlobeView.tsx` - Initializer mapping global config hooks to the main Cesium `Viewer`.
|
||||
- `src/core/globe/EntityRenderer.tsx` - Extremely hot processing loop extracting Zustand state variables directly to WebGL GPU hardware calls via Cesium Primitives.
|
||||
- `src/core/globe/StackManager.ts` - Spiderifier spatial engine dynamically resolving overlapping coordinate markers geometrically in 3D-space.
|
||||
|
||||
## Build System
|
||||
- `Dockerfile` - Multi-stage container instructions targeting a 110MB production Alpine build footprint.
|
||||
- `next.config.ts` - NextJS 16 overrides forcing standalone rendering extraction and tight CSP headers.
|
||||
- `prisma/schema.prisma` - DB tables strictly configuring Prisma to bind exclusively towards locally-mounted SQLite structures.
|
||||
|
||||
## Configuration
|
||||
- `.agents/` - Complete repository workflow configuration (Antigravity Code). Contains AI `rules/`, `skills/`, and internal architectural `context/` for automatic coordination.
|
||||
- `public/cesium/` - Runtime engine bundles duplicated exclusively during pre-build tracking (copied from `node_modules`).
|
||||
@@ -0,0 +1,21 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Project Overview
|
||||
|
||||
WorldWideView is a real-time geospatial intelligence engine that visualizes live global data on an interactive 3D globe. It leverages a modern frontend stack to render high-density datasets (aircraft, maritime vessels, conflict events, environmental data) synchronously.
|
||||
|
||||
The core value proposition is mapping diverse, decoupled intelligence streams onto a central geographic interface using a dynamically loaded plugin architecture. Data sources operate completely decoupled from the display platform, streaming observations via WebSockets for sub-second visual updates.
|
||||
|
||||
## Key Files
|
||||
- `package.json` (lines 1-80) - Core dependencies and project metadata.
|
||||
- `src/app/layout.tsx` (lines 15-40) - Global application shell and React structure.
|
||||
- `src/core/plugins/PluginManager.ts` (lines 20-56) - Heart of the engine, registers and lifecycle-manages external intelligence views.
|
||||
|
||||
## Technology Stack
|
||||
- **Framework:** Next.js 16 (App Router) — `src/app/`
|
||||
- **3D Engine:** CesiumJS + Resium — `src/core/globe/GlobeView.tsx` (lines 40-90)
|
||||
- **State Management:** Zustand — `src/core/state/store.ts` (slice pattern)
|
||||
- **Database:** Prisma ORM w/ SQLite locally — `prisma/schema.prisma`
|
||||
- **Typing:** TypeScript 5 w/ Strict Mode — `tsconfig.json`
|
||||
|
||||
## Platform Support
|
||||
Built as a highly portable Next.js container, it supports `local`, `cloud`, and `demo` editions via the `NEXT_PUBLIC_WWV_EDITION` flag declared in `.env.local` and evaluated at runtime in `src/core/edition.ts`.
|
||||
@@ -0,0 +1,25 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Testing
|
||||
|
||||
WorldWideView maintains a robust Vitest testing infrastructure utilizing `jsdom` environments to mock browser globals and React Testing Library utilities for accurate integration flow testing.
|
||||
|
||||
The primary requirement is full test coverage over authentication routes, edge-case platform parsing, and API rate-limit security.
|
||||
|
||||
## Test Types
|
||||
- **Unit Logic:** Verifies math, utilities, and configuration mappings (e.g. `edition.test.ts`).
|
||||
- **Middleware Integration:** Evaluates Request/Response blocks (e.g. `rateLimit.test.ts`).
|
||||
- **Component Mocking:** Exercises the React ecosystem state behaviors (e.g. `DeclarativePlugin.test.ts`).
|
||||
|
||||
## Key Files
|
||||
- `vitest.config.ts` (lines 5-25): Defines the inclusion criteria spanning `src/lib/**`, `src/core/**`, and `src/plugins/**`.
|
||||
- `src/lib/rateLimit.test.ts` (lines 15-60): Demonstrates test encapsulation regarding the Upstash Redis fallbacks.
|
||||
- `src/core/edition.test.ts` (lines 10-30): Confirms valid feature flag evaluations across local/demo builds.
|
||||
|
||||
## Running Tests
|
||||
Run tests natively within the root directory utilizing `pnpm`:
|
||||
```bash
|
||||
# Execute standard test suite runs over all watched directories
|
||||
pnpm test
|
||||
# OR
|
||||
vitest run
|
||||
```
|
||||
@@ -0,0 +1,6 @@
|
||||
const { PrismaClient } = require('./src/generated/prisma');
|
||||
const prisma = new PrismaClient();
|
||||
prisma.installedPlugin.findMany().then(r => console.log(JSON.stringify(r.map(record => {
|
||||
const manifest = JSON.parse(record.config);
|
||||
return { id: manifest.id, entry: manifest.entry, format: manifest.format };
|
||||
}), null, 2))).catch(console.error).finally(() => prisma.$disconnect());
|
||||
@@ -0,0 +1,9 @@
|
||||
import sqlite3
|
||||
import json
|
||||
conn = sqlite3.connect('data/wwv.db')
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('SELECT id, dataSource FROM installed_plugins')
|
||||
rows = cursor.fetchall()
|
||||
for r in rows:
|
||||
if r[1]:
|
||||
print(f"plugin={r[0]}, dataSource={r[1]}")
|
||||
@@ -0,0 +1,37 @@
|
||||
Write-Host "[*] Setting up WorldWideView for Local Development..."
|
||||
|
||||
# Check for pnpm
|
||||
try {
|
||||
$null = Get-Command pnpm -ErrorAction Stop
|
||||
} catch {
|
||||
Write-Host "[Error] pnpm is not installed or not in PATH."
|
||||
Write-Host "Please install it first: https://pnpm.io/installation"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "[*] Installing dependencies..."
|
||||
pnpm install
|
||||
|
||||
Write-Host "[*] Running initial setup (generating secrets)..."
|
||||
pnpm run setup
|
||||
|
||||
# Check for the sibling Data Engine repository
|
||||
if (-not (Test-Path "../wwv-data-engine")) {
|
||||
Write-Host ""
|
||||
Write-Host "=====================================================================" -ForegroundColor Yellow
|
||||
Write-Host "[!] NOTICE: Local Data Engine not found at ../wwv-data-engine" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
Write-Host "Frontend-Only Mode: You are developing the frontend UI." -ForegroundColor Green
|
||||
Write-Host "WorldWideView will automatically stream data from the Cloud Engine." -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Full-Stack Mode: If you want to develop backend data seeders, you" -ForegroundColor Cyan
|
||||
Write-Host "must clone the open-source data engine as a sibling directory:" -ForegroundColor Cyan
|
||||
Write-Host " cd ..; git clone https://github.com/silvertakana/wwv-data-engine"
|
||||
Write-Host " cd wwv-data-engine; pnpm install"
|
||||
Write-Host "=====================================================================" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "[*] Starting local Next.js frontend server..."
|
||||
Write-Host " (To run the data engine backends concurrently, run: pnpm dev:all)"
|
||||
pnpm run dev
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🌍 Setting up WorldWideView for Local Development..."
|
||||
|
||||
# Check for pnpm
|
||||
if ! command -v pnpm &> /dev/null; then
|
||||
echo "❌ Error: pnpm is required but not installed."
|
||||
echo "Please install it first: https://pnpm.io/installation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📦 Installing dependencies..."
|
||||
pnpm install
|
||||
|
||||
echo "🔐 Running initial setup (generating secrets)..."
|
||||
pnpm run setup
|
||||
|
||||
# Check for the sibling Data Engine repository
|
||||
if [ ! -d "../wwv-data-engine" ]; then
|
||||
echo ""
|
||||
echo "====================================================================="
|
||||
echo "⚠️ NOTICE: Local Data Engine not found at ../wwv-data-engine"
|
||||
echo ""
|
||||
echo "Frontend-Only Mode: You are developing the frontend UI."
|
||||
echo "WorldWideView will automatically stream data from the Cloud Engine."
|
||||
echo ""
|
||||
echo "Full-Stack Mode: If you want to develop backend data seeders, you"
|
||||
echo "must clone the open-source data engine as a sibling directory:"
|
||||
echo " cd .. && git clone https://github.com/silvertakana/wwv-data-engine"
|
||||
echo " cd wwv-data-engine && pnpm install"
|
||||
echo "====================================================================="
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo "🚀 Starting local Next.js frontend server..."
|
||||
echo " (To run the data engine backends concurrently, run: pnpm dev:all)"
|
||||
pnpm run dev
|
||||
+1
-1
@@ -25,7 +25,7 @@ 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: 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",
|
||||
"script-src 'self' 'unsafe-eval' 'unsafe-inline' blob: https://unpkg.com 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",
|
||||
// Camera streams load images/MJPEG from arbitrary IPs worldwide — http: https: required
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "worldwideview",
|
||||
"version": "1.13.3",
|
||||
"version": "1.19.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"setup": "node scripts/setup.mjs",
|
||||
|
||||
+11
@@ -105,6 +105,16 @@ export interface ServerPluginConfig {
|
||||
}
|
||||
export interface PluginContext {
|
||||
apiBaseUrl: string;
|
||||
/**
|
||||
* Key-value map of generic environment variables.
|
||||
* The engine surfaces any variable starting with NEXT_PUBLIC_WWV_PLUGIN_
|
||||
*
|
||||
* WARNING: These are exposed to the client-side browser bundle.
|
||||
* DO NOT USE THIS FOR API KEYS. For sensitive tokens, use getSecret() if provided.
|
||||
*/
|
||||
env: Record<string, string>;
|
||||
/** The running edition of the WWV engine */
|
||||
edition: "local" | "cloud" | "demo";
|
||||
timeRange: TimeRange;
|
||||
onDataUpdate: (entities: GeoEntity[]) => void;
|
||||
onError: (error: Error) => void;
|
||||
@@ -228,4 +238,5 @@ export type DataBusEvents = {
|
||||
globeReady: Record<string, never>;
|
||||
};
|
||||
export * from "./viteGlobals";
|
||||
export { wwvStaticCompiler } from "./vite/wwvStaticCompiler";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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 truncated
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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 truncated
|
||||
+27
-7
@@ -1,6 +1,21 @@
|
||||
"use strict";
|
||||
// ─── WorldWideView Plugin SDK ─────────────────────────────────
|
||||
// The public API for building WorldWideView plugins.
|
||||
// Import from "@worldwideview/wwv-plugin-sdk" in your plugin.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
@@ -12,10 +27,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
||||
}
|
||||
return t;
|
||||
};
|
||||
import { createElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wwvStaticCompiler = exports.DEFAULT_ICON_SIZE = void 0;
|
||||
exports.createSvgIconUrl = createSvgIconUrl;
|
||||
const react_1 = require("react");
|
||||
const server_1 = require("react-dom/server");
|
||||
/** Standard SVG icon size (px) used by createSvgIconUrl when no size is given. */
|
||||
export const DEFAULT_ICON_SIZE = 32;
|
||||
exports.DEFAULT_ICON_SIZE = 32;
|
||||
/** Default dark background color for icon circles. */
|
||||
const DEFAULT_BG_COLOR = "rgba(15, 23, 42, 0.85)";
|
||||
/**
|
||||
@@ -23,9 +41,9 @@ const DEFAULT_BG_COLOR = "rgba(15, 23, 42, 0.85)";
|
||||
* By default wraps the icon in a filled circle for visibility on any terrain.
|
||||
* Pass `{ background: false }` to opt out.
|
||||
*/
|
||||
export function createSvgIconUrl(Icon, opts = {}) {
|
||||
const { background = true, backgroundColor = DEFAULT_BG_COLOR, size = DEFAULT_ICON_SIZE } = opts, iconProps = __rest(opts, ["background", "backgroundColor", "size"]);
|
||||
const innerSvg = renderToStaticMarkup(createElement(Icon, Object.assign({ size }, iconProps)));
|
||||
function createSvgIconUrl(Icon, opts = {}) {
|
||||
const { background = true, backgroundColor = DEFAULT_BG_COLOR, size = exports.DEFAULT_ICON_SIZE } = opts, iconProps = __rest(opts, ["background", "backgroundColor", "size"]);
|
||||
const innerSvg = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(Icon, Object.assign({ size }, iconProps)));
|
||||
if (!background) {
|
||||
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(innerSvg)}`;
|
||||
}
|
||||
@@ -42,4 +60,6 @@ export function createSvgIconUrl(Icon, opts = {}) {
|
||||
].join("");
|
||||
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(wrappedSvg)}`;
|
||||
}
|
||||
export * from "./viteGlobals";
|
||||
__exportStar(require("./viteGlobals"), exports);
|
||||
var wwvStaticCompiler_1 = require("./vite/wwvStaticCompiler");
|
||||
Object.defineProperty(exports, "wwvStaticCompiler", { enumerable: true, get: function () { return wwvStaticCompiler_1.wwvStaticCompiler; } });
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
"use strict";
|
||||
// ─── Plugin Manifest Types ───────────────────────────────────
|
||||
// Schema for plugin.json manifest files.
|
||||
// Three formats: declarative (JSON-only), static (GeoJSON), bundle (JS code).
|
||||
export {};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@worldwideview/wwv-plugin-sdk",
|
||||
"version": "1.3.0",
|
||||
"version": "1.5.0",
|
||||
"description": "Plugin SDK — types, interfaces, and utilities for building WorldWideView globe plugins",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -178,6 +178,16 @@ export interface ServerPluginConfig {
|
||||
// All plugins (built-in and 3rd party) receive the same context.
|
||||
export interface PluginContext {
|
||||
apiBaseUrl: string;
|
||||
/**
|
||||
* Key-value map of generic environment variables.
|
||||
* The engine surfaces any variable starting with NEXT_PUBLIC_WWV_PLUGIN_
|
||||
*
|
||||
* WARNING: These are exposed to the client-side browser bundle.
|
||||
* DO NOT USE THIS FOR API KEYS. For sensitive tokens, use getSecret() if provided.
|
||||
*/
|
||||
env: Record<string, string>;
|
||||
/** The running edition of the WWV engine */
|
||||
edition: "local" | "cloud" | "demo";
|
||||
timeRange: TimeRange;
|
||||
onDataUpdate: (entities: GeoEntity[]) => void;
|
||||
onError: (error: Error) => void;
|
||||
@@ -260,3 +270,4 @@ export type DataBusEvents = {
|
||||
};
|
||||
|
||||
export * from "./viteGlobals";
|
||||
export { wwvStaticCompiler } from "./vite/wwvStaticCompiler";
|
||||
@@ -0,0 +1,185 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Vite plugin that auto-generates a WorldPlugin class for static plugins.
|
||||
*
|
||||
* If the plugin's package.json has `worldwideview.format: "static"` and
|
||||
* no `src/index.ts` exists, this plugin injects a virtual module that:
|
||||
* - Fetches GeoJSON data from the CDN at runtime
|
||||
* - Converts features into GeoEntity objects
|
||||
* - Renders with the manifest's rendering config
|
||||
*/
|
||||
export function wwvStaticCompiler(): any {
|
||||
let pluginRoot = "";
|
||||
let manifest: any = null;
|
||||
let generatedEntry = "";
|
||||
|
||||
return {
|
||||
name: "wwv-static-compiler",
|
||||
enforce: "pre" as const,
|
||||
|
||||
config(userConfig: any) {
|
||||
pluginRoot = userConfig.root || process.cwd();
|
||||
const pkgPath = path.join(pluginRoot, "package.json");
|
||||
if (!fs.existsSync(pkgPath)) return;
|
||||
|
||||
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
||||
manifest = pkg.worldwideview || null;
|
||||
if (!manifest) return;
|
||||
|
||||
manifest._packageName = pkg.name;
|
||||
manifest._packageVersion = pkg.version;
|
||||
manifest._description = pkg.description || "";
|
||||
|
||||
const srcIndex = path.join(pluginRoot, "src", "index.ts");
|
||||
if (fs.existsSync(srcIndex)) return; // real source exists
|
||||
|
||||
// Write a generated entry file
|
||||
const srcDir = path.join(pluginRoot, "src");
|
||||
if (!fs.existsSync(srcDir)) fs.mkdirSync(srcDir, { recursive: true });
|
||||
|
||||
generatedEntry = path.join(srcDir, "__generated_entry.js");
|
||||
const source = generateStaticPluginSource(manifest);
|
||||
fs.writeFileSync(generatedEntry, source, "utf-8");
|
||||
|
||||
// Redirect lib entry to the generated file
|
||||
if (userConfig.build?.lib) {
|
||||
userConfig.build.lib.entry = generatedEntry;
|
||||
}
|
||||
},
|
||||
|
||||
buildEnd() {
|
||||
// Clean up the generated file, but ONLY if we are not in watch mode
|
||||
const isWatchMode = process.argv.includes("--watch") || process.argv.includes("-w");
|
||||
if (!isWatchMode && generatedEntry && fs.existsSync(generatedEntry)) {
|
||||
fs.unlinkSync(generatedEntry);
|
||||
generatedEntry = "";
|
||||
}
|
||||
},
|
||||
|
||||
closeBundle() {
|
||||
// Also clean up on close (redundant safety)
|
||||
const isWatchMode = process.argv.includes("--watch") || process.argv.includes("-w");
|
||||
if (!isWatchMode && generatedEntry && fs.existsSync(generatedEntry)) {
|
||||
fs.unlinkSync(generatedEntry);
|
||||
generatedEntry = "";
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function generateStaticPluginSource(manifest: any): string {
|
||||
const pluginId = manifest.id;
|
||||
const pluginName = manifest.name || pluginId;
|
||||
const description = manifest._description || "";
|
||||
const category = manifest.category || "custom";
|
||||
const icon = manifest.icon || "MapPin";
|
||||
const version = manifest._packageVersion || "1.0.0";
|
||||
const packageName = manifest._packageName;
|
||||
|
||||
const color =
|
||||
manifest.rendering?.defaultColor ||
|
||||
manifest.rendering?.color ||
|
||||
"#3b82f6";
|
||||
const entityType = manifest.rendering?.entityType || "point";
|
||||
const clusterEnabled = manifest.rendering?.clusterEnabled ?? true;
|
||||
const clusterDistance = manifest.rendering?.clusterDistance ?? 50;
|
||||
const maxEntities = manifest.rendering?.maxEntities ?? 5000;
|
||||
const labelField = manifest.rendering?.labelField || "name";
|
||||
|
||||
const dataFileName = manifest.dataFile
|
||||
? path.basename(manifest.dataFile)
|
||||
: "data.json";
|
||||
|
||||
const renderBlock =
|
||||
entityType === "billboard"
|
||||
? `
|
||||
const cacheKey = "default";
|
||||
if (!this._iconUrls[cacheKey]) {
|
||||
this._iconUrls[cacheKey] = createSvgIconUrl(${icon}, { color: ${JSON.stringify(color)} });
|
||||
}
|
||||
return { type: "billboard", iconUrl: this._iconUrls[cacheKey], color: ${JSON.stringify(color)}, iconScale: 0.5 };`
|
||||
: `
|
||||
return { type: "point", color: ${JSON.stringify(color)}, size: 6 };`;
|
||||
|
||||
return `
|
||||
import { ${icon} } from "lucide-react";
|
||||
import { createSvgIconUrl } from "@worldwideview/wwv-plugin-sdk";
|
||||
import dataRaw from "../data/${dataFileName}?raw";
|
||||
|
||||
function representativePoint(geom) {
|
||||
if (!geom) return { lat: 0, lon: 0 };
|
||||
switch (geom.type) {
|
||||
case "Point":
|
||||
return { lat: geom.coordinates[1], lon: geom.coordinates[0], alt: geom.coordinates[2] };
|
||||
case "MultiPoint":
|
||||
case "LineString":
|
||||
return { lat: geom.coordinates[0][1], lon: geom.coordinates[0][0] };
|
||||
case "Polygon":
|
||||
case "MultiLineString":
|
||||
return { lat: geom.coordinates[0][0][1], lon: geom.coordinates[0][0][0] };
|
||||
case "MultiPolygon":
|
||||
return { lat: geom.coordinates[0][0][0][1], lon: geom.coordinates[0][0][0][0] };
|
||||
default:
|
||||
return { lat: 0, lon: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
export default class AutoStaticPlugin {
|
||||
id = ${JSON.stringify(pluginId)};
|
||||
name = ${JSON.stringify(pluginName)};
|
||||
description = ${JSON.stringify(description)};
|
||||
icon = ${icon};
|
||||
category = ${JSON.stringify(category)};
|
||||
version = ${JSON.stringify(version)};
|
||||
|
||||
_context = null;
|
||||
_entities = [];
|
||||
_iconUrls = {};
|
||||
|
||||
async initialize(ctx) {
|
||||
this._context = ctx;
|
||||
let data = null;
|
||||
try {
|
||||
data = JSON.parse(dataRaw);
|
||||
} catch(e) {
|
||||
console.error("Failed to parse data for ${pluginId}", e);
|
||||
}
|
||||
if (data && Array.isArray(data.features)) {
|
||||
this._entities = data.features.map((f, i) => {
|
||||
const pt = representativePoint(f.geometry);
|
||||
return {
|
||||
id: "${pluginId}-" + (f.id ?? i),
|
||||
pluginId: ${JSON.stringify(pluginId)},
|
||||
latitude: pt.lat,
|
||||
longitude: pt.lon,
|
||||
altitude: pt.alt,
|
||||
timestamp: new Date(),
|
||||
label: f.properties?.${labelField} ?? f.properties?.name ?? undefined,
|
||||
properties: { ...f.properties, _geometryType: f.geometry?.type },
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
destroy() { this._context = null; this._entities = []; }
|
||||
async fetch(_timeRange) { return this._entities; }
|
||||
getPollingInterval() { return 0; }
|
||||
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: ${JSON.stringify(color)},
|
||||
clusterEnabled: ${clusterEnabled},
|
||||
clusterDistance: ${clusterDistance},
|
||||
maxEntities: ${maxEntities},
|
||||
};
|
||||
}
|
||||
|
||||
renderEntity(_entity) {${renderBlock}
|
||||
}
|
||||
}
|
||||
`;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ export function wwvPluginGlobals(): any {
|
||||
const Cesium = globalThis.__WWV_HOST__.Cesium;
|
||||
export default Cesium;
|
||||
// Export common bindings for direct destructuring
|
||||
export const { Viewer, Entity, Cartesian3, Cartesian2, Color, CallbackProperty, DistanceDisplayCondition, NearFarScalar, HeightReference, Resource, Rectangle, PolygonHierarchy, ClassificationType, ArcType, Math, JulianDate, TimeInterval, TimeIntervalCollection, SampledPositionProperty, GeoJsonDataSource, PinBuilder } = Cesium;
|
||||
export const { Viewer, Entity, Cartesian3, Cartesian2, Color, CallbackProperty, DistanceDisplayCondition, NearFarScalar, HeightReference, Resource, Rectangle, PolygonHierarchy, ClassificationType, ArcType, Math, JulianDate, TimeInterval, TimeIntervalCollection, SampledPositionProperty, GeoJsonDataSource, PinBuilder, CustomDataSource, ConstantProperty, ColorMaterialProperty, Cartographic } = Cesium;
|
||||
`;
|
||||
}
|
||||
if (originalId === "resium") {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"outDir": "dist",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("shield-alert", [
|
||||
["path", {
|
||||
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
||||
key: "oel41y"
|
||||
}],
|
||||
["path", {
|
||||
d: "M12 8v4",
|
||||
key: "1got3b"
|
||||
}],
|
||||
["path", {
|
||||
d: "M12 16h.01",
|
||||
key: "1drbdi"
|
||||
}]
|
||||
]), c = [
|
||||
{
|
||||
id: "taiwan-adiz",
|
||||
name: "Taiwan ADIZ",
|
||||
country: "Taiwan",
|
||||
type: "ADIZ",
|
||||
status: "Active monitoring",
|
||||
centerLat: 23.5,
|
||||
centerLon: 121,
|
||||
polygon: [
|
||||
[117.5, 21],
|
||||
[117.5, 29],
|
||||
[123, 29],
|
||||
[124.5, 24.5],
|
||||
[124.5, 21],
|
||||
[117.5, 21]
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "china-adiz",
|
||||
name: "East China Sea ADIZ",
|
||||
country: "China",
|
||||
type: "ADIZ",
|
||||
status: "Claimed active",
|
||||
centerLat: 29.5,
|
||||
centerLon: 125,
|
||||
polygon: [
|
||||
[121, 33],
|
||||
[125, 33],
|
||||
[128, 30],
|
||||
[125, 25],
|
||||
[121, 26],
|
||||
[121, 33]
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "kadiz",
|
||||
name: "KADIZ (South Korea)",
|
||||
country: "South Korea",
|
||||
type: "ADIZ",
|
||||
status: "Active monitoring",
|
||||
centerLat: 36,
|
||||
centerLon: 128,
|
||||
polygon: [
|
||||
[123, 33],
|
||||
[123, 37],
|
||||
[125, 39],
|
||||
[131, 39],
|
||||
[132, 36],
|
||||
[128, 32],
|
||||
[123, 33]
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "jadiz",
|
||||
name: "JADIZ (Japan)",
|
||||
country: "Japan",
|
||||
type: "ADIZ",
|
||||
status: "Active monitoring",
|
||||
centerLat: 35,
|
||||
centerLon: 138,
|
||||
polygon: [
|
||||
[122, 23],
|
||||
[122, 30],
|
||||
[131, 39],
|
||||
[138, 46],
|
||||
[146, 46],
|
||||
[146, 25],
|
||||
[134, 25],
|
||||
[122, 23]
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "us-adiz-alaska",
|
||||
name: "US ADIZ (Alaska)",
|
||||
country: "USA",
|
||||
type: "ADIZ",
|
||||
status: "Active monitoring",
|
||||
centerLat: 64,
|
||||
centerLon: -150,
|
||||
polygon: [
|
||||
[-130, 54],
|
||||
[-145, 54],
|
||||
[-165, 50],
|
||||
[-175, 55],
|
||||
[-170, 70],
|
||||
[-140, 70],
|
||||
[-130, 54]
|
||||
]
|
||||
}
|
||||
], l = ({ enabled: e }) => e ? /* @__PURE__ */ globalThis.__WWV_HOST__.jsxRuntime.jsx(globalThis.__WWV_HOST__.jsxRuntime.Fragment, { children: c.map((e) => {
|
||||
let t = globalThis.__WWV_HOST__.Cesium.Cartesian3.fromDegreesArray(e.polygon.flatMap((e) => [e[0], e[1]])), n = e.type === "ADIZ", r = globalThis.__WWV_HOST__.Cesium.Color.fromCssColorString(n ? "#ef4444" : "#fb923c").withAlpha(.2), i = globalThis.__WWV_HOST__.Cesium.Color.fromCssColorString(n ? "#ef4444" : "#fb923c");
|
||||
return /* @__PURE__ */ globalThis.__WWV_HOST__.jsxRuntime.jsx(globalThis.__WWV_HOST__.Resium.Entity, {
|
||||
name: e.name,
|
||||
description: `
|
||||
<table class="cesium-infoBox-defaultTable">
|
||||
<tbody>
|
||||
<tr><th>Country</th><td>${e.country}</td></tr>
|
||||
<tr><th>Type</th><td>${e.type}</td></tr>
|
||||
<tr><th>Status</th><td>${e.status}</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
`,
|
||||
children: /* @__PURE__ */ globalThis.__WWV_HOST__.jsxRuntime.jsx(globalThis.__WWV_HOST__.Resium.PolygonGraphics, {
|
||||
hierarchy: t,
|
||||
material: r,
|
||||
outline: !0,
|
||||
outlineColor: i,
|
||||
outlineWidth: 2,
|
||||
height: 0
|
||||
})
|
||||
}, e.id);
|
||||
}) }) : null, u = class {
|
||||
constructor() {
|
||||
this.id = "air-defense", this.name = "Air Defense Zones", this.description = "Known ADIZ boundaries, no-fly zones, and restricted airspace.", this.icon = s, this.category = "conflict", this.version = "1.0.0";
|
||||
}
|
||||
async initialize(e) {}
|
||||
destroy() {}
|
||||
async fetch(e) {
|
||||
return [];
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: "#ef4444",
|
||||
clusterEnabled: !1,
|
||||
clusterDistance: 0
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
return {
|
||||
type: "point",
|
||||
color: "#ef4444"
|
||||
};
|
||||
}
|
||||
getGlobeComponent() {
|
||||
return l;
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { u as AirDefensePlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "air-defense",
|
||||
"name": "air-defense",
|
||||
"version": "1.0.0",
|
||||
"description": "WorldWideView plugin — Known Air Defense Identification Zones (ADIZ) and boundaries.",
|
||||
"capabilities": [],
|
||||
"category": "Military",
|
||||
"icon": "ShieldAlert",
|
||||
"entry": "/plugins/air-defense/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,319 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("plane", [["path", {
|
||||
d: "M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z",
|
||||
key: "1v9wt8"
|
||||
}]]), c = class {
|
||||
category = "aviation";
|
||||
context = null;
|
||||
defaultLayerColor = "#3b82f6";
|
||||
defaultTrailColor = "#00fff7";
|
||||
iconUrl = "/plane-icon.svg";
|
||||
modelUrl = "/airplane/scene.gltf";
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: this.defaultLayerColor,
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: 40,
|
||||
maxEntities: 5e3
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = e.properties.altitude_m, n = !e.properties.on_ground;
|
||||
return {
|
||||
type: "model",
|
||||
iconUrl: this.iconUrl,
|
||||
size: n ? 8 : 5,
|
||||
modelUrl: this.modelUrl,
|
||||
modelScale: 2.56,
|
||||
modelMinPixelSize: 16,
|
||||
modelHeadingOffset: 180,
|
||||
color: this.getAltitudeColor(t),
|
||||
rotation: e.heading,
|
||||
labelText: e.label || void 0,
|
||||
labelFont: "11px JetBrains Mono, monospace"
|
||||
};
|
||||
}
|
||||
getSelectionBehavior(e) {
|
||||
return e.properties.on_ground ? null : {
|
||||
showTrail: !0,
|
||||
trailDurationSec: 60,
|
||||
trailStepSec: 5,
|
||||
trailColor: this.defaultTrailColor,
|
||||
flyToOffsetMultiplier: 3,
|
||||
flyToBaseDistance: 3e4
|
||||
};
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
//#region src/index.ts
|
||||
function l(e) {
|
||||
return e === null || e <= 0 ? "grounded" : e < 3e3 ? "low" : e < 8e3 ? "mid" : e < 12e3 ? "high" : "extreme";
|
||||
}
|
||||
var u = class extends c {
|
||||
constructor(...e) {
|
||||
super(...e), this.id = "aviation", this.name = "Aviation", this.description = "Real-time aircraft tracking via OpenSky Network", this.icon = s, this.version = "1.0.8";
|
||||
}
|
||||
getAltitudeColor(e) {
|
||||
return e === null || e <= 0 ? "#4ade80" : e < 3e3 ? "#22d3ee" : e < 8e3 ? "#3b82f6" : e < 12e3 ? "#a78bfa" : "#f472b6";
|
||||
}
|
||||
mapPayloadToEntities(e) {
|
||||
let t = [];
|
||||
if (Array.isArray(e)) t = e;
|
||||
else if (e && typeof e == "object") t = Object.values(e);
|
||||
else return [];
|
||||
return t.map((e) => {
|
||||
let t = e.ts || e.time_position || e.last_contact || e.last_updated;
|
||||
return {
|
||||
id: `aviation-${e.icao24}`,
|
||||
pluginId: "aviation",
|
||||
latitude: e.lat,
|
||||
longitude: e.lon,
|
||||
altitude: (e.alt || 0) * 10,
|
||||
heading: e.hdg || void 0,
|
||||
speed: e.spd || void 0,
|
||||
timestamp: new Date(t ? t * 1e3 : Date.now()),
|
||||
label: e.callsign || e.icao24,
|
||||
properties: {
|
||||
icao24: e.icao24,
|
||||
callsign: e.callsign,
|
||||
origin_country: e.origin_country,
|
||||
altitude_m: e.alt,
|
||||
altitude_band: l(e.alt || 0),
|
||||
velocity_ms: e.spd,
|
||||
heading: e.hdg,
|
||||
vertical_rate: e.vertical_rate,
|
||||
on_ground: e.on_ground,
|
||||
squawk: e.squawk
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
async fetch(e) {
|
||||
try {
|
||||
let e = process.env.NEXT_PUBLIC_DEFAULT_ENGINE_URL ? process.env.NEXT_PUBLIC_DEFAULT_ENGINE_URL.replace(/\/stream$/, "").replace(/^ws/, "http") : "http://localhost:5001", t;
|
||||
if (this.context.isPlaybackMode()) {
|
||||
let n = this.context.getCurrentTime().getTime();
|
||||
t = await fetch(`${e}/data/aviation?time=${n}`);
|
||||
} else t = await fetch(`${e}/data/aviation?lookback=15m`);
|
||||
if (!t.ok) throw Error(`Data Engine API returned ${t.status}`);
|
||||
let n = await t.json();
|
||||
return this.mapPayloadToEntities(n.items);
|
||||
} catch (e) {
|
||||
return console.error("[AviationPlugin] Fetch error:", e), this.context?.onError && this.context.onError(e), [];
|
||||
}
|
||||
}
|
||||
mapWebsocketPayload(e) {
|
||||
return this.mapPayloadToEntities(e);
|
||||
}
|
||||
getServerConfig() {
|
||||
return {
|
||||
apiBasePath: "/api/aviation",
|
||||
pollingIntervalMs: 5e3,
|
||||
requiresAuth: !0,
|
||||
historyEnabled: !0,
|
||||
availabilityEnabled: !0
|
||||
};
|
||||
}
|
||||
getLegend() {
|
||||
return [
|
||||
{
|
||||
label: "0 m (Grounded)",
|
||||
color: "#4ade80",
|
||||
filterId: "altitude_band",
|
||||
filterValue: "grounded"
|
||||
},
|
||||
{
|
||||
label: "< 3,000 m",
|
||||
color: "#22d3ee",
|
||||
filterId: "altitude_band",
|
||||
filterValue: "low"
|
||||
},
|
||||
{
|
||||
label: "3,000 - 8,000 m",
|
||||
color: "#3b82f6",
|
||||
filterId: "altitude_band",
|
||||
filterValue: "mid"
|
||||
},
|
||||
{
|
||||
label: "8,000 - 12,000 m",
|
||||
color: "#a78bfa",
|
||||
filterId: "altitude_band",
|
||||
filterValue: "high"
|
||||
},
|
||||
{
|
||||
label: "> 12,000 m",
|
||||
color: "#f472b6",
|
||||
filterId: "altitude_band",
|
||||
filterValue: "extreme"
|
||||
}
|
||||
];
|
||||
}
|
||||
getFilterDefinitions() {
|
||||
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: 15e3,
|
||||
step: 500
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "altitude_band",
|
||||
label: "Altitude Category",
|
||||
type: "select",
|
||||
propertyKey: "altitude_band",
|
||||
options: [
|
||||
{
|
||||
value: "grounded",
|
||||
label: "0 m (Grounded)"
|
||||
},
|
||||
{
|
||||
value: "low",
|
||||
label: "< 3,000 m"
|
||||
},
|
||||
{
|
||||
value: "mid",
|
||||
label: "3,000 - 8,000 m"
|
||||
},
|
||||
{
|
||||
value: "high",
|
||||
label: "8,000 - 12,000 m"
|
||||
},
|
||||
{
|
||||
value: "extreme",
|
||||
label: "> 12,000 m"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "on_ground",
|
||||
label: "On Ground",
|
||||
type: "boolean",
|
||||
propertyKey: "on_ground"
|
||||
},
|
||||
{
|
||||
id: "callsign",
|
||||
label: "Callsign",
|
||||
type: "text",
|
||||
propertyKey: "callsign"
|
||||
}
|
||||
];
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { u as AviationPlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "aviation",
|
||||
"name": "aviation",
|
||||
"version": "1.0.8",
|
||||
"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",
|
||||
"capabilities": [],
|
||||
"category": "Aviation",
|
||||
"icon": "Plane",
|
||||
"entry": "/plugins/aviation/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("map", [
|
||||
["path", {
|
||||
d: "M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",
|
||||
key: "169xi5"
|
||||
}],
|
||||
["path", {
|
||||
d: "M15 5.764v15",
|
||||
key: "1pn4in"
|
||||
}],
|
||||
["path", {
|
||||
d: "M9 3.236v15",
|
||||
key: "1uimfh"
|
||||
}]
|
||||
]), c = class {
|
||||
constructor() {
|
||||
this.id = "borders", this.name = "Borders & Labels", this.description = "Displays political borders and country labels on the map.", this.icon = s, this.category = "custom", this.version = "1.0.0";
|
||||
}
|
||||
async initialize(e) {}
|
||||
destroy() {}
|
||||
async fetch(e) {
|
||||
return [];
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 9999999;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: "#00ffff",
|
||||
clusterEnabled: !1,
|
||||
clusterDistance: 0,
|
||||
maxEntities: 0
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
return { type: "point" };
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { c as BordersPlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "borders",
|
||||
"name": "borders",
|
||||
"version": "1.0.4",
|
||||
"description": "WorldWideView plugin that displays political borders and country labels as a globe overlay",
|
||||
"capabilities": [],
|
||||
"category": "Custom",
|
||||
"icon": "Map",
|
||||
"entry": "/plugins/borders/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "camera",
|
||||
"name": "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",
|
||||
"capabilities": [],
|
||||
"category": "Infrastructure",
|
||||
"icon": "Camera",
|
||||
"entry": "/plugins/camera/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,286 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("crosshair", [
|
||||
["circle", {
|
||||
cx: "12",
|
||||
cy: "12",
|
||||
r: "10",
|
||||
key: "1mglay"
|
||||
}],
|
||||
["line", {
|
||||
x1: "22",
|
||||
x2: "18",
|
||||
y1: "12",
|
||||
y2: "12",
|
||||
key: "l9bcsi"
|
||||
}],
|
||||
["line", {
|
||||
x1: "6",
|
||||
x2: "2",
|
||||
y1: "12",
|
||||
y2: "12",
|
||||
key: "13hhkx"
|
||||
}],
|
||||
["line", {
|
||||
x1: "12",
|
||||
x2: "12",
|
||||
y1: "6",
|
||||
y2: "2",
|
||||
key: "10w3f3"
|
||||
}],
|
||||
["line", {
|
||||
x1: "12",
|
||||
x2: "12",
|
||||
y1: "22",
|
||||
y2: "18",
|
||||
key: "15g9kq"
|
||||
}]
|
||||
]), c = [
|
||||
{
|
||||
id: "ukraine-russia",
|
||||
name: "Eastern Ukraine / Russian Border",
|
||||
lat: 48.0196,
|
||||
lon: 37.8028,
|
||||
subtext: "High-intensity conventional warfare",
|
||||
description: "Active frontline spanning eastern and southern Ukraine, including drone and missile exchanges.",
|
||||
escalationScore: 5,
|
||||
escalationTrend: "escalating",
|
||||
status: "Active Full-Scale Conflict",
|
||||
whyItMatters: "Global geopolitical stability, NATO involvement, grain and energy market impacts.",
|
||||
radiusKm: 600
|
||||
},
|
||||
{
|
||||
id: "gaza-israel",
|
||||
name: "Gaza Strip & Israel",
|
||||
lat: 31.5,
|
||||
lon: 34.466667,
|
||||
subtext: "Urban warfare and regional tension",
|
||||
description: "Intense urban warfare in Gaza with frequent missile exchanges and multi-front regional escalations.",
|
||||
escalationScore: 5,
|
||||
escalationTrend: "stable",
|
||||
status: "Active Conflict",
|
||||
whyItMatters: "Humanitarian crisis, Red Sea shipping impacts, broader Middle East regional war risks.",
|
||||
radiusKm: 150
|
||||
},
|
||||
{
|
||||
id: "red-sea-houthi",
|
||||
name: "Red Sea & Bab al-Mandab",
|
||||
lat: 13.5135,
|
||||
lon: 43.1491,
|
||||
subtext: "Maritime security threat",
|
||||
description: "Houthi drone and missile attacks on commercial shipping in the Red Sea and Gulf of Aden.",
|
||||
escalationScore: 4,
|
||||
escalationTrend: "stable",
|
||||
status: "Targeted Strikes",
|
||||
whyItMatters: "Disruption of ~12% of global trade relying on the Suez Canal.",
|
||||
radiusKm: 400
|
||||
},
|
||||
{
|
||||
id: "taiwan-strait",
|
||||
name: "Taiwan Strait",
|
||||
lat: 24.5126,
|
||||
lon: 119.9304,
|
||||
subtext: "Geopolitical flashpoint",
|
||||
description: "High Chinese military drills, ADIZ incursions, and naval presence surrounding Taiwan.",
|
||||
escalationScore: 3,
|
||||
escalationTrend: "escalating",
|
||||
status: "Tension / Gray Zone",
|
||||
whyItMatters: "Semiconductor supply chain, US-China relations, Indo-Pacific security.",
|
||||
radiusKm: 300
|
||||
},
|
||||
{
|
||||
id: "sudan-civil-war",
|
||||
name: "Sudan",
|
||||
lat: 15.5007,
|
||||
lon: 32.5599,
|
||||
subtext: "Civil War",
|
||||
description: "Widespread fighting between the SAF and RSF causing massive displacement.",
|
||||
escalationScore: 5,
|
||||
escalationTrend: "escalating",
|
||||
status: "Active Conflict",
|
||||
whyItMatters: "Severe humanitarian crisis and destabilization of the Horn of Africa.",
|
||||
radiusKm: 700
|
||||
},
|
||||
{
|
||||
id: "myanmar-civil-war",
|
||||
name: "Myanmar",
|
||||
lat: 21.9162,
|
||||
lon: 95.956,
|
||||
subtext: "Civil War",
|
||||
description: "Intensified civil war between the military junta and various ethnic armed organizations.",
|
||||
escalationScore: 4,
|
||||
escalationTrend: "stable",
|
||||
status: "Active Conflict",
|
||||
whyItMatters: "Regional stability in Southeast Asia, refugee crisis.",
|
||||
radiusKm: 500
|
||||
},
|
||||
{
|
||||
id: "korean-dmz",
|
||||
name: "Korean DMZ",
|
||||
lat: 38.3308,
|
||||
lon: 127.2406,
|
||||
subtext: "Militarized boundary",
|
||||
description: "Heightened tension with North Korean artillery drills, drone incursions, and rhetoric.",
|
||||
escalationScore: 3,
|
||||
escalationTrend: "escalating",
|
||||
status: "High Tension",
|
||||
whyItMatters: "Nuclear risk, East Asia security, US alliance.",
|
||||
radiusKm: 150
|
||||
}
|
||||
];
|
||||
//#endregion
|
||||
//#region src/index.tsx
|
||||
function l(e) {
|
||||
return e >= 5 ? "#991b1b" : e >= 4 ? "#ef4444" : e >= 3 ? "#f97316" : "#fbbf24";
|
||||
}
|
||||
function u(e, t) {
|
||||
let n = e?.cesiumElement;
|
||||
n && !n._wwvEntity && (n._wwvEntity = t);
|
||||
}
|
||||
function d(e) {
|
||||
return {
|
||||
id: e.id,
|
||||
pluginId: "conflict-zones",
|
||||
latitude: e.lat,
|
||||
longitude: e.lon,
|
||||
altitude: 0,
|
||||
timestamp: /* @__PURE__ */ new Date(),
|
||||
properties: {
|
||||
name: e.name,
|
||||
description: e.description,
|
||||
type: e.subtext || "N/A",
|
||||
status: e.status,
|
||||
escalationScore: e.escalationScore,
|
||||
escalationTrend: e.escalationTrend,
|
||||
whyItMatters: e.whyItMatters,
|
||||
radiusKm: e.radiusKm
|
||||
}
|
||||
};
|
||||
}
|
||||
var f = ({ enabled: e }) => e ? /* @__PURE__ */ globalThis.__WWV_HOST__.jsxRuntime.jsx(globalThis.__WWV_HOST__.jsxRuntime.Fragment, { children: c.map((e) => {
|
||||
let t = globalThis.__WWV_HOST__.Cesium.Cartesian3.fromDegrees(e.lon, e.lat), n = l(e.escalationScore), r = globalThis.__WWV_HOST__.Cesium.Color.fromCssColorString(n).withAlpha(.25), i = globalThis.__WWV_HOST__.Cesium.Color.fromCssColorString(n).withAlpha(.8), a = e.radiusKm * 1e3, o = d(e);
|
||||
return /* @__PURE__ */ globalThis.__WWV_HOST__.jsxRuntime.jsx(globalThis.__WWV_HOST__.Resium.Entity, {
|
||||
position: t,
|
||||
name: e.name,
|
||||
ref: (e) => u(e, o),
|
||||
children: /* @__PURE__ */ globalThis.__WWV_HOST__.jsxRuntime.jsx(globalThis.__WWV_HOST__.Resium.EllipseGraphics, {
|
||||
semiMajorAxis: a,
|
||||
semiMinorAxis: a,
|
||||
material: r,
|
||||
outline: !0,
|
||||
outlineColor: i,
|
||||
outlineWidth: 3,
|
||||
height: 0
|
||||
})
|
||||
}, e.id);
|
||||
}) }) : null, p = class {
|
||||
constructor() {
|
||||
this.id = "conflict-zones", this.name = "Conflict Zones", this.description = "Active conflict zones and geopolitical hotspots worldwide.", this.icon = s, this.category = "conflict", this.version = "1.0.0", this.iconUrls = {};
|
||||
}
|
||||
async initialize(e) {}
|
||||
destroy() {}
|
||||
async fetch(e) {
|
||||
return [];
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: "#ef4444",
|
||||
clusterEnabled: !1,
|
||||
clusterDistance: 0
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = l(e.properties.escalationScore || 3);
|
||||
return this.iconUrls[t] || (this.iconUrls[t] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(s, { color: t })), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrls[t],
|
||||
color: t
|
||||
};
|
||||
}
|
||||
getFilterDefinitions() {
|
||||
return [{
|
||||
id: "severity",
|
||||
label: "Severity",
|
||||
type: "select",
|
||||
propertyKey: "escalationScore",
|
||||
options: [
|
||||
{
|
||||
value: "5",
|
||||
label: "Critical"
|
||||
},
|
||||
{
|
||||
value: "4",
|
||||
label: "High Tension"
|
||||
},
|
||||
{
|
||||
value: "3",
|
||||
label: "Elevated"
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
label: "Watchlist"
|
||||
}
|
||||
]
|
||||
}, {
|
||||
id: "trend",
|
||||
label: "Trend",
|
||||
type: "select",
|
||||
propertyKey: "escalationTrend",
|
||||
options: [
|
||||
{
|
||||
value: "escalating",
|
||||
label: "Escalating"
|
||||
},
|
||||
{
|
||||
value: "stable",
|
||||
label: "Stable"
|
||||
},
|
||||
{
|
||||
value: "de-escalating",
|
||||
label: "De-escalating"
|
||||
}
|
||||
]
|
||||
}];
|
||||
}
|
||||
getGlobeComponent() {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { p as ConflictZonesPlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "conflict-zones",
|
||||
"name": "conflict-zones",
|
||||
"version": "1.1.0",
|
||||
"description": "WorldWideView plugin — Active conflict zones and geopolitical hotspots worldwide.",
|
||||
"capabilities": [],
|
||||
"category": "Conflict",
|
||||
"icon": "Crosshair",
|
||||
"entry": "/plugins/conflict-zones/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils.js
|
||||
var e = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), t = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), n = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, r = globalThis.__WWV_HOST__.React.forwardRef(({ color: e = "currentColor", size: r = 24, strokeWidth: i = 2, absoluteStrokeWidth: a, className: o = "", children: s, iconNode: c, ...l }, u) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: u,
|
||||
...n,
|
||||
width: r,
|
||||
height: r,
|
||||
stroke: e,
|
||||
strokeWidth: a ? Number(i) * 24 / Number(r) : i,
|
||||
className: t("lucide", o),
|
||||
...l
|
||||
}, [...c.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(s) ? s : [s]])), i = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...o }, s) => globalThis.__WWV_HOST__.React.createElement(r, {
|
||||
ref: s,
|
||||
iconNode: i,
|
||||
className: t(`lucide-${e(n)}`, a),
|
||||
...o
|
||||
}));
|
||||
return a.displayName = `${n}`, a;
|
||||
})("SunMoon", [
|
||||
["path", {
|
||||
d: "M12 8a2.83 2.83 0 0 0 4 4 4 4 0 1 1-4-4",
|
||||
key: "1fu5g2"
|
||||
}],
|
||||
["path", {
|
||||
d: "M12 2v2",
|
||||
key: "tus03m"
|
||||
}],
|
||||
["path", {
|
||||
d: "M12 20v2",
|
||||
key: "1lh1kg"
|
||||
}],
|
||||
["path", {
|
||||
d: "m4.9 4.9 1.4 1.4",
|
||||
key: "b9915j"
|
||||
}],
|
||||
["path", {
|
||||
d: "m17.7 17.7 1.4 1.4",
|
||||
key: "qc3ed3"
|
||||
}],
|
||||
["path", {
|
||||
d: "M2 12h2",
|
||||
key: "1t8f8n"
|
||||
}],
|
||||
["path", {
|
||||
d: "M20 12h2",
|
||||
key: "1q8mjw"
|
||||
}],
|
||||
["path", {
|
||||
d: "m6.3 17.7-1.4 1.4",
|
||||
key: "5gca6"
|
||||
}],
|
||||
["path", {
|
||||
d: "m19.1 4.9-1.4 1.4",
|
||||
key: "wpu9u6"
|
||||
}]
|
||||
]), a = class {
|
||||
constructor() {
|
||||
this.id = "daynight", this.name = "Day / Night", this.description = "Real-time day/night terminator with sunlit and shadow regions.", this.icon = i, this.category = "custom", this.version = "1.0.0";
|
||||
}
|
||||
async initialize(e) {}
|
||||
destroy() {}
|
||||
async fetch(e) {
|
||||
return [{
|
||||
id: "daynight-scene",
|
||||
pluginId: this.id,
|
||||
latitude: 0,
|
||||
longitude: 0,
|
||||
timestamp: /* @__PURE__ */ new Date(),
|
||||
properties: {
|
||||
sceneModifier: !0,
|
||||
enableLighting: !0
|
||||
}
|
||||
}];
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: "#fbbf24",
|
||||
clusterEnabled: !1,
|
||||
clusterDistance: 0
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
return {
|
||||
type: "point",
|
||||
color: "transparent",
|
||||
size: 0
|
||||
};
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { a as DayNightPlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "daynight",
|
||||
"name": "daynight",
|
||||
"version": "1.0.0",
|
||||
"description": "WorldWideView plugin — Day/Night terminator overlay showing sunlit and dark regions of the globe in real-time.",
|
||||
"capabilities": [],
|
||||
"category": "Custom",
|
||||
"icon": "SunMoon",
|
||||
"entry": "/plugins/daynight/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/defaultAttributes.js
|
||||
var e = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = ((n, r) => {
|
||||
let i = globalThis.__WWV_HOST__.React.forwardRef(({ color: i = "currentColor", size: a = 24, strokeWidth: o = 2, absoluteStrokeWidth: s, className: c = "", children: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...e,
|
||||
width: a,
|
||||
height: a,
|
||||
stroke: i,
|
||||
strokeWidth: s ? Number(o) * 24 / Number(a) : o,
|
||||
className: [
|
||||
"lucide",
|
||||
`lucide-${t(n)}`,
|
||||
c
|
||||
].join(" "),
|
||||
...u
|
||||
}, [...r.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(l) ? l : [l]]));
|
||||
return i.displayName = `${n}`, i;
|
||||
})("Activity", [["path", {
|
||||
d: "M22 12h-4l-3 9L9 3l-3 9H2",
|
||||
key: "d5dnw9"
|
||||
}]]), r = class {
|
||||
context = null;
|
||||
iconUrls = {};
|
||||
defaultLayerColor = "#ef4444";
|
||||
clusterDistance = 40;
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
getEntityIcon(e) {
|
||||
return this.icon;
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: this.defaultLayerColor,
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: this.clusterDistance
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = this.getSeverityValue(e), n = this.getSeverityColor(t), r = this.getSeveritySize(t), i = this.getEntityIcon(e), a = `${i?.displayName || i?.name || "default"}-${n}`;
|
||||
return this.iconUrls[a] || (this.iconUrls[a] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(i, { color: n })), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrls[a],
|
||||
color: n,
|
||||
size: r,
|
||||
outlineColor: "#000000",
|
||||
outlineWidth: 1,
|
||||
labelText: e.label || void 0,
|
||||
labelFont: "11px JetBrains Mono, monospace"
|
||||
};
|
||||
}
|
||||
}, i = class extends r {
|
||||
constructor(...e) {
|
||||
super(...e), this.id = "earthquakes", this.name = "Earthquakes", this.description = "Recent seismic activity from USGS", this.icon = n, this.category = "natural-disaster", this.version = "1.1.0", this.defaultLayerColor = "#f97316";
|
||||
}
|
||||
getSeverityValue(e) {
|
||||
return Number(e.properties.magnitude ?? 0) || 0;
|
||||
}
|
||||
getSeverityColor(e) {
|
||||
return e < 5 ? "#fcd34d" : e < 6 ? "#f97316" : e < 7 ? "#ef4444" : "#7f1d1d";
|
||||
}
|
||||
getSeveritySize(e) {
|
||||
return e < 5 ? 5 : e < 6 ? 8 : e < 7 ? 12 : 16;
|
||||
}
|
||||
async fetch(e) {
|
||||
try {
|
||||
let e = await globalThis.fetch("/api/earthquake");
|
||||
if (!e.ok) return this.context?.onError(/* @__PURE__ */ Error(`Earthquakes API returned ${e.status}`)), [];
|
||||
let t = await e.json();
|
||||
return (Array.isArray(t?.features) ? t.features : []).flatMap((e) => {
|
||||
let t = e?.geometry?.coordinates, n = e?.properties?.time;
|
||||
if (!Array.isArray(t) || t.length < 2 || !Number.isFinite(t[0]) || !Number.isFinite(t[1]) || !Number.isFinite(n)) return [];
|
||||
let r = Number(e?.properties?.mag ?? 0) || 0;
|
||||
return [{
|
||||
id: `${this.id}-${e.id}`,
|
||||
pluginId: this.id,
|
||||
latitude: t[1],
|
||||
longitude: t[0],
|
||||
altitude: 0,
|
||||
timestamp: new Date(n),
|
||||
label: `M${e?.properties?.mag ?? "?"}`,
|
||||
properties: {
|
||||
magnitude: r,
|
||||
depth: Number(e?.geometry?.coordinates?.[2] ?? 0) || 0,
|
||||
place: e?.properties?.place ?? null,
|
||||
url: e?.properties?.url ?? null,
|
||||
updated: e?.properties?.updated ?? null,
|
||||
status: e?.properties?.status ?? null,
|
||||
tsunami: e?.properties?.tsunami ?? null,
|
||||
sig: e?.properties?.sig ?? null,
|
||||
magType: e?.properties?.magType ?? null
|
||||
}
|
||||
}];
|
||||
});
|
||||
} catch (e) {
|
||||
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to fetch earthquakes");
|
||||
return this.context?.onError(t), [];
|
||||
}
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 12e4;
|
||||
}
|
||||
getServerConfig() {
|
||||
return {
|
||||
apiBasePath: "/api/earthquake",
|
||||
pollingIntervalMs: 12e4,
|
||||
historyEnabled: !1
|
||||
};
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: "#ef4444",
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: 40,
|
||||
maxEntities: 2e3
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = this.getSeverityValue(e);
|
||||
return {
|
||||
type: "point",
|
||||
color: this.getSeverityColor(t),
|
||||
size: this.getSeveritySize(t),
|
||||
outlineColor: "#000000",
|
||||
outlineWidth: 1,
|
||||
labelText: e.label
|
||||
};
|
||||
}
|
||||
getLegend() {
|
||||
return [
|
||||
{
|
||||
label: "M < 5.0",
|
||||
color: "#fcd34d",
|
||||
filterId: "magnitude",
|
||||
filterValue: "0"
|
||||
},
|
||||
{
|
||||
label: "M 5.0 - 5.9",
|
||||
color: "#f97316",
|
||||
filterId: "magnitude",
|
||||
filterValue: "5.0"
|
||||
},
|
||||
{
|
||||
label: "M 6.0 - 6.9",
|
||||
color: "#ef4444",
|
||||
filterId: "magnitude",
|
||||
filterValue: "6.0"
|
||||
},
|
||||
{
|
||||
label: "M ≥ 7.0",
|
||||
color: "#7f1d1d",
|
||||
filterId: "magnitude",
|
||||
filterValue: "7.0"
|
||||
}
|
||||
];
|
||||
}
|
||||
getFilterDefinitions() {
|
||||
return [{
|
||||
id: "magnitude",
|
||||
label: "Magnitude",
|
||||
type: "range",
|
||||
propertyKey: "magnitude",
|
||||
range: {
|
||||
min: 0,
|
||||
max: 10,
|
||||
step: .1
|
||||
}
|
||||
}, {
|
||||
id: "depth",
|
||||
label: "Depth (km)",
|
||||
type: "range",
|
||||
propertyKey: "depth",
|
||||
range: {
|
||||
min: 0,
|
||||
max: 800,
|
||||
step: 10
|
||||
}
|
||||
}];
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { i as EarthquakesPlugin };
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"id": "earthquakes",
|
||||
"name": "Earthquakes",
|
||||
"description": "Recent seismic activity from USGS via Active Proxy",
|
||||
"icon": "Activity",
|
||||
"category": "Natural Disasters",
|
||||
"type": "data-layer",
|
||||
"format": "bundle",
|
||||
"entry": "/plugins/earthquakes/frontend.mjs",
|
||||
"trust": "unverified",
|
||||
"capabilities": ["data"],
|
||||
"version": "1.1.0"
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("landmark", [
|
||||
["path", {
|
||||
d: "M10 18v-7",
|
||||
key: "wt116b"
|
||||
}],
|
||||
["path", {
|
||||
d: "M11.12 2.198a2 2 0 0 1 1.76.006l7.866 3.847c.476.233.31.949-.22.949H3.474c-.53 0-.695-.716-.22-.949z",
|
||||
key: "1m329m"
|
||||
}],
|
||||
["path", {
|
||||
d: "M14 18v-7",
|
||||
key: "vav6t3"
|
||||
}],
|
||||
["path", {
|
||||
d: "M18 18v-7",
|
||||
key: "aexdmj"
|
||||
}],
|
||||
["path", {
|
||||
d: "M3 22h18",
|
||||
key: "8prr45"
|
||||
}],
|
||||
["path", {
|
||||
d: "M6 18v-7",
|
||||
key: "1ivflk"
|
||||
}]
|
||||
]), c = class {
|
||||
context = null;
|
||||
iconUrls = {};
|
||||
defaultLayerColor = "#3b82f6";
|
||||
clusterDistance = 50;
|
||||
maxEntities = 5e3;
|
||||
iconScale = 1;
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
async fetch(e) {
|
||||
return [];
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: this.defaultLayerColor,
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: this.clusterDistance,
|
||||
maxEntities: this.maxEntities
|
||||
};
|
||||
}
|
||||
getEntityColor(e) {
|
||||
return this.defaultLayerColor;
|
||||
}
|
||||
getEntityIcon(e) {
|
||||
return this.icon;
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = this.getEntityColor(e), n = this.getEntityIcon(e), r = `${n?.displayName || n?.name || "default"}-${t}`;
|
||||
return this.iconUrls[r] || (this.iconUrls[r] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(n, { color: t })), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrls[r],
|
||||
color: t,
|
||||
iconScale: this.iconScale
|
||||
};
|
||||
}
|
||||
}, l = class extends c {
|
||||
constructor(...e) {
|
||||
super(...e), this.id = "embassies", this.name = "Embassies & Consulates", this.description = "Global embassies, consulates, and diplomatic missions from OpenStreetMap", this.icon = s, this.category = "infrastructure", this.version = "1.0.3", this.defaultLayerColor = "#a855f7", this.maxEntities = 1e3;
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { l as EmbassiesConsulatesPlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "embassies",
|
||||
"name": "embassies",
|
||||
"version": "1.0.3",
|
||||
"description": "WorldWideView plugin — Global embassies, consulates, and diplomatic missions from OpenStreetMap",
|
||||
"capabilities": [],
|
||||
"category": "Custom",
|
||||
"icon": "Landmark",
|
||||
"entry": "/plugins/embassies/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,255 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = (n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
}, c = s("bomb", [
|
||||
["circle", {
|
||||
cx: "11",
|
||||
cy: "13",
|
||||
r: "9",
|
||||
key: "hd149"
|
||||
}],
|
||||
["path", {
|
||||
d: "M14.35 4.65 16.3 2.7a2.41 2.41 0 0 1 3.4 0l1.6 1.6a2.4 2.4 0 0 1 0 3.4l-1.95 1.95",
|
||||
key: "jp4j1b"
|
||||
}],
|
||||
["path", {
|
||||
d: "m22 2-1.5 1.5",
|
||||
key: "ay92ug"
|
||||
}]
|
||||
]), l = s("plane", [["path", {
|
||||
d: "M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z",
|
||||
key: "1v9wt8"
|
||||
}]]), u = s("rocket", [
|
||||
["path", {
|
||||
d: "M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",
|
||||
key: "qeys4"
|
||||
}],
|
||||
["path", {
|
||||
d: "M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",
|
||||
key: "u4xsad"
|
||||
}],
|
||||
["path", {
|
||||
d: "M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",
|
||||
key: "676m9"
|
||||
}],
|
||||
["path", {
|
||||
d: "M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",
|
||||
key: "92ym6u"
|
||||
}]
|
||||
]), d = s("shield-alert", [
|
||||
["path", {
|
||||
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
||||
key: "oel41y"
|
||||
}],
|
||||
["path", {
|
||||
d: "M12 8v4",
|
||||
key: "1got3b"
|
||||
}],
|
||||
["path", {
|
||||
d: "M12 16h.01",
|
||||
key: "1drbdi"
|
||||
}]
|
||||
]), f = s("target", [
|
||||
["circle", {
|
||||
cx: "12",
|
||||
cy: "12",
|
||||
r: "10",
|
||||
key: "1mglay"
|
||||
}],
|
||||
["circle", {
|
||||
cx: "12",
|
||||
cy: "12",
|
||||
r: "6",
|
||||
key: "1vlfrh"
|
||||
}],
|
||||
["circle", {
|
||||
cx: "12",
|
||||
cy: "12",
|
||||
r: "2",
|
||||
key: "1c9p78"
|
||||
}]
|
||||
]), p = class {
|
||||
context = null;
|
||||
iconUrls = {};
|
||||
defaultLayerColor = "#ef4444";
|
||||
clusterDistance = 40;
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
getEntityIcon(e) {
|
||||
return this.icon;
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: this.defaultLayerColor,
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: this.clusterDistance
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = this.getSeverityValue(e), n = this.getSeverityColor(t), r = this.getSeveritySize(t), i = this.getEntityIcon(e), a = `${i?.displayName || i?.name || "default"}-${n}`;
|
||||
return this.iconUrls[a] || (this.iconUrls[a] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(i, { color: n })), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrls[a],
|
||||
color: n,
|
||||
size: r,
|
||||
outlineColor: "#000000",
|
||||
outlineWidth: 1,
|
||||
labelText: e.label || void 0,
|
||||
labelFont: "11px JetBrains Mono, monospace"
|
||||
};
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
//#region src/index.ts
|
||||
function m(e) {
|
||||
switch (e.toLowerCase()) {
|
||||
case "missile strike": return u;
|
||||
case "air strike": return l;
|
||||
case "ground combat": return f;
|
||||
case "artillery": return c;
|
||||
default: return d;
|
||||
}
|
||||
}
|
||||
var h = class extends p {
|
||||
constructor(...e) {
|
||||
super(...e), this.id = "iranwarlive", this.name = "Iran War Live", this.description = "Live OSINT tracking — Data sourced from IranWarLive.com (Not for Life-Safety)", this.icon = d, this.category = "conflict", this.version = "1.0.2", this.defaultLayerColor = "#ef4444", this.clusterDistance = 40;
|
||||
}
|
||||
getSeverityValue(e) {
|
||||
return e.properties.casualties || 0;
|
||||
}
|
||||
getSeverityColor(e) {
|
||||
return "#ef4444";
|
||||
}
|
||||
getSeveritySize(e) {
|
||||
return 16;
|
||||
}
|
||||
getEntityIcon(e) {
|
||||
return m(e.properties.type || "Unknown");
|
||||
}
|
||||
async fetch(e) {
|
||||
try {
|
||||
let e = process.env.NEXT_PUBLIC_DEFAULT_ENGINE_URL ? process.env.NEXT_PUBLIC_DEFAULT_ENGINE_URL.replace(/\/stream$/, "").replace(/^ws/, "http") : "http://localhost:5001", t = await globalThis.fetch(`${e}/data/iranwarlive`);
|
||||
if (!t.ok) throw Error(`IranWarLive Backend returned ${t.status}`);
|
||||
let n = await t.json();
|
||||
return !n.items || !Array.isArray(n.items) ? [] : n.items.map((e) => {
|
||||
let t = e._osint_meta?.coordinates?.lat || 0, n = e._osint_meta?.coordinates?.lng || 0, r = new Date(e.timestamp), i = Math.max(0, Math.round((Date.now() - r.getTime()) / (1e3 * 60 * 60)));
|
||||
return {
|
||||
id: e.event_id,
|
||||
pluginId: "iranwarlive",
|
||||
latitude: t,
|
||||
longitude: n,
|
||||
timestamp: r,
|
||||
label: e.type + (e.location ? ` in ${e.location}` : ""),
|
||||
properties: {
|
||||
hours_ago: i,
|
||||
type: e.type,
|
||||
confidence: e.confidence,
|
||||
location: e.location,
|
||||
summary: e.event_summary,
|
||||
casualties: e._osint_meta?.casualties || 0,
|
||||
source_url: e.source_url,
|
||||
preview_image: e.preview_image,
|
||||
preview_video: e.preview_video
|
||||
}
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
return console.error("[IranWarLivePlugin] Fetch error from microservice backend:", e), [];
|
||||
}
|
||||
}
|
||||
getServerConfig() {
|
||||
return {
|
||||
apiBasePath: "/api/iranwarlive",
|
||||
pollingIntervalMs: 0,
|
||||
historyEnabled: !0
|
||||
};
|
||||
}
|
||||
getFilterDefinitions() {
|
||||
return [
|
||||
{
|
||||
id: "type",
|
||||
label: "Strike Type",
|
||||
type: "select",
|
||||
propertyKey: "type",
|
||||
options: [{
|
||||
value: "Missile Strike",
|
||||
label: "Missile Strike"
|
||||
}, {
|
||||
value: "Air Strike",
|
||||
label: "Air Strike"
|
||||
}]
|
||||
},
|
||||
{
|
||||
id: "confidence",
|
||||
label: "Intelligence Confidence",
|
||||
type: "select",
|
||||
propertyKey: "confidence",
|
||||
options: [{
|
||||
value: "News Wire",
|
||||
label: "News Wire"
|
||||
}, {
|
||||
value: "State Actor",
|
||||
label: "State Defense Press"
|
||||
}]
|
||||
},
|
||||
{
|
||||
id: "hours_ago",
|
||||
label: "Max Hours Ago",
|
||||
type: "range",
|
||||
propertyKey: "hours_ago",
|
||||
range: {
|
||||
min: 0,
|
||||
max: 168,
|
||||
step: 1
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
getLegend() {
|
||||
return [{
|
||||
label: "Kinetic Event",
|
||||
color: "#ef4444"
|
||||
}];
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { h as IranWarLivePlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "iranwarlive",
|
||||
"name": "iranwarlive",
|
||||
"version": "1.0.2",
|
||||
"description": "Iran War Live — Live OSINT data sourced from IranWarLive.com",
|
||||
"capabilities": [],
|
||||
"category": "Conflict",
|
||||
"icon": "ShieldAlert",
|
||||
"entry": "/plugins/iranwarlive/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = (n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
}, c = s("lamp", [
|
||||
["path", {
|
||||
d: "M12 12v6",
|
||||
key: "3ahymv"
|
||||
}],
|
||||
["path", {
|
||||
d: "M4.077 10.615A1 1 0 0 0 5 12h14a1 1 0 0 0 .923-1.385l-3.077-7.384A2 2 0 0 0 15 2H9a2 2 0 0 0-1.846 1.23Z",
|
||||
key: "1l7kg2"
|
||||
}],
|
||||
["path", {
|
||||
d: "M8 20a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1z",
|
||||
key: "1mmzpi"
|
||||
}]
|
||||
]), l = s("lightbulb", [
|
||||
["path", {
|
||||
d: "M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",
|
||||
key: "1gvzjb"
|
||||
}],
|
||||
["path", {
|
||||
d: "M9 18h6",
|
||||
key: "x1upvd"
|
||||
}],
|
||||
["path", {
|
||||
d: "M10 22h4",
|
||||
key: "ceow96"
|
||||
}]
|
||||
]), u = class {
|
||||
context = null;
|
||||
iconUrls = {};
|
||||
defaultLayerColor = "#3b82f6";
|
||||
clusterDistance = 50;
|
||||
maxEntities = 5e3;
|
||||
iconScale = 1;
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
async fetch(e) {
|
||||
return [];
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: this.defaultLayerColor,
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: this.clusterDistance,
|
||||
maxEntities: this.maxEntities
|
||||
};
|
||||
}
|
||||
getEntityColor(e) {
|
||||
return this.defaultLayerColor;
|
||||
}
|
||||
getEntityIcon(e) {
|
||||
return this.icon;
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = this.getEntityColor(e), n = this.getEntityIcon(e), r = `${n?.displayName || n?.name || "default"}-${t}`;
|
||||
return this.iconUrls[r] || (this.iconUrls[r] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(n, { color: t })), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrls[r],
|
||||
color: t,
|
||||
iconScale: this.iconScale
|
||||
};
|
||||
}
|
||||
}, d = class extends u {
|
||||
constructor(...e) {
|
||||
super(...e), this.id = "lighthouses", this.name = "Lighthouses", this.description = "Lighthouses worldwide from OSM", this.icon = c, this.category = "maritime", this.version = "1.0.1", this.defaultLayerColor = "#facc15";
|
||||
}
|
||||
getEntityIcon(e) {
|
||||
return l;
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { d as LighthousesPlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "lighthouses",
|
||||
"name": "lighthouses",
|
||||
"version": "1.0.1",
|
||||
"description": "WorldWideView plugin — Lighthouses worldwide from OSM",
|
||||
"capabilities": [],
|
||||
"category": "Maritime",
|
||||
"icon": "Lamp",
|
||||
"entry": "/plugins/lighthouses/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "maritime",
|
||||
"name": "maritime",
|
||||
"version": "1.0.7",
|
||||
"description": "WorldWideView plugin for real-time vessel tracking via AIS feeds. Color-coded by vessel type with speed and heading indicators",
|
||||
"capabilities": [],
|
||||
"category": "Maritime",
|
||||
"icon": "Ship",
|
||||
"entry": "/plugins/maritime/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,225 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("shield", [["path", {
|
||||
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
||||
key: "oel41y"
|
||||
}]]), c = class {
|
||||
category = "aviation";
|
||||
context = null;
|
||||
defaultLayerColor = "#3b82f6";
|
||||
defaultTrailColor = "#00fff7";
|
||||
iconUrl = "/plane-icon.svg";
|
||||
modelUrl = "/airplane/scene.gltf";
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: this.defaultLayerColor,
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: 40,
|
||||
maxEntities: 5e3
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = e.properties.altitude_m, n = !e.properties.on_ground;
|
||||
return {
|
||||
type: "model",
|
||||
iconUrl: this.iconUrl,
|
||||
size: n ? 8 : 5,
|
||||
modelUrl: this.modelUrl,
|
||||
modelScale: 2.56,
|
||||
modelMinPixelSize: 16,
|
||||
modelHeadingOffset: 180,
|
||||
color: this.getAltitudeColor(t),
|
||||
rotation: e.heading,
|
||||
labelText: e.label || void 0,
|
||||
labelFont: "11px JetBrains Mono, monospace"
|
||||
};
|
||||
}
|
||||
getSelectionBehavior(e) {
|
||||
return e.properties.on_ground ? null : {
|
||||
showTrail: !0,
|
||||
trailDurationSec: 60,
|
||||
trailStepSec: 5,
|
||||
trailColor: this.defaultTrailColor,
|
||||
flyToOffsetMultiplier: 3,
|
||||
flyToBaseDistance: 3e4
|
||||
};
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
//#region src/index.ts
|
||||
function l(e) {
|
||||
return e * .3048;
|
||||
}
|
||||
var u = class extends c {
|
||||
constructor(...e) {
|
||||
super(...e), this.id = "military-aviation", this.name = "Military Aviation", this.description = "Real-time military aircraft tracking via adsb.lol", this.icon = s, this.version = "1.0.4", this.defaultLayerColor = "#ff6f00", this.defaultTrailColor = "#ffea00", this.iconUrl = "/military-plane-icon.svg";
|
||||
}
|
||||
getAltitudeColor(e) {
|
||||
let t = e === null ? null : e / .3048;
|
||||
return t === null || t <= 0 ? "#39ff14" : t < 1e4 ? "#ff6f00" : t < 25e3 ? "#ff1744" : t < 4e4 ? "#ff4081" : "#ffea00";
|
||||
}
|
||||
mapPayloadToEntities(e) {
|
||||
let t = [];
|
||||
if (Array.isArray(e)) t = e;
|
||||
else if (e && typeof e == "object") t = Object.values(e);
|
||||
else return [];
|
||||
return t.filter((e) => e.lat != null && e.lon != null).map((e) => {
|
||||
let t = typeof e.alt_baro == "number" ? e.alt_baro : null, n = t === null ? null : l(t), r = e.alt_baro === "ground";
|
||||
return {
|
||||
id: `military-aviation-${e.hex}`,
|
||||
pluginId: "military-aviation",
|
||||
latitude: e.lat,
|
||||
longitude: e.lon,
|
||||
altitude: n === null ? 0 : n * 10,
|
||||
heading: e.track ?? void 0,
|
||||
speed: e.gs ?? void 0,
|
||||
timestamp: /* @__PURE__ */ new Date(),
|
||||
label: e.flight?.trim() || e.r || e.hex,
|
||||
properties: {
|
||||
hex: e.hex,
|
||||
callsign: e.flight?.trim() || null,
|
||||
registration: e.r || null,
|
||||
aircraft_type: e.t || null,
|
||||
altitude_ft: t,
|
||||
altitude_m: n,
|
||||
ground_speed_kts: e.gs ?? null,
|
||||
heading: e.track ?? null,
|
||||
squawk: e.squawk || null,
|
||||
on_ground: r,
|
||||
category: e.category || null,
|
||||
emergency: e.emergency || null,
|
||||
history: e.history || []
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
async fetch(e) {
|
||||
try {
|
||||
let e = "http://localhost:5001";
|
||||
typeof process < "u" && process.env && process.env.NEXT_PUBLIC_DEFAULT_ENGINE_URL ? e = process.env.NEXT_PUBLIC_DEFAULT_ENGINE_URL.replace(/\/stream$/, "").replace(/^ws/, "http") : globalThis.__WWV_HOST__?.NEXT_PUBLIC_WS_ENGINE_URL && (e = globalThis.__WWV_HOST__.NEXT_PUBLIC_WS_ENGINE_URL.replace(/\/stream$/, "").replace(/^ws/, "http"));
|
||||
let t = await globalThis.fetch(`${e}/data/military-aviation`);
|
||||
if (!t.ok) throw Error(`Military API returned ${t.status}`);
|
||||
let n = await t.json(), r = n.ac || n.items;
|
||||
return this.mapPayloadToEntities(r);
|
||||
} catch (e) {
|
||||
return console.error("[MilitaryPlugin] Fetch error:", e), this.context?.onError && this.context.onError(e), [];
|
||||
}
|
||||
}
|
||||
mapWebsocketPayload(e) {
|
||||
return this.mapPayloadToEntities(e);
|
||||
}
|
||||
getServerConfig() {
|
||||
return {
|
||||
apiBasePath: "/api/military-aviation",
|
||||
pollingIntervalMs: 0,
|
||||
historyEnabled: !0
|
||||
};
|
||||
}
|
||||
getFilterDefinitions() {
|
||||
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: 6e4,
|
||||
step: 1e3
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "on_ground",
|
||||
label: "On Ground",
|
||||
type: "boolean",
|
||||
propertyKey: "on_ground"
|
||||
}
|
||||
];
|
||||
}
|
||||
getLegend() {
|
||||
return [
|
||||
{
|
||||
label: "0 ft (Surface)",
|
||||
color: "#39ff14"
|
||||
},
|
||||
{
|
||||
label: "< 10,000 ft",
|
||||
color: "#ff6f00"
|
||||
},
|
||||
{
|
||||
label: "10,000 - 25,000 ft",
|
||||
color: "#ff1744"
|
||||
},
|
||||
{
|
||||
label: "25,000 - 40,000 ft",
|
||||
color: "#ff4081"
|
||||
},
|
||||
{
|
||||
label: "> 40,000 ft",
|
||||
color: "#ffea00"
|
||||
}
|
||||
];
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { u as MilitaryPlugin };
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"id": "military-aviation",
|
||||
"name": "Military Aviation",
|
||||
"description": "Live WebSocket tracking of military aircraft via wwv-data-engine (Microservice)",
|
||||
"icon": "Crosshair",
|
||||
"category": "Aviation",
|
||||
"type": "data-layer",
|
||||
"format": "bundle",
|
||||
"entry": "/plugins/military-aviation/frontend.mjs",
|
||||
"trust": "unverified",
|
||||
"capabilities": ["data", "websocket"],
|
||||
"version": "1.0.4"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
//#region src/index.ts
|
||||
var e = "military-bases";
|
||||
//#endregion
|
||||
export { e as PLUGIN_ID };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "military-bases",
|
||||
"name": "military-bases",
|
||||
"version": "1.0.2",
|
||||
"description": "WorldWideView plugin for worldwide military bases, airfields, and barracks from OpenStreetMap",
|
||||
"capabilities": [],
|
||||
"category": "Military",
|
||||
"icon": "Swords",
|
||||
"entry": "/plugins/military-bases/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("pickaxe", [
|
||||
["path", {
|
||||
d: "m14 13-8.381 8.38a1 1 0 0 1-3.001-3L11 9.999",
|
||||
key: "1lw9ds"
|
||||
}],
|
||||
["path", {
|
||||
d: "M15.973 4.027A13 13 0 0 0 5.902 2.373c-1.398.342-1.092 2.158.277 2.601a19.9 19.9 0 0 1 5.822 3.024",
|
||||
key: "ffj4ej"
|
||||
}],
|
||||
["path", {
|
||||
d: "M16.001 11.999a19.9 19.9 0 0 1 3.024 5.824c.444 1.369 2.26 1.676 2.603.278A13 13 0 0 0 20 8.069",
|
||||
key: "8tj4zw"
|
||||
}],
|
||||
["path", {
|
||||
d: "M18.352 3.352a1.205 1.205 0 0 0-1.704 0l-5.296 5.296a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l5.296-5.296a1.205 1.205 0 0 0 0-1.704z",
|
||||
key: "hh6h97"
|
||||
}]
|
||||
]), c = ({ viewer: e, enabled: t }) => {
|
||||
let n = globalThis.__WWV_HOST__.React.useRef(null);
|
||||
return globalThis.__WWV_HOST__.React.useEffect(() => {
|
||||
if (!e || !t) {
|
||||
e && n.current && (e.dataSources.remove(n.current), n.current = null);
|
||||
return;
|
||||
}
|
||||
let r = !1;
|
||||
async function i() {
|
||||
if (e) try {
|
||||
let t = new globalThis.__WWV_HOST__.Cesium.GeoJsonDataSource("mineral-mines");
|
||||
if (await t.load("/data/mineral_mines.geojson", {
|
||||
markerSymbol: "minepost",
|
||||
markerColor: globalThis.__WWV_HOST__.Cesium.Color.fromCssColorString("#d97706"),
|
||||
markerSize: 24,
|
||||
clampToGround: !0
|
||||
}), r) return;
|
||||
t.clustering.enabled = !0, t.clustering.pixelRange = 40, t.clustering.minimumClusterSize = 3, t.clustering.clusterEvent.addEventListener((e, t) => {
|
||||
t.label.show = !0, t.label.text = e.length.toLocaleString(), t.label.font = "bold 14px sans-serif", t.label.fillColor = globalThis.__WWV_HOST__.Cesium.Color.WHITE, t.label.outlineColor = globalThis.__WWV_HOST__.Cesium.Color.BLACK, t.label.outlineWidth = 2, t.label.style = globalThis.__WWV_HOST__.Cesium.LabelStyle.FILL_AND_OUTLINE, t.label.verticalOrigin = globalThis.__WWV_HOST__.Cesium.VerticalOrigin.CENTER, t.label.horizontalOrigin = globalThis.__WWV_HOST__.Cesium.HorizontalOrigin.CENTER, t.billboard.show = !0, t.billboard.id = t.label.id, t.billboard.verticalOrigin = globalThis.__WWV_HOST__.Cesium.VerticalOrigin.CENTER;
|
||||
let n = new globalThis.__WWV_HOST__.Cesium.PinBuilder();
|
||||
t.billboard.image = n.fromColor(globalThis.__WWV_HOST__.Cesium.Color.fromCssColorString("#d97706").withAlpha(.8), 48).toDataURL();
|
||||
}), e.dataSources.add(t), n.current = t;
|
||||
} catch (e) {
|
||||
console.error("[MineralMinesPlugin] Failed to load data", e);
|
||||
}
|
||||
}
|
||||
return i(), () => {
|
||||
r = !0, e && n.current && (e.dataSources.remove(n.current), n.current = null);
|
||||
};
|
||||
}, [e, t]), null;
|
||||
}, l = class {
|
||||
constructor() {
|
||||
this.id = "mineral-mines", this.name = "Mineral Mines", this.description = "Global mining sites and quarries from OpenStreetMap.", this.icon = s, this.category = "economic", this.version = "1.0.0";
|
||||
}
|
||||
async initialize(e) {}
|
||||
destroy() {}
|
||||
async fetch(e) {
|
||||
return [];
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: "#d97706",
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: 50,
|
||||
maxEntities: 5e4
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
return this.iconUrl ||= globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(s, { color: "#d97706" }), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrl,
|
||||
color: "#d97706"
|
||||
};
|
||||
}
|
||||
getGlobeComponent() {
|
||||
return c;
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { l as MineralMinesPlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "mineral-mines",
|
||||
"name": "mineral-mines",
|
||||
"version": "1.0.0",
|
||||
"description": "WorldWideView plugin — Global mining sites and quarries from OpenStreetMap.",
|
||||
"capabilities": [],
|
||||
"category": "Economic",
|
||||
"icon": "Pickaxe",
|
||||
"entry": "/plugins/mineral-mines/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = (n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
}, c = s("atom", [
|
||||
["circle", {
|
||||
cx: "12",
|
||||
cy: "12",
|
||||
r: "1",
|
||||
key: "41hilf"
|
||||
}],
|
||||
["path", {
|
||||
d: "M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",
|
||||
key: "1l2ple"
|
||||
}],
|
||||
["path", {
|
||||
d: "M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",
|
||||
key: "1wam0m"
|
||||
}]
|
||||
]), l = s("radiation", [
|
||||
["path", {
|
||||
d: "M12 12h.01",
|
||||
key: "1mp3jc"
|
||||
}],
|
||||
["path", {
|
||||
d: "M14 15.4641a4 4 0 0 1-4 0L7.52786 19.74597 A 1 1 0 0 0 7.99303 21.16211 10 10 0 0 0 16.00697 21.16211 1 1 0 0 0 16.47214 19.74597z",
|
||||
key: "1y4lzb"
|
||||
}],
|
||||
["path", {
|
||||
d: "M16 12a4 4 0 0 0-2-3.464l2.472-4.282a1 1 0 0 1 1.46-.305 10 10 0 0 1 4.006 6.94A1 1 0 0 1 21 12z",
|
||||
key: "163ggk"
|
||||
}],
|
||||
["path", {
|
||||
d: "M8 12a4 4 0 0 1 2-3.464L7.528 4.254a1 1 0 0 0-1.46-.305 10 10 0 0 0-4.006 6.94A1 1 0 0 0 3 12z",
|
||||
key: "1l9i0b"
|
||||
}]
|
||||
]), u = class {
|
||||
context = null;
|
||||
iconUrls = {};
|
||||
defaultLayerColor = "#3b82f6";
|
||||
clusterDistance = 50;
|
||||
maxEntities = 5e3;
|
||||
iconScale = 1;
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
async fetch(e) {
|
||||
return [];
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: this.defaultLayerColor,
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: this.clusterDistance,
|
||||
maxEntities: this.maxEntities
|
||||
};
|
||||
}
|
||||
getEntityColor(e) {
|
||||
return this.defaultLayerColor;
|
||||
}
|
||||
getEntityIcon(e) {
|
||||
return this.icon;
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = this.getEntityColor(e), n = this.getEntityIcon(e), r = `${n?.displayName || n?.name || "default"}-${t}`;
|
||||
return this.iconUrls[r] || (this.iconUrls[r] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(n, { color: t })), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrls[r],
|
||||
color: t,
|
||||
iconScale: this.iconScale
|
||||
};
|
||||
}
|
||||
}, d = {
|
||||
operational: "#22c55e",
|
||||
"under construction": "#eab308",
|
||||
decommissioned: "#64748b",
|
||||
abandoned: "#ef4444"
|
||||
}, f = class extends u {
|
||||
constructor(...e) {
|
||||
super(...e), this.id = "nuclear", this.name = "Nuclear Facilities", this.description = "Global nuclear power plants and reactors from OSM.", this.icon = c, this.category = "infrastructure", this.version = "1.0.2", this.defaultLayerColor = "#22d3ee", this.maxEntities = 1e3;
|
||||
}
|
||||
getEntityColor(e) {
|
||||
return d[(e.properties?.status)?.toLowerCase() || "unknown"] || this.defaultLayerColor;
|
||||
}
|
||||
getEntityIcon(e) {
|
||||
return d[(e.properties?.status)?.toLowerCase() || "unknown"] ? l : c;
|
||||
}
|
||||
getFilterDefinitions() {
|
||||
return [{
|
||||
id: "status",
|
||||
label: "Facility Status",
|
||||
propertyKey: "status",
|
||||
type: "select",
|
||||
options: [
|
||||
{
|
||||
value: "operational",
|
||||
label: "Operational"
|
||||
},
|
||||
{
|
||||
value: "under construction",
|
||||
label: "Under Construction"
|
||||
},
|
||||
{
|
||||
value: "decommissioned",
|
||||
label: "Decommissioned"
|
||||
},
|
||||
{
|
||||
value: "abandoned",
|
||||
label: "Abandoned"
|
||||
}
|
||||
]
|
||||
}];
|
||||
}
|
||||
getLegend() {
|
||||
return [
|
||||
{
|
||||
label: "Operational",
|
||||
color: d.operational,
|
||||
filterId: "status",
|
||||
filterValue: "operational"
|
||||
},
|
||||
{
|
||||
label: "Under Const.",
|
||||
color: d["under construction"],
|
||||
filterId: "status",
|
||||
filterValue: "under construction"
|
||||
},
|
||||
{
|
||||
label: "Decommissioned",
|
||||
color: d.decommissioned,
|
||||
filterId: "status",
|
||||
filterValue: "decommissioned"
|
||||
},
|
||||
{
|
||||
label: "Abandoned",
|
||||
color: d.abandoned,
|
||||
filterId: "status",
|
||||
filterValue: "abandoned"
|
||||
}
|
||||
];
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { f as NuclearPlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "nuclear-facilities",
|
||||
"name": "nuclear",
|
||||
"version": "1.0.2",
|
||||
"description": "WorldWideView plugin displaying global nuclear power plants, reactors, and decommissioned facilities from OpenStreetMap",
|
||||
"capabilities": [],
|
||||
"category": "Infrastructure",
|
||||
"icon": "Atom",
|
||||
"entry": "/plugins/nuclear/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("satellite", [
|
||||
["path", {
|
||||
d: "m13.5 6.5-3.148-3.148a1.205 1.205 0 0 0-1.704 0L6.352 5.648a1.205 1.205 0 0 0 0 1.704L9.5 10.5",
|
||||
key: "dzhfyz"
|
||||
}],
|
||||
["path", {
|
||||
d: "M16.5 7.5 19 5",
|
||||
key: "1ltcjm"
|
||||
}],
|
||||
["path", {
|
||||
d: "m17.5 10.5 3.148 3.148a1.205 1.205 0 0 1 0 1.704l-2.296 2.296a1.205 1.205 0 0 1-1.704 0L13.5 14.5",
|
||||
key: "nfoymv"
|
||||
}],
|
||||
["path", {
|
||||
d: "M9 21a6 6 0 0 0-6-6",
|
||||
key: "1iajcf"
|
||||
}],
|
||||
["path", {
|
||||
d: "M9.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l4.296-4.296a1.205 1.205 0 0 0 0-1.704l-2.296-2.296a1.205 1.205 0 0 0-1.704 0z",
|
||||
key: "nv9zqy"
|
||||
}]
|
||||
]), c = {
|
||||
stations: "#00fff7",
|
||||
visual: "#f0abfc",
|
||||
weather: "#a78bfa",
|
||||
"gps-ops": "#22c55e",
|
||||
resource: "#f97316",
|
||||
starlink: "#ffffff",
|
||||
military: "#3b82f6"
|
||||
};
|
||||
function l(e) {
|
||||
return c[e] ?? "#94a3b8";
|
||||
}
|
||||
var u = class {
|
||||
constructor() {
|
||||
this.id = "satellite", this.name = "Satellites", this.description = "Real-time satellite tracking (ISS, GPS, weather, military)", this.icon = s, this.category = "infrastructure", this.version = "1.0.0", this.context = null, this.iconUrls = {};
|
||||
}
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
async fetch(e) {
|
||||
try {
|
||||
let e = process.env.NEXT_PUBLIC_DEFAULT_ENGINE_URL ? process.env.NEXT_PUBLIC_DEFAULT_ENGINE_URL.replace(/\/stream$/, "").replace(/^ws/, "http") : "http://localhost:5001", t = await globalThis.fetch(`${e}/data/satellite`);
|
||||
if (!t.ok) throw Error(`Satellite API returned ${t.status}`);
|
||||
let n = await t.json(), r = n.satellites || n.items || [];
|
||||
return !r || !Array.isArray(r) ? [] : r.map((e) => ({
|
||||
id: `satellite-${e.noradId}`,
|
||||
pluginId: "satellite",
|
||||
latitude: e.latitude,
|
||||
longitude: e.longitude,
|
||||
altitude: e.altitude * 1e3,
|
||||
heading: e.heading,
|
||||
speed: e.speed,
|
||||
timestamp: /* @__PURE__ */ new Date(),
|
||||
label: e.name,
|
||||
properties: {
|
||||
noradId: e.noradId,
|
||||
name: e.name,
|
||||
group: e.group,
|
||||
country: e.country,
|
||||
objectType: e.objectType,
|
||||
altitudeKm: e.altitude,
|
||||
period: e.period
|
||||
}
|
||||
}));
|
||||
} catch (e) {
|
||||
return console.error("[SatellitePlugin] Fetch error:", e), [];
|
||||
}
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: "#00fff7",
|
||||
clusterEnabled: !1,
|
||||
clusterDistance: 0,
|
||||
maxEntities: 1e3
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = e.properties.group || "", n = t === "stations", r = l(t);
|
||||
return this.iconUrls[r] || (this.iconUrls[r] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(s, { color: r })), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrls[r],
|
||||
color: r,
|
||||
size: n ? 12 : 6,
|
||||
outlineColor: "#000000",
|
||||
outlineWidth: 1,
|
||||
labelText: n ? e.label : void 0,
|
||||
labelFont: "12px sans-serif",
|
||||
disableManualHorizonCulling: !0,
|
||||
disableDepthTestDistance: 0
|
||||
};
|
||||
}
|
||||
getSelectionBehavior(e) {
|
||||
return {
|
||||
showTrail: !0,
|
||||
trailDurationSec: 300,
|
||||
trailStepSec: 10,
|
||||
trailColor: "#00fff7",
|
||||
flyToOffsetMultiplier: 4,
|
||||
flyToBaseDistance: 2e6
|
||||
};
|
||||
}
|
||||
getFilterDefinitions() {
|
||||
return [{
|
||||
id: "group",
|
||||
label: "Satellite Group",
|
||||
type: "select",
|
||||
propertyKey: "group",
|
||||
options: [
|
||||
{
|
||||
value: "stations",
|
||||
label: "Space Stations"
|
||||
},
|
||||
{
|
||||
value: "visual",
|
||||
label: "Brightest Satellites"
|
||||
},
|
||||
{
|
||||
value: "weather",
|
||||
label: "Weather"
|
||||
},
|
||||
{
|
||||
value: "gps-ops",
|
||||
label: "GPS"
|
||||
},
|
||||
{
|
||||
value: "resource",
|
||||
label: "Earth Observation"
|
||||
}
|
||||
]
|
||||
}];
|
||||
}
|
||||
getLegend() {
|
||||
return [
|
||||
{
|
||||
label: "Space Stations",
|
||||
color: l("stations"),
|
||||
filterId: "group",
|
||||
filterValue: "stations"
|
||||
},
|
||||
{
|
||||
label: "Brightest Satellites",
|
||||
color: l("visual"),
|
||||
filterId: "group",
|
||||
filterValue: "visual"
|
||||
},
|
||||
{
|
||||
label: "Weather",
|
||||
color: l("weather"),
|
||||
filterId: "group",
|
||||
filterValue: "weather"
|
||||
},
|
||||
{
|
||||
label: "GPS",
|
||||
color: l("gps-ops"),
|
||||
filterId: "group",
|
||||
filterValue: "gps-ops"
|
||||
},
|
||||
{
|
||||
label: "Earth Observation",
|
||||
color: l("resource"),
|
||||
filterId: "group",
|
||||
filterValue: "resource"
|
||||
},
|
||||
{
|
||||
label: "Starlink",
|
||||
color: l("starlink"),
|
||||
filterId: "group",
|
||||
filterValue: "starlink"
|
||||
},
|
||||
{
|
||||
label: "Military",
|
||||
color: l("military"),
|
||||
filterId: "group",
|
||||
filterValue: "military"
|
||||
},
|
||||
{
|
||||
label: "Other",
|
||||
color: l("other"),
|
||||
filterId: "group",
|
||||
filterValue: "other"
|
||||
}
|
||||
];
|
||||
}
|
||||
getServerConfig() {
|
||||
return {
|
||||
apiBasePath: "/api/satellite",
|
||||
pollingIntervalMs: 0,
|
||||
historyEnabled: !0
|
||||
};
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { u as SatellitePlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "satellite",
|
||||
"name": "satellite",
|
||||
"version": "1.0.2",
|
||||
"description": "WorldWideView plugin for real-time satellite tracking using CelesTrak TLE data and SGP4 propagation. Tracks ISS, Starlink, GPS, weather, military, and reconnaissance satellites on the 3D globe.",
|
||||
"capabilities": [],
|
||||
"category": "Space",
|
||||
"icon": "Satellite",
|
||||
"entry": "/plugins/satellite/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("anchor", [
|
||||
["path", {
|
||||
d: "M12 6v16",
|
||||
key: "nqf5sj"
|
||||
}],
|
||||
["path", {
|
||||
d: "m19 13 2-1a9 9 0 0 1-18 0l2 1",
|
||||
key: "y7qv08"
|
||||
}],
|
||||
["path", {
|
||||
d: "M9 11h6",
|
||||
key: "1fldmi"
|
||||
}],
|
||||
["circle", {
|
||||
cx: "12",
|
||||
cy: "4",
|
||||
r: "2",
|
||||
key: "muu5ef"
|
||||
}]
|
||||
]), c = class {
|
||||
context = null;
|
||||
iconUrls = {};
|
||||
defaultLayerColor = "#3b82f6";
|
||||
clusterDistance = 50;
|
||||
maxEntities = 5e3;
|
||||
iconScale = 1;
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
async fetch(e) {
|
||||
return [];
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: this.defaultLayerColor,
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: this.clusterDistance,
|
||||
maxEntities: this.maxEntities
|
||||
};
|
||||
}
|
||||
getEntityColor(e) {
|
||||
return this.defaultLayerColor;
|
||||
}
|
||||
getEntityIcon(e) {
|
||||
return this.icon;
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = this.getEntityColor(e), n = this.getEntityIcon(e), r = `${n?.displayName || n?.name || "default"}-${t}`;
|
||||
return this.iconUrls[r] || (this.iconUrls[r] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(n, { color: t })), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrls[r],
|
||||
color: t,
|
||||
iconScale: this.iconScale
|
||||
};
|
||||
}
|
||||
}, l = class extends c {
|
||||
constructor(...e) {
|
||||
super(...e), this.id = "seaports", this.name = "Seaports", this.description = "Harbours and seaports worldwide from OSM", this.icon = s, this.category = "maritime", this.version = "1.0.1", this.defaultLayerColor = "#0ea5e9";
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { l as SeaportsPlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "seaports",
|
||||
"name": "seaports",
|
||||
"version": "1.0.1",
|
||||
"description": "WorldWideView plugin — Harbours and seaports worldwide from OSM",
|
||||
"capabilities": [],
|
||||
"category": "Maritime",
|
||||
"icon": "Anchor",
|
||||
"entry": "/plugins/seaports/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("rocket", [
|
||||
["path", {
|
||||
d: "M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",
|
||||
key: "qeys4"
|
||||
}],
|
||||
["path", {
|
||||
d: "M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",
|
||||
key: "u4xsad"
|
||||
}],
|
||||
["path", {
|
||||
d: "M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",
|
||||
key: "676m9"
|
||||
}],
|
||||
["path", {
|
||||
d: "M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",
|
||||
key: "92ym6u"
|
||||
}]
|
||||
]), c = class {
|
||||
context = null;
|
||||
iconUrls = {};
|
||||
defaultLayerColor = "#3b82f6";
|
||||
clusterDistance = 50;
|
||||
maxEntities = 5e3;
|
||||
iconScale = 1;
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
async fetch(e) {
|
||||
return [];
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: this.defaultLayerColor,
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: this.clusterDistance,
|
||||
maxEntities: this.maxEntities
|
||||
};
|
||||
}
|
||||
getEntityColor(e) {
|
||||
return this.defaultLayerColor;
|
||||
}
|
||||
getEntityIcon(e) {
|
||||
return this.icon;
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = this.getEntityColor(e), n = this.getEntityIcon(e), r = `${n?.displayName || n?.name || "default"}-${t}`;
|
||||
return this.iconUrls[r] || (this.iconUrls[r] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(n, { color: t })), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrls[r],
|
||||
color: t,
|
||||
iconScale: this.iconScale
|
||||
};
|
||||
}
|
||||
}, l = class extends c {
|
||||
constructor(...e) {
|
||||
super(...e), this.id = "spaceports", this.name = "Spaceports", this.description = "Space launch sites worldwide from OSM", this.icon = s, this.category = "space", this.version = "1.0.2", this.defaultLayerColor = "#7c3aed", this.maxEntities = 1e3;
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { l as SpaceportsPlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "spaceports",
|
||||
"name": "spaceports",
|
||||
"version": "1.0.2",
|
||||
"description": "WorldWideView plugin — Space launch sites worldwide from OSM",
|
||||
"capabilities": [],
|
||||
"category": "Space",
|
||||
"icon": "Rocket",
|
||||
"entry": "/plugins/spaceports/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("mountain", [["path", {
|
||||
d: "m8 3 4 8 5-5 5 15H2L8 3z",
|
||||
key: "otkl63"
|
||||
}]]), c = class {
|
||||
context = null;
|
||||
iconUrls = {};
|
||||
defaultLayerColor = "#3b82f6";
|
||||
clusterDistance = 50;
|
||||
maxEntities = 5e3;
|
||||
iconScale = 1;
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
async fetch(e) {
|
||||
return [];
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: this.defaultLayerColor,
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: this.clusterDistance,
|
||||
maxEntities: this.maxEntities
|
||||
};
|
||||
}
|
||||
getEntityColor(e) {
|
||||
return this.defaultLayerColor;
|
||||
}
|
||||
getEntityIcon(e) {
|
||||
return this.icon;
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = this.getEntityColor(e), n = this.getEntityIcon(e), r = `${n?.displayName || n?.name || "default"}-${t}`;
|
||||
return this.iconUrls[r] || (this.iconUrls[r] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(n, { color: t })), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrls[r],
|
||||
color: t,
|
||||
iconScale: this.iconScale
|
||||
};
|
||||
}
|
||||
}, l = class extends c {
|
||||
constructor(...e) {
|
||||
super(...e), this.id = "volcanoes", this.name = "Volcanoes", this.description = "Active and dormant volcanoes worldwide from OSM", this.icon = s, this.category = "natural-disaster", this.version = "1.0.1", this.defaultLayerColor = "#ef4444", this.maxEntities = 1e3;
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { l as VolcanoesPlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "volcanoes",
|
||||
"name": "volcanoes",
|
||||
"version": "1.0.1",
|
||||
"description": "WorldWideView plugin — Active and dormant volcanoes worldwide from OSM",
|
||||
"capabilities": [],
|
||||
"category": "Natural Disaster",
|
||||
"icon": "Mountain",
|
||||
"entry": "/plugins/volcanoes/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,234 +0,0 @@
|
||||
//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
||||
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
|
||||
let t = n(e);
|
||||
return t.charAt(0).toUpperCase() + t.slice(1);
|
||||
}, i = {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 24,
|
||||
height: 24,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 2,
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, a = (e) => {
|
||||
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
||||
return !1;
|
||||
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
|
||||
ref: d,
|
||||
...i,
|
||||
width: n,
|
||||
height: n,
|
||||
stroke: t,
|
||||
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
|
||||
className: e("lucide", s),
|
||||
...!c && !a(u) && { "aria-hidden": "true" },
|
||||
...u
|
||||
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = ((n, i) => {
|
||||
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
|
||||
ref: c,
|
||||
iconNode: i,
|
||||
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
|
||||
...s
|
||||
}));
|
||||
return a.displayName = r(n), a;
|
||||
})("flame", [["path", {
|
||||
d: "M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",
|
||||
key: "1slcih"
|
||||
}]]);
|
||||
//#endregion
|
||||
//#region src/index.ts
|
||||
function c(e) {
|
||||
return e < 10 ? "#fbbf24" : e < 50 ? "#f97316" : e < 100 ? "#ef4444" : "#dc2626";
|
||||
}
|
||||
function l(e) {
|
||||
return e < 10 ? 5 : e < 50 ? 7 : e < 100 ? 9 : 12;
|
||||
}
|
||||
function u(e) {
|
||||
return e < 10 ? "low" : e < 50 ? "moderate" : e < 100 ? "high" : "extreme";
|
||||
}
|
||||
var d = class {
|
||||
constructor() {
|
||||
this.id = "wildfire", this.name = "Wildfire", this.description = "Active fire detection via NASA FIRMS (VIIRS)", this.icon = s, this.category = "natural-disaster", this.version = "1.0.0", this.context = null, this.iconUrls = {};
|
||||
}
|
||||
async initialize(e) {
|
||||
this.context = e;
|
||||
}
|
||||
destroy() {
|
||||
this.context = null;
|
||||
}
|
||||
async fetch(e) {
|
||||
try {
|
||||
let e = process.env.NEXT_PUBLIC_DEFAULT_ENGINE_URL ? process.env.NEXT_PUBLIC_DEFAULT_ENGINE_URL.replace(/\/stream$/, "").replace(/^ws/, "http") : "http://localhost:5001", t = await globalThis.fetch(`${e}/data/wildfires`);
|
||||
if (!t.ok) throw Error(`Wildfire API returned ${t.status}`);
|
||||
let n = await t.json();
|
||||
return !n.items || !Array.isArray(n.items) ? [] : n.items.map((e) => ({
|
||||
id: `wildfire-${e.latitude.toFixed(4)}-${e.longitude.toFixed(4)}-${e.acq_date}-${e.tier || 3}`,
|
||||
pluginId: "wildfire",
|
||||
latitude: e.latitude,
|
||||
longitude: e.longitude,
|
||||
timestamp: /* @__PURE__ */ new Date(`${e.acq_date}T${e.acq_time.padStart(4, "0").slice(0, 2)}:${e.acq_time.padStart(4, "0").slice(2)}:00Z`),
|
||||
label: `FRP: ${e.frp}`,
|
||||
properties: {
|
||||
frp: e.frp,
|
||||
frp_band: u(e.frp),
|
||||
confidence: e.confidence,
|
||||
satellite: e.satellite,
|
||||
acq_date: e.acq_date,
|
||||
acq_time: e.acq_time,
|
||||
bright_ti4: e.bright_ti4,
|
||||
bright_ti5: e.bright_ti5,
|
||||
tier: e.tier
|
||||
}
|
||||
}));
|
||||
} catch (e) {
|
||||
return console.error("[WildfirePlugin] Fetch error:", e), [];
|
||||
}
|
||||
}
|
||||
getPollingInterval() {
|
||||
return 0;
|
||||
}
|
||||
getServerConfig() {
|
||||
return {
|
||||
apiBasePath: "/api/wildfires",
|
||||
pollingIntervalMs: 0,
|
||||
historyEnabled: !0
|
||||
};
|
||||
}
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: "#ef4444",
|
||||
clusterEnabled: !0,
|
||||
clusterDistance: 30
|
||||
};
|
||||
}
|
||||
renderEntity(e) {
|
||||
let t = e.properties.frp || 0, n = c(t), r = e.properties.tier || 3, i;
|
||||
return r === 1 ? i = {
|
||||
near: 35e5,
|
||||
far: Infinity
|
||||
} : r === 2 ? i = {
|
||||
near: 1e6,
|
||||
far: 35e5
|
||||
} : r === 3 && (i = {
|
||||
near: 0,
|
||||
far: 1e6
|
||||
}), this.iconUrls[n] || (this.iconUrls[n] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(s, { color: n })), {
|
||||
type: "billboard",
|
||||
iconUrl: this.iconUrls[n],
|
||||
color: n,
|
||||
iconScale: l(t) / 10 * (r === 1 ? 2 : r === 2 ? 1.5 : 1),
|
||||
distanceDisplayCondition: i
|
||||
};
|
||||
}
|
||||
getFilterDefinitions() {
|
||||
return [
|
||||
{
|
||||
id: "frp",
|
||||
label: "Fire Radiative Power (MW)",
|
||||
type: "range",
|
||||
propertyKey: "frp",
|
||||
range: {
|
||||
min: 0,
|
||||
max: 500,
|
||||
step: 10
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "frp_band",
|
||||
label: "Intensity Category",
|
||||
type: "select",
|
||||
propertyKey: "frp_band",
|
||||
options: [
|
||||
{
|
||||
value: "low",
|
||||
label: "FRP < 10 (Low)"
|
||||
},
|
||||
{
|
||||
value: "moderate",
|
||||
label: "FRP 10 - 50 (Moderate)"
|
||||
},
|
||||
{
|
||||
value: "high",
|
||||
label: "FRP 50 - 100 (High)"
|
||||
},
|
||||
{
|
||||
value: "extreme",
|
||||
label: "FRP > 100 (Extreme)"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "confidence",
|
||||
label: "Confidence",
|
||||
type: "select",
|
||||
propertyKey: "confidence",
|
||||
options: [
|
||||
{
|
||||
value: "low",
|
||||
label: "Low"
|
||||
},
|
||||
{
|
||||
value: "nominal",
|
||||
label: "Nominal"
|
||||
},
|
||||
{
|
||||
value: "high",
|
||||
label: "High"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "satellite",
|
||||
label: "Satellite",
|
||||
type: "select",
|
||||
propertyKey: "satellite",
|
||||
options: [
|
||||
{
|
||||
value: "N",
|
||||
label: "Suomi NPP"
|
||||
},
|
||||
{
|
||||
value: "1",
|
||||
label: "NOAA-20"
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
label: "NOAA-21"
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
getLegend() {
|
||||
return [
|
||||
{
|
||||
label: "FRP < 10 (Low)",
|
||||
color: "#fbbf24",
|
||||
filterId: "frp_band",
|
||||
filterValue: "low"
|
||||
},
|
||||
{
|
||||
label: "FRP 10 - 50 (Moderate)",
|
||||
color: "#f97316",
|
||||
filterId: "frp_band",
|
||||
filterValue: "moderate"
|
||||
},
|
||||
{
|
||||
label: "FRP 50 - 100 (High)",
|
||||
color: "#ef4444",
|
||||
filterId: "frp_band",
|
||||
filterValue: "high"
|
||||
},
|
||||
{
|
||||
label: "FRP > 100 (Extreme)",
|
||||
color: "#dc2626",
|
||||
filterId: "frp_band",
|
||||
filterValue: "extreme"
|
||||
}
|
||||
];
|
||||
}
|
||||
};
|
||||
//#endregion
|
||||
export { d as WildfirePlugin };
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "wildfire",
|
||||
"name": "wildfire",
|
||||
"version": "1.0.7",
|
||||
"description": "WorldWideView plugin for active wildfire and hotspot detection using NASA FIRMS (VIIRS) satellite data. Supports tiered LOD rendering and FRP-based sizing",
|
||||
"capabilities": [],
|
||||
"category": "Natural Disaster",
|
||||
"icon": "Flame",
|
||||
"entry": "/plugins/wildfire/frontend.mjs",
|
||||
"format": "bundle",
|
||||
"trust": "unverified"
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
const packagesDir = path.resolve(process.cwd(), "packages");
|
||||
const packagesDir = path.resolve(process.cwd(), "..", "worldwideview-plugins", "packages");
|
||||
const publicPluginsDir = path.resolve(process.cwd(), "public", "plugins");
|
||||
|
||||
if (!fs.existsSync(publicPluginsDir)) {
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
Write-Host "[*] Setting up WorldWideView for local self-hosting..."
|
||||
|
||||
# Check Docker
|
||||
try {
|
||||
$null = docker info 2>&1
|
||||
if ($LASTEXITCODE -ne 0) { throw }
|
||||
} catch {
|
||||
Write-Host "[Error] Docker is not running or not accessible."
|
||||
Write-Host "Please install or start Docker Desktop: https://docs.docker.com/get-docker/"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check Docker Compose
|
||||
try {
|
||||
$null = docker compose version 2>&1
|
||||
if ($LASTEXITCODE -ne 0) { throw }
|
||||
} catch {
|
||||
Write-Host "[Error] Docker Compose is not installed or accessible."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Generate docker-compose.yml
|
||||
Write-Host "[*] Creating docker-compose.yml..."
|
||||
|
||||
$dockerCompose = @(
|
||||
"services:"
|
||||
" wwv:"
|
||||
" image: ghcr.io/silvertakana/worldwideview:latest"
|
||||
" ports:"
|
||||
" - `"3000:3000`""
|
||||
" volumes:"
|
||||
" - wwv-data:/app/data"
|
||||
" env_file:"
|
||||
" - .env"
|
||||
" restart: unless-stopped"
|
||||
""
|
||||
"volumes:"
|
||||
" wwv-data:"
|
||||
)
|
||||
|
||||
$dockerCompose | Out-File -FilePath docker-compose.yml -Encoding utf8
|
||||
|
||||
# Generate .env
|
||||
if (-Not (Test-Path .env)) {
|
||||
Write-Host "[*] Generating new .env file with AUTH_SECRET..."
|
||||
$bytes = New-Object Byte[] 32
|
||||
[System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
|
||||
$secret = -join ($bytes | ForEach-Object { $_.ToString("x2") })
|
||||
"AUTH_SECRET=$secret" | Out-File -FilePath .env -Encoding ascii
|
||||
"NEXT_PUBLIC_WWV_EDITION=local" | Out-File -FilePath .env -Encoding ascii -Append
|
||||
} else {
|
||||
Write-Host "[Success] .env already exists, skipping generation."
|
||||
}
|
||||
|
||||
Write-Host "[*] Starting Docker container..."
|
||||
docker compose up -d
|
||||
|
||||
Write-Host "`n[Success] WorldWideView is running at http://localhost:3000"
|
||||
Write-Host " Data is persisted in Docker volume 'wwv-data'"
|
||||
Write-Host " Auth secret is saved in .env (don't delete this file)`n"
|
||||
Write-Host "To stop the server: docker compose down"
|
||||
Write-Host "To view logs: docker compose logs -f wwv"
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🌍 Setting up WorldWideView for local self-hosting..."
|
||||
|
||||
# Check if docker is actually available and running
|
||||
if ! docker info > /dev/null 2>&1; then
|
||||
echo "❌ Error: Docker is not running or not accessible."
|
||||
echo "If you are on Windows using WSL, ensure Docker Desktop is running and WSL integration is enabled for your default distro."
|
||||
echo "Please install or start Docker Desktop: https://docs.docker.com/get-docker/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for docker compose plugin
|
||||
if ! docker compose version > /dev/null 2>&1; then
|
||||
echo "❌ Error: Docker Compose is not installed or accessible."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 1. Generate docker-compose.yml
|
||||
echo "📦 Creating docker-compose.yml..."
|
||||
cat > docker-compose.yml << 'EOF'
|
||||
services:
|
||||
wwv:
|
||||
image: ghcr.io/silvertakana/worldwideview:latest
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- wwv-data:/app/data
|
||||
env_file:
|
||||
- .env
|
||||
restart: unless-stopped # ← Auto-starts on boot
|
||||
|
||||
volumes:
|
||||
wwv-data:
|
||||
EOF
|
||||
|
||||
# 2. Generate .env with a persistent secret
|
||||
if [ ! -f .env ]; then
|
||||
echo "🔐 Generating new .env file with AUTH_SECRET..."
|
||||
# Use openssl if available, otherwise use urandom
|
||||
if command -v openssl &> /dev/null; then
|
||||
SECRET=$(openssl rand -hex 32)
|
||||
else
|
||||
SECRET=$(head -c 32 /dev/urandom | xxd -p)
|
||||
fi
|
||||
echo "AUTH_SECRET=$SECRET" > .env
|
||||
echo "NEXT_PUBLIC_WWV_EDITION=local" >> .env
|
||||
else
|
||||
echo "✅ .env already exists, skipping generation."
|
||||
fi
|
||||
|
||||
# 3. Start it
|
||||
echo "🚀 Starting Docker container..."
|
||||
docker compose up -d
|
||||
|
||||
echo ""
|
||||
echo "✅ WorldWideView is running at http://localhost:3000"
|
||||
echo " Data is persisted in Docker volume 'wwv-data'"
|
||||
echo " Auth secret is saved in .env (don't delete this file)"
|
||||
echo ""
|
||||
echo "To stop the server: docker compose down"
|
||||
echo "To view logs: docker compose logs -f wwv"
|
||||
@@ -0,0 +1,62 @@
|
||||
Write-Host "[*] Setting up WorldWideView for local self-hosting..."
|
||||
|
||||
# Check Docker
|
||||
try {
|
||||
$null = docker info 2>&1
|
||||
if ($LASTEXITCODE -ne 0) { throw }
|
||||
} catch {
|
||||
Write-Host "[Error] Docker is not running or not accessible."
|
||||
Write-Host "Please install or start Docker Desktop: https://docs.docker.com/get-docker/"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check Docker Compose
|
||||
try {
|
||||
$null = docker compose version 2>&1
|
||||
if ($LASTEXITCODE -ne 0) { throw }
|
||||
} catch {
|
||||
Write-Host "[Error] Docker Compose is not installed or accessible."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Generate docker-compose.yml
|
||||
Write-Host "[*] Creating docker-compose.yml..."
|
||||
|
||||
$dockerCompose = @(
|
||||
"services:"
|
||||
" wwv:"
|
||||
" image: ghcr.io/silvertakana/worldwideview:latest"
|
||||
" ports:"
|
||||
" - `"3000:3000`""
|
||||
" volumes:"
|
||||
" - wwv-data:/app/data"
|
||||
" env_file:"
|
||||
" - .env"
|
||||
" restart: unless-stopped"
|
||||
""
|
||||
"volumes:"
|
||||
" wwv-data:"
|
||||
)
|
||||
|
||||
$dockerCompose | Out-File -FilePath docker-compose.yml -Encoding utf8
|
||||
|
||||
# Generate .env
|
||||
if (-Not (Test-Path .env)) {
|
||||
Write-Host "[*] Generating new .env file with AUTH_SECRET..."
|
||||
$bytes = New-Object Byte[] 32
|
||||
[System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
|
||||
$secret = -join ($bytes | ForEach-Object { $_.ToString("x2") })
|
||||
"AUTH_SECRET=$secret" | Out-File -FilePath .env -Encoding ascii
|
||||
"NEXT_PUBLIC_WWV_EDITION=local" | Out-File -FilePath .env -Encoding ascii -Append
|
||||
} else {
|
||||
Write-Host "[Success] .env already exists, skipping generation."
|
||||
}
|
||||
|
||||
Write-Host "[*] Starting Docker container..."
|
||||
docker compose up -d
|
||||
|
||||
Write-Host "`n[Success] WorldWideView is running at http://localhost:3000"
|
||||
Write-Host " Data is persisted in Docker volume 'wwv-data'"
|
||||
Write-Host " Auth secret is saved in .env (don't delete this file)`n"
|
||||
Write-Host "To stop the server: docker compose down"
|
||||
Write-Host "To view logs: docker compose logs -f wwv"
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🌍 Setting up WorldWideView for local self-hosting..."
|
||||
|
||||
# Check if docker is actually available and running
|
||||
if ! docker info > /dev/null 2>&1; then
|
||||
echo "❌ Error: Docker is not running or not accessible."
|
||||
echo "If you are on Windows using WSL, ensure Docker Desktop is running and WSL integration is enabled for your default distro."
|
||||
echo "Please install or start Docker Desktop: https://docs.docker.com/get-docker/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for docker compose plugin
|
||||
if ! docker compose version > /dev/null 2>&1; then
|
||||
echo "❌ Error: Docker Compose is not installed or accessible."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 1. Generate docker-compose.yml
|
||||
echo "📦 Creating docker-compose.yml..."
|
||||
cat > docker-compose.yml << 'EOF'
|
||||
services:
|
||||
wwv:
|
||||
image: ghcr.io/silvertakana/worldwideview:latest
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- wwv-data:/app/data
|
||||
env_file:
|
||||
- .env
|
||||
restart: unless-stopped # ← Auto-starts on boot
|
||||
|
||||
volumes:
|
||||
wwv-data:
|
||||
EOF
|
||||
|
||||
# 2. Generate .env with a persistent secret
|
||||
if [ ! -f .env ]; then
|
||||
echo "🔐 Generating new .env file with AUTH_SECRET..."
|
||||
# Use openssl if available, otherwise use urandom
|
||||
if command -v openssl &> /dev/null; then
|
||||
SECRET=$(openssl rand -hex 32)
|
||||
else
|
||||
SECRET=$(head -c 32 /dev/urandom | xxd -p)
|
||||
fi
|
||||
echo "AUTH_SECRET=$SECRET" > .env
|
||||
echo "NEXT_PUBLIC_WWV_EDITION=local" >> .env
|
||||
else
|
||||
echo "✅ .env already exists, skipping generation."
|
||||
fi
|
||||
|
||||
# 3. Start it
|
||||
echo "🚀 Starting Docker container..."
|
||||
docker compose up -d
|
||||
|
||||
echo ""
|
||||
echo "✅ WorldWideView is running at http://localhost:3000"
|
||||
echo " Data is persisted in Docker volume 'wwv-data'"
|
||||
echo " Auth secret is saved in .env (don't delete this file)"
|
||||
echo ""
|
||||
echo "To stop the server: docker compose down"
|
||||
echo "To view logs: docker compose logs -f wwv"
|
||||
@@ -44,10 +44,39 @@ export async function POST(request: Request) {
|
||||
);
|
||||
}
|
||||
|
||||
// Validate manifest if provided
|
||||
if (manifest) {
|
||||
const validation = validateManifest(manifest);
|
||||
// Fetch from marketplace if manifest is missing (e.g. from in-app update)
|
||||
let finalManifest = manifest;
|
||||
if (!finalManifest) {
|
||||
const MARKETPLACE_URL = process.env.NEXT_PUBLIC_MARKETPLACE_URL || "https://marketplace.worldwideview.dev";
|
||||
try {
|
||||
const res = await fetch(`${MARKETPLACE_URL}/api/plugins/${pluginId}`);
|
||||
if (res.ok) {
|
||||
const card = await res.json();
|
||||
finalManifest = { ...card };
|
||||
|
||||
// Reconstruct entry URL for plugins that are distributed via NPM.
|
||||
// We also forcefully coerce format to "bundle" here because
|
||||
// the marketplace cache might still return "static" for plugins we recently converted.
|
||||
if (finalManifest.npmPackage) {
|
||||
const targetVersion = version || finalManifest.version || "1.0.0";
|
||||
finalManifest.format = "bundle";
|
||||
finalManifest.entry = `https://unpkg.com/${finalManifest.npmPackage}@${targetVersion}/dist/frontend.mjs`;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`[Marketplace Install Route] Failed to fetch manifest for ${pluginId}`, e);
|
||||
}
|
||||
}
|
||||
|
||||
// Validate manifest
|
||||
if (finalManifest) {
|
||||
const validation = validateManifest(finalManifest);
|
||||
if (!validation.valid) {
|
||||
console.error(
|
||||
`[Marketplace Install Route] ❌ MANIFEST VALIDATION FAILED for ${pluginId}\n` +
|
||||
`Errors: ${validation.errors.join(", ")}\n` +
|
||||
`Evaluated Payload:\n${JSON.stringify(finalManifest, null, 2)}`
|
||||
);
|
||||
return withCors(
|
||||
NextResponse.json(
|
||||
{ error: "Invalid manifest", details: validation.errors },
|
||||
@@ -56,16 +85,20 @@ export async function POST(request: Request) {
|
||||
request,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// We cannot proceed safely if we don't have a manifest and it's missing from DB.
|
||||
// If we do have an existing db record, we could technically merge, but we'll enforce manifest req here.
|
||||
console.warn(`[Marketplace Install] No manifest provided or found for ${pluginId}`);
|
||||
}
|
||||
|
||||
// Server-side trust stamping — always overwrite trust from the
|
||||
// live registry. Never trust the incoming manifest's claim.
|
||||
if (manifest) {
|
||||
if (finalManifest) {
|
||||
const verified = await getVerifiedPluginIds();
|
||||
manifest.trust = verified.has(pluginId) ? "verified" : "unverified";
|
||||
finalManifest.trust = verified.has(pluginId) ? "verified" : "unverified";
|
||||
}
|
||||
|
||||
const config = manifest ? JSON.stringify(manifest) : "{}";
|
||||
const config = finalManifest ? JSON.stringify(finalManifest) : "{}";
|
||||
const record = await upsertPlugin(pluginId, version || "1.0.0", config);
|
||||
|
||||
return withCors(
|
||||
|
||||
@@ -10,6 +10,7 @@ import { getVerifiedPluginIds } from "@/lib/marketplace/registryClient";
|
||||
|
||||
import { isDemo, isDemoAdmin } from "@/core/edition";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { seedDefaultPlugins } from "@/lib/marketplace/seedDefaultPlugins";
|
||||
|
||||
export async function OPTIONS(request: Request) {
|
||||
return handlePreflight(request);
|
||||
@@ -24,6 +25,9 @@ export async function OPTIONS(request: Request) {
|
||||
* from the verified list are correctly flagged as unverified.
|
||||
*/
|
||||
export async function GET(request: Request) {
|
||||
// Seed default plugins on fresh installs (idempotent — runs once)
|
||||
await seedDefaultPlugins();
|
||||
|
||||
// On demo, all installed plugins are visible to everyone (admin vetted them)
|
||||
if (!isDemo) {
|
||||
const authError = await validateMarketplaceAuth(request);
|
||||
@@ -36,11 +40,11 @@ export async function GET(request: Request) {
|
||||
getVerifiedPluginIds(),
|
||||
]);
|
||||
|
||||
// Support local sandbox workflows by checking /public/plugins
|
||||
// Support local sandbox workflows by checking /public/plugins-local
|
||||
const localPlugins: any[] = [];
|
||||
try {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
const pluginsDir = path.join(process.cwd(), "public", "plugins");
|
||||
if (process.env.NODE_ENV === "development" || process.env.WWV_PLUGIN_DEV === "true") {
|
||||
const pluginsDir = path.join(process.cwd(), "public", "plugins-local");
|
||||
if (fs.existsSync(pluginsDir)) {
|
||||
for (const folder of fs.readdirSync(pluginsDir)) {
|
||||
const manifestPath = path.join(pluginsDir, folder, "plugin.json");
|
||||
@@ -61,14 +65,14 @@ export async function GET(request: Request) {
|
||||
|
||||
const allRecords = [...records, ...localPlugins];
|
||||
|
||||
console.log(`[Marketplace API] All Records count: ${allRecords.length}`);
|
||||
|
||||
|
||||
const manifests = allRecords
|
||||
.map((r: any): PluginManifest | null => {
|
||||
try {
|
||||
const manifest = JSON.parse(r.config);
|
||||
if (!manifest.id) manifest.id = r.pluginId;
|
||||
console.log(`[Marketplace API] Parsed manifest for ${manifest.id} -> format: ${manifest.format}, entry: ${manifest.entry}, dataFile: ${manifest.dataFile}`);
|
||||
|
||||
return manifest as PluginManifest;
|
||||
} catch {
|
||||
return null;
|
||||
|
||||
@@ -6,6 +6,7 @@ import { dataBus } from "@/core/data/DataBus";
|
||||
import { pluginManager } from "@/core/plugins/PluginManager";
|
||||
import { wsClient } from "@/core/data/WsClient";
|
||||
import { resolveEngineUrl } from "@/core/data/resolveEngineUrl";
|
||||
import { fetchLocalEngineManifest } from "@/core/data/engineManifest";
|
||||
|
||||
/**
|
||||
* Subscribes to DataBus events and syncs state.
|
||||
@@ -18,6 +19,8 @@ export function DataBusSubscriber() {
|
||||
const cacheMaxAge = useStore((s) => s.dataConfig.cacheMaxAge);
|
||||
|
||||
useEffect(() => {
|
||||
// Detect local engine before subscribing to plugins
|
||||
fetchLocalEngineManifest();
|
||||
pluginManager.setCacheMaxAge(cacheMaxAge);
|
||||
}, [cacheMaxAge]);
|
||||
|
||||
|
||||
@@ -94,8 +94,6 @@ export function LayerPanel() {
|
||||
className="panel-tabs"
|
||||
onWheel={(e) => {
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
// e.preventDefault() is excluded, or included if right panel has it. The right panel has it, but React often warns if preventDefault is called on passive listeners. Let's match it anyway.
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<button
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
// src/core/data/engineManifest.ts
|
||||
// Fetches /manifest from a local data engine to discover available seeders.
|
||||
// Used by resolveEngineUrl for per-plugin local vs cloud routing.
|
||||
|
||||
let localManifest: string[] | null = null;
|
||||
let manifestFetched = false;
|
||||
|
||||
const LOCAL_ENGINE_BASE = "http://localhost:5001";
|
||||
|
||||
/**
|
||||
* Fetch the list of available seeders from a local engine.
|
||||
* Returns null if no local engine is detected (timeout after 2s).
|
||||
*/
|
||||
export async function fetchLocalEngineManifest(): Promise<string[] | null> {
|
||||
if (manifestFetched) return localManifest;
|
||||
manifestFetched = true;
|
||||
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), 2000);
|
||||
|
||||
const res = await fetch(`${LOCAL_ENGINE_BASE}/manifest`, {
|
||||
signal: controller.signal,
|
||||
});
|
||||
clearTimeout(timeout);
|
||||
|
||||
if (!res.ok) return null;
|
||||
|
||||
const data = await res.json();
|
||||
localManifest = data.plugins || [];
|
||||
console.log(
|
||||
`[EngineManifest] Local engine detected: ${localManifest!.length} seeders`,
|
||||
localManifest
|
||||
);
|
||||
return localManifest;
|
||||
} catch {
|
||||
console.log("[EngineManifest] No local engine detected, using cloud.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Check if the local engine has a seeder for a given plugin ID. */
|
||||
export function localEngineHasPlugin(pluginId: string): boolean {
|
||||
if (!localManifest) return false;
|
||||
return localManifest.includes(pluginId);
|
||||
}
|
||||
|
||||
/** Reset the cache (for testing or reconnection). */
|
||||
export function resetManifestCache(): void {
|
||||
localManifest = null;
|
||||
manifestFetched = false;
|
||||
}
|
||||
@@ -1,14 +1,17 @@
|
||||
// src/core/data/resolveEngineUrl.ts
|
||||
import { pluginManager } from "@/core/plugins/PluginManager";
|
||||
import { localEngineHasPlugin } from "./engineManifest";
|
||||
|
||||
const CLOUD_ENGINE_URL = "wss://dataengine.worldwideview.dev/stream";
|
||||
|
||||
const RAW_ENGINE_URL =
|
||||
process.env.NEXT_PUBLIC_DEFAULT_ENGINE_URL || "ws://localhost:5001/stream";
|
||||
process.env.NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL || CLOUD_ENGINE_URL;
|
||||
|
||||
/** Normalize a base URL into a valid WebSocket stream URL. */
|
||||
function toWsStreamUrl(url: string): string {
|
||||
let normalized = url
|
||||
.replace(/^https:\/\//, "wss://")
|
||||
.replace(/^http:\/\//, "ws://");
|
||||
// Ensure the path ends with /stream
|
||||
if (!normalized.endsWith("/stream")) {
|
||||
normalized = normalized.replace(/\/+$/, "") + "/stream";
|
||||
}
|
||||
@@ -16,6 +19,7 @@ function toWsStreamUrl(url: string): string {
|
||||
}
|
||||
|
||||
const DEFAULT_ENGINE_URL = toWsStreamUrl(RAW_ENGINE_URL);
|
||||
const LOCAL_ENGINE_URL = "ws://localhost:5001/stream";
|
||||
|
||||
/**
|
||||
* Resolves the WebSocket engine URL for a given plugin.
|
||||
@@ -23,21 +27,27 @@ const DEFAULT_ENGINE_URL = toWsStreamUrl(RAW_ENGINE_URL);
|
||||
* Resolution order:
|
||||
* 1. Plugin's ServerPluginConfig.streamUrl (code-based plugins)
|
||||
* 2. Plugin's PluginManifest.dataSource.streamUrl (manifest-based plugins)
|
||||
* 3. NEXT_PUBLIC_DEFAULT_ENGINE_URL environment variable
|
||||
* 4. Fallback: ws://localhost:5001/stream
|
||||
* 3. Local engine (if running and has this plugin's seeder)
|
||||
* 4. NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL env var
|
||||
* 5. Fallback: wss://dataengine.worldwideview.dev/stream (cloud)
|
||||
*/
|
||||
export function resolveEngineUrl(pluginId: string): string {
|
||||
// 1. Check code-based plugin server config
|
||||
// 1. Code-based plugin server config
|
||||
const managed = pluginManager.getPlugin(pluginId);
|
||||
if (managed) {
|
||||
const serverConfig = managed.plugin.getServerConfig?.();
|
||||
if (serverConfig?.streamUrl) return serverConfig.streamUrl;
|
||||
}
|
||||
|
||||
// 2. Check manifest-based plugin data source config
|
||||
// 2. Manifest-based plugin data source config
|
||||
const manifest = pluginManager.getManifest(pluginId);
|
||||
if (manifest?.dataSource?.streamUrl) return manifest.dataSource.streamUrl;
|
||||
|
||||
// 3. Global default (already normalized)
|
||||
// 3. Local engine (split-routing)
|
||||
if (localEngineHasPlugin(pluginId)) {
|
||||
return LOCAL_ENGINE_URL;
|
||||
}
|
||||
|
||||
// 4+5. Global default (env var or cloud)
|
||||
return DEFAULT_ENGINE_URL;
|
||||
}
|
||||
@@ -25,8 +25,10 @@ export async function loadInstalledPlugins(): Promise<number> {
|
||||
|
||||
const result = validateManifest(manifest);
|
||||
if (!result.valid) {
|
||||
console.warn(
|
||||
`[InstalledPlugins] Skipping "${record.pluginId}": ${result.errors.join(", ")}`,
|
||||
console.error(
|
||||
`[InstalledPlugins] ❌ MANIFEST VALIDATION FAILED for "${record.pluginId}"\n` +
|
||||
`Errors: ${result.errors.join(", ")}\n` +
|
||||
`Evaluated Payload:\n${JSON.stringify(manifest, null, 2)}`
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -42,8 +42,25 @@ class PluginManager {
|
||||
return;
|
||||
}
|
||||
|
||||
const envVars: Record<string, string> = {};
|
||||
if (typeof process !== "undefined" && process.env) {
|
||||
for (const [key, value] of Object.entries(process.env)) {
|
||||
if (key.startsWith("NEXT_PUBLIC_WWV_PLUGIN_")) {
|
||||
envVars[key.replace("NEXT_PUBLIC_WWV_PLUGIN_", "")] = value || "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const edition = (process.env.NEXT_PUBLIC_WWV_EDITION || "local") as "local" | "cloud" | "demo";
|
||||
|
||||
if (Object.keys(envVars).length > 0) {
|
||||
console.debug(`[PluginManager] Injected ${Object.keys(envVars).length} custom env vars into "${plugin.id}"`);
|
||||
}
|
||||
|
||||
const context: PluginContext = {
|
||||
apiBaseUrl: "",
|
||||
env: envVars,
|
||||
edition,
|
||||
timeRange: {
|
||||
start: new Date(Date.now() - 24 * 60 * 60 * 1000),
|
||||
end: new Date(),
|
||||
@@ -92,8 +109,14 @@ class PluginManager {
|
||||
async () => {
|
||||
const managed = this.plugins.get(plugin.id);
|
||||
if (!managed || !managed.enabled) return;
|
||||
const entities = await plugin.fetch(managed.context.timeRange);
|
||||
this.handleDataUpdate(plugin.id, entities);
|
||||
try {
|
||||
const entities = await plugin.fetch(managed.context.timeRange);
|
||||
this.handleDataUpdate(plugin.id, entities);
|
||||
} catch (err: any) {
|
||||
useStore.getState().setLayerLoading(plugin.id, false);
|
||||
managed.context.onError(err instanceof Error ? err : new Error(String(err)));
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -187,6 +210,10 @@ class PluginManager {
|
||||
*/
|
||||
async loadFromManifest(manifest: PluginManifest): Promise<void> {
|
||||
const plugin = await loadPluginFromManifest(manifest);
|
||||
if (manifest.id && plugin.id !== manifest.id) {
|
||||
console.warn(`[PluginManager] Overriding plugin ID from internal '${plugin.id}' to manifest ID '${manifest.id}'`);
|
||||
plugin.id = manifest.id;
|
||||
}
|
||||
this.loadedManifests.set(manifest.id, manifest);
|
||||
await this.registerPlugin(plugin);
|
||||
}
|
||||
|
||||
@@ -48,5 +48,18 @@ export function injectHostGlobals(): void {
|
||||
CameraStream,
|
||||
};
|
||||
|
||||
// REST Engine URL
|
||||
const envDataEngine = process.env.NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL;
|
||||
if (envDataEngine) {
|
||||
(globalThis as any).__WWV_ENGINE_URL__ = envDataEngine;
|
||||
} else {
|
||||
// ALWAYS default to the cloud engine unless explicitly told otherwise via env var
|
||||
(globalThis as any).__WWV_ENGINE_URL__ = 'https://dataengine.worldwideview.dev';
|
||||
}
|
||||
|
||||
// WebSocket Engine URL
|
||||
const fallbackWs = envDataEngine ? envDataEngine.replace(/^http/, "ws") + "/stream" : 'wss://dataengine.worldwideview.dev/stream';
|
||||
(globalThis as any).__WWV_WS_ENGINE_URL__ = fallbackWs;
|
||||
|
||||
console.log("[HostGlobals] React and SDK injected for dynamic plugins");
|
||||
}
|
||||
@@ -1,14 +1,10 @@
|
||||
// ─── Plugin Loader Router ────────────────────────────────────
|
||||
// Given a PluginManifest, instantiates the correct plugin implementation.
|
||||
// Routes: declarative → DeclarativePlugin, static → StaticDataPlugin,
|
||||
// bundle → dynamic import.
|
||||
// ─── Plugin Loader ───────────────────────────────────────────
|
||||
// All plugins are bundles. Given a manifest, dynamically import
|
||||
// the entry and return a WorldPlugin instance.
|
||||
|
||||
import type { WorldPlugin } from "./PluginTypes";
|
||||
import type { PluginManifest } from "./PluginManifest";
|
||||
import { validateManifest } from "./validateManifest";
|
||||
import { DeclarativePlugin } from "./loaders/DeclarativePlugin";
|
||||
import { StaticDataPlugin } from "./loaders/StaticDataPlugin";
|
||||
import type { GeoJsonFeatureCollection } from "@/types/geojson";
|
||||
|
||||
export class ManifestLoadError extends Error {
|
||||
constructor(
|
||||
@@ -21,16 +17,7 @@ export class ManifestLoadError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
/** Load a static GeoJSON file referenced by a static-format manifest. */
|
||||
async function loadGeoJsonFile(dataFile: string): Promise<GeoJsonFeatureCollection> {
|
||||
const res = await fetch(dataFile);
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to load GeoJSON file "${dataFile}": HTTP ${res.status}`);
|
||||
}
|
||||
return res.json() as Promise<GeoJsonFeatureCollection>;
|
||||
}
|
||||
|
||||
/** Load a bundle-format plugin via dynamic import. */
|
||||
/** Load a bundle plugin via dynamic import. */
|
||||
async function loadBundlePlugin(entry: string): Promise<WorldPlugin> {
|
||||
const module = await import(/* webpackIgnore: true */ entry);
|
||||
|
||||
@@ -55,13 +42,11 @@ async function loadBundlePlugin(entry: string): Promise<WorldPlugin> {
|
||||
return module.default as WorldPlugin;
|
||||
}
|
||||
|
||||
// Scan for a named export class that implements WorldPlugin
|
||||
for (const key in module) {
|
||||
const instance = instantiate(module[key]);
|
||||
if (instance) return instance;
|
||||
}
|
||||
|
||||
// Try finding an instantiated object exported by name
|
||||
|
||||
for (const key in module) {
|
||||
const exp = module[key];
|
||||
if (exp && typeof exp === "object" && typeof exp.initialize === "function") {
|
||||
@@ -69,20 +54,26 @@ async function loadBundlePlugin(entry: string): Promise<WorldPlugin> {
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`Failed to load valid WorldPlugin from bundle: ${entry}. Make sure you export a class that implements WorldPlugin.`);
|
||||
throw new Error(
|
||||
`Failed to load valid WorldPlugin from bundle: ${entry}. ` +
|
||||
`Make sure you export a class that implements WorldPlugin.`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a PluginManifest, returns a fully constructed WorldPlugin instance.
|
||||
*
|
||||
* @throws ManifestLoadError if validation fails or loading fails
|
||||
*/
|
||||
export async function loadPluginFromManifest(
|
||||
manifest: PluginManifest,
|
||||
): Promise<WorldPlugin> {
|
||||
// 1. Validate
|
||||
const result = validateManifest(manifest);
|
||||
if (!result.valid) {
|
||||
console.error(
|
||||
`[loadPluginFromManifest] ❌ VALIDATION FAILED for "${manifest.id || "unknown"}"\n` +
|
||||
`Errors: ${result.errors.join(", ")}\n` +
|
||||
`Payload:\n${JSON.stringify(manifest, null, 2)}`,
|
||||
);
|
||||
throw new ManifestLoadError(
|
||||
manifest.id,
|
||||
`Invalid manifest: ${result.errors.join(", ")}`,
|
||||
@@ -90,26 +81,8 @@ export async function loadPluginFromManifest(
|
||||
);
|
||||
}
|
||||
|
||||
// 2. Route by format
|
||||
try {
|
||||
switch (manifest.format) {
|
||||
case "declarative":
|
||||
return new DeclarativePlugin(manifest);
|
||||
|
||||
case "static": {
|
||||
const geojson = await loadGeoJsonFile(manifest.dataFile!);
|
||||
return new StaticDataPlugin(manifest, geojson.features);
|
||||
}
|
||||
|
||||
case "bundle":
|
||||
return await loadBundlePlugin(manifest.entry!);
|
||||
|
||||
default:
|
||||
throw new ManifestLoadError(
|
||||
manifest.id,
|
||||
`Unknown format: "${manifest.format}"`,
|
||||
);
|
||||
}
|
||||
return await loadBundlePlugin(manifest.entry!);
|
||||
} catch (err) {
|
||||
if (err instanceof ManifestLoadError) throw err;
|
||||
throw new ManifestLoadError(
|
||||
|
||||
@@ -114,6 +114,8 @@ describe("DeclarativePlugin", () => {
|
||||
getPluginSettings: () => undefined,
|
||||
isPlaybackMode: () => false,
|
||||
getCurrentTime: () => new Date(),
|
||||
env: {},
|
||||
edition: "local",
|
||||
});
|
||||
|
||||
const entities = await plugin.fetch({ start: new Date(), end: new Date() });
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
// ─── StaticDataPlugin ────────────────────────────────────────
|
||||
// Loads Format 2 plugins: GeoJSON file + rendering config.
|
||||
// No polling, no API calls — data is converted once at init.
|
||||
|
||||
import type {
|
||||
WorldPlugin,
|
||||
GeoEntity,
|
||||
TimeRange,
|
||||
PluginContext,
|
||||
LayerConfig,
|
||||
CesiumEntityOptions,
|
||||
PluginCategory,
|
||||
} from "../PluginTypes";
|
||||
import type { PluginManifest, RenderingConfig } from "../PluginManifest";
|
||||
import type { GeoJsonFeature, GeoJsonGeometry } from "@/types/geojson";
|
||||
|
||||
// ─── Geometry → Representative Point ────────────────────────
|
||||
|
||||
interface RepPoint {
|
||||
lat: number;
|
||||
lon: number;
|
||||
alt?: number;
|
||||
}
|
||||
|
||||
function representativePoint(geom: GeoJsonGeometry): RepPoint {
|
||||
switch (geom.type) {
|
||||
case "Point": {
|
||||
const [lon, lat, alt] = geom.coordinates;
|
||||
return { lat, lon, ...(alt !== undefined ? { alt } : {}) };
|
||||
}
|
||||
case "MultiPoint":
|
||||
case "LineString": {
|
||||
const first = geom.coordinates[0] as number[];
|
||||
return { lat: first[1], lon: first[0] };
|
||||
}
|
||||
case "Polygon":
|
||||
case "MultiLineString": {
|
||||
const ring = geom.coordinates[0] as number[][];
|
||||
return { lat: ring[0][1], lon: ring[0][0] };
|
||||
}
|
||||
case "MultiPolygon": {
|
||||
const poly = geom.coordinates[0] as number[][][];
|
||||
return { lat: poly[0][0][1], lon: poly[0][0][0] };
|
||||
}
|
||||
default:
|
||||
return { lat: 0, lon: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Feature → GeoEntity ────────────────────────────────────
|
||||
|
||||
function featureToEntity(
|
||||
feature: GeoJsonFeature,
|
||||
pluginId: string,
|
||||
index: number,
|
||||
labelField?: string,
|
||||
): GeoEntity {
|
||||
const point = representativePoint(feature.geometry);
|
||||
const featureId = feature.id ?? index;
|
||||
|
||||
return {
|
||||
id: `${pluginId}-${featureId}`,
|
||||
pluginId,
|
||||
latitude: point.lat,
|
||||
longitude: point.lon,
|
||||
altitude: point.alt,
|
||||
timestamp: new Date(),
|
||||
label: labelField
|
||||
? (feature.properties[labelField] as string) ?? undefined
|
||||
: (feature.properties.name as string) ?? undefined,
|
||||
properties: {
|
||||
...feature.properties,
|
||||
_geometryType: feature.geometry.type,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// ─── Rendering Config → LayerConfig ─────────────────────────
|
||||
|
||||
function renderingToLayerConfig(rendering?: RenderingConfig): LayerConfig {
|
||||
return {
|
||||
color: rendering?.color ?? "#3b82f6",
|
||||
clusterEnabled: rendering?.clusterEnabled ?? false,
|
||||
clusterDistance: rendering?.clusterDistance ?? 0,
|
||||
minZoomLevel: rendering?.minZoomLevel,
|
||||
maxEntities: rendering?.maxEntities,
|
||||
};
|
||||
}
|
||||
|
||||
// ─── StaticDataPlugin Class ─────────────────────────────────
|
||||
|
||||
export class StaticDataPlugin implements WorldPlugin {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
readonly description: string;
|
||||
readonly icon: string;
|
||||
readonly category: PluginCategory;
|
||||
readonly version: string;
|
||||
readonly pluginType = "data-layer" as const;
|
||||
readonly capabilities: ["data:own"] = ["data:own"];
|
||||
|
||||
private entities: GeoEntity[] = [];
|
||||
private readonly rendering: RenderingConfig | undefined;
|
||||
|
||||
constructor(
|
||||
private readonly manifest: PluginManifest,
|
||||
private readonly features: GeoJsonFeature[],
|
||||
) {
|
||||
this.id = manifest.id;
|
||||
this.name = manifest.name;
|
||||
this.description = manifest.description ?? "";
|
||||
this.icon = manifest.icon ?? "📍";
|
||||
this.category = (manifest.category as PluginCategory) ?? "custom";
|
||||
this.version = manifest.version;
|
||||
this.rendering = manifest.rendering;
|
||||
}
|
||||
|
||||
async initialize(_ctx: PluginContext): Promise<void> {
|
||||
this.entities = this.features.map((feature, i) =>
|
||||
featureToEntity(
|
||||
feature,
|
||||
this.id,
|
||||
i,
|
||||
this.rendering?.labelField,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
this.entities = [];
|
||||
}
|
||||
|
||||
async fetch(_timeRange: TimeRange): Promise<GeoEntity[]> {
|
||||
return this.entities;
|
||||
}
|
||||
|
||||
getPollingInterval(): number {
|
||||
return 0; // Static — never re-fetch
|
||||
}
|
||||
|
||||
getLayerConfig(): LayerConfig {
|
||||
return renderingToLayerConfig(this.rendering);
|
||||
}
|
||||
|
||||
renderEntity(_entity: GeoEntity): CesiumEntityOptions {
|
||||
return {
|
||||
type: this.rendering?.entityType ?? "point",
|
||||
color: this.rendering?.color ?? "#3b82f6",
|
||||
iconUrl: this.rendering?.icon,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export { DeclarativePlugin } from "./DeclarativePlugin";
|
||||
export { getNestedValue } from "./getNestedValue";
|
||||
export { mapGeoJsonToEntities } from "./mapGeoJsonToEntities";
|
||||
export { mapJsonToEntities } from "./mapJsonToEntities";
|
||||
export { mapGeoJsonToEntities } from "./mapGeoJsonToEntities";
|
||||
@@ -1,5 +1,5 @@
|
||||
// ─── Plugin Manifest Validation ──────────────────────────────
|
||||
// Validates a plugin.json manifest against format-specific rules.
|
||||
// Validates a plugin manifest. All plugins are now bundles.
|
||||
|
||||
import type { PluginManifest } from "./PluginManifest";
|
||||
|
||||
@@ -8,123 +8,52 @@ export interface ValidationResult {
|
||||
errors: string[];
|
||||
}
|
||||
|
||||
const VALID_FORMATS = ["declarative", "static", "bundle"] as const;
|
||||
const VALID_TYPES = ["data-layer", "extension"] as const;
|
||||
const VALID_TRUSTS = ["built-in", "verified", "unverified"] as const;
|
||||
|
||||
/** Validate required base fields shared by all formats. */
|
||||
function validateBaseFields(m: PluginManifest): string[] {
|
||||
export function validateManifest(
|
||||
manifest: Partial<PluginManifest>,
|
||||
): ValidationResult {
|
||||
const errors: string[] = [];
|
||||
|
||||
if (!m.id?.trim()) errors.push("Missing required field: id");
|
||||
if (!m.name?.trim()) errors.push("Missing required field: name");
|
||||
if (!m.version?.trim()) errors.push("Missing required field: version");
|
||||
// Default type for older manifests missing the field
|
||||
if (manifest && !manifest.type) {
|
||||
manifest.type = "data-layer";
|
||||
}
|
||||
|
||||
if (!VALID_TYPES.includes(m.type as typeof VALID_TYPES[number])) {
|
||||
errors.push(`Invalid type "${m.type}". Must be: ${VALID_TYPES.join(", ")}`);
|
||||
if (!manifest.id?.trim()) errors.push("Missing required field: id");
|
||||
if (!manifest.name?.trim()) errors.push("Missing required field: name");
|
||||
if (!manifest.version?.trim()) errors.push("Missing required field: version");
|
||||
|
||||
if (!VALID_TYPES.includes(manifest.type as typeof VALID_TYPES[number])) {
|
||||
errors.push(`Invalid type "${manifest.type}". Must be: ${VALID_TYPES.join(", ")}`);
|
||||
}
|
||||
if (!VALID_FORMATS.includes(m.format as typeof VALID_FORMATS[number])) {
|
||||
errors.push(`Invalid format "${m.format}". Must be: ${VALID_FORMATS.join(", ")}`);
|
||||
if (!VALID_TRUSTS.includes(manifest.trust as typeof VALID_TRUSTS[number])) {
|
||||
errors.push(`Invalid trust "${manifest.trust}". Must be: ${VALID_TRUSTS.join(", ")}`);
|
||||
}
|
||||
if (!VALID_TRUSTS.includes(m.trust as typeof VALID_TRUSTS[number])) {
|
||||
errors.push(`Invalid trust "${m.trust}". Must be: ${VALID_TRUSTS.join(", ")}`);
|
||||
}
|
||||
if (!Array.isArray(m.capabilities) || m.capabilities.length === 0) {
|
||||
if (!Array.isArray(manifest.capabilities) || manifest.capabilities.length === 0) {
|
||||
errors.push("capabilities must be a non-empty array");
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/** Validate fields required for declarative format. */
|
||||
function validateDeclarative(m: PluginManifest): string[] {
|
||||
const errors: string[] = [];
|
||||
|
||||
if (!m.dataSource) {
|
||||
errors.push("Declarative plugins require dataSource");
|
||||
// Entry is required — all plugins are bundles now
|
||||
if (!manifest.entry?.trim()) {
|
||||
errors.push("Missing required field: entry");
|
||||
} else {
|
||||
if (!m.dataSource.url?.trim()) errors.push("dataSource.url is required");
|
||||
if (typeof m.dataSource.pollInterval !== "number") {
|
||||
errors.push("dataSource.pollInterval must be a number");
|
||||
}
|
||||
}
|
||||
if (!m.fieldMapping) {
|
||||
errors.push("Declarative plugins require fieldMapping");
|
||||
}
|
||||
if (!m.rendering) {
|
||||
errors.push("Declarative plugins require rendering");
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/** Validate fields required for static format. */
|
||||
function validateStatic(m: PluginManifest): string[] {
|
||||
const errors: string[] = [];
|
||||
|
||||
if (!m.dataFile?.trim()) {
|
||||
errors.push("Static plugins require dataFile");
|
||||
}
|
||||
if (!m.rendering) {
|
||||
errors.push("Static plugins require rendering");
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
function validateBundle(m: PluginManifest): string[] {
|
||||
const errors: string[] = [];
|
||||
|
||||
if (!m.entry?.trim()) {
|
||||
errors.push("Bundle plugins require entry");
|
||||
} else {
|
||||
const entry = m.entry.trim();
|
||||
const entry = manifest.entry.trim();
|
||||
const isRelative = entry.startsWith("/") || entry.startsWith("./");
|
||||
const isLocal = entry.startsWith("http://localhost") || entry.startsWith("http://127.0.0.1") || entry.startsWith("https://localhost") || entry.startsWith("https://127.0.0.1");
|
||||
const isWWV = entry.startsWith("https://marketplace.worldwideview.dev") || entry.includes(".worldwideview.dev");
|
||||
const isLocal = entry.startsWith("http://localhost") || entry.startsWith("http://127.0.0.1");
|
||||
const isWWV = entry.includes(".worldwideview.dev");
|
||||
const isCDN = entry.startsWith("https://cdn.jsdelivr.net") || entry.startsWith("https://unpkg.com");
|
||||
|
||||
if (!isRelative && !isLocal && !isWWV && !isCDN) {
|
||||
errors.push("Bundle entry URL must be a relative path, CDN, localhost, or an official worldwideview.dev domain");
|
||||
}
|
||||
|
||||
if (entry.includes("unknown-package")) {
|
||||
errors.push("Bundle entry contains a placeholder package name ('unknown-package'). Manifest generation failed.");
|
||||
errors.push("entry URL must be a relative path, CDN, localhost, or worldwideview.dev domain");
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/** Validate extension plugins require extends field. */
|
||||
function validateExtension(m: PluginManifest): string[] {
|
||||
if (m.type !== "extension") return [];
|
||||
|
||||
if (!Array.isArray(m.extends) || m.extends.length === 0) {
|
||||
return ["Extension plugins require a non-empty extends array"];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/** Validate a plugin manifest against all rules. */
|
||||
export function validateManifest(manifest: PluginManifest): ValidationResult {
|
||||
const errors = [
|
||||
...validateBaseFields(manifest),
|
||||
...validateExtension(manifest),
|
||||
];
|
||||
|
||||
// Format-specific validation (only if base format is valid)
|
||||
if (VALID_FORMATS.includes(manifest.format as typeof VALID_FORMATS[number])) {
|
||||
switch (manifest.format) {
|
||||
case "declarative":
|
||||
errors.push(...validateDeclarative(manifest));
|
||||
break;
|
||||
case "static":
|
||||
errors.push(...validateStatic(manifest));
|
||||
break;
|
||||
case "bundle":
|
||||
errors.push(...validateBundle(manifest));
|
||||
break;
|
||||
// Extension plugins require extends
|
||||
if (manifest.type === "extension") {
|
||||
if (!Array.isArray(manifest.extends) || manifest.extends.length === 0) {
|
||||
errors.push("Extension plugins require a non-empty extends array");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,4 @@
|
||||
* Used by the status endpoint to always report these as "installed"
|
||||
* even when they haven't been installed via the marketplace flow.
|
||||
*/
|
||||
export const BUILT_IN_PLUGIN_IDS = [
|
||||
"aviation",
|
||||
"maritime",
|
||||
"military-aviation",
|
||||
"wildfire",
|
||||
"camera",
|
||||
"borders",
|
||||
"osm-search",
|
||||
] as const;
|
||||
export const BUILT_IN_PLUGIN_IDS = [] as const;
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Marketplace plugins automatically installed on fresh instances.
|
||||
*
|
||||
* These provide a rich out-of-the-box experience — the globe looks alive
|
||||
* from the very first load. Users can uninstall any of these afterwards.
|
||||
*
|
||||
* All core plugins are now installed via marketplace defaults.
|
||||
*/
|
||||
export const DEFAULT_PLUGIN_IDS = [
|
||||
"aviation",
|
||||
"maritime",
|
||||
"military-aviation",
|
||||
"wildfire",
|
||||
"camera",
|
||||
"borders",
|
||||
"osm-search",
|
||||
"earthquakes",
|
||||
"satellite",
|
||||
"daynight",
|
||||
"conflict-zones",
|
||||
"volcanoes",
|
||||
"airports",
|
||||
] as const;
|
||||
@@ -0,0 +1,193 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Mocks — must be declared before importing the module under test
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const mockFindUnique = vi.fn();
|
||||
const mockCount = vi.fn();
|
||||
const mockUpsert = vi.fn();
|
||||
|
||||
vi.mock("../db", () => ({
|
||||
prisma: {
|
||||
setting: { findUnique: (...a: any[]) => mockFindUnique(...a), upsert: (...a: any[]) => mockUpsert(...a) },
|
||||
installedPlugin: { count: (...a: any[]) => mockCount(...a) },
|
||||
},
|
||||
}));
|
||||
|
||||
const mockUpsertPlugin = vi.fn();
|
||||
vi.mock("./repository", () => ({ upsertPlugin: (...a: any[]) => mockUpsertPlugin(...a) }));
|
||||
|
||||
const mockValidateManifest = vi.fn();
|
||||
vi.mock("@/core/plugins/validateManifest", () => ({
|
||||
validateManifest: (...a: any[]) => mockValidateManifest(...a),
|
||||
}));
|
||||
|
||||
const mockGetVerifiedPluginIds = vi.fn();
|
||||
vi.mock("./registryClient", () => ({
|
||||
getVerifiedPluginIds: (...a: any[]) => mockGetVerifiedPluginIds(...a),
|
||||
}));
|
||||
|
||||
let mockIsDemo = false;
|
||||
vi.mock("@/core/edition", () => ({ get isDemo() { return mockIsDemo; } }));
|
||||
|
||||
// Mock global fetch for marketplace API calls
|
||||
const mockFetch = vi.fn();
|
||||
vi.stubGlobal("fetch", mockFetch);
|
||||
|
||||
import { seedDefaultPlugins } from "./seedDefaultPlugins";
|
||||
import { DEFAULT_PLUGIN_IDS } from "./defaultPlugins";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helpers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function fakeManifest(id: string) {
|
||||
return {
|
||||
id,
|
||||
name: id,
|
||||
version: "1.0.0",
|
||||
format: "bundle",
|
||||
entry: `https://unpkg.com/wwv-plugin-${id}@1.0.0/dist/frontend.mjs`,
|
||||
npmPackage: `wwv-plugin-${id}`,
|
||||
rendering: { type: "point", color: "#ff0000", size: 6 },
|
||||
};
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Tests
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe("seedDefaultPlugins", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
mockIsDemo = false;
|
||||
delete process.env.WWV_SKIP_DEFAULT_PLUGINS;
|
||||
|
||||
// Defaults: not seeded, no existing plugins, manifests valid
|
||||
mockFindUnique.mockResolvedValue(null);
|
||||
mockCount.mockResolvedValue(0);
|
||||
mockGetVerifiedPluginIds.mockResolvedValue(new Set(DEFAULT_PLUGIN_IDS));
|
||||
mockValidateManifest.mockReturnValue({ valid: true, errors: [] });
|
||||
mockUpsertPlugin.mockResolvedValue({});
|
||||
mockUpsert.mockResolvedValue({});
|
||||
|
||||
mockFetch.mockImplementation(async (url: string) => ({
|
||||
ok: true,
|
||||
json: async () => {
|
||||
const match = url.match(/plugins\/(.+)$/);
|
||||
return match ? fakeManifest(match[1]) : {};
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
it("seeds all default plugins on a fresh install", async () => {
|
||||
await seedDefaultPlugins();
|
||||
|
||||
expect(mockUpsertPlugin).toHaveBeenCalledTimes(DEFAULT_PLUGIN_IDS.length);
|
||||
for (const id of DEFAULT_PLUGIN_IDS) {
|
||||
expect(mockUpsertPlugin).toHaveBeenCalledWith(
|
||||
id,
|
||||
"1.0.0",
|
||||
expect.stringContaining(`"id":"${id}"`),
|
||||
);
|
||||
}
|
||||
|
||||
// Guard row written
|
||||
expect(mockUpsert).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
where: { key: "defaults_seeded" },
|
||||
create: { key: "defaults_seeded", value: "true" },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("skips immediately when already seeded", async () => {
|
||||
mockFindUnique.mockResolvedValue({ key: "defaults_seeded", value: "true" });
|
||||
|
||||
await seedDefaultPlugins();
|
||||
|
||||
expect(mockUpsertPlugin).not.toHaveBeenCalled();
|
||||
expect(mockFetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("marks seeded without installing when plugins already exist", async () => {
|
||||
mockCount.mockResolvedValue(3);
|
||||
|
||||
await seedDefaultPlugins();
|
||||
|
||||
expect(mockUpsertPlugin).not.toHaveBeenCalled();
|
||||
// Guard row still written
|
||||
expect(mockUpsert).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
where: { key: "defaults_seeded" },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("handles marketplace API failure gracefully", async () => {
|
||||
mockFetch.mockRejectedValue(new Error("Network error"));
|
||||
|
||||
await seedDefaultPlugins();
|
||||
|
||||
// Should NOT throw
|
||||
expect(mockUpsertPlugin).not.toHaveBeenCalled();
|
||||
// Guard row still written (fail-safe)
|
||||
expect(mockUpsert).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("skips when WWV_SKIP_DEFAULT_PLUGINS=true", async () => {
|
||||
process.env.WWV_SKIP_DEFAULT_PLUGINS = "true";
|
||||
|
||||
await seedDefaultPlugins();
|
||||
|
||||
expect(mockUpsertPlugin).not.toHaveBeenCalled();
|
||||
expect(mockFetch).not.toHaveBeenCalled();
|
||||
// Guard row written so it doesn't re-check
|
||||
expect(mockUpsert).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("skips entirely on demo edition", async () => {
|
||||
mockIsDemo = true;
|
||||
|
||||
await seedDefaultPlugins();
|
||||
|
||||
expect(mockUpsertPlugin).not.toHaveBeenCalled();
|
||||
expect(mockFetch).not.toHaveBeenCalled();
|
||||
expect(mockUpsert).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("skips individual plugins with invalid manifests", async () => {
|
||||
// Make the first plugin fail validation
|
||||
let callCount = 0;
|
||||
mockValidateManifest.mockImplementation(() => {
|
||||
callCount++;
|
||||
if (callCount === 1) return { valid: false, errors: ["missing field"] };
|
||||
return { valid: true, errors: [] };
|
||||
});
|
||||
|
||||
await seedDefaultPlugins();
|
||||
|
||||
// One fewer than total (the first was skipped)
|
||||
expect(mockUpsertPlugin).toHaveBeenCalledTimes(DEFAULT_PLUGIN_IDS.length - 1);
|
||||
});
|
||||
|
||||
it("stamps trust from the verified registry", async () => {
|
||||
const firstId = DEFAULT_PLUGIN_IDS[0];
|
||||
// Only the first plugin is verified
|
||||
mockGetVerifiedPluginIds.mockResolvedValue(new Set([firstId]));
|
||||
|
||||
await seedDefaultPlugins();
|
||||
|
||||
// Check the first call has "verified"
|
||||
const firstCall = mockUpsertPlugin.mock.calls[0];
|
||||
expect(firstCall[0]).toBe(firstId);
|
||||
const firstManifest = JSON.parse(firstCall[2]);
|
||||
expect(firstManifest.trust).toBe("verified");
|
||||
|
||||
// Check a non-verified one
|
||||
const secondCall = mockUpsertPlugin.mock.calls[1];
|
||||
const secondManifest = JSON.parse(secondCall[2]);
|
||||
expect(secondManifest.trust).toBe("unverified");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,135 @@
|
||||
import { prisma } from "../db";
|
||||
import { isDemo } from "@/core/edition";
|
||||
import { DEFAULT_PLUGIN_IDS } from "./defaultPlugins";
|
||||
import { upsertPlugin } from "./repository";
|
||||
import { validateManifest } from "@/core/plugins/validateManifest";
|
||||
import { getVerifiedPluginIds } from "./registryClient";
|
||||
|
||||
const MARKETPLACE_URL =
|
||||
process.env.NEXT_PUBLIC_MARKETPLACE_URL ||
|
||||
"https://marketplace.worldwideview.dev";
|
||||
|
||||
/**
|
||||
* Seed default marketplace plugins on a fresh install.
|
||||
*
|
||||
* Runs once per instance lifecycle — an idempotent guard
|
||||
* (`defaults_seeded` in the Setting table) prevents re-runs.
|
||||
*
|
||||
* Like the "sample data" that ships with a new app: the seeder
|
||||
* writes records to the database on first boot, then never runs again.
|
||||
*
|
||||
* Errors are logged but never thrown — a failed seed must never
|
||||
* block the application from starting.
|
||||
*/
|
||||
export async function seedDefaultPlugins(): Promise<void> {
|
||||
try {
|
||||
// Demo has its own mechanism (NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS)
|
||||
if (isDemo) return;
|
||||
|
||||
// Opt-out for power users deploying fresh instances
|
||||
if (process.env.WWV_SKIP_DEFAULT_PLUGINS === "true") {
|
||||
await markSeeded();
|
||||
return;
|
||||
}
|
||||
|
||||
// Idempotent guard — already seeded?
|
||||
const guard = await prisma.setting.findUnique({
|
||||
where: { key: "defaults_seeded" },
|
||||
});
|
||||
if (guard) return;
|
||||
|
||||
// Not truly fresh if plugins already exist
|
||||
const existing = await prisma.installedPlugin.count();
|
||||
if (existing > 0) {
|
||||
await markSeeded();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(
|
||||
`[DefaultPlugins] Fresh install detected — seeding ${DEFAULT_PLUGIN_IDS.length} default plugins…`,
|
||||
);
|
||||
|
||||
const verified = await getVerifiedPluginIds();
|
||||
let installed = 0;
|
||||
|
||||
for (const pluginId of DEFAULT_PLUGIN_IDS) {
|
||||
try {
|
||||
const manifest = await fetchManifest(pluginId);
|
||||
if (!manifest) continue;
|
||||
|
||||
// Server-side trust stamping
|
||||
manifest.trust = verified.has(pluginId)
|
||||
? "verified"
|
||||
: "unverified";
|
||||
|
||||
// Reconstruct CDN entry for npm-distributed plugins
|
||||
if (manifest.npmPackage) {
|
||||
const ver = manifest.version || "1.0.0";
|
||||
manifest.format = "bundle";
|
||||
manifest.entry = `https://unpkg.com/${manifest.npmPackage}@${ver}/dist/frontend.mjs`;
|
||||
}
|
||||
|
||||
const validation = validateManifest(manifest);
|
||||
if (!validation.valid) {
|
||||
console.warn(
|
||||
`[DefaultPlugins] Skipping ${pluginId}: ${validation.errors.join(", ")}`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
await upsertPlugin(
|
||||
pluginId,
|
||||
manifest.version || "1.0.0",
|
||||
JSON.stringify(manifest),
|
||||
);
|
||||
installed++;
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
`[DefaultPlugins] Failed to seed ${pluginId}:`,
|
||||
err,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
await markSeeded();
|
||||
console.log(
|
||||
`[DefaultPlugins] Seeded ${installed}/${DEFAULT_PLUGIN_IDS.length} plugins`,
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("[DefaultPlugins] Seeder failed:", err);
|
||||
// Never throw — seeding failure must not block the app
|
||||
}
|
||||
}
|
||||
|
||||
/** Fetch a plugin manifest from the marketplace API. */
|
||||
async function fetchManifest(
|
||||
pluginId: string,
|
||||
): Promise<Record<string, any> | null> {
|
||||
try {
|
||||
const res = await fetch(`${MARKETPLACE_URL}/api/plugins/${pluginId}`);
|
||||
if (!res.ok) {
|
||||
console.warn(
|
||||
`[DefaultPlugins] Marketplace returned ${res.status} for ${pluginId}`,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
const data = await res.json();
|
||||
if (!data.id) data.id = pluginId;
|
||||
return data;
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
`[DefaultPlugins] Network error fetching ${pluginId}:`,
|
||||
err,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Write the idempotent guard row. */
|
||||
async function markSeeded(): Promise<void> {
|
||||
await prisma.setting.upsert({
|
||||
where: { key: "defaults_seeded" },
|
||||
update: { value: "true" },
|
||||
create: { key: "defaults_seeded", value: "true" },
|
||||
});
|
||||
}
|
||||
@@ -20,7 +20,7 @@ export const cameraProxyLimiter = new RateLimiter({
|
||||
/** /api/marketplace/install-redirect — prevents install spam. */
|
||||
export const installLimiter = new RateLimiter({
|
||||
windowMs: 60_000,
|
||||
maxRequests: 10,
|
||||
maxRequests: 60,
|
||||
});
|
||||
|
||||
/** /api/marketplace/grant-token — prevents JWT generation spam. */
|
||||
@@ -32,7 +32,7 @@ export const grantTokenLimiter = new RateLimiter({
|
||||
/** /api/marketplace/status, install, uninstall — general marketplace API. */
|
||||
export const marketplaceApiLimiter = new RateLimiter({
|
||||
windowMs: 60_000,
|
||||
maxRequests: 20,
|
||||
maxRequests: 60,
|
||||
});
|
||||
|
||||
/** /api/auth/[...nextauth] — prevents credential brute-force. */
|
||||
|
||||
Reference in new issue
Block a user