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:; " +
|
"worker-src 'self' blob:; " +
|
||||||
"style-src 'self' 'unsafe-inline' fonts.googleapis.com; " +
|
"style-src 'self' 'unsafe-inline' fonts.googleapis.com; " +
|
||||||
"font-src 'self' fonts.gstatic.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; " +
|
"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'; " +
|
"frame-ancestors 'none'; " +
|
||||||
"base-uri 'self'; " +
|
"base-uri 'self'; " +
|
||||||
"form-action 'self';"
|
"form-action 'self';"
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ export interface FindState {
|
|||||||
longitude: string;
|
longitude: string;
|
||||||
locationName?: string;
|
locationName?: string;
|
||||||
category?: string;
|
category?: string;
|
||||||
|
rating?: number | null;
|
||||||
|
ratingCount?: number;
|
||||||
isPublic: boolean;
|
isPublic: boolean;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
userId: string;
|
userId: string;
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
type="font/ttf"
|
type="font/ttf"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
/>
|
/>
|
||||||
<link rel="dns-prefetch" href="//tile.openstreetmap.org" />
|
<link rel="dns-prefetch" href="//tiles.stadiamaps.com" />
|
||||||
<link rel="preconnect" href="https://tile.openstreetmap.org" crossorigin="anonymous" />
|
<link rel="preconnect" href="https://tiles.stadiamaps.com" crossorigin="anonymous" />
|
||||||
<!-- Resource hints for login page background -->
|
<!-- Resource hints for login page background -->
|
||||||
{#if isLoginRoute}
|
{#if isLoginRoute}
|
||||||
<link rel="preload" href="/cafe-bg-compressed.jpg" as="image" />
|
<link rel="preload" href="/cafe-bg-compressed.jpg" as="image" />
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
description?: string;
|
description?: string;
|
||||||
category?: string;
|
category?: string;
|
||||||
locationName?: string;
|
locationName?: string;
|
||||||
|
rating?: number | null;
|
||||||
|
ratingCount?: number;
|
||||||
isPublic: number;
|
isPublic: number;
|
||||||
userId: string;
|
userId: string;
|
||||||
username: string;
|
username: string;
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ export const GET: RequestHandler = async ({ url, locals }) => {
|
|||||||
description: find.description,
|
description: find.description,
|
||||||
locationName: location.locationName,
|
locationName: location.locationName,
|
||||||
category: find.category,
|
category: find.category,
|
||||||
|
rating: find.rating,
|
||||||
|
ratingCount: find.ratingCount,
|
||||||
isPublic: find.isPublic,
|
isPublic: find.isPublic,
|
||||||
createdAt: find.createdAt,
|
createdAt: find.createdAt,
|
||||||
userId: find.userId,
|
userId: find.userId,
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ export const GET: RequestHandler = async ({ params, locals }) => {
|
|||||||
longitude: location.longitude,
|
longitude: location.longitude,
|
||||||
locationName: location.locationName,
|
locationName: location.locationName,
|
||||||
category: find.category,
|
category: find.category,
|
||||||
|
rating: find.rating,
|
||||||
|
ratingCount: find.ratingCount,
|
||||||
isPublic: find.isPublic,
|
isPublic: find.isPublic,
|
||||||
createdAt: find.createdAt,
|
createdAt: find.createdAt,
|
||||||
userId: find.userId,
|
userId: find.userId,
|
||||||
|
|||||||
@@ -111,6 +111,8 @@ export const GET: RequestHandler = async ({ url, locals }) => {
|
|||||||
title: find.title,
|
title: find.title,
|
||||||
description: find.description,
|
description: find.description,
|
||||||
category: find.category,
|
category: find.category,
|
||||||
|
rating: find.rating,
|
||||||
|
ratingCount: find.ratingCount,
|
||||||
isPublic: find.isPublic,
|
isPublic: find.isPublic,
|
||||||
createdAt: find.createdAt,
|
createdAt: find.createdAt,
|
||||||
userId: find.userId,
|
userId: find.userId,
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ self.addEventListener('fetch', (event) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle OpenStreetMap tiles with cache-first strategy
|
// 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);
|
const cachedResponse = await r2Cache.match(event.request);
|
||||||
if (cachedResponse) {
|
if (cachedResponse) {
|
||||||
return cachedResponse;
|
return cachedResponse;
|
||||||
|
|||||||
Reference in New Issue
Block a user