Init
This commit is contained in:
parent
cc1c894d9b
commit
d49d224ba4
|
@ -22,11 +22,14 @@
|
|||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons+Outlined" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC&display=swap" rel="stylesheet">
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
<script async="" src="https://www.googletagmanager.com/gtag/js?id=G-PVVC00CJ26"></script>
|
||||
|
||||
<meta name="description" content="It's me, 186526! | 186526 的自留地">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="It's me, 186526! | 186526.xyz">
|
||||
<meta name="og:description" content="It's me, 186526! | 186526 的自留地">
|
||||
|
||||
<link rel="manifest" href="./manifest.json">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -92,6 +95,11 @@
|
|||
</card>
|
||||
</group>
|
||||
<group id="footer">
|
||||
<div>
|
||||
<a href="https://i.186526.xyz/pgp_keys.asc">
|
||||
<img alt="Keybase PGP" src="https://blog.186526.xyz/shields.io/keybase/pgp/186526">
|
||||
</a>
|
||||
</div>
|
||||
<p>
|
||||
萌ICP备<a href="https://icp.gov.moe/?keyword=20218600">20218600</a>号
|
||||
</p>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
"vite": "^2.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"typed.js": "^2.0.12"
|
||||
"typed.js": "^2.0.12",
|
||||
"workbox-cdn": "4.2.0"
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "It's me, 186526!",
|
||||
"short_name": "186526.xyz",
|
||||
"lang": "zh-CN",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"theme_color": "#2A2734",
|
||||
"background_color": "#FBDBC4",
|
||||
"icons": [
|
||||
{
|
||||
"src": "./maskable.png",
|
||||
"sizes": "1269x1269",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "./avatar.webp",
|
||||
"sizes": "512x512",
|
||||
"type": "image/webp"
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.4 MiB |
|
@ -0,0 +1,49 @@
|
|||
importScripts(
|
||||
'workbox/workbox-sw.js',
|
||||
);
|
||||
self.addEventListener('install', (e) => {
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
if (workbox) {
|
||||
workbox.core.setCacheNameDetails({
|
||||
prefix: 'home-app',
|
||||
suffix: '0.0.2',
|
||||
precache: 'precache',
|
||||
runtime: 'runtime',
|
||||
});
|
||||
workbox.routing.registerRoute(
|
||||
/\/assets/,
|
||||
new workbox.strategies.CacheFirst({
|
||||
plugins: [
|
||||
new workbox.expiration.Plugin({
|
||||
maxAgeSeconds: 24 * 60 * 60,
|
||||
}),
|
||||
],
|
||||
cacheName: 'assets',
|
||||
}),
|
||||
);
|
||||
workbox.routing.registerRoute(
|
||||
'/manifest.json',
|
||||
new workbox.strategies.StaleWhileRevalidate({
|
||||
plugins: [
|
||||
new workbox.expiration.Plugin({
|
||||
maxAgeSeconds: 7 * 24 * 60 * 60,
|
||||
}),
|
||||
],
|
||||
cacheName: 'startpage_me',
|
||||
}),
|
||||
);
|
||||
workbox.routing.registerRoute(
|
||||
'/',
|
||||
new workbox.strategies.StaleWhileRevalidate({
|
||||
plugins: [
|
||||
new workbox.expiration.Plugin({
|
||||
maxAgeSeconds: 60 * 60 * 24,
|
||||
}),
|
||||
],
|
||||
cacheName: 'startpage_me',
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
../node_modules/workbox-cdn/workbox
|
34
src/main.ts
34
src/main.ts
|
@ -1,10 +1,13 @@
|
|||
const __APP_VERSION__ = "__APP_VERSION";
|
||||
const __APP_BUILD_TIME__ = __APP_BUILD_TIME;
|
||||
|
||||
import "./styles/base.css";
|
||||
import "./styles/header.css";
|
||||
import "./styles/contents.css";
|
||||
|
||||
import Typed from "typed.js";
|
||||
|
||||
window.addEventListener("load", (event) => {
|
||||
window.addEventListener("load", (_ev) => {
|
||||
new Typed(document.querySelector("description") ?? "description", {
|
||||
stringsElement: "#description-list",
|
||||
shuffle: true,
|
||||
|
@ -20,4 +23,33 @@ window.addEventListener("load", (event) => {
|
|||
tooltip.innerText = Elem.getAttribute("alt") ?? "";
|
||||
Elem.appendChild(tooltip);
|
||||
});
|
||||
|
||||
// @ts-expect-error
|
||||
document.querySelector(
|
||||
"#footer > div"
|
||||
).innerHTML += `<img alt="Update Commit" src="https://blog.186526.xyz/shields.io/badge/commit-${__APP_VERSION__}-blue" /> <img alt="Latest Update" src="https://blog.186526.xyz/shields.io/date/${__APP_BUILD_TIME__}?color=sucessful&label=latest%20update" />`;
|
||||
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register("./sw.js", {
|
||||
scope: "/",
|
||||
})
|
||||
.then(function (registration) {
|
||||
console.log(
|
||||
"ServiceWorker registration successful with scope: ",
|
||||
registration.scope
|
||||
);
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.warn("ServiceWorker registration failed: ", err);
|
||||
});
|
||||
let refreshing = false;
|
||||
navigator.serviceWorker.addEventListener("controllerchange", () => {
|
||||
if (refreshing) {
|
||||
return;
|
||||
}
|
||||
refreshing = true;
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 MiB |
|
@ -3,6 +3,11 @@ contents {
|
|||
position: absolute;
|
||||
top: 75vh;
|
||||
|
||||
right: 0vh;
|
||||
left: 0vh;
|
||||
|
||||
margin: 0vh 5vw;
|
||||
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
|
@ -48,7 +53,7 @@ group#friend > card > a > img {
|
|||
|
||||
group#footer {
|
||||
display: block;
|
||||
margin: 0vh 2.5vw;
|
||||
margin: 2rem 0.5rem;
|
||||
align-self: flex-start;
|
||||
color: var(--font-color-lighter);
|
||||
font-size: calc(var(--font-size-description) - 0.4rem);
|
||||
|
@ -63,3 +68,10 @@ group#footer > * {
|
|||
filter: invert(100%);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 480px) {
|
||||
contents {
|
||||
margin: 0 2vw;
|
||||
}
|
||||
}
|
|
@ -1 +1,3 @@
|
|||
/// <reference types="vite/client" />
|
||||
declare const __APP_VERSION: string;
|
||||
declare const __APP_BUILD_TIME: string;
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"routes": [
|
||||
{
|
||||
"src": "/(.*)",
|
||||
"headers": {
|
||||
"Cache-Control": "s-maxage=1209600, max-age=86400, public",
|
||||
"Strict-Transport-Security": "max-age=63072000; includeSubDomains; preload",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
|
||||
"Access-Control-Allow-Headers": "Accept, Authorization, Cache-Control, Content-Type, DNT, If-Modified-Since, Keep-Alive, Origin, User-Agent, X-Requested-With, Token, x-access-token"
|
||||
},
|
||||
"continue": true
|
||||
},
|
||||
{
|
||||
"src": "/goto/github",
|
||||
"status": 302,
|
||||
"headers": {
|
||||
"Location": "https://github.com/186526"
|
||||
}
|
||||
},
|
||||
{
|
||||
"src": "/goto/telegram",
|
||||
"status": 302,
|
||||
"headers": {
|
||||
"Location": "https://t.me/real186526"
|
||||
}
|
||||
},
|
||||
{
|
||||
"src": "/goto/blog",
|
||||
"status": 302,
|
||||
"headers": {
|
||||
"Location": "https://blog.186526.xyz"
|
||||
}
|
||||
},
|
||||
{
|
||||
"src": "/goto/email",
|
||||
"status": 302,
|
||||
"headers": {
|
||||
"Location": "mailto:admin@186526.xyz"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -4,7 +4,8 @@ import child_process from "child_process"
|
|||
*/
|
||||
const config = {
|
||||
define: {
|
||||
'__APP_VERSION': child_process.execSync('git rev-parse --short HEAD'),
|
||||
'__APP_VERSION': child_process.execSync('git rev-parse --short HEAD').toString().replaceAll("\n",""),
|
||||
'__APP_BUILD_TIME': Math.floor(Date.now() / 1000),
|
||||
}
|
||||
}
|
||||
export default config
|
|
@ -223,3 +223,8 @@ vite@^2.9.5:
|
|||
rollup "^2.59.0"
|
||||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
workbox-cdn@4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.npmmirror.com/workbox-cdn/-/workbox-cdn-4.2.0.tgz#1bab3a0ab8d4d1edd00c7d30721790d669aa5bb7"
|
||||
integrity sha512-tX7a5svvRqbUCnvfuM4izwDYO3T+LtpTpPoJx6HMaN/OSA+yqJH321Dbqg8SOUvzJjyRfFRQiriCX1csdqdFyg==
|
||||
|
|
Loading…
Reference in New Issue