feat: add bilingual guild analytics with battle filters and composition insights
This commit is contained in:
13 files changed
+730
-2
No files matched your search
+20
@@ -0,0 +1,20 @@
|
||||
import { proxyAlbion } from './scripts/albion-proxy.mjs';
|
||||
|
||||
export default {
|
||||
async fetch(request, env) {
|
||||
const url = new URL(request.url);
|
||||
if (url.pathname.startsWith('/api/albion/')) {
|
||||
// An optional separately hosted API only shares public reports with the configured site.
|
||||
const origin = request.headers.get('Origin');
|
||||
const allowed = !origin || origin === url.origin || origin === env.SITE_ORIGIN;
|
||||
if (!allowed) return new Response('Forbidden', { status: 403 });
|
||||
const response = await proxyAlbion(request);
|
||||
if (origin && origin === env.SITE_ORIGIN) {
|
||||
response.headers.set('Access-Control-Allow-Origin', origin);
|
||||
response.headers.set('Vary', 'Origin');
|
||||
}
|
||||
return response;
|
||||
}
|
||||
return env.ASSETS.fetch(request);
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user