chore: sync local changes (2026-03-12)
|
Before Width: | Height: | Size: 18 MiB |
|
Before Width: | Height: | Size: 4.3 MiB |
|
Before Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 480 KiB |
|
Before Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 920 KiB |
|
Before Width: | Height: | Size: 3.1 MiB |
|
Before Width: | Height: | Size: 3.6 MiB |
|
Before Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 265 KiB |
|
Before Width: | Height: | Size: 9.0 MiB |
|
Before Width: | Height: | Size: 4.2 MiB |
|
Before Width: | Height: | Size: 8.4 MiB |
|
Before Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 5.5 MiB |
|
Before Width: | Height: | Size: 5.7 MiB |
|
Before Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 5.2 MiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 5.1 MiB |
|
Before Width: | Height: | Size: 4.8 MiB |
|
Before Width: | Height: | Size: 9.6 MiB |
|
Before Width: | Height: | Size: 2.9 MiB |
|
Before Width: | Height: | Size: 3.4 MiB |
|
Before Width: | Height: | Size: 3.0 MiB |
25
mengyadriftbottle-frontend/public/manifest.webmanifest
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "萌芽漂流瓶",
|
||||
"short_name": "漂流瓶",
|
||||
"description": "让心意随海浪飘向远方,邂逅那个懂你的人——萌芽漂流瓶",
|
||||
"lang": "zh-CN",
|
||||
"start_url": "/",
|
||||
"scope": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#0b1020",
|
||||
"theme_color": "#0ea5e9",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/logo.png",
|
||||
"sizes": "2048x2048",
|
||||
"type": "image/png",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "/logo3.png",
|
||||
"sizes": "2048x2048",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
97
mengyadriftbottle-frontend/public/offline.html
Normal file
@@ -0,0 +1,97 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="theme-color" content="#0ea5e9" />
|
||||
<title>离线 - 萌芽漂流瓶</title>
|
||||
<style>
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
--bg: #0b1020;
|
||||
--fg: #e5e7eb;
|
||||
--muted: rgba(229, 231, 235, 0.7);
|
||||
--accent: #0ea5e9;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: radial-gradient(
|
||||
1200px 800px at 20% 10%,
|
||||
rgba(14, 165, 233, 0.2),
|
||||
transparent 60%
|
||||
),
|
||||
radial-gradient(
|
||||
900px 700px at 80% 90%,
|
||||
rgba(99, 102, 241, 0.18),
|
||||
transparent 55%
|
||||
),
|
||||
var(--bg);
|
||||
color: var(--fg);
|
||||
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
|
||||
Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji';
|
||||
}
|
||||
.card {
|
||||
width: min(520px, calc(100vw - 32px));
|
||||
padding: 20px 18px;
|
||||
border-radius: 16px;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
h1 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
p {
|
||||
margin: 0;
|
||||
line-height: 1.6;
|
||||
color: var(--muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
.actions {
|
||||
margin-top: 14px;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
a,
|
||||
button {
|
||||
appearance: none;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
padding: 10px 14px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
color: #001018;
|
||||
background: linear-gradient(180deg, #22c3ff, #0ea5e9);
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
}
|
||||
button.secondary {
|
||||
color: var(--fg);
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
border: 1px solid rgba(255, 255, 255, 0.14);
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main class="card">
|
||||
<h1>当前处于离线状态</h1>
|
||||
<p>网络连接不可用,已为你保留基础页面。恢复网络后可继续使用完整功能。</p>
|
||||
<div class="actions">
|
||||
<a href="/">返回首页</a>
|
||||
<button class="secondary" type="button" onclick="location.reload()">
|
||||
重新加载
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
102
mengyadriftbottle-frontend/public/sw.js
Normal file
@@ -0,0 +1,102 @@
|
||||
const CACHE_PREFIX = 'mengyadriftbottle'
|
||||
const CACHE_VERSION = 'v1'
|
||||
const STATIC_CACHE = `${CACHE_PREFIX}-static-${CACHE_VERSION}`
|
||||
const RUNTIME_CACHE = `${CACHE_PREFIX}-runtime-${CACHE_VERSION}`
|
||||
|
||||
const PRECACHE_URLS = [
|
||||
'/',
|
||||
'/index.html',
|
||||
'/offline.html',
|
||||
'/manifest.webmanifest',
|
||||
'/logo.png',
|
||||
'/logo3.png',
|
||||
]
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(
|
||||
(async () => {
|
||||
const cache = await caches.open(STATIC_CACHE)
|
||||
await cache.addAll(PRECACHE_URLS)
|
||||
self.skipWaiting()
|
||||
})(),
|
||||
)
|
||||
})
|
||||
|
||||
self.addEventListener('activate', (event) => {
|
||||
event.waitUntil(
|
||||
(async () => {
|
||||
const keys = await caches.keys()
|
||||
await Promise.all(
|
||||
keys.map((key) => {
|
||||
if (
|
||||
key.startsWith(`${CACHE_PREFIX}-`) &&
|
||||
key !== STATIC_CACHE &&
|
||||
key !== RUNTIME_CACHE
|
||||
) {
|
||||
return caches.delete(key)
|
||||
}
|
||||
return undefined
|
||||
}),
|
||||
)
|
||||
await self.clients.claim()
|
||||
})(),
|
||||
)
|
||||
})
|
||||
|
||||
self.addEventListener('message', (event) => {
|
||||
if (event?.data?.type === 'SKIP_WAITING') {
|
||||
self.skipWaiting()
|
||||
}
|
||||
})
|
||||
|
||||
function isSameOrigin(url) {
|
||||
return url.origin === self.location.origin
|
||||
}
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
const { request } = event
|
||||
if (request.method !== 'GET') return
|
||||
|
||||
const url = new URL(request.url)
|
||||
if (!isSameOrigin(url)) return
|
||||
|
||||
if (url.pathname.startsWith('/api')) return
|
||||
|
||||
if (request.mode === 'navigate') {
|
||||
event.respondWith(
|
||||
(async () => {
|
||||
try {
|
||||
const networkResponse = await fetch(request)
|
||||
const cache = await caches.open(RUNTIME_CACHE)
|
||||
cache.put('/index.html', networkResponse.clone())
|
||||
return networkResponse
|
||||
} catch {
|
||||
const cache = await caches.open(RUNTIME_CACHE)
|
||||
const cached =
|
||||
(await cache.match('/index.html')) ||
|
||||
(await caches.match('/index.html')) ||
|
||||
(await caches.match('/offline.html'))
|
||||
return cached || Response.error()
|
||||
}
|
||||
})(),
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const isAsset = ['script', 'style', 'image', 'font'].includes(request.destination)
|
||||
|
||||
if (isAsset) {
|
||||
event.respondWith(
|
||||
(async () => {
|
||||
const cached = await caches.match(request)
|
||||
if (cached) return cached
|
||||
|
||||
const response = await fetch(request)
|
||||
const cache = await caches.open(RUNTIME_CACHE)
|
||||
cache.put(request, response.clone())
|
||||
return response
|
||||
})(),
|
||||
)
|
||||
return
|
||||
}
|
||||
})
|
||||