feat: 同步服务托管网页应用,daywk 单域名部署就绪
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
node_modules/
|
||||
dist/
|
||||
release/
|
||||
*.local
|
||||
android/.gradle/
|
||||
|
||||
+24
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<rect x="1.6" y="1.6" width="20.8" height="20.8" rx="4.6" fill="#3370FF"/>
|
||||
<rect x="5.8" y="7.2" width="12.4" height="11.5" rx="1.1" fill="#FFFFFF"/>
|
||||
<rect x="5.8" y="7.2" width="12.4" height="2.2" fill="#3370FF"/>
|
||||
<rect x="7.9" y="4.9" width="1.1" height="3.2" rx="0.5" fill="#FFFFFF"/>
|
||||
<rect x="15.0" y="4.9" width="1.1" height="3.2" rx="0.5" fill="#FFFFFF"/>
|
||||
<circle cx="8.6" cy="12.4" r="0.62" fill="#3370FF"/>
|
||||
<circle cx="12" cy="12.4" r="0.62" fill="#3370FF"/>
|
||||
<circle cx="15.4" cy="12.4" r="0.62" fill="#3370FF"/>
|
||||
<circle cx="8.6" cy="15.4" r="0.62" fill="#3370FF"/>
|
||||
<circle cx="12" cy="15.4" r="0.62" fill="#3370FF"/>
|
||||
<circle cx="15.4" cy="15.4" r="0.62" fill="#3370FF"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 770 B |
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
ACCENT = (51, 112, 255, 255)
|
||||
WHITE = (255, 255, 255, 255)
|
||||
|
||||
def make(size, path):
|
||||
img = Image.new('RGBA', (size, size), (0, 0, 0, 0))
|
||||
d = ImageDraw.Draw(img)
|
||||
m = size * 0.07
|
||||
d.rounded_rectangle([m, m, size - m, size - m], radius=size * 0.19, fill=ACCENT)
|
||||
x0, y0, x1, y1 = size * 0.24, size * 0.30, size * 0.76, size * 0.78
|
||||
d.rounded_rectangle([x0, y0, x1, y1], radius=size * 0.045, fill=WHITE)
|
||||
d.rectangle([x0, y0 + size * 0.045, x1, y0 + size * 0.09], fill=ACCENT)
|
||||
for cx in (0.36, 0.64):
|
||||
d.rounded_rectangle([size * cx - size * 0.02, size * 0.20, size * cx + size * 0.02, size * 0.33], radius=size * 0.02, fill=WHITE)
|
||||
for dx in (0.34, 0.5, 0.66):
|
||||
for dy in (0.5, 0.63):
|
||||
d.ellipse([size * dx - size * 0.025, size * dy - size * 0.025, size * dx + size * 0.025, size * dy + size * 0.025], fill=ACCENT)
|
||||
img.save(path)
|
||||
|
||||
make(192, 'icon-192.png')
|
||||
make(512, 'icon-512.png')
|
||||
print('icons generated')
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||
<meta name="theme-color" content="#FFFFFF" />
|
||||
<link rel="manifest" href="./manifest.webmanifest" />
|
||||
<link rel="icon" href="./icons/icon.svg" type="image/svg+xml" />
|
||||
<link rel="apple-touch-icon" href="./icons/icon-192.png" />
|
||||
<title>实习工作日志</title>
|
||||
<script type="module" crossorigin src="./assets/index-DMG3WiLM.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-hTAHZZ1V.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "实习工作日志",
|
||||
"short_name": "工作日志",
|
||||
"description": "实习打卡、工作记录、备忘录与加密密码库",
|
||||
"start_url": "./",
|
||||
"scope": "./",
|
||||
"display": "standalone",
|
||||
"background_color": "#FFFFFF",
|
||||
"theme_color": "#FFFFFF",
|
||||
"icons": [
|
||||
{ "src": "./icons/icon-192.png", "sizes": "192x192", "type": "image/png" },
|
||||
{ "src": "./icons/icon-512.png", "sizes": "512x512", "type": "image/png" },
|
||||
{ "src": "./icons/icon.svg", "sizes": "any", "type": "image/svg+xml" }
|
||||
]
|
||||
}
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
const CACHE = 'intern-log-v1'
|
||||
const CORE = ['./', './index.html']
|
||||
|
||||
self.addEventListener('install', event => {
|
||||
event.waitUntil(caches.open(CACHE).then(c => c.addAll(CORE)).then(() => self.skipWaiting()))
|
||||
})
|
||||
|
||||
self.addEventListener('activate', event => {
|
||||
event.waitUntil(
|
||||
caches.keys()
|
||||
.then(keys => Promise.all(keys.filter(k => k !== CACHE).map(k => caches.delete(k))))
|
||||
.then(() => self.clients.claim())
|
||||
)
|
||||
})
|
||||
|
||||
self.addEventListener('fetch', event => {
|
||||
const req = event.request
|
||||
if (req.method !== 'GET') return
|
||||
const url = new URL(req.url)
|
||||
if (url.origin !== location.origin) return
|
||||
|
||||
// 页面导航:网络优先,离线回退缓存的应用壳
|
||||
if (req.mode === 'navigate') {
|
||||
event.respondWith(
|
||||
fetch(req)
|
||||
.then(resp => {
|
||||
const clone = resp.clone()
|
||||
caches.open(CACHE).then(c => c.put('./index.html', clone))
|
||||
return resp
|
||||
})
|
||||
.catch(() => caches.match('./index.html'))
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// 静态资源:缓存优先,未命中时拉取并写入缓存
|
||||
event.respondWith(
|
||||
caches.match(req).then(hit => hit || fetch(req).then(resp => {
|
||||
if (resp.ok) {
|
||||
const clone = resp.clone()
|
||||
caches.open(CACHE).then(c => c.put(req, clone))
|
||||
}
|
||||
return resp
|
||||
}))
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user