fix:api-sync rating and CORS new OSM tiles

This commit is contained in:
2025-12-16 16:01:25 +01:00
parent 95ddd1046e
commit b6b73195a5
8 changed files with 15 additions and 5 deletions

View File

@@ -50,9 +50,9 @@ export const handle: Handle = async ({ event, resolve }) => {
"worker-src 'self' blob:; " +
"style-src 'self' 'unsafe-inline' fonts.googleapis.com; " +
"font-src 'self' fonts.gstatic.com; " +
"img-src 'self' data: blob: *.openstreetmap.org *.tile.openstreetmap.org *.r2.cloudflarestorage.com *.r2.dev; " +
"img-src 'self' data: blob: *.tiles.stadiamap.com *.r2.cloudflarestorage.com *.r2.dev; " +
"media-src 'self' *.r2.cloudflarestorage.com *.r2.dev; " +
"connect-src 'self' *.openstreetmap.org https://fcm.googleapis.com https://android.googleapis.com; " +
"connect-src 'self' *.stadiamap.com https://fcm.googleapis.com https://android.googleapis.com; " +
"frame-ancestors 'none'; " +
"base-uri 'self'; " +
"form-action 'self';"

View File

@@ -44,6 +44,8 @@ export interface FindState {
longitude: string;
locationName?: string;
category?: string;
rating?: number | null;
ratingCount?: number;
isPublic: boolean;
createdAt: Date;
userId: string;

View File

@@ -22,8 +22,8 @@
type="font/ttf"
crossorigin="anonymous"
/>
<link rel="dns-prefetch" href="//tile.openstreetmap.org" />
<link rel="preconnect" href="https://tile.openstreetmap.org" crossorigin="anonymous" />
<link rel="dns-prefetch" href="//tiles.stadiamaps.com" />
<link rel="preconnect" href="https://tiles.stadiamaps.com" crossorigin="anonymous" />
<!-- Resource hints for login page background -->
{#if isLoginRoute}
<link rel="preload" href="/cafe-bg-compressed.jpg" as="image" />

View File

@@ -17,6 +17,8 @@
description?: string;
category?: string;
locationName?: string;
rating?: number | null;
ratingCount?: number;
isPublic: number;
userId: string;
username: string;

View File

@@ -72,6 +72,8 @@ export const GET: RequestHandler = async ({ url, locals }) => {
description: find.description,
locationName: location.locationName,
category: find.category,
rating: find.rating,
ratingCount: find.ratingCount,
isPublic: find.isPublic,
createdAt: find.createdAt,
userId: find.userId,

View File

@@ -23,6 +23,8 @@ export const GET: RequestHandler = async ({ params, locals }) => {
longitude: location.longitude,
locationName: location.locationName,
category: find.category,
rating: find.rating,
ratingCount: find.ratingCount,
isPublic: find.isPublic,
createdAt: find.createdAt,
userId: find.userId,

View File

@@ -111,6 +111,8 @@ export const GET: RequestHandler = async ({ url, locals }) => {
title: find.title,
description: find.description,
category: find.category,
rating: find.rating,
ratingCount: find.ratingCount,
isPublic: find.isPublic,
createdAt: find.createdAt,
userId: find.userId,

View File

@@ -155,7 +155,7 @@ self.addEventListener('fetch', (event) => {
}
// Handle OpenStreetMap tiles with cache-first strategy
if (url.hostname === 'tile.openstreetmap.org') {
if (url.hostname === 'tiles.stadiamaps.com') {
const cachedResponse = await r2Cache.match(event.request);
if (cachedResponse) {
return cachedResponse;