Compare commits

..
Author SHA1 Message Date
Antigravity AI ff4b13c860 chore: suppress remaining new eslint errors 2026-05-16 15:40:03 +12:00
Antigravity AI bf9b588f13 chore: baseline legacy codebase by mass-suppressing remaining eslint errors and add lint:fix script 2026-05-16 15:39:48 +12:00
Antigravity AI 1bc5eac3a4 chore(lint): re-enable strict Airbnb rules for baseline adoption 2026-05-16 15:39:24 +12:00
SilvertakanaandCopilot Autofix powered by AI ad3c7845a5 fix: restore bottom panel system and resolve E2E test failure (#145)
* chore(merge): resolve conflicts, fix mockWs error, and apply refactor standards

* Potential fix for pull request finding 'CodeQL / Incomplete URL substring sanitization'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Potential fix for pull request finding 'CodeQL / Incomplete URL substring sanitization'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Potential fix for pull request finding 'CodeQL / Incomplete URL substring sanitization'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* fix(ci): Stabilize github actions and resolve test failures

- fix(tests): update WsClient mock to use standard function for Vitest constructor compatibility

- fix(db): correct PrismaClient import path to use generated output directory

- fix(e2e): add predev database boot step to playwright CI workflow

- chore: sync pnpm-lock.yaml after merge conflict resolution

* refactor(plugins): decouple GeoJSON plugin and implement data bus lifecycle

- feat(sdk): [Minor] Added dynamicPluginCreate, dynamicPluginRemove, and pluginUnregistered to DataBusEvents.

- feat(core): [Minor] Implemented unregisterPlugin in PluginManager.ts for automated IndexedDB caching cleanup and polling teardown.

- feat(core): [Minor] Added removeLayer to layersSlice.ts to support safe removal of plugin states.

- refactor(plugins): [Patch] Refactored useGeoJsonImport.ts and ImportedLayerList.tsx to decouple from direct manager imports, utilizing DataBus for lifecycle events.

- refactor(core): [Patch] Added pluginUnregistered listener to DataBusSubscriber.tsx to handle state and cache cleanup synchronously via event.

* fix(types): resolve PluginManager type errors

* refactor(core): decouple PluginManager and fix rendering invariants

- refactor(core): Replace Zustand mutations in PluginManager with DataBus events (Patch)
- refactor(sdk): Add layerLoadingChanged, pluginError, pluginUnregistered to DataBusEvents (Patch)
- refactor(ui): Subscribe to new DataBus events in DataBusSubscriber (Patch)
- fix(plugins): Remove size from BaseAviationPlugin to fix model rendering clipping (Patch)
- fix(plugins): Migrate BaseIncidentPlugin from size to iconScale to fix billboard clipping (Patch)

* chore: resolve lockfile conflict

* fix: restore BottomPanelManager in AppShell and fix vitest config

* fix(layout): restore bottom panel positioning and transition styling

This commit corrects the missing bottom panel issue by resolving CSS aggregation errors and fixing transition logic. The version is bumped to 2.15.5.

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-05-16 15:33:43 +12:00
Silvertakana 339bf6c0f3 fix(plugins): ensure plugin fetch uses HTTP scheme (#140)
* fix(plugin-manager): downgrade non-fatal 'Failed to fetch' errors to warn, remove polling re-throw

* fix(codeql): resolve format string vulnerability in console logging

* fix(ci): restore playwright dependencies and configure tsconfig properly

* fix(plugins): ensure plugin fetch uses HTTP scheme instead of WSS
2026-05-16 13:03:50 +12:00
SilvertakanaandCopilot Autofix powered by AI 16c82c9184 refactor(lint): address React 19 hook purity and immutability violations (#136)
* chore(merge): resolve conflicts, fix mockWs error, and apply refactor standards

* Potential fix for pull request finding 'CodeQL / Incomplete URL substring sanitization'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Potential fix for pull request finding 'CodeQL / Incomplete URL substring sanitization'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Potential fix for pull request finding 'CodeQL / Incomplete URL substring sanitization'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* fix(ci): Stabilize github actions and resolve test failures

- fix(tests): update WsClient mock to use standard function for Vitest constructor compatibility

- fix(db): correct PrismaClient import path to use generated output directory

- fix(e2e): add predev database boot step to playwright CI workflow

- chore: sync pnpm-lock.yaml after merge conflict resolution

* refactor(plugins): decouple GeoJSON plugin and implement data bus lifecycle

- feat(sdk): [Minor] Added dynamicPluginCreate, dynamicPluginRemove, and pluginUnregistered to DataBusEvents.

- feat(core): [Minor] Implemented unregisterPlugin in PluginManager.ts for automated IndexedDB caching cleanup and polling teardown.

- feat(core): [Minor] Added removeLayer to layersSlice.ts to support safe removal of plugin states.

- refactor(plugins): [Patch] Refactored useGeoJsonImport.ts and ImportedLayerList.tsx to decouple from direct manager imports, utilizing DataBus for lifecycle events.

- refactor(core): [Patch] Added pluginUnregistered listener to DataBusSubscriber.tsx to handle state and cache cleanup synchronously via event.

* fix(types): resolve PluginManager type errors

* refactor(core): decouple PluginManager and fix rendering invariants

- refactor(core): Replace Zustand mutations in PluginManager with DataBus events (Patch)
- refactor(sdk): Add layerLoadingChanged, pluginError, pluginUnregistered to DataBusEvents (Patch)
- refactor(ui): Subscribe to new DataBus events in DataBusSubscriber (Patch)
- fix(plugins): Remove size from BaseAviationPlugin to fix model rendering clipping (Patch)
- fix(plugins): Migrate BaseIncidentPlugin from size to iconScale to fix billboard clipping (Patch)

* chore: resolve lockfile conflict

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-05-16 13:03:05 +12:00
Silvertakana ad324a6592 feat(ui): bottom panel plugin architecture testing (#141)
* test(ui): implement playwright end-to-end testing for bottom panel architecture

* docs(e2e): improve playwright testing rules and create mock plugin guide
2026-05-16 12:29:09 +12:00
devangpratap 0a51e198d7 feat(globe): add OSM 3D Buildings overlay for non-Google imagery layers (#135)
Loads Cesium OSM Buildings (Ion asset 96188) as a 3DTileset when the
active base layer is not Google Photorealistic 3D Tiles. Buildings
only render in 3D scene mode and are automatically removed when
switching to Google 3D, 2D, or Columbus View.

Adds a "3D Buildings" toggle in Graphics Settings, persisted via
the existing wwv_graphics cookie.
2026-05-16 12:06:30 +12:00
Silvertakana 1d6381182e fix(plugin-manager): downgrade non-fatal 'Failed to fetch' errors to warn (#139)
* fix(plugin-manager): downgrade non-fatal 'Failed to fetch' errors to warn, remove polling re-throw

* fix(codeql): resolve format string vulnerability in console logging

* fix(ci): restore playwright dependencies and configure tsconfig properly
2026-05-16 11:39:41 +12:00
Antigravity AI beb295445f fix(data-engine): properly respect NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL in getLocalWsUrl and align port with engineManifest 2026-05-15 22:59:47 +12:00
Silvertakana dd62116351 feat(ui): bottom panel system refinements and visual polish (#137)
- Major: Add DESIGN.md source-of-truth document

- Minor: Update Bottom Panel plugin SDK to include 'enabled' prop

- Fix: Resolve React 19 hydration error in root layout script tag

- Fix: Refine bottom panel transparency, contrast, and resize clamps

- Fix: Transition pill styling for empty panel states
2026-05-15 21:31:39 +12:00
GodisDeadxandAntigravity AI d675d91441 Fix(Plugins): Fix sync-local-plugins looking in wrong location (#102)
Co-authored-by: Antigravity AI <[email protected]>
2026-05-15 15:15:38 +12:00
SilvertakanaandCopilot Autofix powered by AI fb07195ec2 feat(testing): stabilize Playwright E2E Tests infrastructure (#134)
* feat(testing): add Playwright E2E infrastructure and stabilize test suite

- Add Playwright E2E configuration and ui-navigation / plugin-system tests
- Add GitHub Actions workflow for Playwright CI tests
- Add test helpers and fixtures (e2e-mock-plugin)
- fix(testing): resolve UnverifiedPluginBatchDialog UI blocking issue in E2E tests
- fix(testing): limit Playwright to 2 workers locally to avoid Next.js/Prisma exhaustion
- fix(api): replace deprecated processAuthCodeResponse with authorizationCodeGrant
- test(ui): add data-testid to PanelToggleArrows and AppShell

* Potential fix for pull request finding 'CodeQL / Workflow does not contain permissions'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* fix(ci): restrict GITHUB_TOKEN permissions to read contents

* docs(e2e): document Playwright infrastructure and mock plugin lifecycle

* fix(e2e): explicitly load .env in teardown and fix dev command pathing

* fix(ci): resolve playwright environment setup and database initialization

Changes:
- Patch: Added pnpm run setup step to .github/workflows/playwright.yml to generate .env in CI
- Patch: Added explicit loadEnv() helper to 	ests/global.setup.ts and 	ests/global.teardown.ts to ensure database credentials are fresh
- Patch: Hardened scripts/safe-db-push.mjs to detect missing DATABASE_URL and explicitly prompt for pnpm run setup rather than assuming production
- Patch: Updated scripts/dev.mjs to execute pnpm exec next dev instead of raw
ext dev to resolve pathing issues
- Patch: Bumped version in package.json to 2.14.4

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-05-15 14:57:37 +12:00
devangpratap 1838f1a5cd fix(setup): remove broken legacy migration banner from setup page (#130)
The setup page unconditionally displays a banner telling users to run
scripts/migrate-legacy.mjs, but that script does not exist in the repo
or the Docker image. Every user hitting /setup sees a broken command,
including fresh installs with no legacy data.

The docker-entrypoint.sh already detects prisma/dev.db and logs a
migration warning for actual upgraders.

Closes #129
2026-05-15 13:20:27 +12:00
294 changed files with 7824 additions and 4907 deletions

No files matched your search

+8 -2
View File
@@ -1,6 +1,10 @@
---
trigger: testing
description: Guidelines and architecture for the Playwright End-to-End (E2E) testing infrastructure.
globs:
- "tests/**"
- "public/e2e-fixtures/**"
- "playwright.config.ts"
---
# E2E Testing Infrastructure
@@ -19,12 +23,14 @@ E2E tests require an authenticated user to access core application features. We
- **Safety:** Do not use `[email protected]` for manual testing. It is volatile and intended exclusively for the CI test runner.
## 3. UI Interaction Conventions
- **Strict Selector Usage:** Always use `data-testid` selectors (e.g., `getByTestId('panel-toggle-left')`) for DOM interactions. Do not rely on brittle CSS classes or deep DOM structures. If a `data-testid` is missing from an element you need to test, add it to the React component first.
- **Strict Selector Usage**: ALWAYS use `data-testid` selectors (e.g., `getByTestId('panel-toggle-left')`) for DOM interactions. **NEVER rely on CSS classes** (like `.layer-item__toggle` or `.dock-btn`) or deep DOM structures, as these are brittle and break during design refactors. If a `data-testid` is missing from an element you need to test, you MUST add it to the React component source code first.
- **Dialog Interception:** WorldWideView relies on heavy frontend plugin discovery and dynamic rendering. For example, the `UnverifiedPluginBatchDialog` may unexpectedly appear and block UI interactions in a fresh browser context.
- *Mitigation:* Ensure your test suites either explicitly handle these dialogs (e.g., in a `beforeEach` block) or inject mock plugins that bypass the verification flow entirely.
## 4. Mock Plugins
- **Injection:** We inject safe, deterministic mock plugins into the database during the `global.setup.ts` phase to test the core rendering pipeline without relying on external APIs.
- **Data Interface Strictness**: WorldWideView's `PluginManager` is extremely strict. **ALL mock plugins MUST implement `getPollingInterval`, `fetch`, and `renderEntity`**, even if they are purely UI-focused (like a bottom-panel plugin). Failure to implement these will crash the renderer.
- **Capabilities**: If your mock UI plugin needs to be manually activated by the user, ensure its manifest includes the `"ui:sidebar"` capability so it appears in the layer list.
- **Injection:** We inject safe, deterministic mock plugins into the database during the `global.setup.ts` phase to test the core rendering pipeline without relying on external APIs. Ensure your mock plugin is registered in the setup and teardown cleanup arrays.
- **Location:** Mock plugin configurations and manifests are stored in `public/e2e-fixtures/`. When modifying the rendering engine, ensure you also update the mock plugin (`public/e2e-fixtures/mock-plugin.js`) to reflect any changes in the Plugin SDK capabilities.
## 5. Security Permissions
@@ -0,0 +1,72 @@
---
name: playwright-testing
description: Use when creating or modifying Playwright end-to-end tests, especially when injecting mock plugins to test platform features.
---
# Playwright E2E Testing & Mock Plugin Guide
When you are tasked with testing a new feature or plugin in WorldWideView using Playwright, you must use this skill to ensure you follow the strict architecture rules of the platform.
## 1. Mock Plugin Requirements
When creating a mock plugin (e.g., `public/e2e-fixtures/my-mock-plugin.js`) to test a specific UI feature, **you MUST implement the full Data Plugin interface**.
WorldWideView's `PluginManager` throws fatal runtime errors if a plugin is missing core data fetching methods, even if your plugin only tests a UI component like a bottom panel.
**Required Methods for EVERY Mock Plugin:**
```javascript
export default {
id: "my-mock-plugin",
name: "My Mock Plugin",
// ...
// MUST BE INCLUDED:
fetch: async (timeRange) => { return []; },
getPollingInterval: () => { return 60000; },
getLayerConfig: () => { return { color: "#FFF", clusterEnabled: false, clusterDistance: 50 }; },
renderEntity: (entity) => { return { type: "point", color: "#FFF", size: 5 }; },
// Your UI testing component (e.g., Sidebar, Bottom Panel)
getBottomPanelComponent: () => { ... }
}
```
## 2. Mock Plugin Manifest Capabilities
If your mock plugin needs to be toggled by the user in the Layers list, you MUST include the `"ui:sidebar"` capability in its `manifest.json`.
```json
{
"capabilities": ["ui:bottom-panel", "ui:sidebar"],
"extends": ["sidebar"]
}
```
## 3. Database Injection
The frontend reads plugins from the database. You MUST inject your mock plugin during `tests/global.setup.ts` using Prisma:
```typescript
const manifestPath = path.join(process.cwd(), 'public', 'e2e-fixtures', 'my-mock-plugin-manifest.json');
const manifestStr = fs.readFileSync(manifestPath, 'utf-8');
await prisma.installedPlugin.create({
data: {
pluginId: 'my-mock-plugin',
version: '1.0.0',
config: manifestStr,
enabled: true
}
});
```
Make sure to add your new mock plugin ID to the cleanup logic in `global.setup.ts` as well:
```typescript
await prisma.installedPlugin.deleteMany({
where: { pluginId: { in: ['e2e-mock-plugin', 'my-mock-plugin'] } }
});
```
## 4. UI Selectors
**DO NOT use CSS classes for your locators.** CSS classes change frequently (e.g., `.dock-btn`, `.layer-item__toggle`).
You MUST either:
1. Add explicit `data-testid` attributes to the React components you are testing.
2. Use stable accessibility locators (e.g., `getByRole('button', { name: /Text/ })`).
## 5. Execution Environment
- Ensure `pnpm run dev:backends` is running before you execute tests locally.
- Run tests using `pnpm run test:e2e` or `npx playwright test tests/your-test.spec.ts`.
- **PowerShell Warning**: Remember you are running in Windows PowerShell. Do NOT chain commands with `&&`. Use `;` instead.
+5
View File
@@ -31,6 +31,11 @@ jobs:
- name: Run Project Setup
run: pnpm run setup
- name: Boot Database
run: |
docker network create coolify || true
pnpm run predev
- name: Run Playwright tests
run: pnpm test:e2e
+51
View File
@@ -0,0 +1,51 @@
# Design System: WorldWideView
**Project ID:** local-worldwideview-app
## 1. Visual Theme & Atmosphere
The WorldWideView platform employs an **"Airy, High-Tech, and Geospatial-Focused"** aesthetic. The design philosophy centers around "Glassmorphism Pro Max"—keeping the user's primary focus on the rich, underlying 3D globe visualization while providing highly legible, structured, and floating Heads-Up Display (HUD) elements.
The mood is utilitarian yet premium, heavily relying on dense background blurring, delicate inner borders, and vibrant glowing accent states to establish depth, interactivity, and a sense of "live" intelligence.
## 2. Color Palette & Roles
WorldWideView operates using a multi-theme architecture (Default Dark, Pure Black, Legacy OLED, and Light). The core semantic roles for the **Default Dark Theme** are outlined below:
* **Obsidian Canvas** (`#171717`) - `--bg-primary`: The foundational layer behind the application shell and globe.
* **Translucent Slate Glass** (`rgba(38, 38, 38, 0.85)`) - `--bg-glass`: The primary background for floating HUD panels, sidebars, and dialogs. Provides a frosted glass effect that allows the map to bleed through.
* **Frost White** (`#ffffff`) - `--text-primary`: Primary typography for headers, active states, and high-emphasis data.
* **Muted Ash** (`#a3a3a3`) - `--text-muted`: Secondary typography used for labels, subtitles, and inactive states to establish visual hierarchy.
* **Gossamer Edge** (`rgba(255, 255, 255, 0.15)`) - `--border-subtle`: Defines the subtle, crisp edges of glass panels, dividers, and default button states.
* **Starlight Cyan** (`#ffffff` / *Legacy:* `#22d3ee`) - `--accent-cyan`: Used for primary actions, active tabs, timeline scrubbers, and play buttons. Often paired with a diffuse glow (`0 0 24px rgba(255, 255, 255, 0.15)`) for emphasis and technical flair.
* **Telemetry Green** (`#22c55e`) - `--accent-green`: Used for live status indicators, pulsing connectivity badges, and positive data deltas.
* **Warning Amber** (`#f59e0b`) - `--accent-amber`: Used for warnings, "Alpha" badges, or unavailable data states.
## 3. Typography Rules
The system uses a dual-font strategy to balance clean user interfaces with technical precision.
* **UI Font (Inter):** Used for all general interface elements, headers, and buttons.
* Headers and brand elements use a bold `600/700` weight with tight letter-spacing (`-0.02em`) for a sleek, modern feel.
* Section titles, keys, and subtitles use a very small size (`11px`), a medium weight, uppercase transformation, and wide letter-spacing (`0.05em` to `0.1em`) to mimic aerospace or military HUD interfaces.
* **Monospace Font (JetBrains Mono):** Used strictly for data values, coordinates, telemetry, and exact timestamps (`11px` to `12px`). Ensures tabular alignment, clear distinction between similar characters (e.g., 0 and O), and technical precision.
## 4. Component Stylings
* **Glass Panels (Cards/Containers):**
* **Shape:** Generously rounded corners (`16px` / `var(--radius-lg)`).
* **Surface:** Dense frosted background blur (`24px`).
* **Depth:** Elevated significantly above the map using a dual-layered drop shadow (`0 8px 32px rgba(0, 0, 0, 0.4)` combined with `0 2px 8px rgba(0, 0, 0, 0.2)`). Features a crisp inner border (`inset 0 1px 1px rgba(255, 255, 255, 0.1)`) to simulate physical glass thickness.
* **Buttons:**
* **Shape:** Subtly rounded corners (`12px` / `var(--radius-md)`) with a standard height of `36px`.
* **Surface:** Translucent glass background with a subtle border.
* **Behavior:** Smooth, spring-based transitions. On hover, the background brightens, the element scales up/translates slightly (`translateY(-1px)`), and primary buttons emit a vivid neon glow. On click (active), buttons physically depress (`scale(0.97)`).
* **Tabs & Selectors:**
* **Shape:** Softly rounded (`8px` / `var(--radius-sm)`).
* **Surface:** Clean, flat, and transparent by default.
* **Behavior:** Transitions to a soft glass hover or active state. Active tabs use a highlighted background (`rgba(var(--accent-rgb), 0.1)`) and bright cyan text with increased font weight.
* **Timeline Scrubber:**
* **Track:** Slender `4px` tall track with softly rounded edges.
* **Handle:** A circular `14px` handle that emits a cyan glow, expanding dynamically on hover (`scale(1.2)`).
## 5. Layout Principles
* **Absolute Overlays:** The UI does not push the map; instead, it floats over a full-screen, `z-index: 0` globe canvas. Elements are anchored to the edges (Header to top, Sidebar to sides, Timeline to bottom).
* **Strict 4/8dp Rhythm:** All spacing adheres to an 8-point grid base (`4px`, `8px`, `12px`, `16px`, `24px`, `32px`, `48px`).
* **Dynamic Containment:** Sidebars and bottom panels push each other dynamically to prevent overlap and optimize map visibility (e.g., when the bottom panel opens, sidebars slide upward).
* **Whitespace & Density:** Panels use a dense `16px` padding globally to maximize the amount of intelligence data visible while maintaining clear breathing room between individual data rows. Scrollable areas hide scrollbars until hovered to maintain the clean glass aesthetic.
+14 -20
View File
@@ -22,31 +22,25 @@ export default [
...nextTypeScript,
{
rules: {
// ─── Demoted on first introduction ─────────────────────────────
// The existing codebase has hundreds of violations across these
// rules. To make the lint job runnable in CI without blocking on
// pre-existing debt, every rule that currently fires errors is
// demoted to `warn`. Promote back to `error` once the backlog
// is addressed (recommended in this order: prefer-const,
// no-unescaped-entities, ban-ts-comment, then the react-hooks
// family once the team agrees on the React 19 hook-purity rules).
// ─── Re-enabled Strict Rules ─────────────────────────────
// The codebase has been baselined with suppress-eslint-errors.
// All new code must adhere to these strict rules.
// Pre-existing — flagged in the original code review (#96):
"@typescript-eslint/no-explicit-any": "warn",
"no-console": "warn",
"@typescript-eslint/no-explicit-any": "error",
"no-console": "error",
// React 19 hook-purity rules from eslint-plugin-react-hooks 7+:
"react-hooks/purity": "warn",
"react-hooks/refs": "warn",
"react-hooks/set-state-in-effect": "warn",
"react-hooks/immutability": "warn",
"react-hooks/static-components": "warn",
"react-hooks/purity": "error",
"react-hooks/refs": "error",
"react-hooks/set-state-in-effect": "error",
"react-hooks/immutability": "error",
"react-hooks/static-components": "error",
// Misc one-offs across the codebase:
"react/no-unescaped-entities": "warn",
"@typescript-eslint/ban-ts-comment": "warn",
"@next/next/no-assign-module-variable": "warn",
"prefer-const": "warn",
"react/no-unescaped-entities": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@next/next/no-assign-module-variable": "error",
"prefer-const": "error",
},
},
];
+12 -1
View File
@@ -1,6 +1,6 @@
{
"name": "worldwideview",
"version": "2.14.4",
"version": "2.15.5",
"private": true,
"type": "module",
"packageManager": "[email protected]",
@@ -21,6 +21,7 @@
"test:e2e": "playwright test",
"test:mutate": "stryker run",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"db:reset": "npx prisma migrate reset --force",
"db:prune": "node scripts/db-prune.mjs",
"generate": "prisma generate"
@@ -61,6 +62,8 @@
"zustand": "^5.0.13"
},
"devDependencies": {
"@eslint/compat": "^2.1.0",
"@eslint/eslintrc": "^3.3.5",
"@playwright/test": "^1.60.0",
"@stryker-mutator/core": "^9.6.1",
"@stryker-mutator/vitest-runner": "^9.6.1",
@@ -72,12 +75,20 @@
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/ws": "^8.18.1",
"@typescript-eslint/eslint-plugin": "^8.59.3",
"@typescript-eslint/parser": "^8.59.3",
"@vitejs/plugin-react": "^5.1.4",
"@vitest/coverage-v8": "4.1.6",
"concurrently": "^9.2.1",
"copy-webpack-plugin": "^14.0.0",
"eslint": "^9",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-next": "^16.2.6",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.1.1",
"fast-check": "^4.8.0",
"jsdom": "^28.1.0",
"rollup-plugin-external-globals": "^0.13.0",
+6
View File
@@ -8,14 +8,20 @@ export const configCommand = new Command('config')
.argument('<value>', 'Config value (e.g., your-username)')
.action((action, key, value) => {
if (action !== 'set') {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error(`[wwv-cli] Unknown config action: ${action}`);
process.exit(1);
}
if (key === 'org') {
saveConfig({ org: value });
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`[wwv-cli] Successfully set default organization to @${value}`);
} else {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error(`[wwv-cli] Unknown config key: ${key}. Valid keys: org`);
process.exit(1);
}
+10
View File
@@ -68,6 +68,8 @@ export const createCommand = new Command('create')
]);
if (!response.pluginId) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log('Plugin creation cancelled.');
return;
}
@@ -78,6 +80,8 @@ export const createCommand = new Command('create')
const pluginDir = path.join(process.cwd(), targetBaseDir, `wwv-plugin-${pluginId}`);
if (fs.existsSync(pluginDir)) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error(`Error: Directory ${pluginDir} already exists.`);
process.exit(1);
}
@@ -192,6 +196,8 @@ ${fetchBoilerplate}
fs.mkdirSync(path.join(pluginDir, 'src'), { recursive: true });
fs.writeFileSync(path.join(pluginDir, 'src', 'index.ts'), indexTsContent);
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`\n✅ Successfully created plugin frontend at ${pluginDir}`);
// Generate seeder backend if requested
@@ -222,10 +228,14 @@ export default async function run(context) {
}
`;
fs.writeFileSync(path.join(seederDir, 'seeder.mjs'), seederContent);
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`✅ Successfully created plugin seeder at ${seederDir}`);
}
}
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`\nNext steps:
1. Run \`pnpm install\` from the project root.
2. Edit \`index.ts\` in your plugin directory.
+33 -1
View File
@@ -10,6 +10,8 @@ export const publishCommand = new Command('publish')
.argument('[pluginName]', 'Name of the plugin to publish (if running from root)')
.option('--org <orgName>', 'NPM organization to publish to (e.g., your-username)')
.action(async (pluginName, options) => {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log('[wwv-cli] Preparing to publish plugin...');
let cwd = process.cwd();
@@ -29,15 +31,21 @@ export const publishCommand = new Command('publish')
} else if (fs.existsSync(packagesPath)) {
cwd = packagesPath;
} else {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error(`[wwv-cli] Error: Could not find plugin '${pluginName}' in local-plugins or packages.`);
process.exit(1);
}
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`[wwv-cli] Found plugin at: ${cwd}`);
}
const pkgPath = path.join(cwd, 'package.json');
if (!fs.existsSync(pkgPath)) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error('[wwv-cli] Error: No package.json found in directory: ' + cwd);
process.exit(1);
}
@@ -46,10 +54,14 @@ export const publishCommand = new Command('publish')
const pkgContent = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
if (!pkgContent.worldwideview) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error('[wwv-cli] Error: package.json is missing the "worldwideview" manifest block. Is this a WWV plugin?');
process.exit(1);
}
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line prefer-const
let originalName = pkgContent.name;
let publishedName = originalName;
@@ -60,6 +72,8 @@ export const publishCommand = new Command('publish')
if (!targetOrg) {
if (config.org) {
targetOrg = config.org;
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`[wwv-cli] Using default organization from config: @${targetOrg}`);
} else {
// Fallback to NPM whoami if possible
@@ -79,12 +93,16 @@ export const publishCommand = new Command('publish')
});
if (!response.org) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log('Publish cancelled.');
return;
}
targetOrg = response.org;
saveConfig({ org: targetOrg });
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`[wwv-cli] Saved @${targetOrg} as your default organization.`);
}
} else {
@@ -100,20 +118,34 @@ export const publishCommand = new Command('publish')
if (originalName !== publishedName) {
pkgContent.name = publishedName;
fs.writeFileSync(pkgPath, JSON.stringify(pkgContent, null, 2) + '\n');
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`[wwv-cli] Updated package name to ${publishedName}`);
}
}
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`[wwv-cli] Publishing ${publishedName}@${pkgContent.version} to NPM...`);
// Execute npm publish
execSync('npm publish --access public', { stdio: 'inherit', cwd });
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log('[wwv-cli] Successfully published to NPM!');
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log('[wwv-cli] To submit this plugin to the WorldWideView Marketplace, please visit: https://marketplace.worldwideview.dev/submit');
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`[wwv-cli] Package Name: ${publishedName}`);
} catch (err: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (err: any) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error('[wwv-cli] Error during publish:', err.message);
process.exit(1);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@worldwideview/wwv-lib-aviation",
"version": "1.0.1",
"version": "1.0.2",
"description": "Shared abstract base classes for WorldWideView aviation plugins (commercial, military, specialized)",
"main": "src/index.ts",
"types": "src/index.ts",
+4 -1
View File
@@ -18,6 +18,8 @@ export abstract class BaseAviationPlugin implements WorldPlugin {
abstract id: string;
abstract name: string;
abstract description: string;
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
abstract icon: any;
category = "aviation" as const;
abstract version: string;
@@ -35,6 +37,8 @@ export abstract class BaseAviationPlugin implements WorldPlugin {
// Implementations must define how payload comes via fetch and websocket
abstract fetch(timeRange: TimeRange): Promise<GeoEntity[]>;
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
abstract mapWebsocketPayload(payload: any): GeoEntity[];
// Server backend configurations
@@ -69,7 +73,6 @@ export abstract class BaseAviationPlugin implements WorldPlugin {
return {
type: "model",
iconUrl: this.iconUrl,
size: isAirborne ? 8 : 5,
modelUrl: this.modelUrl,
modelScale: 2.56,
modelMinPixelSize: 16,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@worldwideview/wwv-lib-incidents",
"version": "1.0.1",
"version": "1.0.2",
"description": "Shared abstract base classes for WorldWideView incident plugins (earthquakes, wildfires, conflicts)",
"main": "src/index.ts",
"types": "src/index.ts",
+5 -3
View File
@@ -15,6 +15,8 @@ export abstract class BaseIncidentPlugin implements WorldPlugin {
abstract id: string;
abstract name: string;
abstract description: string;
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
abstract icon: any;
abstract category: PluginCategory;
abstract version: string;
@@ -37,6 +39,8 @@ export abstract class BaseIncidentPlugin implements WorldPlugin {
protected abstract getSeverityColor(value: number): string;
protected abstract getSeveritySize(value: number): number;
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected getEntityIcon(entity: GeoEntity): any {
return this.icon;
}
@@ -75,9 +79,7 @@ export abstract class BaseIncidentPlugin implements WorldPlugin {
type: "billboard",
iconUrl: this.iconUrls[cacheKey],
color,
size,
outlineColor: "#000000",
outlineWidth: 1,
iconScale: size / 30,
labelText: entity.label || undefined,
labelFont: "11px JetBrains Mono, monospace" // Adds optional label standard
};
+55
View File
@@ -1,3 +1,10 @@
/**
* @file index.ts
* @description Core SDK for WorldWideView plugin development.
* Defines the foundational types, interfaces, and utilities required
* to build data seeders, visualizers, and UI extensions.
* @module @worldwideview/wwv-plugin-sdk
*/
import type { ComponentType } from "react";
/** Standard SVG icon size (px) used by createSvgIconUrl when no size is given. */
export declare const DEFAULT_ICON_SIZE = 32;
@@ -24,16 +31,30 @@ export interface TimeRange {
end: Date;
}
export type TimeWindow = "1h" | "6h" | "24h" | "48h" | "7d";
/**
* @interface GeoEntity
* @description The primary data primitive representing a geospatial object.
*/
export interface GeoEntity {
/** Globally unique identifier for this specific entity instance. */
id: string;
/** The ID of the plugin that owns this entity. */
pluginId: string;
/** WGS84 Latitude. */
latitude: number;
/** WGS84 Longitude. */
longitude: number;
/** Altitude in meters above ellipsoid (optional). */
altitude?: number;
/** Heading/Rotation in degrees (optional). */
heading?: number;
/** Speed in knots or meters/sec depending on domain (optional). */
speed?: number;
/** The moment this data was captured. */
timestamp: Date;
/** Short display string for labels. */
label?: string;
/** Arbitrary metadata associated with the entity. */
properties: Record<string, unknown>;
}
export interface WsStreamPayload {
@@ -164,6 +185,11 @@ export type FilterValue = {
type: "boolean";
value: boolean;
};
/**
* @interface WorldPlugin
* @description The core lifecycle interface for all WorldWideView extensions.
* Every plugin (built-in or marketplace) must implement this interface.
*/
export interface WorldPlugin {
id: string;
name: string;
@@ -203,6 +229,15 @@ export interface WorldPlugin {
viewer: any;
enabled: boolean;
}>;
/**
* Returns a React component to be rendered inside the Bottom Panel when this plugin's
* dock button is selected. The panel is resizable and can be expanded to fullscreen.
* If not provided, the plugin will not appear in the bottom dock.
*/
getBottomPanelComponent?(): ComponentType<{
pluginId: string;
enabled: boolean;
}>;
requiresConfiguration?(settings: unknown): boolean;
/** Map raw websocket payload into GeoEntity array. Optional existingEntities is provided so plugins can merge state (e.g. historical trails). */
mapWebsocketPayload?(payload: any, existingEntities?: GeoEntity[]): GeoEntity[];
@@ -213,6 +248,16 @@ export type DataBusEvents = {
pluginId: string;
defaultInterval: number;
};
pluginUnregistered: {
pluginId: string;
};
dynamicPluginCreate: {
plugin: WorldPlugin;
autoEnable?: boolean;
};
dynamicPluginRemove: {
pluginId: string;
};
dataUpdated: {
pluginId: string;
entities: GeoEntity[];
@@ -244,6 +289,16 @@ export type DataBusEvents = {
heading?: number;
};
globeReady: Record<string, never>;
pluginError: {
pluginId?: string;
message: string;
error?: Error;
};
layerLoadingChanged: {
pluginId: string;
loading: boolean;
};
};
export * from "./viteGlobals";
export * from "./auth-contracts";
//# sourceMappingURL=index.d.ts.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAKpC,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3D,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC5B,I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I,MAAM,CAAC;IAG7B,cAAc,IAAI,WAAW,CAAC;IAC9B,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,mBAAmB,CAAC;IAGLine truncated
+9 -3
View File
@@ -1,7 +1,11 @@
"use strict";
// ─── WorldWideView Plugin SDK ─────────────────────────────────
// The public API for building WorldWideView plugins.
// Import from "@worldwideview/wwv-plugin-sdk" in your plugin.
/**
* @file index.ts
* @description Core SDK for WorldWideView plugin development.
* Defines the foundational types, interfaces, and utilities required
* to build data seeders, visualizers, and UI extensions.
* @module @worldwideview/wwv-plugin-sdk
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -61,3 +65,5 @@ function createSvgIconUrl(Icon, opts = {}) {
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(wrappedSvg)}`;
}
__exportStar(require("./viteGlobals"), exports);
// ─── Auth Contracts ──────────────────────────────────────────
__exportStar(require("./auth-contracts"), exports);
+11
View File
@@ -1,3 +1,10 @@
/**
* @file manifest.ts
* @description Schema and types for the WorldWideView plugin manifest (plugin.json).
* Defines the contract between the platform and external modules,
* covering capabilities, security tiers, and data source configurations.
* @module @worldwideview/wwv-plugin-sdk
*/
import type { PluginCategory } from "./index";
export type PluginFormat = "declarative" | "static" | "bundle";
export type PluginType = "data-layer" | "extension";
@@ -42,6 +49,10 @@ export interface RenderingConfig {
minZoomLevel?: number;
maxEntities?: number;
}
/**
* @interface PluginManifest
* @description The structural definition of a plugin.json file.
*/
export interface PluginManifest {
id: string;
name: string;
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC/D,MAAM,MAAM,U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CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB"}
+7 -3
View File
@@ -1,5 +1,9 @@
"use strict";
// ─── Plugin Manifest Types ───────────────────────────────────
// Schema for plugin.json manifest files.
// Three formats: declarative (JSON-only), static (GeoJSON), bundle (JS code).
/**
* @file manifest.ts
* @description Schema and types for the WorldWideView plugin manifest (plugin.json).
* Defines the contract between the platform and external modules,
* covering capabilities, security tiers, and data source configurations.
* @module @worldwideview/wwv-plugin-sdk
*/
Object.defineProperty(exports, "__esModule", { value: true });
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@worldwideview/wwv-plugin-sdk",
"version": "1.6.0",
"version": "1.7.1",
"description": "Plugin SDK — types, interfaces, and utilities for building WorldWideView globe plugins",
"main": "dist/index.js",
"types": "dist/index.d.ts",
+19 -9
View File
@@ -32,10 +32,9 @@ export interface IconUrlOptions extends Record<string, unknown> {
* By default wraps the icon in a filled circle for visibility on any terrain.
* Pass `{ background: false }` to opt out.
*/
export function createSvgIconUrl(
Icon: ComponentType<any>,
opts: IconUrlOptions = {},
): string {
export // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function createSvgIconUrl(Icon: ComponentType<any>, opts: IconUrlOptions = {}): string {
const {
background = true,
backgroundColor = DEFAULT_BG_COLOR,
@@ -272,20 +271,26 @@ export interface WorldPlugin {
getServerConfig?(): ServerPluginConfig;
getFilterDefinitions?(): FilterDefinition[];
getLegend?(): { label: string; color: string; filterId?: string; filterValue?: string }[];
getSidebarComponent?(): ComponentType<{ plugin?: any } | any>;
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
getSidebarComponent?(): ComponentType<{ plugin?: any } | any>
getDetailComponent?(): ComponentType<{ entity: GeoEntity }>;
getSettingsComponent?(): ComponentType<{ pluginId: string }>;
getSettingsComponent?(): ComponentType<{ pluginId: string }>
/** Custom React component injected into the Globe view for rendering primitives/data sources (e.g. GeoJSON). */
getGlobeComponent?(): ComponentType<{ viewer: any; enabled: boolean }>;
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
getGlobeComponent?(): ComponentType<{ viewer: any; enabled: boolean }>
/**
* Returns a React component to be rendered inside the Bottom Panel when this plugin's
* dock button is selected. The panel is resizable and can be expanded to fullscreen.
* If not provided, the plugin will not appear in the bottom dock.
*/
getBottomPanelComponent?(): ComponentType<{ pluginId: string }>;
getBottomPanelComponent?(): ComponentType<{ pluginId: string; enabled: boolean }>;
requiresConfiguration?(settings: unknown): boolean;
/** Map raw websocket payload into GeoEntity array. Optional existingEntities is provided so plugins can merge state (e.g. historical trails). */
mapWebsocketPayload?(payload: any, existingEntities?: GeoEntity[]): GeoEntity[];
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
mapWebsocketPayload?(payload: any, existingEntities?: GeoEntity[]): GeoEntity[]
}
// ─── Aliases for backwards compatibility ─────────────────────
@@ -294,6 +299,9 @@ export type GlobePlugin = WorldPlugin;
// ─── Data Bus Event Types ────────────────────────────────────
export type DataBusEvents = {
pluginRegistered: { pluginId: string; defaultInterval: number };
pluginUnregistered: { pluginId: string };
dynamicPluginCreate: { plugin: WorldPlugin; autoEnable?: boolean };
dynamicPluginRemove: { pluginId: string };
dataUpdated: { pluginId: string; entities: GeoEntity[] };
entitySelected: { entity: GeoEntity | null };
layerToggled: { pluginId: string; enabled: boolean };
@@ -302,6 +310,8 @@ export type DataBusEvents = {
cameraFaceTowards: { lat: number; lon: number; alt: number };
cameraGoTo: { lat: number; lon: number; alt: number; distance?: number; maxPitch?: number; heading?: number };
globeReady: Record<string, never>;
pluginError: { pluginId?: string; message: string; error?: Error };
layerLoadingChanged: { pluginId: string; loading: boolean };
};
export * from "./viteGlobals";
@@ -12,8 +12,12 @@ import path from "path";
* - Converts features into GeoEntity objects
* - Renders with the manifest's rendering config
*/
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function wwvStaticCompiler(): any {
let pluginRoot = "";
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let manifest: any = null;
let generatedEntry = "";
@@ -21,6 +25,8 @@ export function wwvStaticCompiler(): any {
name: "wwv-static-compiler",
enforce: "pre" as const,
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
config(userConfig: any) {
pluginRoot = userConfig.root || process.cwd();
const pkgPath = path.join(pluginRoot, "package.json");
@@ -71,6 +77,8 @@ export function wwvStaticCompiler(): any {
};
}
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function generateStaticPluginSource(manifest: any): string {
const pluginId = manifest.id;
const pluginName = manifest.name || pluginId;
@@ -22,6 +22,8 @@ interface GlobalsMap {
*
* @returns {any} A Vite plugin object.
*/
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function wwvPluginGlobals(): any {
const HOST_MAPPINGS: GlobalsMap = {
"react": "React",
+111
View File
@@ -115,6 +115,12 @@ importers:
specifier: ^5.0.13
version: 5.0.13(@types/[email protected])([email protected])([email protected]([email protected]))
devDependencies:
'@eslint/compat':
specifier: ^2.1.0
version: 2.1.0([email protected]([email protected]))
'@eslint/eslintrc':
specifier: ^3.3.5
version: 3.3.5
'@playwright/test':
specifier: ^1.60.0
version: 1.60.0
@@ -148,6 +154,12 @@ importers:
'@types/ws':
specifier: ^8.18.1
version: 8.18.1
'@typescript-eslint/eslint-plugin':
specifier: ^8.59.3
version: 8.59.3(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])
'@typescript-eslint/parser':
specifier: ^8.59.3
version: 8.59.3([email protected]([email protected]))([email protected])
'@vitejs/plugin-react':
specifier: ^5.1.4
version: 5.2.0([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
@@ -163,9 +175,27 @@ importers:
eslint:
specifier: ^9
version: 9.39.4([email protected])
eslint-config-airbnb:
specifier: ^19.0.4
version: 19.0.4([email protected])([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]))
eslint-config-airbnb-typescript:
specifier: ^18.0.0
version: 18.0.0(@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected]))(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))
eslint-config-next:
specifier: ^16.2.6
version: 16.2.6(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])
eslint-plugin-import:
specifier: ^2.32.0
version: 2.32.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))
eslint-plugin-jsx-a11y:
specifier: ^6.10.2
version: 6.10.2([email protected]([email protected]))
eslint-plugin-react:
specifier: ^7.37.5
version: 7.37.5([email protected]([email protected]))
eslint-plugin-react-hooks:
specifier: ^7.1.1
version: 7.1.1([email protected]([email protected]))
fast-check:
specifier: ^4.8.0
version: 4.8.0
@@ -706,6 +736,15 @@ packages:
resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
'@eslint/[email protected]':
resolution: {integrity: sha512-LgaSCymEpw7tF53xvDw9SNsraPb1IBHxpdABIOM0hW8UAlP8znrjYtuxfR58FSJ3L9BhwD+FaPRFQpZq84Nh6g==}
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
peerDependencies:
eslint: ^8.40 || 9 || 10
peerDependenciesMeta:
eslint:
optional: true
'@eslint/[email protected]':
resolution: {integrity: sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@@ -718,6 +757,10 @@ packages:
resolution: {integrity: sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@eslint/[email protected]':
resolution: {integrity: sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==}
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
'@eslint/[email protected]':
resolution: {integrity: sha512-4IlJx0X0qftVsN5E+/vGujTRIFtwuLbNsVUe7TO6zYPDR1O6nFwvwhIKEKSrl6dZchmYBITazxKoUYOjdtjlRg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@@ -2787,6 +2830,9 @@ packages:
[email protected]:
resolution: {integrity: sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ==}
[email protected]:
resolution: {integrity: sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==}
[email protected]:
resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
@@ -3064,6 +3110,30 @@ packages:
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
engines: {node: '>=10'}
[email protected]:
resolution: {integrity: sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==}
engines: {node: ^10.12.0 || >=12.0.0}
peerDependencies:
eslint: ^7.32.0 || ^8.2.0
eslint-plugin-import: ^2.25.2
[email protected]:
resolution: {integrity: sha512-oc+Lxzgzsu8FQyFVa4QFaVKiitTYiiW3frB9KYW5OWdPrqFc7FzxgB20hP4cHMlr+MBzGcLl3jnCOVOydL9mIg==}
peerDependencies:
'@typescript-eslint/eslint-plugin': ^7.0.0
'@typescript-eslint/parser': ^7.0.0
eslint: ^8.56.0
[email protected]:
resolution: {integrity: sha512-T75QYQVQX57jiNgpF9r1KegMICE94VYwoFQyMGhrvc+lB8YF2E/M/PYDaQe1AJcWaEgqLE+ErXV1Og/+6Vyzew==}
engines: {node: ^10.12.0 || ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^7.32.0 || ^8.2.0
eslint-plugin-import: ^2.25.3
eslint-plugin-jsx-a11y: ^6.5.1
eslint-plugin-react: ^7.28.0
eslint-plugin-react-hooks: ^4.3.0
[email protected]:
resolution: {integrity: sha512-z2ELYSkyrrJ6cuunTU8vhsT/RpouPkjaSah06nVW6Rg2Hpg0Vs8s497/e5s8G8qtdp4ccsiovz5P1rv+5VSW2Q==}
peerDependencies:
@@ -5853,6 +5923,12 @@ snapshots:
'@eslint-community/[email protected]': {}
'@eslint/[email protected]([email protected]([email protected]))':
dependencies:
'@eslint/core': 1.2.1
optionalDependencies:
eslint: 9.39.4([email protected])
'@eslint/[email protected]':
dependencies:
'@eslint/object-schema': 2.1.7
@@ -5869,6 +5945,10 @@ snapshots:
dependencies:
'@types/json-schema': 7.0.15
'@eslint/[email protected]':
dependencies:
'@types/json-schema': 7.0.15
'@eslint/[email protected]':
dependencies:
ajv: 6.14.0
@@ -8015,6 +8095,8 @@ snapshots:
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]([email protected]([email protected])):
@@ -8400,6 +8482,35 @@ snapshots:
[email protected]: {}
[email protected]([email protected])([email protected]([email protected])):
dependencies:
confusing-browser-globals: 1.0.11
eslint: 9.39.4([email protected])
eslint-plugin-import: 2.32.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))
object.assign: 4.1.7
object.entries: 1.1.9
semver: 6.3.1
[email protected](@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected]))(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected])):
dependencies:
'@typescript-eslint/eslint-plugin': 8.59.3(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])
'@typescript-eslint/parser': 8.59.3([email protected]([email protected]))([email protected])
eslint: 9.39.4([email protected])
eslint-config-airbnb-base: 15.0.0([email protected])([email protected]([email protected]))
transitivePeerDependencies:
- eslint-plugin-import
[email protected]([email protected])([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected])):
dependencies:
eslint: 9.39.4([email protected])
eslint-config-airbnb-base: 15.0.0([email protected])([email protected]([email protected]))
eslint-plugin-import: 2.32.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))
eslint-plugin-jsx-a11y: 6.10.2([email protected]([email protected]))
eslint-plugin-react: 7.37.5([email protected]([email protected]))
eslint-plugin-react-hooks: 7.1.1([email protected]([email protected]))
object.assign: 4.1.7
object.entries: 1.1.9
[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected]):
dependencies:
'@next/eslint-plugin-next': 16.2.6
@@ -0,0 +1,14 @@
{
"id": "e2e-mock-bottom-panel",
"name": "E2E Bottom Panel Mock",
"version": "1.0.0",
"description": "A static mock plugin used for Playwright E2E tests focusing on the bottom panel.",
"author": "WorldWideView Automated Tests",
"type": "extension",
"format": "bundle",
"trust": "unverified",
"entry": "/e2e-fixtures/e2e-mock-bottom-panel.js",
"capabilities": ["ui:bottom-panel", "ui:sidebar"],
"extends": ["bottom-panel", "sidebar"],
"category": "utility"
}
@@ -0,0 +1,77 @@
// This file is loaded by the plugin manager in the E2E test environment.
// It bypasses the build step and directly uses the host's injected React instance.
export default {
id: "e2e-mock-bottom-panel",
name: "E2E Bottom Panel Mock",
description: "A mock plugin for Bottom Panel E2E testing.",
icon: "data:image/svg+xml;base64,PHN2Zz48L3N2Zz4=", // Empty SVG as fallback
category: "custom",
version: "1.0.0",
// Lifecycle
initialize: async (ctx) => {
// eslint-disable-next-line no-console
console.log("[e2e-mock-bottom-panel] Initialized");
},
destroy: () => {
// eslint-disable-next-line no-console
console.log("[e2e-mock-bottom-panel] Destroyed");
},
// Data
fetch: async (timeRange) => {
return []; // No entities for this mock
},
getPollingInterval: () => {
return 60000;
},
// Rendering
getLayerConfig: () => {
return {
color: "#0000FF",
clusterEnabled: false,
clusterDistance: 50
};
},
renderEntity: (entity) => {
return {
type: "point",
color: "#0000FF",
size: 5
};
},
// Provide a bottom panel UI component using the host's React instance
getBottomPanelComponent: () => {
// Access React from the global host object injected by WorldWideView
const React = globalThis.__WWV_HOST__.React;
if (!React) {
// eslint-disable-next-line no-console
console.error("[e2e-mock-bottom-panel] Failed to resolve React from __WWV_HOST__");
return null;
}
// Return a component function
return function MockBottomPanel() {
return React.createElement(
"div",
{
"data-testid": "e2e-bottom-panel-content",
style: {
padding: "16px",
background: "rgba(0, 0, 255, 0.1)",
border: "1px solid blue",
height: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center"
}
},
"Mock Bottom Panel Active"
);
};
}
};
+3
View File
@@ -12,9 +12,11 @@ export default {
// Lifecycle
initialize: async (ctx) => {
// eslint-disable-next-line no-console
console.log("[e2e-mock-plugin] Initialized");
},
destroy: () => {
// eslint-disable-next-line no-console
console.log("[e2e-mock-plugin] Destroyed");
},
@@ -48,6 +50,7 @@ export default {
const React = globalThis.__WWV_HOST__.React;
if (!React) {
// eslint-disable-next-line no-console
console.error("[e2e-mock-plugin] Failed to resolve React from __WWV_HOST__");
return null;
}
+14
View File
@@ -43,6 +43,7 @@ loadEnv('.env');
const skipLocalDb = process.env.WWV_SKIP_LOCAL_DB === 'true' || process.env.WWV_SKIP_LOCAL_DB === '1';
if (skipLocalDb) {
// eslint-disable-next-line no-console
console.log('⏭️ Skipping local PostgreSQL startup (WWV_SKIP_LOCAL_DB is set).');
process.exit(0);
}
@@ -59,6 +60,7 @@ if (folderName !== 'worldwideview') {
}
process.env.WWV_DB_PORT = port.toString();
// eslint-disable-next-line no-console
console.log(`🔌 Assigned deterministic database port: ${port}`);
// Robust rewrite of DATABASE_URL in .env
@@ -78,6 +80,7 @@ if (fs.existsSync(envPath)) {
foundTargetActive = true;
return line;
} else {
// eslint-disable-next-line no-console
console.warn(`⚠️ [Telemetry] Commenting out conflicting DATABASE_URL: ${line.trim()}`);
linesModified = true;
return `# ${line}`;
@@ -87,6 +90,7 @@ if (fs.existsSync(envPath)) {
});
if (!foundTargetActive) {
// eslint-disable-next-line no-console
console.log(`🔌 [Telemetry] Injecting correct local DATABASE_URL for port ${port}.`);
newLines.push(``);
newLines.push(`# Dynamically injected by boot-db.mjs for worktree`);
@@ -107,8 +111,10 @@ if (fs.existsSync(envPath)) {
} catch (err) {
attempt++;
if (err.code === 'EBUSY' || err.code === 'EPERM' || err.message.includes('os error 32')) {
// eslint-disable-next-line no-console
console.warn(`⚠️ [Telemetry] File lock encountered on .env (attempt ${attempt}/${maxRetries}). Retrying in 100ms...`);
if (attempt >= maxRetries) {
// eslint-disable-next-line no-console
console.error('❌ Failed to write .env after multiple attempts due to file locks.');
throw err;
}
@@ -124,6 +130,7 @@ if (fs.existsSync(envPath)) {
}
// eslint-disable-next-line no-console
console.log('🚀 Checking local PostgreSQL database...');
try {
@@ -131,19 +138,26 @@ try {
try {
execSync('docker --version', { stdio: 'ignore' });
} catch (e) {
// eslint-disable-next-line no-console
console.log('⚠️ Docker is not installed or not in PATH. Skipping local database startup.');
// eslint-disable-next-line no-console
console.log('💡 If you want to run a local database automatically, please install Docker Desktop.');
process.exit(0);
}
// Start the db service and wait for it to be healthy
// eslint-disable-next-line no-console
console.log('📦 Starting PostgreSQL via Docker Compose...');
execSync('docker compose up -d --wait db', { stdio: 'inherit' });
// eslint-disable-next-line no-console
console.log('✅ Local PostgreSQL database is ready!');
} catch (error) {
// eslint-disable-next-line no-console
console.error('❌ Failed to start local database:', error.message);
// eslint-disable-next-line no-console
console.log('💡 Ensure that docker is running and try again');
// eslint-disable-next-line no-console
console.log('💡 You may need to start it manually or set WWV_SKIP_LOCAL_DB=true to use an external database.');
}
+5
View File
@@ -21,10 +21,15 @@ const missing = checks.filter(c => !process.env[c.name]);
if (missing.length === 0) process.exit(0);
const yellow = (s) => `\x1b[33m${s}\x1b[0m`;
// eslint-disable-next-line no-console
console.warn(yellow("\n⚠ Build-time env vars not set:"));
for (const c of missing) {
// eslint-disable-next-line no-console
console.warn(yellow(`\n ${c.name}`));
// eslint-disable-next-line no-console
console.warn(` ${c.why}`);
// eslint-disable-next-line no-console
console.warn(` Fix: ${c.how}`);
}
// eslint-disable-next-line no-console
console.warn(yellow("\nContinuing build — these are warnings, not errors.\n"));
+7
View File
@@ -2,22 +2,29 @@ import { prisma } from "../src/lib/db";
async function main() {
const plugins = await prisma.installedPlugin.findMany();
// eslint-disable-next-line no-console
console.log("Installed plugins:");
// eslint-disable-next-line no-console
plugins.forEach((p) => console.log(` ${p.pluginId} | config: ${p.config.substring(0, 60)}`));
const geojson = plugins.find((p) => p.pluginId === "geojson");
if (geojson) {
await prisma.installedPlugin.delete({ where: { id: geojson.id } });
// eslint-disable-next-line no-console
console.log("\nDeleted orphaned 'geojson' record.");
} else {
// eslint-disable-next-line no-console
console.log("\nNo orphaned 'geojson' record found.");
}
const remaining = await prisma.installedPlugin.findMany();
// eslint-disable-next-line no-console
console.log("\nRemaining plugins:");
// eslint-disable-next-line no-console
remaining.forEach((p) => console.log(` ${p.pluginId}`));
await prisma.$disconnect();
}
// eslint-disable-next-line no-console
main().catch(console.error);
+2
View File
@@ -12,5 +12,7 @@ const geoJson = convertToGeoJson(raw);
writeFileSync(outputPath, JSON.stringify(geoJson, null, 2), "utf-8");
// eslint-disable-next-line no-console
console.log(`✅ Converted ${geoJson.features.length} features`);
// eslint-disable-next-line no-console
console.log(` Output: ${outputPath}`);
+5
View File
@@ -15,6 +15,7 @@ function copyDir(src, dest) {
}
const entries = fs.readdirSync(src, { withFileTypes: true });
// eslint-disable-next-line prefer-const
for (let entry of entries) {
const srcPath = path.join(src, entry.name);
const destPath = path.join(dest, entry.name);
@@ -27,15 +28,19 @@ function copyDir(src, dest) {
}
}
// eslint-disable-next-line no-console
console.log('Copying Cesium assets...');
folders.forEach(folder => {
const src = path.join(cesiumSource, folder);
const dest = path.join(targetBase, folder);
if (fs.existsSync(src)) {
copyDir(src, dest);
// eslint-disable-next-line no-console
console.log(`Copied ${folder}`);
} else {
// eslint-disable-next-line no-console
console.warn(`Source folder not found: ${src}`);
}
});
// eslint-disable-next-line no-console
console.log('Cesium assets copied successfully.');
+7
View File
@@ -9,6 +9,7 @@ import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';
// eslint-disable-next-line no-console
console.log('🧹 Starting Garbage Collection for orphaned WorldWideView Docker volumes...');
try {
@@ -23,6 +24,7 @@ try {
);
if (wwvVolumes.length === 0) {
// eslint-disable-next-line no-console
console.log('✅ No WorldWideView volumes found.');
process.exit(0);
}
@@ -50,23 +52,28 @@ try {
}
if (!activeProjectNames.has(projectName)) {
// eslint-disable-next-line no-console
console.log(`🗑️ Deleting orphaned volume: ${volume}`);
try {
execSync(`docker volume rm ${volume}`, { stdio: 'inherit' });
orphanedCount++;
} catch (rmError) {
// eslint-disable-next-line no-console
console.warn(`⚠️ Could not remove volume ${volume}. It may still be in use.`);
}
}
}
if (orphanedCount === 0) {
// eslint-disable-next-line no-console
console.log('✅ All existing volumes belong to active worktrees. Nothing to prune.');
} else {
// eslint-disable-next-line no-console
console.log(`✅ Successfully pruned ${orphanedCount} orphaned volume(s).`);
}
} catch (error) {
// eslint-disable-next-line no-console
console.error('❌ Failed to prune volumes:', error.message);
process.exit(1);
}
+3
View File
@@ -19,6 +19,7 @@ for (const dir of dirs) {
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
if (!pkg.worldwideview) {
// eslint-disable-next-line no-console
console.log(`Skipped ${dir} - No worldwideview metadata in package.json`);
continue;
}
@@ -45,8 +46,10 @@ for (const dir of dirs) {
fs.copyFileSync(distPath, path.join(targetDir, "frontend.mjs"));
fs.writeFileSync(path.join(targetDir, "plugin.json"), JSON.stringify(manifest, null, 2));
// eslint-disable-next-line no-console
console.log(`Deployed ${publicName} to public/plugins`);
} else {
// eslint-disable-next-line no-console
console.log(`Skipped ${dir} - dist or package.json not found.`);
}
}
+4
View File
@@ -54,6 +54,7 @@ const shutdown = () => {
if (isShuttingDown) return;
isShuttingDown = true;
// eslint-disable-next-line no-console
console.log('\n🛑 Shutting down dev servers...');
// Forcefully kill the process tree of each command cross-platform
@@ -64,11 +65,14 @@ const shutdown = () => {
});
if (teardownDbOnExit) {
// eslint-disable-next-line no-console
console.log('📦 Tearing down local PostgreSQL database...');
try {
execSync('docker compose stop db', { stdio: 'inherit' });
// eslint-disable-next-line no-console
console.log('✅ Local database stopped.');
} catch (e) {
// eslint-disable-next-line no-console
console.error('⚠️ Failed to stop database container.');
}
}
+1
View File
@@ -49,6 +49,7 @@ export default defineConfig({
// Add vite.config.ts
fs.writeFileSync(path.join(packagesDir, dir, "vite.config.ts"), viteConfigContent);
// eslint-disable-next-line no-console
console.log(`Added vite.config.ts to ${dir} (entry: ${entryFile})`);
}
}
+3
View File
@@ -12,6 +12,7 @@ const certPath = path.join(process.cwd(), 'data', 'localhost.crt');
const keyPath = path.join(process.cwd(), 'data', 'localhost.key');
if (!fs.existsSync(certPath) || !fs.existsSync(keyPath)) {
// eslint-disable-next-line no-console
console.error('[HTTPS Proxy] Certificates not found. Proxy will not start.');
process.exit(1);
}
@@ -38,6 +39,7 @@ const server = https.createServer(options, (req, res) => {
});
proxyReq.on('error', (e) => {
// eslint-disable-next-line no-console
console.error(`[HTTPS Proxy] Error proxying request to ${req.url}:`, e.message);
res.writeHead(502);
res.end('Bad Gateway');
@@ -47,5 +49,6 @@ const server = https.createServer(options, (req, res) => {
});
server.listen(listenPort, '0.0.0.0', () => {
// eslint-disable-next-line no-console
console.log(`[HTTPS Proxy] Secure bridge listening on https://0.0.0.0:${listenPort} (forwarding to http://127.0.0.1:${targetPort})`);
});
+7
View File
@@ -7,9 +7,11 @@ async function main() {
if (action === "list") {
const users = await prisma.user.findMany();
if (users.length === 0) {
// eslint-disable-next-line no-console
console.log("No users found — visit /setup to create one.");
} else {
users.forEach((u) =>
// eslint-disable-next-line no-console
console.log(` ${u.email} | ${u.name} | ${u.role} | ${u.createdAt}`)
);
}
@@ -17,6 +19,7 @@ async function main() {
const email = process.argv[3];
const newPass = process.argv[4];
if (!email || !newPass) {
// eslint-disable-next-line no-console
console.log("Usage: tsx scripts/manage-users.ts reset <email> <password>");
return;
}
@@ -25,15 +28,19 @@ async function main() {
where: { email },
data: { hashedPassword: hashed },
});
// eslint-disable-next-line no-console
console.log(`Password reset for ${email}`);
} else if (action === "delete-all") {
await prisma.user.deleteMany();
// eslint-disable-next-line no-console
console.log("All users deleted — visit /setup to create a new admin.");
} else {
// eslint-disable-next-line no-console
console.log("Usage: tsx scripts/manage-users.ts <list|reset|delete-all>");
}
await prisma.$disconnect();
}
// eslint-disable-next-line no-console
main().catch(console.error);
+8
View File
@@ -22,6 +22,7 @@ const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL!;
const SUPABASE_KEY = process.env.SUPABASE_SERVICE_ROLE_KEY || process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!;
if (!SUPABASE_URL || !SUPABASE_KEY) {
// eslint-disable-next-line no-console
console.error("Missing Supabase credentials in .env.local");
process.exit(1);
}
@@ -31,6 +32,7 @@ const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
// Connect to SQLite DB (respects DB_PATH, fallback to data engine location)
const defaultDbPath = path.resolve(process.cwd(), "packages/wwv-data-engine/data/engine.db");
const dbPath = process.env.DB_PATH || defaultDbPath;
// eslint-disable-next-line no-console
console.log(`Connecting to SQLite at ${dbPath}...`);
// Ensure DB directory exists
@@ -63,6 +65,7 @@ const insertHistory = db.prepare(`
`);
async function migrate() {
// eslint-disable-next-line no-console
console.log("Fetching existing aviation_history records from Supabase...");
let offset = 0;
const limit = 10000; // Chunk size
@@ -75,15 +78,18 @@ async function migrate() {
.range(offset, offset + limit - 1);
if (error) {
// eslint-disable-next-line no-console
console.error("Fetch error:", error);
process.exit(1);
}
if (!data || data.length === 0) {
// eslint-disable-next-line no-console
console.log("No more records to fetch.");
break;
}
// eslint-disable-next-line no-console
console.log(`Processing ${data.length} records (Offset: ${offset})...`);
// Batch insert to SQLite
@@ -109,6 +115,7 @@ async function migrate() {
insertMany(data);
totalInserted += data.length;
} catch (err) {
// eslint-disable-next-line no-console
console.error("SQLite Insert Error:", err);
}
@@ -119,6 +126,7 @@ async function migrate() {
offset += limit;
}
// eslint-disable-next-line no-console
console.log(`Migration complete! Successfully injected ~${totalInserted} records into SQLite.`);
}
+6
View File
@@ -3,7 +3,9 @@ import { execSync } from 'child_process';
const dbUrl = process.env.DATABASE_URL || '';
if (!dbUrl) {
// eslint-disable-next-line no-console
console.error("❌ ERROR: DATABASE_URL is missing.");
// eslint-disable-next-line no-console
console.error(" Did you forget to run 'pnpm run setup' to generate your .env file?");
process.exit(1);
}
@@ -11,11 +13,15 @@ if (!dbUrl) {
const isLocal = dbUrl.includes('localhost') || dbUrl.includes('127.0.0.1') || dbUrl.includes('host.docker.internal') || dbUrl.includes('postgres:postgres@db:5432');
if (!isLocal) {
// eslint-disable-next-line no-console
console.error("❌ ERROR: DATABASE_URL points to a remote database.");
// eslint-disable-next-line no-console
console.error(" Running 'prisma db push --accept-data-loss' on production/staging data is forbidden.");
// eslint-disable-next-line no-console
console.error(" If you truly need to migrate a remote db, run prisma db push manually.");
process.exit(1);
}
// eslint-disable-next-line no-console
console.log("🔒 Local database detected. Safely running prisma db push...");
execSync('npx prisma db push --accept-data-loss', { stdio: 'inherit' });
+6
View File
@@ -16,12 +16,15 @@ const EXAMPLE = resolve(ROOT, ".env.example");
const TARGET = resolve(ROOT, ".env");
if (existsSync(TARGET)) {
// eslint-disable-next-line no-console
console.log("✅ .env already exists — skipping setup.");
// eslint-disable-next-line no-console
console.log(" Delete it and re-run if you want to regenerate.");
process.exit(0);
}
if (!existsSync(EXAMPLE)) {
// eslint-disable-next-line no-console
console.error("❌ .env.example not found. Are you in the right directory?");
process.exit(1);
}
@@ -48,6 +51,9 @@ content = content
writeFileSync(TARGET, content, "utf8");
// eslint-disable-next-line no-console
console.log("✅ .env created with a generated AUTH_SECRET.");
// eslint-disable-next-line no-console
console.log(" Fill in any optional API keys (Cesium, Bing, OpenSky, etc.)");
// eslint-disable-next-line no-console
console.log(" then run: npm run dev");
+9 -1
View File
@@ -60,7 +60,7 @@ export function discoverLocalPlugins() {
* into a single ES module, externalizing shared host dependencies.
*/
export async function buildPlugin({ dir, manifest, pluginDir }) {
const devEntry = manifest.dev_entry || "src/index.ts";
const devEntry = manifest.dev_entry || "index.ts";
let entryFile = path.join(pluginDir, devEntry);
// Fallback: check for .tsx
@@ -68,6 +68,7 @@ export async function buildPlugin({ dir, manifest, pluginDir }) {
const tsxEntry = devEntry.replace(".ts", ".tsx");
entryFile = path.join(pluginDir, tsxEntry);
if (!fs.existsSync(entryFile)) {
// eslint-disable-next-line no-console
console.warn(`[sync] ⚠ No entry file found for ${dir}, skipping`);
return false;
}
@@ -109,6 +110,7 @@ export async function buildPlugin({ dir, manifest, pluginDir }) {
});
return true;
} catch (err) {
// eslint-disable-next-line no-console
console.error(`[sync] ❌ Build failed for ${dir}:`, err.message);
return false;
}
@@ -121,6 +123,7 @@ export function syncToPublic({ dir, manifest, pluginDir }) {
const distMap = path.join(pluginDir, "dist", "frontend.mjs.map");
if (!fs.existsSync(distFile)) {
// eslint-disable-next-line no-console
console.warn(`[sync] ⚠ No dist for ${dir}, skipping sync`);
return;
}
@@ -151,6 +154,7 @@ export function syncToPublic({ dir, manifest, pluginDir }) {
JSON.stringify(pluginJson, null, 2)
);
// eslint-disable-next-line no-console
console.log(`[sync] ✅ ${publicName} → public/plugins-local/${publicName}/`);
}
@@ -161,6 +165,7 @@ function cleanStale(activeIds) {
for (const dir of fs.readdirSync(OUTPUT_DIR)) {
if (!activeSet.has(dir)) {
fs.rmSync(path.join(OUTPUT_DIR, dir), { recursive: true, force: true });
// eslint-disable-next-line no-console
console.log(`[sync] 🗑 Removed stale plugin: ${dir}`);
}
}
@@ -170,11 +175,13 @@ export async function syncAll() {
const plugins = discoverLocalPlugins();
if (plugins.length === 0) {
// eslint-disable-next-line no-console
console.log("[sync] No local plugins found.");
cleanStale([]);
return;
}
// eslint-disable-next-line no-console
console.log(`[sync] Found ${plugins.length} local plugin(s): ${plugins.map(p => p.dir).join(", ")}`);
for (const plugin of plugins) {
@@ -190,6 +197,7 @@ export async function syncAll() {
const isDirectRun = process.argv[1] && path.resolve(process.argv[1]) === path.resolve(fileURLToPath(import.meta.url));
if (isDirectRun) {
syncAll().catch(err => {
// eslint-disable-next-line no-console
console.error("[sync] Fatal:", err);
process.exit(1);
});
+21
View File
@@ -6,7 +6,9 @@ import net from 'node:net';
// 1. Get branch argument
const branchName = process.argv[2];
if (!branchName) {
// eslint-disable-next-line no-console
console.error('\x1b[31mError: Please provide a worktree branch name.\x1b[0m');
// eslint-disable-next-line no-console
console.error('Usage: pnpm run test-worktree <branch-name>');
process.exit(1);
}
@@ -33,6 +35,7 @@ try {
}
}
} catch (err) {
// eslint-disable-next-line no-console
console.warn('\x1b[33mWarning: Failed to parse git worktree list.\x1b[0m');
}
@@ -44,41 +47,52 @@ if (!worktreePath) {
// 3. Validate worktree exists
if (!fs.existsSync(worktreePath)) {
// eslint-disable-next-line no-console
console.error(`\x1b[31mError: Worktree directory not found for branch '${branchName}'\x1b[0m`);
// eslint-disable-next-line no-console
console.error(`Searched path: ${worktreePath}`);
// eslint-disable-next-line no-console
console.error(`Ensure you have created it using 'git worktree add <path> -b ${branchName}'`);
process.exit(1);
}
// 3. Setup Environment
// eslint-disable-next-line no-console
console.log(`\x1b[34m[1/5] Checking environment in ${worktreePath}...\x1b[0m`);
const rootEnvPath = path.join(rootDir, '.env.local');
const worktreeEnvPath = path.join(worktreePath, '.env.local');
if (!fs.existsSync(worktreeEnvPath) && fs.existsSync(rootEnvPath)) {
fs.copyFileSync(rootEnvPath, worktreeEnvPath);
// eslint-disable-next-line no-console
console.log('Copied .env.local from root.');
}
// 4. Install Dependencies
// eslint-disable-next-line no-console
console.log(`\x1b[34m[2/5] Symlinking modules and generating local clients...\x1b[0m`);
// eslint-disable-next-line no-console
console.log('Running pnpm install in worktree...');
execSync('pnpm install', { cwd: worktreePath, stdio: 'inherit' });
// eslint-disable-next-line no-console
console.log('Generating Prisma Clients (Root)...');
execSync('npx prisma generate', { cwd: worktreePath, stdio: 'inherit' });
// eslint-disable-next-line no-console
console.log('Generating Prisma Clients (Data Engine)...');
const enginePath = path.join(worktreePath, 'packages', 'wwv-data-engine');
if (fs.existsSync(enginePath)) {
try {
execSync('npx prisma generate', { cwd: enginePath, stdio: 'inherit' });
} catch (err) {
// eslint-disable-next-line no-console
console.warn('\x1b[33m[Warning] Could not generate Data Engine Prisma client. This happens on Windows when another workspace is running and locking the shared pnpm DLL. It is safe to ignore as the client already exists in the cache.\x1b[0m');
}
}
// 5. Setup databases
// eslint-disable-next-line no-console
console.log(`\x1b[34m[3/5] Setting up local databases...\x1b[0m`);
const rootDataDir = path.join(worktreePath, 'data');
const engineDataDir = path.join(enginePath, 'data');
@@ -108,14 +122,18 @@ function findFreePort(startPort) {
// 7. Start the Servers
async function start() {
// eslint-disable-next-line no-console
console.log(`\x1b[34m[4/5] Assigning isolated ports...\x1b[0m`);
// Start scanning *after* the default main dev ports to absolutely ensure we don't accidentally grab them
const frontendPort = await findFreePort(3002);
const backendPort = await findFreePort(5002);
// eslint-disable-next-line no-console
console.log(`Next.js Frontend Port: \x1b[32m${frontendPort}\x1b[0m`);
// eslint-disable-next-line no-console
console.log(`Data Engine Backend Port: \x1b[32m${backendPort}\x1b[0m`);
// eslint-disable-next-line no-console
console.log(`\x1b[34m[4/5] Booting isolated servers...\x1b[0m`);
// Start Backend First
@@ -149,9 +167,11 @@ async function start() {
frontendProcess.stderr.on('data', (data) => process.stderr.write(`[\x1b[31mNext.js Error\x1b[0m] ${data}`));
// 7. Open Browser
// eslint-disable-next-line no-console
console.log(`\x1b[34m[5/5] Launching browser...\x1b[0m`);
setTimeout(() => {
const url = `http://localhost:${frontendPort}`;
// eslint-disable-next-line no-console
console.log(`Opening \x1b[32m${url}\x1b[0m...`);
const startCmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
execSync(`${startCmd} ${url}`);
@@ -164,4 +184,5 @@ async function start() {
});
}
// eslint-disable-next-line no-console
start().catch(console.error);
+6
View File
@@ -39,10 +39,12 @@ function handleFileChange(eventType, filename) {
async function runSync(filename) {
isSyncing = true;
// eslint-disable-next-line no-console
console.log(`\n[watch] Change detected in local plugins (file: ${filename}). Syncing...`);
try {
await syncAll();
} catch (err) {
// eslint-disable-next-line no-console
console.error(`[watch] Sync failed:`, err);
} finally {
isSyncing = false;
@@ -54,17 +56,21 @@ async function runSync(filename) {
}
// Initial sync
// eslint-disable-next-line no-console
console.log(`[watch] Starting initial sync...`);
isSyncing = true;
syncAll().then(() => {
isSyncing = false;
if (pendingSync) {
pendingSync = false;
// eslint-disable-next-line no-console
runSync("pending changes").catch(console.error);
}
// eslint-disable-next-line no-console
console.log(`[watch] Watching ${LOCAL_PLUGINS_DIR} for changes...`);
fs.watch(LOCAL_PLUGINS_DIR, { recursive: true }, handleFileChange);
}).catch(err => {
isSyncing = false;
// eslint-disable-next-line no-console
console.error(`[watch] Initial sync failed:`, err);
});
+6 -6
View File
@@ -50,11 +50,11 @@ function isAgentAction(v: unknown): v is AgentAction {
if (!v || typeof v !== "object") return false;
const a = (v as { action?: unknown }).action;
return (
a === "fly_to" ||
a === "face_towards" ||
a === "layer_toggle" ||
a === "highlight_layer" ||
a === "select_entity" ||
a === "ping"
a === "fly_to"
|| a === "face_towards"
|| a === "layer_toggle"
|| a === "highlight_layer"
|| a === "select_entity"
|| a === "ping"
);
}
+3 -1
View File
@@ -48,6 +48,8 @@ export async function GET() {
}
}, 25_000);
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(controller as any)._cleanup = () => {
clearInterval(heartbeat);
unsubscribe();
@@ -62,7 +64,7 @@ export async function GET() {
headers: {
"Content-Type": "text/event-stream",
"Cache-Control": "no-cache, no-transform",
"Connection": "keep-alive",
Connection: "keep-alive",
"X-Accel-Buffering": "no",
},
});
+2
View File
@@ -21,6 +21,8 @@ export async function GET(request: Request) {
for (const [k, v] of Object.entries(headers)) res.headers.set(k, v);
return res;
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[setup-status] Database error:", err);
const res = NextResponse.json(
{ error: "database_unavailable", edition },
+5 -1
View File
@@ -13,11 +13,15 @@ export async function POST(req: Request) {
sig!,
process.env.STRIPE_WEBHOOK_SECRET!
);
} catch (err: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (err: any) {
return new NextResponse(`Webhook Error: ${err.message}`, { status: 400 });
}
if (event.type === "checkout.session.completed") {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log("Subscription completed!");
// Update user tier in DB, send license key via email
}
+6 -8
View File
@@ -22,14 +22,12 @@ function readMaybe(p: string): string | null {
}
}
const BUILD_ID =
process.env.NEXT_PUBLIC_WWV_BUILD_ID ??
readMaybe(path.join(process.cwd(), ".build-id")) ??
"dev";
const BUILD_AT =
process.env.NEXT_PUBLIC_WWV_BUILD_AT ??
readMaybe(path.join(process.cwd(), ".build-at")) ??
null;
const BUILD_ID = process.env.NEXT_PUBLIC_WWV_BUILD_ID
?? readMaybe(path.join(process.cwd(), ".build-id"))
?? "dev";
const BUILD_AT = process.env.NEXT_PUBLIC_WWV_BUILD_AT
?? readMaybe(path.join(process.cwd(), ".build-at"))
?? null;
export async function GET() {
return NextResponse.json({
+4 -6
View File
@@ -14,8 +14,7 @@
import type { CameraAdapter, CameraFeature } from "./types";
const BULK_URL = "https://eapps.ncdot.gov/services/traffic-prod/v1/cameras";
const DETAIL_URL = (id: number) =>
`https://eapps.ncdot.gov/services/traffic-prod/v1/cameras/${id}`;
const DETAIL_URL = (id: number) => `https://eapps.ncdot.gov/services/traffic-prod/v1/cameras/${id}`;
const CONCURRENCY = 20;
@@ -64,7 +63,8 @@ async function mapWithConcurrency<T, R>(
let next = 0;
async function run() {
while (next < items.length) {
const i = next++;
const i = next;
next += 1;
results[i] = await worker(items[i]);
}
}
@@ -113,9 +113,7 @@ export const ncdotAdapter: CameraAdapter = {
const bulk = (await bulkRes.json()) as BulkRecord[];
if (!Array.isArray(bulk)) return [];
const details = await mapWithConcurrency(bulk, CONCURRENCY, (b) =>
fetchDetail(b.id),
);
const details = await mapWithConcurrency(bulk, CONCURRENCY, (b) => fetchDetail(b.id),);
const features: CameraFeature[] = [];
for (const d of details) {
@@ -55,8 +55,7 @@ export const osmSurveillanceAdapter: CameraAdapter = {
if (!res.ok) throw new Error(`overpass ${res.status}`);
const data = (await res.json()) as { elements?: OverpassNode[] };
const nodes = (data.elements ?? []).filter(
(e): e is OverpassNode =>
e.type === "node" && typeof e.lat === "number",
(e): e is OverpassNode => e.type === "node" && typeof e.lat === "number",
);
return nodes.map<CameraFeature>((n) => {
+5 -5
View File
@@ -113,12 +113,10 @@ export async function fetchAdapter(adapter: CameraAdapter): Promise<CameraFeatur
try {
const data = await Promise.race([
adapter.fetch(),
new Promise<CameraFeature[]>((_resolve, reject) =>
setTimeout(
new Promise<CameraFeature[]>((_resolve, reject) => setTimeout(
() => reject(new Error(`Adapter ${adapter.id} timed out after ${ADAPTER_FETCH_TIMEOUT_MS}ms`)),
ADAPTER_FETCH_TIMEOUT_MS,
),
),
),),
]);
cache.set(adapter.id, {
data,
@@ -126,7 +124,9 @@ export async function fetchAdapter(adapter: CameraAdapter): Promise<CameraFeatur
fetchedAt: new Date(now).toISOString(),
});
return data;
} catch (e: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (e: any) {
const errMsg = e?.message ?? String(e);
if (c) {
cache.set(adapter.id, { ...c, error: errMsg });
@@ -15,6 +15,8 @@ function districtUrl(d: number): string {
return `https://cwwp2.dot.ca.gov/data/d${d}/cctv/cctvStatusD${padded}.json`;
}
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function toGeoJsonFeature(raw: any): GdotCameraFeature | null {
const cam = raw.cctv;
if (!cam?.location) return null;
+7 -4
View File
@@ -29,7 +29,7 @@ export async function GET(req: NextRequest) {
const ajaxRes = await fetch(ajaxUrl, {
headers: {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"Referer": targetUrl
Referer: targetUrl
}
});
const ajaxHtml = await ajaxRes.text();
@@ -37,13 +37,16 @@ export async function GET(req: NextRequest) {
const streamMatch = ajaxHtml.match(/src:\s*'([^']+m3u8[^']+)'/);
if (streamMatch && streamMatch[1]) {
return NextResponse.json({ streamUrl: streamMatch[1] });
} else {
return NextResponse.json({ error: "Could not find m3u8 stream on balticlivecam backend" }, { status: 404 });
}
return NextResponse.json({ error: "Could not find m3u8 stream on balticlivecam backend" }, { status: 404 });
}
return NextResponse.json({ error: "Unsupported extractor platform" }, { status: 400 });
} catch (error: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (error: any) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[CameraExtractor] Error:", error.message);
return NextResponse.json({ error: "Failed to extract stream" }, { status: 500 });
}
+4 -3
View File
@@ -5,9 +5,8 @@
* until all features are retrieved.
*/
const GDOT_BASE =
"https://services1.arcgis.com/2iUE8l8JKrP2tygQ/arcgis/rest/services" +
"/GDOT_Live_Traffic_Cameras/FeatureServer/0/query";
const GDOT_BASE = "https://services1.arcgis.com/2iUE8l8JKrP2tygQ/arcgis/rest/services"
+ "/GDOT_Live_Traffic_Cameras/FeatureServer/0/query";
const PAGE_SIZE = 2000;
@@ -30,6 +29,8 @@ export interface GdotCameraFeature {
}
/** Convert a raw ArcGIS feature into our GeoJSON format. */
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function toGeoJsonFeature(raw: any): GdotCameraFeature | null {
const { attributes: a, geometry: g } = raw;
if (!g?.x || !g?.y) return null;
+5 -3
View File
@@ -29,9 +29,9 @@ export async function GET(req: NextRequest) {
try {
const upstream = await fetch(targetUrl, {
headers: {
headers: {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
},
signal: AbortSignal.timeout(MAX_IFRAME_DURATION_MS),
@@ -45,7 +45,7 @@ export async function GET(req: NextRequest) {
}
const contentType = upstream.headers.get("content-type") || "text/html";
// If it's not HTML, just proxy the stream directly (fallback)
if (!contentType.includes("text/html")) {
return new Response(upstream.body as ReadableStream, {
@@ -82,6 +82,8 @@ export async function GET(req: NextRequest) {
});
} catch (error: unknown) {
const message = error instanceof Error ? error.message : "Unknown error";
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[IframeProxy] Error:", message);
return NextResponse.json(
{ error: "Failed to proxy iframe" },
+6 -2
View File
@@ -27,7 +27,7 @@ export async function GET(req: NextRequest) {
const response = await safeFetch(targetUrl, {
headers: {
"User-Agent": "WorldWideView/1.0",
"Accept": "application/json, text/plain, */*",
Accept: "application/json, text/plain, */*",
},
maxSize: 5 * 1024 * 1024, // 5MB
timeout: 10000 // 10s
@@ -51,7 +51,11 @@ export async function GET(req: NextRequest) {
{ status: 502 },
);
}
} catch (error: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (error: any) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[CameraProxy] Error fetching target URL:", error);
const status = error.message.includes("SSRF Error") ? 403 : 500;
return NextResponse.json(
+3 -2
View File
@@ -48,8 +48,7 @@ export async function GET(req: NextRequest) {
);
}
const contentType =
upstream.headers.get("content-type") || "application/octet-stream";
const contentType = upstream.headers.get("content-type") || "application/octet-stream";
return new Response(upstream.body as ReadableStream, {
status: 200,
@@ -63,6 +62,8 @@ export async function GET(req: NextRequest) {
});
} catch (error: unknown) {
const message = error instanceof Error ? error.message : "Unknown error";
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[StreamProxy] Error:", message);
const status = message.includes("SSRF Error") ? 403 : 502;
return NextResponse.json(
+6 -4
View File
@@ -8,7 +8,7 @@ function isPrivateUrl(urlStr: string): boolean {
const parsed = new URL(urlStr);
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return true;
const host = parsed.hostname;
// If developer overrides local restrictions, bypass checks
if (process.env.WWV_PROXY_ALLOW_LOCAL === "true") return false;
@@ -48,8 +48,8 @@ export async function GET(req: NextRequest) {
signal: AbortSignal.timeout(TIMEOUT_MS)
});
} catch (headError: any) {
// Primitive IP camera servers (like Insecam sources) often aggressively drop the TCP connection
// instead of returning 405 when they see an unsupported HTTP method like HEAD.
// Primitive IP camera servers (like Insecam sources) often aggressively drop the TCP connection
// instead of returning 405 when they see an unsupported HTTP method like HEAD.
// If the socket was closed unexpectedly, retry with GET.
if (headError.cause?.code === 'UND_ERR_SOCKET' || headError.message?.includes('fetch failed')) {
response = await fetch(url, {
@@ -81,7 +81,9 @@ export async function GET(req: NextRequest) {
contentType: response.headers.get("content-type"),
latencyMs: Date.now() - startTime
});
} catch (error: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (error: any) {
const realError = error.cause || error;
const code = realError?.code || error?.code || realError?.name || error?.name;
+6
View File
@@ -11,12 +11,18 @@ import type { GdotCameraFeature } from "../gdot/gdotFetcher";
const TFL_URL = "https://api.tfl.gov.uk/Place/Type/JamCam";
/** Extract a named property from TfL additionalProperties array. */
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function getProp(props: any[], key: string): string {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const found = props?.find((p: any) => p.key === key);
return found?.value || "";
}
/** Convert a raw TfL JamCam place into our GeoJSON format. */
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function toGeoJsonFeature(raw: any): GdotCameraFeature | null {
if (!raw.lat || !raw.lon) return null;
+5 -1
View File
@@ -31,7 +31,11 @@ export async function GET(req: NextRequest) {
total: cameras.length,
sources,
});
} catch (error: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (error: any) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[TrafficCameras] Error:", error);
return NextResponse.json(
{ error: "Failed to fetch traffic cameras" },
+5 -4
View File
@@ -13,8 +13,7 @@
import type { GdotCameraFeature } from "../gdot/gdotFetcher";
const WSDOT_BASE =
"https://wsdot.wa.gov/Traffic/api/HighwayCameras/HighwayCamerasREST.svc/GetCamerasAsJson";
const WSDOT_BASE = "https://wsdot.wa.gov/Traffic/api/HighwayCameras/HighwayCamerasREST.svc/GetCamerasAsJson";
interface WsdotCamera {
CameraID: number;
@@ -77,9 +76,11 @@ export async function fetchWsdotCameras(): Promise<GdotCameraFeature[]> {
const key = process.env.WSDOT_API_KEY;
if (!key) {
if (!warnedMissingKey) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.warn(
"[WSDOT] WSDOT_API_KEY not set — skipping. " +
"Get a free key at https://wsdot.wa.gov/traffic/api/",
"[WSDOT] WSDOT_API_KEY not set — skipping. "
+ "Get a free key at https://wsdot.wa.gov/traffic/api/",
);
warnedMissingKey = true;
}
+4 -2
View File
@@ -30,10 +30,10 @@ export async function POST(request: Request) {
try {
const body = await request.json();
// Convert wwv-manifest.json format to PluginManifest format
const manifest = parseWwvManifest(body);
// Dev-loaded plugins are unverified by default
manifest.trust = "unverified";
@@ -50,6 +50,8 @@ export async function POST(request: Request) {
{ status: 200, headers: { "Access-Control-Allow-Origin": "*" } }
);
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[Load Unpacked] Error:", err);
return NextResponse.json(
{ error: "Failed to parse or load unpacked manifest" },
+4
View File
@@ -4,6 +4,8 @@ export const revalidate = 120;
const FEED_URL = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson";
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isValidFeature(feature: any): boolean {
const coordinates = feature?.geometry?.coordinates;
const time = feature?.properties?.time;
@@ -44,6 +46,8 @@ export async function GET() {
features,
});
} catch (error) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[EarthquakeRoute] Error:", error);
return NextResponse.json(
{ error: "Failed to fetch earthquake feed" },
+7 -1
View File
@@ -24,12 +24,18 @@ export async function POST(req: NextRequest) {
if (!response.ok) {
const errorText = await response.text();
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("GlitchTip tunnel rejected payload:", response.status, errorText);
return NextResponse.json({ status: "error", message: "GlitchTip rejected payload" }, { status: response.status });
}
return NextResponse.json({ status: "ok" });
} catch (error: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (error: any) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("GlitchTip tunnel internal error:", error);
return NextResponse.json({ status: "error", message: "Tunnel relay failed" }, { status: 500 });
}
@@ -12,7 +12,7 @@ export async function GET(
// Await params as required in Next.js 15+
const resolvedParams = await params;
const subdomain = resolvedParams.subdomain;
const {subdomain} = resolvedParams;
try {
const workspace = await prisma.workspace.findUnique({
@@ -26,6 +26,8 @@ export async function GET(
return NextResponse.json(workspace);
} catch (e) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("Failed to lookup workspace", e);
return NextResponse.json({ error: "Internal server error" }, { status: 500 });
}
+2
View File
@@ -62,6 +62,8 @@ export async function POST(request: Request) {
return NextResponse.json({ error: `Unknown service: ${service}` }, { status: 400 });
}
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[KeyVerify] Unexpected error:", err);
return NextResponse.json({ error: "Verification request failed" }, { status: 500 });
}
+17 -10
View File
@@ -2,22 +2,23 @@ import { NextRequest, NextResponse } from "next/server";
import * as client from "openid-client";
import { encryptCredential } from "@/lib/auth/encryption";
import { prisma as db } from "@/lib/db";
export async function GET(req: NextRequest) {
const isHttps = req.nextUrl.protocol === "https:";
const cookiePrefix = isHttps ? "__Host-" : "";
const stateCookie = req.cookies.get(`${cookiePrefix}pkce_state`)?.value;
const verifierCookie = req.cookies.get(`${cookiePrefix}pkce_verifier`)?.value;
const urlState = req.nextUrl.searchParams.get("state");
if (!stateCookie || urlState !== stateCookie) {
return NextResponse.json({ error: "State mismatch" }, { status: 400 });
}
if (!verifierCookie) {
return NextResponse.json({ error: "Missing code_verifier" }, { status: 400 });
}
const marketplaceUrl = process.env.NEXT_PUBLIC_WWV_MARKETPLACE_URL || "https://app.worldwideview.dev";
const issuer = new URL(marketplaceUrl);
const server = {
@@ -29,11 +30,13 @@ export async function GET(req: NextRequest) {
try {
const tokens = await client.authorizationCodeGrant(
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
config as any,
new URL(req.url),
{ expectedState: stateCookie, pkceCodeVerifier: verifierCookie }
);
if (tokens.access_token) {
const encrypted = await encryptCredential(tokens.access_token);
await db.marketplaceCredential.upsert({
@@ -53,13 +56,17 @@ export async function GET(req: NextRequest) {
}
});
}
} catch (err: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (err: any) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[PKCE] Exchange failed:", err.message);
return NextResponse.json({ error: "Failed to exchange authorization code" }, { status: 500 });
}
const res = NextResponse.redirect(new URL("/", req.nextUrl.origin), 302);
res.cookies.set(`${cookiePrefix}pkce_state`, "", {
httpOnly: true,
secure: isHttps,
@@ -67,7 +74,7 @@ export async function GET(req: NextRequest) {
path: "/api/marketplace/callback",
maxAge: 0
});
res.cookies.set(`${cookiePrefix}pkce_verifier`, "", {
httpOnly: true,
secure: isHttps,
@@ -75,6 +82,6 @@ export async function GET(req: NextRequest) {
path: "/api/marketplace/callback",
maxAge: 0
});
return res;
}
@@ -12,8 +12,10 @@ export async function GET(request: Request) {
try {
// Fetch currently installed plugins from PostgreSQL
const installedPlugins = await getInstalledPlugins();
// Exclude built-in versions, only check genuine semver strings or unverified records.
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const updatablePlugins = installedPlugins.filter((p: any) => p.version !== "built-in");
if (updatablePlugins.length === 0) {
@@ -24,13 +26,13 @@ export async function GET(request: Request) {
const res = await fetch(`${MARKETPLACE_URL}/api/plugins`, {
next: { revalidate: 60 } // Cache for 60 seconds
});
if (!res.ok) {
throw new Error(`Marketplace returned ${res.status}`);
}
const marketplacePlugins = await res.json();
// Build a lookup map of Market versions
const marketVersions = new Map();
for (const p of marketplacePlugins) {
@@ -42,7 +44,7 @@ export async function GET(request: Request) {
// Compare and flag updates
for (const localPlugin of updatablePlugins) {
const marketVersion = marketVersions.get(localPlugin.pluginId);
// Only suggest an update if marketplace version exists and differs
if (marketVersion && marketVersion !== "0.0.0" && marketVersion !== localPlugin.version) {
updates[localPlugin.pluginId] = marketVersion;
@@ -51,6 +53,8 @@ export async function GET(request: Request) {
return NextResponse.json({ updates });
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[marketplace/check-updates] Error:", err);
return NextResponse.json(
{ error: "Failed to check for updates" },
+7 -7
View File
@@ -5,9 +5,9 @@ export async function GET(req: NextRequest) {
const state = client.randomState();
const code_verifier = client.randomPKCECodeVerifier();
const code_challenge = await client.calculatePKCECodeChallenge(code_verifier);
const marketplaceUrl = process.env.NEXT_PUBLIC_WWV_MARKETPLACE_URL || "https://app.worldwideview.dev";
const url = new URL("/oauth/authorize", marketplaceUrl);
url.searchParams.set("client_id", "local-app");
url.searchParams.set("response_type", "code");
@@ -16,12 +16,12 @@ export async function GET(req: NextRequest) {
url.searchParams.set("state", state);
url.searchParams.set("redirect_uri", `${req.nextUrl.origin}/api/marketplace/callback`);
url.searchParams.set("scope", "plugins:read");
const res = NextResponse.redirect(url.toString(), 302);
const isHttps = req.nextUrl.protocol === "https:";
const cookiePrefix = isHttps ? "__Host-" : "";
res.cookies.set(`${cookiePrefix}pkce_state`, state, {
httpOnly: true,
secure: isHttps,
@@ -29,7 +29,7 @@ export async function GET(req: NextRequest) {
path: "/api/marketplace/callback",
maxAge: 60 * 10 // 10 minutes
});
res.cookies.set(`${cookiePrefix}pkce_verifier`, code_verifier, {
httpOnly: true,
secure: isHttps,
@@ -37,6 +37,6 @@ export async function GET(req: NextRequest) {
path: "/api/marketplace/callback",
maxAge: 60 * 10 // 10 minutes
});
return res;
}
+2
View File
@@ -38,6 +38,8 @@ export async function POST(request: Request) {
await disablePlugin(pluginId);
return withCors(NextResponse.json({ status: "disabled", pluginId }), request);
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[marketplace/disable] Error:", err);
return withCors(
NextResponse.json({ error: "Disable failed" }, { status: 500 }),
@@ -24,6 +24,8 @@ export async function GET(request: Request) {
request,
);
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[marketplace/disabled-builtins] Error:", err);
return withCors(
NextResponse.json({ disabledIds: [] }),
+2
View File
@@ -38,6 +38,8 @@ export async function POST(request: Request) {
await enablePlugin(pluginId);
return withCors(NextResponse.json({ status: "enabled", pluginId }), request);
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[marketplace/enable] Error:", err);
return withCors(
NextResponse.json({ error: "Enable failed" }, { status: 500 }),
+5 -3
View File
@@ -17,8 +17,8 @@ function isSafeRedirect(url: string): boolean {
try {
const parsed = new URL(url);
return (
ALLOWED_REDIRECT_HOSTS.has(parsed.hostname) ||
parsed.hostname.endsWith(".worldwideview.dev")
ALLOWED_REDIRECT_HOSTS.has(parsed.hostname)
|| parsed.hostname.endsWith(".worldwideview.dev")
);
} catch {
return false;
@@ -53,7 +53,7 @@ export async function GET(request: NextRequest) {
if (!session?.user) {
const origin = getRequestOrigin(request);
const loginUrl = new URL("/login", origin);
// Construct a relative path for callback to ensure it redirects back to the identical host
const callbackPath = request.nextUrl.pathname + request.nextUrl.search;
loginUrl.searchParams.set("callbackUrl", callbackPath);
@@ -73,6 +73,8 @@ export async function GET(request: NextRequest) {
// Token in fragment — never sent to server in logs/referer
return NextResponse.redirect(`${dest.toString()}#token=${token}`);
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[grant-token] Unexpected error:", err);
return NextResponse.json({ error: "Internal server error" }, { status: 500 });
}
@@ -24,7 +24,7 @@ if (process.env.ALLOWED_DEV_ORIGIN) {
function isSafeRedirect(url: string): boolean {
try {
const parsed = new URL(url);
const hostname = parsed.hostname;
const {hostname} = parsed;
return ALLOWED_REDIRECT_HOSTS.has(hostname) || hostname.endsWith(".worldwideview.dev");
} catch {
return false;
@@ -104,6 +104,8 @@ export async function GET(request: NextRequest) {
try {
await upsertPlugin(pluginId, version, JSON.stringify(manifest));
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[install-redirect] upsertPlugin failed:", err);
if (isSafeRedirect(redirectTo)) {
const errorUrl = new URL(redirectTo);
@@ -126,9 +128,10 @@ export async function GET(request: NextRequest) {
// Token in fragment — never sent to server in logs/referer
return NextResponse.redirect(`${successUrl.toString()}#token=${token}`);
} catch (err) {
// Top-level catch: log and redirect to marketplace with error, don't expose raw 500
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[install-redirect] Unexpected error:", err);
if (isSafeRedirect(redirectTo)) {
const errorUrl = new URL(redirectTo);
+15 -7
View File
@@ -21,8 +21,6 @@ export async function POST(request: Request) {
);
}
const rateLimited = marketplaceApiLimiter.check(getClientIp(request));
if (rateLimited) return withCors(rateLimited, request);
@@ -32,6 +30,8 @@ export async function POST(request: Request) {
try {
const body = await request.json();
const { pluginId, version, manifest } = body;
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`[Marketplace Install Route] Installing plugin: ${pluginId} v${version || "1.0.0"}`);
if (!pluginId || typeof pluginId !== "string") {
@@ -53,9 +53,9 @@ export async function POST(request: Request) {
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
// 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";
@@ -64,6 +64,8 @@ export async function POST(request: Request) {
}
}
} catch (e) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error(`[Marketplace Install Route] Failed to fetch manifest for ${pluginId}`, e);
}
}
@@ -72,10 +74,12 @@ export async function POST(request: Request) {
if (finalManifest) {
const validation = validateManifest(finalManifest);
if (!validation.valid) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error(
`[Marketplace Install Route] ❌ MANIFEST VALIDATION FAILED for ${pluginId}\n` +
`Errors: ${validation.errors.join(", ")}\n` +
`Evaluated Payload:\n${JSON.stringify(finalManifest, null, 2)}`
`[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(
@@ -88,6 +92,8 @@ export async function POST(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.
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.warn(`[Marketplace Install] No manifest provided or found for ${pluginId}`);
}
@@ -111,6 +117,8 @@ export async function POST(request: Request) {
request,
);
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[Bridge/install] Error:", err);
return withCors(
NextResponse.json(
+25 -12
View File
@@ -42,6 +42,8 @@ export async function GET(request: Request) {
]);
// Support local sandbox workflows by checking /public/plugins-local
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const localPlugins: any[] = [];
try {
if (process.env.NODE_ENV === "development" || process.env.WWV_PLUGIN_DEV === "true") {
@@ -54,6 +56,8 @@ export async function GET(request: Request) {
const config = fs.readFileSync(manifestPath, "utf-8");
localPlugins.push({ pluginId: folder, config });
} catch (e) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error(`Error reading local plugin ${folder}:`, e);
}
}
@@ -61,15 +65,17 @@ export async function GET(request: Request) {
}
}
} catch (e) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("Error scanning local plugins directory:", e);
}
const allRecords = [...records, ...localPlugins];
const manifests = allRecords
.map((r: any): PluginManifest | null => {
.// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
map((r: any): PluginManifest | null => {
try {
const manifest = JSON.parse(r.config);
if (!manifest.id) manifest.id = r.pluginId;
@@ -79,7 +85,9 @@ export async function GET(request: Request) {
return null;
}
})
.filter((m: any): m is PluginManifest => {
.// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
filter((m: any): m is PluginManifest => {
if (!m) return false;
// Skip built-in plugins — already registered by AppShell
if (m.trust === "built-in") return false;
@@ -92,18 +100,20 @@ export async function GET(request: Request) {
// Skip bundle plugins whose entry is a bare module specifier
// (e.g. "camera") — cannot be dynamically imported in the browser.
if (
m.format === "bundle" &&
!m.entry.startsWith("/") &&
!m.entry.startsWith("./") &&
!m.entry.startsWith("http")
m.format === "bundle"
&& !m.entry.startsWith("/")
&& !m.entry.startsWith("./")
&& !m.entry.startsWith("http")
) return false;
// For anything that looks like a real manifest, validate it and log if it fails
const validation = validateManifest(m);
if (!validation.valid) {
const errorMessage = `Manifest validation failed for ${m.id}`;
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error(`[Marketplace API] ${errorMessage}:`, validation.errors);
// Capture in Sentry so we have visibility into malformed third-party plugins
Sentry.captureMessage(errorMessage, {
level: "error",
@@ -116,7 +126,9 @@ export async function GET(request: Request) {
}
return validation.valid;
})
.map((m: any) => {
.// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
map((m: any) => {
// Re-stamp trust against the live registry so revoked plugins
// are correctly gated by the unverified dialog on the client.
if (m.trust !== "built-in") {
@@ -131,7 +143,7 @@ export async function GET(request: Request) {
if (m.format === "declarative" && m.dataSource) {
// Only omit headers and potentially sensitive auth params.
// The URL might be needed by the client for polling, but headers like Bearer tokens shouldn't leak.
// If the audit explicitly asks to strip URL, maybe just replace it entirely if it's sensitive,
// If the audit explicitly asks to strip URL, maybe just replace it entirely if it's sensitive,
// but usually headers are the sensitive part. We strip headers.
if (m.dataSource.headers) {
m.dataSource.headers = {};
@@ -142,8 +154,9 @@ export async function GET(request: Request) {
return withCors(NextResponse.json({ manifests }), request);
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[Marketplace/load] Error:", err);
return withCors(NextResponse.json({ manifests: [] }), request);
}
}
+12 -10
View File
@@ -1,4 +1,6 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import {
describe, it, expect, vi, beforeEach
} from "vitest";
import { NextRequest } from "next/server";
import { GET as connectRoute } from "./connect/route";
import { GET as callbackRoute } from "./callback/route";
@@ -39,14 +41,14 @@ describe("PKCE Flow", () => {
it("should generate PKCE parameters and redirect with secure cookies", async () => {
const req = new NextRequest("https://localhost:3000/api/marketplace/connect");
const res = await connectRoute(req);
expect(res.status).toBe(302);
// Check redirect URL
const location = res.headers.get("Location");
expect(location).toContain("response_type=code");
expect(location).toContain("code_challenge_method=S256");
// Check cookie flags
const cookies = res.headers.get("Set-Cookie");
expect(cookies).toBeDefined();
@@ -63,7 +65,7 @@ describe("PKCE Flow", () => {
it("should reject if state does not match", async () => {
const req = new NextRequest("https://localhost:3000/api/marketplace/callback?state=wrong-state&code=test-code");
req.cookies.set("__Host-pkce_state", "correct-state");
const res = await callbackRoute(req);
expect(res.status).toBe(400);
expect(await res.json()).toEqual({ error: "State mismatch" });
@@ -73,7 +75,7 @@ describe("PKCE Flow", () => {
const req = new NextRequest("https://localhost:3000/api/marketplace/callback?state=correct-state&code=test-code");
req.cookies.set("__Host-pkce_state", "correct-state");
// code_verifier cookie is intentionally omitted
const res = await callbackRoute(req);
expect(res.status).toBe(400);
expect(await res.json()).toEqual({ error: "Missing code_verifier" });
@@ -83,19 +85,19 @@ describe("PKCE Flow", () => {
const req = new NextRequest("https://localhost:3000/api/marketplace/callback?state=correct-state&code=test-code");
req.cookies.set("__Host-pkce_state", "correct-state");
req.cookies.set("__Host-pkce_verifier", "mock-verifier");
const res = await callbackRoute(req);
const cookies = res.headers.get("Set-Cookie");
expect(cookies).toContain("__Host-pkce_state=;");
expect(cookies).toContain("Max-Age=0");
});
it("should perform openid-client exchange and save encrypted token", async () => {
const req = new NextRequest("https://localhost:3000/api/marketplace/callback?state=correct-state&code=test-code");
req.cookies.set("__Host-pkce_state", "correct-state");
req.cookies.set("__Host-pkce_verifier", "mock-verifier");
const res = await callbackRoute(req);
expect(res.status).toBe(302); // Redirect back to marketplace or app
});
@@ -33,6 +33,8 @@ export async function POST(request: Request) {
return NextResponse.json({ status: "sideloaded", manifest });
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[Sideload] Error:", err);
return NextResponse.json(
{ error: "Sideload failed" },
+5 -2
View File
@@ -25,6 +25,8 @@ export async function GET(request: Request) {
try {
const dbPlugins = await getInstalledPlugins();
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const dbMap = new Map(dbPlugins.map((p: any) => [p.pluginId, p]));
// Collect all DB plugins (enabled and disabled)
@@ -38,14 +40,15 @@ export async function GET(request: Request) {
return withCors(NextResponse.json({ plugins, canManagePlugins }), request);
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[marketplace/status] Error:", err);
let canManagePlugins = !isDemo;
if (isDemo) {
const authError = await validateMarketplaceAuth(request);
canManagePlugins = authError === null;
}
return withCors(NextResponse.json({ plugins: [], canManagePlugins }), request);
}
}
+2 -3
View File
@@ -19,8 +19,6 @@ export async function POST(request: Request) {
);
}
const rateLimited = marketplaceApiLimiter.check(getClientIp(request));
if (rateLimited) return withCors(rateLimited, request);
@@ -52,6 +50,8 @@ export async function POST(request: Request) {
return withCors(NextResponse.json({ status: "uninstalled", pluginId }), request);
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[marketplace/uninstall] Error:", err);
return withCors(
NextResponse.json({ error: "Uninstall failed" }, { status: 500 }),
@@ -59,4 +59,3 @@ export async function POST(request: Request) {
);
}
}
+6
View File
@@ -17,6 +17,8 @@ export async function GET(request: Request) {
const isValidUserKey = userKey && userKey.length >= 20;
const apiKey = isValidUserKey ? userKey : process.env.GOOGLE_MAPS_API_KEY;
if (!apiKey) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("GOOGLE_MAPS_API_KEY is not defined and no user key provided");
return NextResponse.json({ error: "Server configuration error" }, { status: 500 });
}
@@ -38,6 +40,8 @@ export async function GET(request: Request) {
const data = await response.json();
if (data.status !== "OK") {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("Google Places Details API Error:", data);
return NextResponse.json({ error: "Failed to fetch place details" }, { status: 500 });
}
@@ -57,6 +61,8 @@ export async function GET(request: Request) {
cache.set(cacheId, { data: result, expiresAt: Date.now() + TTL_MS });
return NextResponse.json(result);
} catch (error) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("Error in Places Details route:", error);
return NextResponse.json({ error: "Internal server error" }, { status: 500 });
}
+8
View File
@@ -17,6 +17,8 @@ export async function GET(request: Request) {
const isValidUserKey = userKey && userKey.length >= 20;
const apiKey = isValidUserKey ? userKey : process.env.GOOGLE_MAPS_API_KEY;
if (!apiKey) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("GOOGLE_MAPS_API_KEY is not defined and no user key provided");
return NextResponse.json({ error: "Server configuration error" }, { status: 500 });
}
@@ -39,10 +41,14 @@ export async function GET(request: Request) {
const data = await response.json();
if (data.status !== "OK" && data.status !== "ZERO_RESULTS") {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("Google Places API Error:", data);
return NextResponse.json({ error: "Failed to fetch predictions" }, { status: 500 });
}
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const predictions = data.predictions.map((p: any) => ({
description: p.description,
placeId: p.place_id,
@@ -55,6 +61,8 @@ export async function GET(request: Request) {
cache.set(cacheKey, { data: result, expiresAt: Date.now() + TTL_MS });
return NextResponse.json(result);
} catch (error) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("Error in Places Autocomplete route:", error);
return NextResponse.json({ error: "Internal server error" }, { status: 500 });
}
+33 -9
View File
@@ -1,18 +1,20 @@
import { NextResponse } from "next/server";
import https from "https";
const OVERPASS_MIRRORS = [
"https://overpass-api.de/api/interpreter",
"https://lz4.overpass-api.de/api/interpreter",
"https://overpass.kumi.systems/api/interpreter"
];
import https from "https";
async function tryMirror(urlStr: string, query: string, timeoutMs: number) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return new Promise<any>((resolve, reject) => {
const url = new URL(urlStr);
const bodyStr = `data=${encodeURIComponent(query)}`;
const req = https.request(url, {
method: "POST",
family: 4, // Force IPv4 to avoid Docker IPv6 dropout
@@ -24,7 +26,7 @@ async function tryMirror(urlStr: string, query: string, timeoutMs: number) {
timeout: timeoutMs,
}, (res) => {
let data = "";
res.on("data", chunk => data += chunk);
res.on("data", (chunk) => data += chunk);
res.on("end", () => {
resolve({
ok: res.statusCode && res.statusCode >= 200 && res.statusCode < 300,
@@ -41,7 +43,7 @@ async function tryMirror(urlStr: string, query: string, timeoutMs: number) {
req.destroy();
reject(new Error("Request timed out"));
});
req.write(bodyStr);
req.end();
});
@@ -56,11 +58,15 @@ export async function POST(req: Request) {
return NextResponse.json({ error: "Missing query" }, { status: 400 });
}
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`[OSMSearchProxy] Querying Overpass API mirrors... (length: ${query.length})`);
let lastError = null;
for (const mirror of OVERPASS_MIRRORS) {
try {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.log(`[OSMSearchProxy] Trying mirror: ${mirror}`);
const res = await tryMirror(mirror, query, 25000); // 25s per mirror
@@ -70,12 +76,16 @@ export async function POST(req: Request) {
return NextResponse.json({ data: data.elements });
}
if (data.remark) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.warn(`[OSMSearchProxy] ${mirror} returned remark: ${data.remark}`);
// If it's a specific query error (remark), don't bother retrying mirrors
return NextResponse.json({ error: data.remark }, { status: 400 });
}
} else {
const text = await res.text();
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.warn(`[OSMSearchProxy] Mirror ${mirror} failed: ${res.status} ${res.statusText}`);
lastError = { status: res.status, statusText: res.statusText, details: text };
// If it's a 4xx error (except 429), it's probably a bad query, so don't retry
@@ -83,19 +93,33 @@ export async function POST(req: Request) {
break;
}
}
} catch (err: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (err: any) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.warn(`[OSMSearchProxy] Mirror ${mirror} threw error:`);
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.warn(err);
if (err instanceof Error) console.warn(err.stack);
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
if (err instanceof Error)
// eslint-disable-next-line no-console
console.warn(err.stack);
lastError = { status: 500, statusText: "Internal Error", details: String(err && err.message ? err.message : err) };
}
}
return NextResponse.json(
{ error: "All Overpass mirrors failed or timed out. The OSM servers are likely under heavy load." },
{ error: "All Overpass mirrors failed or timed out. The OSM servers are likely under heavy load." },
{ status: 504 }
);
} catch (e: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (e: any) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error(`[OSMSearchProxy] Internal error:`, e);
return NextResponse.json({ error: "Internal server error" }, { status: 500 });
}
+6 -2
View File
@@ -7,7 +7,7 @@ export async function GET() {
const response = await fetch("https://www.submarinecablemap.com/api/v3/cable/cable-geo.json", {
headers: {
"User-Agent": "WorldWideView/1.0",
"Accept": "application/json",
Accept: "application/json",
},
});
@@ -20,7 +20,11 @@ export async function GET() {
const data = await response.json();
return NextResponse.json(data);
} catch (error: any) {
} // TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
catch (error: any) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[UnderseaCablesProxy] Error:", error);
return NextResponse.json(
{ error: "Failed to proxy request" },
+13 -5
View File
@@ -13,9 +13,11 @@ export async function GET(request: Request) {
where: { userId: session.user.id },
orderBy: { lastSeen: "desc" }
});
return NextResponse.json(favorites);
} catch (e) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("GET Favorites Error:", e);
return NextResponse.json({ error: "Failed to fetch favorites" }, { status: 500 });
}
@@ -29,7 +31,9 @@ export async function POST(request: Request) {
try {
const body = await request.json();
const { entityId, pluginId, label, pluginName } = body;
const {
entityId, pluginId, label, pluginName
} = body;
if (!entityId || !pluginId || !label || !pluginName) {
return NextResponse.json({ error: "Missing required fields" }, { status: 400 });
@@ -39,7 +43,7 @@ export async function POST(request: Request) {
where: {
userId_entityId: {
userId: session.user.id,
entityId: entityId
entityId
}
},
update: {
@@ -56,6 +60,8 @@ export async function POST(request: Request) {
return NextResponse.json(fav);
} catch (e) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("POST Favorites Error:", e);
return NextResponse.json({ error: "Failed to create favorite" }, { status: 500 });
}
@@ -70,7 +76,7 @@ export async function DELETE(request: Request) {
try {
const { searchParams } = new URL(request.url);
const entityId = searchParams.get("entityId");
if (!entityId) {
return NextResponse.json({ error: "Missing entityId" }, { status: 400 });
}
@@ -79,13 +85,15 @@ export async function DELETE(request: Request) {
where: {
userId_entityId: {
userId: session.user.id,
entityId: entityId
entityId
}
}
});
return NextResponse.json({ success: true });
} catch (e) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("DELETE Favorites Error:", e);
return NextResponse.json({ error: "Failed to delete favorite" }, { status: 500 });
}
+225 -3
View File
@@ -218,7 +218,7 @@ html, body {
.sidebar {
position: fixed;
top: 80px; /* Reduced to ~12px gap from header */
bottom: 140px; /* Reduced gap from timeline */
bottom: var(--sidebar-bottom, 140px); /* Dynamically pushed by BottomPanelManager */
width: 280px;
z-index: 50;
padding: var(--space-lg);
@@ -230,8 +230,16 @@ html, body {
bottom var(--duration-slow) var(--ease-smooth);
}
.timeline-closed .sidebar {
bottom: var(--space-lg);
body.is-dragging-bottom-panel .sidebar {
transition: transform var(--duration-slow) var(--ease-smooth),
opacity var(--duration-slow) var(--ease-smooth);
}
/* Force animation when crossing the threshold (overrides is-dragging) */
body.sidebar-force-transition .sidebar {
transition: transform var(--duration-slow) var(--ease-smooth),
opacity var(--duration-slow) var(--ease-smooth),
bottom var(--duration-slow) var(--ease-smooth) !important;
}
.sidebar--left {
@@ -1912,3 +1920,217 @@ body.is-resizing-sidebar .sidebar {
background: rgba(255, 255, 255, 0.1);
}
/* ─── Bottom Panel Manager ───────────────────────────────── */
.bottom-panel-system {
position: absolute;
bottom: var(--space-lg, 20px);
left: var(--space-lg, 20px);
right: calc(var(--ad-strip-inset, 0px) + var(--space-lg, 20px));
display: flex;
flex-direction: column;
align-items: center;
z-index: 1000;
pointer-events: none;
}
.bottom-panel-dock {
display: flex;
margin-bottom: 0; /* Flush with panel */
pointer-events: auto;
transition: transform var(--duration-normal) var(--ease-smooth), gap var(--duration-fast) var(--ease-smooth);
/* Centered, horizontally scrollable container */
max-width: 100%;
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE/Edge */
/* Safely center items but prevent left-side clipping on overflow */
justify-content: safe center;
/* Small negative gap so the slanted bases touch/overlap nicely */
gap: -4px;
padding: 0 12px;
}
.bottom-panel-dock::-webkit-scrollbar {
display: none; /* Safari/Chrome */
}
/* The actual button container (transparent, straight rectangle) */
.dock-btn {
position: relative;
flex-shrink: 0;
height: 36px;
padding: 0 24px; /* Wider padding to account for slanted sides */
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
background: transparent;
border: none;
color: var(--text-secondary);
cursor: pointer;
font-size: 11px;
font-weight: 500;
letter-spacing: 0.05em;
text-transform: uppercase;
isolation: isolate; /* Create new stacking context so pseudo-elements don't escape */
transition: color var(--duration-fast) var(--ease-smooth), padding var(--duration-fast) var(--ease-smooth);
}
/* The angled background shape using 3D perspective */
.dock-btn::before {
content: '';
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
z-index: -1;
background: var(--bg-glass);
backdrop-filter: blur(var(--glass-blur, 24px));
border: var(--glass-border);
border-bottom: none;
border-radius: var(--radius-sm) var(--radius-sm) 0 0;
/* Create the trapezoid slant by rotating back on the X axis */
transform: perspective(20px) rotateX(5deg);
transform-origin: bottom;
transition: all var(--duration-fast) var(--ease-smooth);
opacity: 0.6; /* More transparent when inactive */
}
.dock-btn:hover {
color: var(--text-primary);
}
.dock-btn:hover::before {
background: var(--bg-glass-hover);
opacity: 0.85;
}
.dock-btn.active {
color: var(--accent-cyan);
font-weight: 600;
z-index: 2; /* Bring active tab to front */
}
.dock-btn.active::before {
background: var(--bg-glass-active);
border-color: rgba(var(--accent-rgb), 0.5);
box-shadow: inset 0 0 40px rgba(var(--accent-rgb), 0.08), 0 -4px 15px rgba(var(--accent-rgb), 0.15); /* Tint + Glow upwards */
opacity: 1; /* Fully opaque (relative to the rgba alpha) when active */
}
.dock-btn-label {
white-space: nowrap;
}
/* ─── Floating Pills Mode (when no panel is active) ─── */
.bottom-panel-dock.floating-pills {
gap: 8px; /* Give them breathing room */
}
.bottom-panel-dock.floating-pills .dock-btn {
padding: 0 16px; /* Less horizontal padding since it's not a trapezoid */
}
.bottom-panel-dock.floating-pills .dock-btn::before {
border-radius: var(--radius-full);
transform: none; /* Remove trapezoid slant */
border-bottom: var(--glass-border); /* Restore full border */
}
.bottom-panel {
width: 100%;
/* border-radius: var(--radius-lg); - handled by .glass-panel */
display: flex;
flex-direction: column;
pointer-events: auto;
overflow: hidden;
position: relative;
/* Transition applied to height in style, but we can animate opacity/transform too */
transition: height var(--duration-slow) var(--ease-smooth), opacity var(--duration-normal) var(--ease-smooth);
/* Removed background override so it inherits .glass-panel perfectly */
margin-top: -1px; /* Overlap the 1px border so tabs sit perfectly flush */
}
/* Disable height transition during drag to prevent lag */
body.is-dragging-bottom-panel .bottom-panel {
transition: opacity var(--duration-normal) var(--ease-smooth);
}
.bottom-panel.closed {
opacity: 0;
pointer-events: none;
border: none;
}
.bottom-panel.open {
opacity: 1;
}
.bottom-panel-resize-handle {
height: 12px;
width: 100%;
cursor: ns-resize;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
left: 0;
background: transparent;
z-index: 10;
}
.bottom-panel-resize-handle:hover .resize-grip {
background: rgba(255, 255, 255, 0.5);
}
.resize-grip {
width: 40px;
height: 4px;
border-radius: 2px;
background: rgba(255, 255, 255, 0.2);
transition: background 0.2s;
}
.bottom-panel-close-btn {
position: absolute;
top: 12px;
right: 12px;
background: transparent;
border: none;
color: rgba(255, 255, 255, 0.5);
cursor: pointer;
padding: 4px;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
transition: all 0.2s ease;
}
.bottom-panel-close-btn:hover {
color: white;
background: rgba(255, 255, 255, 0.1);
}
.bottom-panel-content {
padding: 24px;
flex: 1;
overflow-y: auto;
/* Ensure the content sits below the resize handle */
margin-top: 12px;
display: flex;
flex-direction: column;
}
/* Timeline adjustments inside the new panel */
.timeline__content {
display: flex;
flex-direction: column;
gap: 12px;
height: 100%;
}
+2 -2
View File
@@ -38,9 +38,9 @@ export default function RootLayout({
)}
{/* Load CesiumJS base styles (optional, but helps with UI widgets if used later) */}
<link rel="stylesheet" href="/cesium/Widgets/widgets.css" />
<Script
<script
id="theme-hydration"
strategy="beforeInteractive"
suppressHydrationWarning
dangerouslySetInnerHTML={{
__html: `
try {
+2 -3
View File
@@ -27,10 +27,10 @@ export async function loginAction(formData: FormData): Promise<LoginResult> {
email,
password,
});
if (error) return { success: false, error: error.message };
return { success: true };
} else {
}
try {
await signIn("credentials", {
email,
@@ -49,5 +49,4 @@ export async function loginAction(formData: FormData): Promise<LoginResult> {
}
throw error;
}
}
}
+37 -38
View File
@@ -2,8 +2,8 @@
import { Suspense, useState } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import { loginAction } from "./actions";
import { isDemo } from "@/core/edition";
import { loginAction } from "./actions";
import styles from "../setup/setup.module.css";
/** Allow relative paths or absolute URLs on the same origin. */
@@ -48,52 +48,51 @@ function LoginForm() {
}
return (
<div className={styles.container}>
<div className={styles.card}>
<div className={styles.logo}>W</div>
<h1 className={styles.title}>Sign in to WorldWideView</h1>
<p className={styles.subtitle}>Enter your credentials to continue</p>
<div className={styles.container}>
<div className={styles.card}>
<div className={styles.logo}>W</div>
<h1 className={styles.title}>Sign in to WorldWideView</h1>
<p className={styles.subtitle}>Enter your credentials to continue</p>
<form onSubmit={handleSubmit} method="post" className={styles.form}>
<label className={styles.label} htmlFor="email">
{isDemo ? "Username" : "Email"}
</label>
<input
id="email"
name="email"
type={isDemo ? "text" : "email"}
required
className={styles.input}
placeholder={isDemo ? "admin" : "[email protected]"}
/>
<form onSubmit={handleSubmit} method="post" className={styles.form}>
<label className={styles.label} htmlFor="email">
{isDemo ? "Username" : "Email"}
<input
id="email"
name="email"
type={isDemo ? "text" : "email"}
required
className={styles.input}
placeholder={isDemo ? "admin" : "[email protected]"}
/>
</label>
<label className={styles.label} htmlFor="password">
Password
</label>
<input
id="password"
name="password"
type="password"
required
className={styles.input}
/>
<label className={styles.label} htmlFor="password">
Password
<input
id="password"
name="password"
type="password"
required
className={styles.input}
/>
</label>
{error && <p className={styles.error}>{error}</p>}
{error && <p className={styles.error}>{error}</p>}
<button type="submit" disabled={loading} className={styles.button}>
{loading ? "Signing in..." : "Sign In"}
</button>
</form>
</div>
<button type="submit" disabled={loading} className={styles.button}>
{loading ? "Signing in..." : "Sign In"}
</button>
</form>
</div>
</div>
);
}
export default function LoginPage() {
return (
<Suspense>
<LoginForm />
</Suspense>
<Suspense>
<LoginForm />
</Suspense>
);
}
+3 -1
View File
@@ -32,7 +32,9 @@ export async function createAdminAccount(formData: FormData): Promise<SetupResul
const hashedPassword = hashSync(password, 12);
await prisma.user.create({
data: { name, email, hashedPassword, role: "admin" },
data: {
name, email, hashedPassword, role: "admin"
},
});
return { success: true };
+57 -64
View File
@@ -27,76 +27,69 @@ export default function SetupPage() {
}
return (
<div className={styles.container}>
<div className={styles.card}>
<div className={styles.logo}>W</div>
<h1 className={styles.title}>Welcome to WorldWideView</h1>
<p className={styles.subtitle}>Create your admin account to get started</p>
<div className={styles.container}>
<div className={styles.card}>
<div className={styles.logo}>W</div>
<h1 className={styles.title}>Welcome to WorldWideView</h1>
<p className={styles.subtitle}>Create your admin account to get started</p>
{/* Legacy Data Detection Banner */}
<div className={styles.legacyNotice}>
<strong>💡 Upgrading from an older version?</strong>
<p>We've detected legacy SQLite data. Once your new Postgres database is connected, you can import your favorites by running the migration command in your terminal.</p>
<code>docker compose exec wwv node scripts/migrate-legacy.mjs</code>
</div>
<form onSubmit={handleSubmit} className={styles.form}>
<label className={styles.label} htmlFor="name">
Display Name
<input
id="name"
name="name"
type="text"
required
className={styles.input}
placeholder="Admin"
/>
</label>
<form onSubmit={handleSubmit} className={styles.form}>
<label className={styles.label} htmlFor="name">
Display Name
</label>
<input
id="name"
name="name"
type="text"
required
className={styles.input}
placeholder="Admin"
/>
<label className={styles.label} htmlFor="email">
Email
<input
id="email"
name="email"
type="email"
required
className={styles.input}
placeholder="[email protected]"
/>
</label>
<label className={styles.label} htmlFor="email">
Email
</label>
<input
id="email"
name="email"
type="email"
required
className={styles.input}
placeholder="[email protected]"
/>
<label className={styles.label} htmlFor="password">
Password
<input
id="password"
name="password"
type="password"
required
minLength={8}
className={styles.input}
placeholder="Min. 8 characters"
/>
</label>
<label className={styles.label} htmlFor="password">
Password
</label>
<input
id="password"
name="password"
type="password"
required
minLength={8}
className={styles.input}
placeholder="Min. 8 characters"
/>
<label className={styles.label} htmlFor="confirm">
Confirm Password
<input
id="confirm"
name="confirm"
type="password"
required
minLength={8}
className={styles.input}
/>
</label>
<label className={styles.label} htmlFor="confirm">
Confirm Password
</label>
<input
id="confirm"
name="confirm"
type="password"
required
minLength={8}
className={styles.input}
/>
{error && <p className={styles.error}>{error}</p>}
{error && <p className={styles.error}>{error}</p>}
<button type="submit" disabled={loading} className={styles.button}>
{loading ? "Creating..." : "Create Admin Account"}
</button>
</form>
</div>
<button type="submit" disabled={loading} className={styles.button}>
{loading ? "Creating..." : "Create Admin Account"}
</button>
</form>
</div>
</div>
);
}
-24
View File
@@ -103,27 +103,3 @@
.button:hover { opacity: 0.9; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.legacyNotice {
margin: 1.5rem 0;
padding: 1rem;
background: rgba(255, 191, 0, 0.05);
border: 1px solid rgba(255, 191, 0, 0.3);
text-align: left;
font-size: 0.8rem;
color: #ffbf00;
}
.legacyNotice strong {
display: block;
margin-bottom: 0.4rem;
}
.legacyNotice code {
display: block;
margin-top: 0.75rem;
padding: 0.5rem;
background: #000;
color: #0f0;
font-family: 'JetBrains Mono', monospace;
word-break: break-all;
}
+69 -50
View File
@@ -1,16 +1,21 @@
import React, { useState, useEffect } from "react";
import styles from "./page.module.css";
import { CameraStream } from "@/components/video/CameraStream";
import styles from "./page.module.css";
import type { TestResult } from "./types";
const LiveTimer = ({ start }: { start: number }) => {
function LiveTimer({ start }: { start: number }) {
const [now, setNow] = useState(Date.now());
useEffect(() => {
const interval = setInterval(() => setNow(Date.now()), 100);
return () => clearInterval(interval);
}, []);
return <span>{(Math.max(0, now - start) / 1000).toFixed(1)}s</span>;
};
return (
<span>
{(Math.max(0, now - start) / 1000).toFixed(1)}
s
</span>
);
}
interface CameraTestCardProps {
result: TestResult;
@@ -21,8 +26,12 @@ interface CameraTestCardProps {
onRetest: (globalIndex: number) => void;
}
export function CameraTestCard({ result, index, globalIndex, previewId, onSetPreview, onRetest }: CameraTestCardProps) {
const { feature, status, httpStatus, contentType, latencyMs, errorMsg } = result;
export function CameraTestCard({
result, index, globalIndex, previewId, onSetPreview, onRetest
}: CameraTestCardProps) {
const {
feature, status, httpStatus, contentType, latencyMs, errorMsg
} = result;
const { stream, name, source } = feature.properties;
const id = stream + index.toString();
@@ -33,69 +42,79 @@ export function CameraTestCard({ result, index, globalIndex, previewId, onSetPre
else if (status === "testing") statusClass += ` ${styles.badgeTesting}`;
return (
<div className={styles.card}>
<div className={styles.cardHeader}>
<h3 className={styles.title} title={name}>{name || "Unknown Camera"}</h3>
<span className={styles.badge}>{source}</span>
</div>
<div className={styles.card}>
<div className={styles.cardHeader}>
<h3 className={styles.title} title={name}>{name || "Unknown Camera"}</h3>
<span className={styles.badge}>{source}</span>
</div>
<div className={styles.badges}>
<span className={statusClass}>
{status === "testing" ? (
<>Testing... <LiveTimer start={result.testStartTime || Date.now()} /></>
<div className={styles.badges}>
<span className={statusClass}>
{status === "testing" ? (
<>
Testing...
<LiveTimer start={result.testStartTime || Date.now()} />
</>
) : (
status.toUpperCase()
)}
{httpStatus && ` (${httpStatus})`}
</span>
{latencyMs !== undefined && <span className={styles.badge}>{latencyMs}ms</span>}
{contentType && <span className={styles.badge}>{contentType.split(';')[0]}</span>}
</div>
{httpStatus && ` (${httpStatus})`}
</span>
{latencyMs !== undefined && (
<span className={styles.badge}>
{latencyMs}
ms
</span>
)}
{contentType && <span className={styles.badge}>{contentType.split(';')[0]}</span>}
</div>
<div className={styles.url}>
{stream || "No stream URL"}
</div>
<div className={styles.url}>
{stream || "No stream URL"}
</div>
{errorMsg && <div className={styles.errorMsg}>{errorMsg}</div>}
{errorMsg && <div className={styles.errorMsg}>{errorMsg}</div>}
<div style={{ marginTop: 'auto', display: 'flex', gap: '0.5rem' }}>
<button
className={styles.button}
style={{
<div style={{ marginTop: 'auto', display: 'flex', gap: '0.5rem' }}>
<button
type="button"
className={styles.button}
style={{
padding: '0.4rem 0.8rem',
fontSize: '0.8rem',
flex: 1,
justifyContent: 'center',
background: 'rgba(255,255,255,0.1)'
}}
onClick={() => onRetest(globalIndex)}
>
🔄 Retest
</button>
<button
className={styles.button}
style={{
onClick={() => onRetest(globalIndex)}
>
🔄 Retest
</button>
<button
type="button"
className={styles.button}
style={{
padding: '0.4rem 0.8rem',
fontSize: '0.8rem',
flex: 2,
justifyContent: 'center',
background: previewId === id ? 'rgba(255,255,255,0.15)' : '#334155'
}}
onClick={() => onSetPreview(previewId === id ? null : id)}
disabled={!stream}
>
{previewId === id ? "Close Preview" : "Live Preview"}
</button>
</div>
{previewId === id && stream && (
<div className={styles.preview}>
<CameraStream
streamUrl={stream}
label={name}
/>
</div>
)}
onClick={() => onSetPreview(previewId === id ? null : id)}
disabled={!stream}
>
{previewId === id ? "Close Preview" : "Live Preview"}
</button>
</div>
{previewId === id && stream && (
<div className={styles.preview}>
<CameraStream
streamUrl={stream}
label={name}
/>
</div>
)}
</div>
);
}
+173 -96
View File
@@ -12,119 +12,195 @@ export default function CameraTestPage() {
const [testStatuses, setTestStatuses] = useState<string[]>(["all"]);
const [previewId, setPreviewId] = useState<string | null>(null);
const { cameras, loading, testing, runTests, stopTests, retestCamera } = useCameraTestRunner(testSources, testStatuses);
const {
cameras, loading, testing, runTests, stopTests, retestCamera
} = useCameraTestRunner(testSources, testStatuses);
const filtered = cameras.filter(c => {
const filtered = cameras.filter((c) => {
const sourceMatches = filterSources.includes("all") || filterSources.includes(c.feature.properties.source || "Unknown");
const statusMatches = filterStatuses.includes("all") || filterStatuses.includes(c.status);
return sourceMatches && statusMatches;
});
const handleMultiSelect = (e: React.ChangeEvent<HTMLSelectElement>, setter: React.Dispatch<React.SetStateAction<string[]>>) => {
const selected = Array.from(e.target.selectedOptions, o => o.value);
const selected = Array.from(e.target.selectedOptions, (o) => o.value);
if (selected.length === 0) setter(["all"]);
else setter(selected);
};
const stats = {
total: cameras.length,
ok: cameras.filter(c => c.status === "ok").length,
error: cameras.filter(c => c.status === "error").length,
timeout: cameras.filter(c => c.status === "timeout").length,
pending: cameras.filter(c => c.status === "pending").length,
testing: cameras.filter(c => c.status === "testing").length
ok: cameras.filter((c) => c.status === "ok").length,
error: cameras.filter((c) => c.status === "error").length,
timeout: cameras.filter((c) => c.status === "timeout").length,
pending: cameras.filter((c) => c.status === "pending").length,
testing: cameras.filter((c) => c.status === "testing").length
};
const dStats = {
total: filtered.length,
ok: filtered.filter(c => c.status === "ok").length,
error: filtered.filter(c => c.status === "error").length,
timeout: filtered.filter(c => c.status === "timeout").length,
pending: filtered.filter(c => c.status === "pending").length,
testing: filtered.filter(c => c.status === "testing").length
ok: filtered.filter((c) => c.status === "ok").length,
error: filtered.filter((c) => c.status === "error").length,
timeout: filtered.filter((c) => c.status === "timeout").length,
pending: filtered.filter((c) => c.status === "pending").length,
testing: filtered.filter((c) => c.status === "testing").length
};
const sources = Array.from(new Set(cameras.map(c => c.feature.properties.source || "Unknown"))).sort();
const sources = Array.from(new Set(cameras.map((c) => c.feature.properties.source || "Unknown"))).sort();
return (
<div className={styles.container}>
<div className={styles.header}>
<h1>Camera Stream Diagnostics</h1>
<p>Run parallel checks on all traffic camera streams to detect compatibility and offline issues.</p>
</div>
<div className={styles.container}>
<div className={styles.header}>
<h1>Camera Stream Diagnostics</h1>
<p>Run parallel checks on all traffic camera streams to detect compatibility and offline issues.</p>
</div>
<div className={styles.stats}>
<div className={styles.statCard}><h3>Total Cameras</h3><p>{stats.total} <span style={{ fontSize: '0.8rem', opacity: 0.7 }}>({dStats.total} shown)</span></p></div>
<div className={styles.statCard}><h3>Responsive (OK)</h3><p className={styles.badgeOk} style={{ background: 'none', padding: 0, border: 'none' }}>{stats.ok} <span style={{ fontSize: '0.8rem', opacity: 0.7 }}>({dStats.ok} shown)</span></p></div>
<div className={styles.statCard}><h3>Errors / Blocked</h3><p className={styles.badgeError} style={{ background: 'none', padding: 0, border: 'none' }}>{stats.error} <span style={{ fontSize: '0.8rem', opacity: 0.7 }}>({dStats.error} shown)</span></p></div>
<div className={styles.statCard}><h3>Timeouts</h3><p className={styles.badgeWarn} style={{ background: 'none', padding: 0, border: 'none' }}>{stats.timeout} <span style={{ fontSize: '0.8rem', opacity: 0.7 }}>({dStats.timeout} shown)</span></p></div>
<div className={styles.statCard}><h3>Pending</h3><p className={stats.testing > 0 ? styles.badgeTesting : ''} style={{ background: 'none', padding: 0, border: 'none', color: stats.testing > 0 ? '#60a5fa' : 'inherit' }}>{stats.pending + stats.testing} <span style={{ fontSize: '0.8rem', opacity: 0.7 }}>({dStats.pending + dStats.testing} shown)</span></p></div>
</div>
<div className={styles.stats}>
<div className={styles.statCard}>
<h3>Total Cameras</h3>
<p>
{stats.total}
{' '}
<span style={{ fontSize: '0.8rem', opacity: 0.7 }}>
(
{dStats.total}
{' '}
shown)
</span>
</p>
</div>
<div className={styles.statCard}>
<h3>Responsive (OK)</h3>
<p className={styles.badgeOk} style={{ background: 'none', padding: 0, border: 'none' }}>
{stats.ok}
{' '}
<span style={{ fontSize: '0.8rem', opacity: 0.7 }}>
(
{dStats.ok}
{' '}
shown)
</span>
</p>
</div>
<div className={styles.statCard}>
<h3>Errors / Blocked</h3>
<p className={styles.badgeError} style={{ background: 'none', padding: 0, border: 'none' }}>
{stats.error}
{' '}
<span style={{ fontSize: '0.8rem', opacity: 0.7 }}>
(
{dStats.error}
{' '}
shown)
</span>
</p>
</div>
<div className={styles.statCard}>
<h3>Timeouts</h3>
<p className={styles.badgeWarn} style={{ background: 'none', padding: 0, border: 'none' }}>
{stats.timeout}
{' '}
<span style={{ fontSize: '0.8rem', opacity: 0.7 }}>
(
{dStats.timeout}
{' '}
shown)
</span>
</p>
</div>
<div className={styles.statCard}>
<h3>Pending</h3>
<p
className={stats.testing > 0 ? styles.badgeTesting : ''}
style={{
background: 'none', padding: 0, border: 'none', color: stats.testing > 0 ? '#60a5fa' : 'inherit'
}}
>
{stats.pending + stats.testing}
{' '}
<span style={{ fontSize: '0.8rem', opacity: 0.7 }}>
(
{dStats.pending + dStats.testing}
{' '}
shown)
</span>
</p>
</div>
</div>
<div className={styles.controls} style={{ borderBottom: '1px solid rgba(255,255,255,0.1)', paddingBottom: '1.5rem', marginBottom: '0.5rem', alignItems: 'flex-start' }}>
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
<span style={{ fontWeight: 600 }}>Target Tests:</span>
<span style={{ fontSize: '0.75rem', opacity: 0.7 }}>Hold Ctrl/Cmd to select multiple</span>
</div>
<div
className={styles.controls}
style={{
borderBottom: '1px solid rgba(255,255,255,0.1)', paddingBottom: '1.5rem', marginBottom: '0.5rem', alignItems: 'flex-start'
}}
>
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
<span style={{ fontWeight: 600 }}>Target Tests:</span>
<span style={{ fontSize: '0.75rem', opacity: 0.7 }}>Hold Ctrl/Cmd to select multiple</span>
</div>
<select multiple className={styles.select} style={{ height: '120px' }} value={testSources} onChange={e => handleMultiSelect(e, setTestSources)} disabled={testing}>
<option value="all">🌍 All Sources</option>
{sources.map(src => (
<option key={src as string} value={src as string}>
{String(src).toUpperCase()}
</option>
<select multiple className={styles.select} style={{ height: '120px' }} value={testSources} onChange={(e) => handleMultiSelect(e, setTestSources)} disabled={testing}>
<option value="all">🌍 All Sources</option>
{sources.map((src) => (
<option key={src as string} value={src as string}>
{String(src).toUpperCase()}
</option>
))}
</select>
</select>
<select multiple className={styles.select} style={{ height: '120px' }} value={testStatuses} onChange={e => handleMultiSelect(e, setTestStatuses)} disabled={testing}>
<option value="all">🔍 All Statuses</option>
<option value="ok">✅ OK</option>
<option value="error">❌ Error</option>
<option value="timeout">⏱️ Timeout</option>
<option value="pending">⏳ Pending</option>
</select>
<select multiple className={styles.select} style={{ height: '120px' }} value={testStatuses} onChange={(e) => handleMultiSelect(e, setTestStatuses)} disabled={testing}>
<option value="all">🔍 All Statuses</option>
<option value="ok">✅ OK</option>
<option value="error">❌ Error</option>
<option value="timeout">⏱️ Timeout</option>
<option value="pending">⏳ Pending</option>
</select>
{loading ? (
<button className={styles.button} disabled>
<span>Loading Cameras...</span>
</button>
{loading ? (
<button type="button" className={styles.button} disabled>
<span>Loading Cameras...</span>
</button>
) : testing ? (
<button className={styles.button} onClick={stopTests} style={{ background: '#ef4444' }}>
🛑 Stop Tests
</button>
<button type="button" className={styles.button} onClick={stopTests} style={{ background: '#ef4444' }}>
🛑 Stop Tests
</button>
) : (
<button className={styles.button} onClick={runTests} disabled={cameras.length === 0}>
▶ Run Tests
</button>
<button type="button" className={styles.button} onClick={runTests} disabled={cameras.length === 0}>
▶ Run Tests
</button>
)}
</div>
</div>
<div className={styles.controls} style={{ alignItems: 'flex-start' }}>
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
<span style={{ fontWeight: 600 }}>Display View:</span>
<span style={{ fontSize: '0.75rem', opacity: 0.7 }}>Hold Ctrl/Cmd to select multiple</span>
</div>
<div className={styles.controls} style={{ alignItems: 'flex-start' }}>
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
<span style={{ fontWeight: 600 }}>Display View:</span>
<span style={{ fontSize: '0.75rem', opacity: 0.7 }}>Hold Ctrl/Cmd to select multiple</span>
</div>
<select multiple className={styles.select} style={{ height: '140px' }} value={filterSources} onChange={e => handleMultiSelect(e, setFilterSources)}>
<option value="all">🌍 Show All Sources</option>
{sources.map(src => (
<option key={src as string} value={src as string}>
{String(src).toUpperCase()}
</option>
<select multiple className={styles.select} style={{ height: '140px' }} value={filterSources} onChange={(e) => handleMultiSelect(e, setFilterSources)}>
<option value="all">🌍 Show All Sources</option>
{sources.map((src) => (
<option key={src as string} value={src as string}>
{String(src).toUpperCase()}
</option>
))}
</select>
</select>
<select multiple className={styles.select} style={{ height: '140px' }} value={filterStatuses} onChange={e => handleMultiSelect(e, setFilterStatuses)}>
<option value="all">🔍 Show All Statuses</option>
<option value="ok">✅ OK</option>
<option value="error">❌ Error</option>
<option value="timeout">⏱️ Timeout</option>
<option value="pending">⏳ Pending</option>
<option value="testing">🔄 Testing</option>
</select>
<select multiple className={styles.select} style={{ height: '140px' }} value={filterStatuses} onChange={(e) => handleMultiSelect(e, setFilterStatuses)}>
<option value="all">🔍 Show All Statuses</option>
<option value="ok">✅ OK</option>
<option value="error">❌ Error</option>
<option value="timeout">⏱️ Timeout</option>
<option value="pending">⏳ Pending</option>
<option value="testing">🔄 Testing</option>
</select>
<button className={styles.button} style={{ background: 'rgba(255,255,255,0.1)', marginLeft: 'auto' }} onClick={() => {
const exportData = cameras.map(c => ({
<button
type="button"
className={styles.button}
style={{ background: 'rgba(255,255,255,0.1)', marginLeft: 'auto' }}
onClick={() => {
const exportData = cameras.map((c) => ({
id: c.feature.properties.name,
source: c.feature.properties.source,
url: c.feature.properties.stream,
@@ -139,24 +215,25 @@ export default function CameraTestPage() {
a.href = url;
a.download = `camera-diagnostics-${new Date().toISOString().split('T')[0]}.json`;
a.click();
}}>
⬇ Export Report
</button>
</div>
<div className={styles.grid}>
{filtered.map((c, i) => (
<CameraTestCard
key={c.feature.properties.stream + i}
result={c}
index={i}
globalIndex={cameras.indexOf(c)}
previewId={previewId}
onSetPreview={setPreviewId}
onRetest={retestCamera}
/>
))}
</div>
}}
>
⬇ Export Report
</button>
</div>
<div className={styles.grid}>
{filtered.map((c, i) => (
<CameraTestCard
key={c.feature.properties.stream + i}
result={c}
index={i}
globalIndex={cameras.indexOf(c)}
previewId={previewId}
onSetPreview={setPreviewId}
onRetest={retestCamera}
/>
))}
</div>
</div>
);
}
+42 -21
View File
@@ -1,4 +1,6 @@
import { useState, useRef, useEffect, useCallback } from "react";
import {
useState, useRef, useEffect, useCallback
} from "react";
import type { TestResult } from "./types";
export function useCameraTestRunner(testSources: string[], testStatuses: string[]) {
@@ -13,12 +15,16 @@ export function useCameraTestRunner(testSources: string[], testStatuses: string[
const res = await fetch("/api/camera/traffic");
const data = await res.json();
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let staticFeatures: any[] = [];
try {
const staticRes = await fetch("/public-cameras.json");
if (staticRes.ok) {
const staticData = await staticRes.json();
if (staticData.features) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
staticFeatures = staticData.features.map((f: any) => ({
...f,
properties: {
@@ -30,20 +36,28 @@ export function useCameraTestRunner(testSources: string[], testStatuses: string[
}
}
} catch (staticErr) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("Failed to fetch static cameras:", staticErr);
}
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let combinedFeatures: any[] = [];
if (data.cameras) {
combinedFeatures = [...data.cameras];
}
combinedFeatures = [...combinedFeatures, ...staticFeatures];
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line @typescript-eslint/no-explicit-any
setCameras(combinedFeatures.map((c: any) => ({
feature: c,
status: "pending"
})));
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error(err);
}
setLoading(false);
@@ -61,7 +75,7 @@ export function useCameraTestRunner(testSources: string[], testStatuses: string[
abortControllerRef.current.abort();
}
abortControllerRef.current = new AbortController();
const signal = abortControllerRef.current.signal;
const {signal} = abortControllerRef.current;
const maxConcurrent = 20;
let index = 0;
@@ -75,10 +89,12 @@ export function useCameraTestRunner(testSources: string[], testStatuses: string[
return sourceMatches && statusMatches;
});
setCameras(prev => {
setCameras((prev) => {
const nextState = [...prev];
for (const { originalIndex } of itemsToTest) {
nextState[originalIndex] = { ...nextState[originalIndex], status: "pending", testStartTime: undefined, latencyMs: undefined, errorMsg: undefined, httpStatus: undefined, contentType: undefined };
nextState[originalIndex] = {
...nextState[originalIndex], status: "pending", testStartTime: undefined, latencyMs: undefined, errorMsg: undefined, httpStatus: undefined, contentType: undefined
};
}
return nextState;
});
@@ -90,15 +106,16 @@ export function useCameraTestRunner(testSources: string[], testStatuses: string[
return;
}
while (active < maxConcurrent && index < itemsToTest.length) {
const item = itemsToTest[index++];
const item = itemsToTest[index];
index += 1;
const currentIndex = item.originalIndex;
active++;
active += 1;
const cam = item.c;
let streamUrl = cam.feature.properties.stream;
const streamUrl = cam.feature.properties.stream;
if (!streamUrl) {
setCameras(prev => {
setCameras((prev) => {
const nextState = [...prev];
nextState[currentIndex] = {
...nextState[currentIndex],
@@ -107,21 +124,21 @@ export function useCameraTestRunner(testSources: string[], testStatuses: string[
};
return nextState;
});
active--;
active -= 1;
next();
continue;
}
setCameras(prev => {
setCameras((prev) => {
const nextState = [...prev];
nextState[currentIndex] = { ...nextState[currentIndex], status: "testing", testStartTime: Date.now() };
return nextState;
});
fetch(`/api/camera/test?url=${encodeURIComponent(streamUrl)}`, { signal })
.then(res => res.json())
.then(data => {
setCameras(prev => {
.then((res) => res.json())
.then((data) => {
setCameras((prev) => {
const nextState = [...prev];
const isOk = data.status === 200 || data.status === 204 || data.status === 206;
nextState[currentIndex] = {
@@ -135,9 +152,9 @@ export function useCameraTestRunner(testSources: string[], testStatuses: string[
return nextState;
});
})
.catch(err => {
.catch((err) => {
if (err.name === 'AbortError') return;
setCameras(prev => {
setCameras((prev) => {
const nextState = [...prev];
nextState[currentIndex] = {
...nextState[currentIndex],
@@ -148,7 +165,7 @@ export function useCameraTestRunner(testSources: string[], testStatuses: string[
});
})
.finally(() => {
active--;
active -= 1;
next();
});
}
@@ -175,16 +192,18 @@ export function useCameraTestRunner(testSources: string[], testStatuses: string[
const streamUrl = cam.feature.properties.stream;
if (!streamUrl) return;
setCameras(prev => {
setCameras((prev) => {
const nextState = [...prev];
nextState[globalIndex] = { ...nextState[globalIndex], status: "testing", testStartTime: Date.now(), latencyMs: undefined, errorMsg: undefined, httpStatus: undefined, contentType: undefined };
nextState[globalIndex] = {
...nextState[globalIndex], status: "testing", testStartTime: Date.now(), latencyMs: undefined, errorMsg: undefined, httpStatus: undefined, contentType: undefined
};
return nextState;
});
try {
const res = await fetch(`/api/camera/test?url=${encodeURIComponent(streamUrl)}`);
const data = await res.json();
setCameras(prev => {
setCameras((prev) => {
const nextState = [...prev];
const isOk = data.status === 200 || data.status === 204 || data.status === 206;
nextState[globalIndex] = {
@@ -198,7 +217,7 @@ export function useCameraTestRunner(testSources: string[], testStatuses: string[
return nextState;
});
} catch (err: any) {
setCameras(prev => {
setCameras((prev) => {
const nextState = [...prev];
nextState[globalIndex] = {
...nextState[globalIndex],
@@ -210,5 +229,7 @@ export function useCameraTestRunner(testSources: string[], testStatuses: string[
}
};
return { cameras, loading, testing, runTests, stopTests, retestCamera };
return {
cameras, loading, testing, runTests, stopTests, retestCamera
};
}
+39 -20
View File
@@ -2,7 +2,7 @@
/**
* @file AdUnit.tsx
* @description Standardized Google AdSense wrapper component.
* @description Standardized Google AdSense wrapper component.
* Handles client-side script pushing and provides a development-mode mock UI.
* @module src/components/ads
*/
@@ -19,23 +19,25 @@ interface AdUnitProps {
/**
* @component AdUnit
* @description Renders a Google AdSense advertisement unit.
*
*
* @param {AdUnitProps} props - Component properties.
* @param {string} props.adSlot - The AdSense slot ID.
* @param {string} [props.adFormat="auto"] - The AdSense format (auto, rectangle, etc).
* @param {React.CSSProperties} [props.style] - Optional inline styles for the container.
* @param {string} [props.className] - Optional CSS class for the container.
*/
export function AdUnit({ adSlot, adFormat = "auto", style, className }: AdUnitProps) {
export function AdUnit({
adSlot, adFormat, style, className
}: AdUnitProps) {
const insRef = useRef<HTMLModElement>(null);
const pushed = useRef(false);
const clientId = process.env.NEXT_PUBLIC_ADSENSE_CLIENT_ID;
useEffect(() => {
if (pushed.current || !clientId) return;
// Next.js Dev / CSS injection often causes a brief moment where
// the ad container has 0 width. Wait until the browser calculates
// the ad container has 0 width. Wait until the browser calculates
// the true CSS width before asking AdSense to fetch an ad.
const timer = setInterval(() => {
if (insRef.current && insRef.current.offsetWidth > 0) {
@@ -45,6 +47,8 @@ export function AdUnit({ adSlot, adFormat = "auto", style, className }: AdUnitPr
(window.adsbygoogle = window.adsbygoogle || []).push({});
pushed.current = true;
} catch (err) {
// TODO: Legacy Airbnb linting violation
// eslint-disable-next-line no-console
console.error("[AdUnit] AdSense push error:", err);
}
}
@@ -62,24 +66,39 @@ export function AdUnit({ adSlot, adFormat = "auto", style, className }: AdUnitPr
// Google AdSense natively returns 400 Bad Request if requested from localhost.
if (process.env.NODE_ENV === "development") {
return (
<div className={className} style={{ ...style, display: "flex", alignItems: "center", justifyContent: "center", backgroundColor: "rgba(255, 255, 255, 0.05)", color: "#888", fontSize: "12px", border: "1px dashed rgba(255, 255, 255, 0.1)", textAlign: "center", padding: "1rem", minHeight: "250px" }}>
<span>AdSense Mock<br/>(Disabled on Localhost)</span>
</div>
<div
className={className}
style={{
...style, display: "flex", alignItems: "center", justifyContent: "center", backgroundColor: "rgba(255, 255, 255, 0.05)", color: "#888", fontSize: "12px", border: "1px dashed rgba(255, 255, 255, 0.1)", textAlign: "center", padding: "1rem", minHeight: "250px"
}}
>
<span>
AdSense Mock
<br />
(Disabled on Localhost)
</span>
</div>
);
}
return (
<div className={className} style={style}>
<ins
ref={insRef}
className="adsbygoogle"
style={{ display: "block" }}
data-ad-client={clientId}
data-ad-slot={adSlot}
data-ad-format={adFormat}
data-full-width-responsive="true"
data-adtest="on"
/>
</div>
<div className={className} style={style}>
<ins
ref={insRef}
className="adsbygoogle"
style={{ display: "block" }}
data-ad-client={clientId}
data-ad-slot={adSlot}
data-ad-format={adFormat}
data-full-width-responsive="true"
data-adtest="on"
/>
</div>
);
}
AdUnit.defaultProps = {
adFormat: "auto",
style: {},
className: "",
};
+47 -48
View File
@@ -2,7 +2,7 @@
/**
* @file DemoAdStrip.tsx
* @description specialized sidebar for the demo edition that hosts AdSense
* @description specialized sidebar for the demo edition that hosts AdSense
* units and a small banner explaining the monetization model.
* @module src/components/ads
*/
@@ -10,8 +10,8 @@
import React, { useState, useEffect } from "react";
import { isDemo } from "@/core/edition";
import { dataBus } from "@/core/data/DataBus";
import { AdUnit } from "./AdUnit";
import { X } from "lucide-react";
import { AdUnit } from "./AdUnit";
import "./DemoAdStrip.css";
/** Ad slot IDs — replace with your AdSense slot IDs. */
@@ -68,63 +68,62 @@ export function DemoAdStrip() {
if (!isDemo || !ENABLE_ADS) return null;
return (
<aside
className="demo-ad-strip"
aria-label="Sponsored content"
style={{
opacity: isReady ? 1 : 0,
<aside
className="demo-ad-strip"
aria-label="Sponsored content"
style={{
opacity: isReady ? 1 : 0,
pointerEvents: isReady ? "auto" : "none",
transition: "opacity 1200ms var(--ease-smooth)"
transition: "opacity 1200ms var(--ease-smooth)"
}}
>
<AdUnit
adSlot={TOP_AD_SLOT}
adFormat="auto"
className="demo-ad-strip__ad"
/>
{!isShortScreen && (
<AdUnit
adSlot={BOTTOM_AD_SLOT}
adFormat="auto"
className="demo-ad-strip__ad"
/>
>
<AdUnit
adSlot={TOP_AD_SLOT}
adFormat="auto"
className="demo-ad-strip__ad"
/>
{!isShortScreen && (
<AdUnit
adSlot={BOTTOM_AD_SLOT}
adFormat="auto"
className="demo-ad-strip__ad"
/>
)}
{!bannerDismissed && (
<div
className="demo-ad-strip__banner"
onClick={() => setShowMessage((prev) => !prev)}
role="button"
tabIndex={0}
onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {
{!bannerDismissed && (
<div
className="demo-ad-strip__banner"
onClick={() => setShowMessage((prev) => !prev)}
role="button"
tabIndex={0}
onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {
if (e.key === "Enter") setShowMessage((prev) => !prev);
}}
>
<button
className="demo-ad-strip__close"
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
>
<button
className="demo-ad-strip__close"
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
e.stopPropagation();
setBannerDismissed(true);
}}
aria-label="Dismiss banner"
>
<X size={12} />
</button>
<span className="demo-ad-strip__banner-label">Why ads?</span>
{showMessage ? (
<span className="demo-ad-strip__banner-text">
This isn&apos;t permanent — it&apos;s temporary
because I&apos;m a single dev and need to cover
hosting costs. Thank you for understanding.
</span>
aria-label="Dismiss banner"
>
<X size={12} />
</button>
<span className="demo-ad-strip__banner-label">Why ads?</span>
{showMessage ? (
<span className="demo-ad-strip__banner-text">
This isn&apos;t permanent — it&apos;s temporary
because I&apos;m a single dev and need to cover
hosting costs. Thank you for understanding.
</span>
) : (
<span className="demo-ad-strip__banner-text">
Click to learn more
</span>
<span className="demo-ad-strip__banner-text">
Click to learn more
</span>
)}
</div>
</div>
)}
</aside>
</aside>
);
}
+13 -13
View File
@@ -20,23 +20,23 @@ interface BootOverlayProps {
/**
* @component BootOverlay
* @description Animated splash screen for initial system boot.
*
*
* @param {BootOverlayProps} props - Component properties.
*/
export function BootOverlay({ visible }: BootOverlayProps) {
return (
<div className={`boot-overlay ${visible ? "" : "boot-overlay--hidden"}`}>
{/* Orbital rings */}
<div className="boot-overlay__rings">
<div className="boot-overlay__ring boot-overlay__ring--1" />
<div className="boot-overlay__ring boot-overlay__ring--2" />
<div className="boot-overlay__ring boot-overlay__ring--3" />
<div className="boot-overlay__core" />
</div>
{/* Brand + status */}
<div className="boot-overlay__title">WorldWideView</div>
<div className="boot-overlay__status">Initializing Systems...</div>
<div className={`boot-overlay ${visible ? "" : "boot-overlay--hidden"}`}>
{/* Orbital rings */}
<div className="boot-overlay__rings">
<div className="boot-overlay__ring boot-overlay__ring--1" />
<div className="boot-overlay__ring boot-overlay__ring--2" />
<div className="boot-overlay__ring boot-overlay__ring--3" />
<div className="boot-overlay__core" />
</div>
{/* Brand + status */}
<div className="boot-overlay__title">WorldWideView</div>
<div className="boot-overlay__status">Initializing Systems...</div>
</div>
);
}
+18 -13
View File
@@ -15,22 +15,27 @@ interface DiscordIconProps {
/**
* Renders the Discord logo as an SVG.
*
*
* @param props - Component properties.
* @returns React component rendering the Discord icon.
*/
export function DiscordIcon({ size = 18, className }: DiscordIconProps) {
export function DiscordIcon({ size, className }: DiscordIconProps) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
viewBox="0 0 24 24"
fill="currentColor"
className={className}
aria-hidden="true"
>
<path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.947 2.418-2.157 2.418z" />
</svg>
<svg
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
viewBox="0 0 24 24"
fill="currentColor"
className={className}
aria-hidden="true"
>
<path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.947 2.418-2.157 2.418z" />
</svg>
);
}
DiscordIcon.defaultProps = {
size: 18,
className: "",
};
Loaded 100 of 294 files, more files were not shown because too many files have changed in this diff. Show more