mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04: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,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user