fix: simplify Google Maps provider setup

This commit is contained in:
Sameh Khamis committed 2026-09-12 11:36:23 -07:00
1 parent aacfa06a31
commit c6462be066
5 files changed
+30 -13

No files matched your search

+6 -4
View File
@@ -21,16 +21,17 @@ export const KEY_SETUP_UPDATE_LIMIT = 16;
export const KEY_SETUP_APPEND_HEADER = '# Keys added by the in-app POWER UP panel';
/**
* Every key the panel offers, in the order it offers them — most magic per
* Provider credentials, in display order — most magic per
* minute first. `tier` mirrors the README's color legend: 'metered' (🔴) is a
* billing-enabled account, 'free' (🟡) is a register-and-paste key.
* `clientExposed` marks the two keys that are injected into the browser
* bundle by design (restrict them at the provider, per SECURITY.md).
* `hidden` keeps advanced configuration out of the panel and missing-key count.
*/
export const KEY_SETUP_KEYS = Object.freeze([
Object.freeze({
id: 'google-maps',
title: 'GOOGLE MAPS — BROWSER',
title: 'GOOGLE MAPS',
unlocks: 'The photorealistic 3D planet + place search',
getUrl: 'https://developers.google.com/maps/documentation/tile/get-api-key',
envVars: Object.freeze(['GOOGLE_MAPS_API_KEY']),
@@ -44,6 +45,7 @@ export const KEY_SETUP_KEYS = Object.freeze([
getUrl: 'https://developers.google.com/maps/documentation/places/web-service/get-api-key',
envVars: Object.freeze(['GOOGLE_MAPS_SERVER_API_KEY']),
tier: 'metered',
hidden: true,
}),
Object.freeze({
id: 'openai',
@@ -274,7 +276,7 @@ export function knownKeySetupEnvVars() {
/** Tooltip guidance for a control gated by one registry entry. */
export function keySetupRequirement(id) {
const entry = KEY_SETUP_KEYS.find((candidate) => candidate.id === id);
if (!entry) return '';
if (!entry || entry.hidden) return '';
return `Needs ${entry.envVars.join(' + ')} — add it in Provider Settings`;
}
@@ -303,7 +305,7 @@ export function isKeySetupExternallyManaged({
* @param {Record<string, string|undefined>} env e.g. process.env
*/
export function keySetupStatus(env = {}) {
const keys = KEY_SETUP_KEYS.map((entry) => {
const keys = KEY_SETUP_KEYS.filter((entry) => !entry.hidden).map((entry) => {
const values = entry.envVars.map((name) => String(env[name] ?? '').trim());
const set = values.every((value) => value.length > 0);
return {