mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
fix(maps): avoid 404 on keyless Google tiles-token probe (#1066)
Return an uncached unavailable-token response for keyless Google tile-token requests. Contribution by @dvilrgamerz.
This commit is contained in:
1 parent
06c51d3438
commit
a7fcb3c232
8 files changed
+147
-4
No files matched your search
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Treat an unavailable Google Maps tile-token endpoint as a supported, silent
|
||||
* outcome. Install after real token providers and before the unknown-API 404.
|
||||
*/
|
||||
export function googleTokenUnavailablePlugin() {
|
||||
const install = (server) => {
|
||||
server.middlewares.use((req, res, next) => {
|
||||
const pathname = String(req.url || '').split('?')[0];
|
||||
if (
|
||||
(req.method !== 'GET' && req.method !== 'HEAD') ||
|
||||
pathname !== '/api/google/tiles-token'
|
||||
) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
res.writeHead(204, { 'Cache-Control': 'no-store' });
|
||||
res.end();
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'google-token-unavailable',
|
||||
configureServer: install,
|
||||
configurePreviewServer: install,
|
||||
};
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import { createBrowserViteConfig } from '../../build/vite.js';
|
||||
import { localProviderPlugins } from '../providers/local.js';
|
||||
import { localMcpPlugin } from '../mcp/plugin.js';
|
||||
import { apiNotFoundPlugin } from './api-not-found.js';
|
||||
import { googleTokenUnavailablePlugin } from './google-token-unavailable.js';
|
||||
import { standaloneVoiceTools } from './voiceTools.js';
|
||||
import { unwatchedRuntimeDirsPlugin } from './unwatched-cache.js';
|
||||
|
||||
@@ -21,6 +22,7 @@ export default defineConfig(({ command, mode }) => {
|
||||
plugins: [
|
||||
...localProviderPlugins({ realtime: { tools }, gemini: { tools } }),
|
||||
localMcpPlugin(),
|
||||
googleTokenUnavailablePlugin(),
|
||||
apiNotFoundPlugin(),
|
||||
unwatchedRuntimeDirsPlugin(),
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user