fix:api-sync rating and CORS new OSM tiles
This commit is contained in:
@@ -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';"
|
||||
|
||||
@@ -44,6 +44,8 @@ export interface FindState {
|
||||
longitude: string;
|
||||
locationName?: string;
|
||||
category?: string;
|
||||
rating?: number | null;
|
||||
ratingCount?: number;
|
||||
isPublic: boolean;
|
||||
createdAt: Date;
|
||||
userId: string;
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
description?: string;
|
||||
category?: string;
|
||||
locationName?: string;
|
||||
rating?: number | null;
|
||||
ratingCount?: number;
|
||||
isPublic: number;
|
||||
userId: string;
|
||||
username: string;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user