mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
release: v0.1.0 — one-click install, keyless boot, in-app Provider Settings (#142)
The first formal release. - One-click install via Pinokio; keyless boot lands on a live Esri World Imagery satellite globe with keyless terrain, with automatic OSM fallback and graceful degradation when terrain is unavailable. - Provider Settings (the POWER UP panel): add, replace, or remove API keys inside the app; credential files made owner-only before any secret is written; external keys shown read-only; the panel refuses shared or proxied servers. - Keyless capability responses for the optional HUD summary and place search. - Aircraft-identity voice answers cover operator, type, and route, and say so plainly when enrichment is unavailable. - README rewritten keyless-first; concise 0.1.0 changelog section; CI workflow included. Gates: 2,672 unit tests pass / 0 fail, build clean, tracking regression 108/108, map-source tray QA pass, setup doctor ready.
This commit is contained in:
1 parent
6d83bb6008
commit
b6da93b8ac
170 files changed
+5800
-853
No files matched your search
@@ -0,0 +1,89 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { googlePlacesContextProxy, keylessGooglePlacesResponse } from '../vite.config.js';
|
||||
|
||||
const KEYLESS_PAYLOAD = { configured: false, error: null, places: [] };
|
||||
|
||||
function installGooglePlacesRoutes() {
|
||||
const routes = new Map();
|
||||
googlePlacesContextProxy().configureServer({
|
||||
middlewares: {
|
||||
use(path, handler) {
|
||||
routes.set(path, handler);
|
||||
},
|
||||
},
|
||||
});
|
||||
return routes;
|
||||
}
|
||||
|
||||
function invokeRoute(handler, { method = 'GET', url = '/', remoteAddress = '127.0.0.1' } = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const headers = new Map();
|
||||
const req = {
|
||||
method,
|
||||
url,
|
||||
headers: {},
|
||||
socket: { remoteAddress },
|
||||
};
|
||||
const res = {
|
||||
statusCode: 200,
|
||||
setHeader(name, value) {
|
||||
headers.set(String(name).toLowerCase(), String(value));
|
||||
},
|
||||
end(body = '') {
|
||||
resolve({
|
||||
statusCode: this.statusCode,
|
||||
headers: Object.fromEntries(headers),
|
||||
body: body ? JSON.parse(String(body)) : null,
|
||||
});
|
||||
},
|
||||
};
|
||||
Promise.resolve(handler(req, res)).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
test('builds the keyless capability response only for a blank key', () => {
|
||||
assert.deepEqual(keylessGooglePlacesResponse(undefined), {
|
||||
statusCode: 200,
|
||||
payload: KEYLESS_PAYLOAD,
|
||||
});
|
||||
assert.deepEqual(keylessGooglePlacesResponse(' '), {
|
||||
statusCode: 200,
|
||||
payload: KEYLESS_PAYLOAD,
|
||||
});
|
||||
assert.equal(keylessGooglePlacesResponse('configured-key'), null);
|
||||
});
|
||||
|
||||
test('keyless Places routes stay successful after the Google quota is exhausted', async () => {
|
||||
const previousKey = process.env.GOOGLE_MAPS_API_KEY;
|
||||
const previousLimit = process.env.GEV_RATELIMIT_GOOGLE_PER_MIN;
|
||||
process.env.GOOGLE_MAPS_API_KEY = '';
|
||||
process.env.GEV_RATELIMIT_GOOGLE_PER_MIN = '1';
|
||||
try {
|
||||
const routes = installGooglePlacesRoutes();
|
||||
const nearby = routes.get('/api/google/nearby-places');
|
||||
const textSearch = routes.get('/api/google/text-search');
|
||||
assert.equal(typeof nearby, 'function');
|
||||
assert.equal(typeof textSearch, 'function');
|
||||
|
||||
// The limiter allows one request per minute; a keyless capability response
|
||||
// must never consume that quota, so every request on both routes — well
|
||||
// past the limit — stays the same deliberate 200.
|
||||
for (let attempt = 0; attempt < 3; attempt += 1) {
|
||||
const nearbyResponse = await invokeRoute(nearby, { url: '/?lat=30.27&lon=-97.74' });
|
||||
assert.equal(nearbyResponse.statusCode, 200);
|
||||
assert.equal(nearbyResponse.headers['cache-control'], 'no-store');
|
||||
assert.deepEqual(nearbyResponse.body, KEYLESS_PAYLOAD);
|
||||
|
||||
const textResponse = await invokeRoute(textSearch, { url: '/?q=capitol&lat=30.27&lon=-97.74' });
|
||||
assert.equal(textResponse.statusCode, 200);
|
||||
assert.equal(textResponse.headers['cache-control'], 'no-store');
|
||||
assert.deepEqual(textResponse.body, KEYLESS_PAYLOAD);
|
||||
}
|
||||
} finally {
|
||||
if (previousKey === undefined) delete process.env.GOOGLE_MAPS_API_KEY;
|
||||
else process.env.GOOGLE_MAPS_API_KEY = previousKey;
|
||||
if (previousLimit === undefined) delete process.env.GEV_RATELIMIT_GOOGLE_PER_MIN;
|
||||
else process.env.GEV_RATELIMIT_GOOGLE_PER_MIN = previousLimit;
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user