This commit is contained in:
186526 2022-05-01 14:04:07 +08:00
parent 42c71b44c6
commit b794f77721
Signed by: 186526
GPG Key ID: C7EB1E6B8CC5E51D
7 changed files with 44 additions and 39 deletions

View File

@ -129,6 +129,11 @@
><img src="https://storage.186526.xyz/home-app/assets/dn42.png"
/></a>
</card>
<card id="gitea">
<a href="https://git.186526.xyz" alt="186526's Gitea"
><img src="https://git.186526.xyz/assets/img/logo.svg"
/></a>
</card>
<card id="github">
<a href="https://github.com/186526" alt="Github"
><img
@ -193,19 +198,17 @@
</group>
<group id="footer">
<div>
<a href="https://i.186526.xyz/pgp_keys.asc">
<a alt="PGP Key" href="https://i.186526.xyz/pgp_keys.asc">
<img
alt="Keybase PGP"
src="https://blog.186526.xyz/shields.io/keybase/pgp/186526"
/>
</a>
<a href="https://icp.gov.moe/?keyword=20218600"
<a alt="Moe ICP 20218600" href="https://icp.gov.moe/?keyword=20218600"
><img
alt="Moe ICP 20218600"
src="https://blog.186526.xyz/shields.io/badge/%E8%90%8CICP%E5%A4%87-20218600-blue"
/></a>
<a href="https://status.186526.eu.org/"
<a alt="186526.xyz Uptime" href="https://status.186526.eu.org/"
><img
src="https://blog.186526.xyz/shields.io/uptimerobot/ratio/m786767672-6913a353d708838f195d30d8"
/></a>
@ -219,6 +222,7 @@
<p>
Running on <a href="https://net.186526.xyz">186526 Network</a>.
Build in <code>"unknown"</code>.
</p>
<p>Copyright © 2020 - Now 186526.xyz All rights Reserved.</p>
</group>

View File

@ -16,6 +16,7 @@
},
"dependencies": {
"@vitejs/plugin-legacy": "^1.8.1",
"tippy.js": "^6.3.7",
"typed.js": "^2.0.12",
"workbox-cdn": "4.2.0"
},

View File

@ -1,10 +1,15 @@
const __APP_VERSION__ = "__APP_VERSION";
const __APP_BUILD_TIME__ = __APP_BUILD_TIME;
const APP_VERSION = __APP_VERSION__;
const APP_BUILD_TIME = __APP_BUILD_TIME__;
import "./styles.css";
import Typed from "typed.js";
import Tippy from 'tippy.js';
import 'tippy.js/dist/tippy.css';
import 'tippy.js/animations/scale.css';
window.addEventListener("load", (_ev) => {
new Typed(document.querySelector("description") ?? "description", {
stringsElement: "#description-list",
@ -18,15 +23,18 @@ window.addEventListener("load", (_ev) => {
});
document.querySelectorAll("[alt]").forEach((Elem) => {
const tooltip = document.createElement("tooltiptext");
tooltip.innerText = Elem.getAttribute("alt") ?? "";
Elem.appendChild(tooltip);
Tippy(Elem, {
content: Elem.getAttribute("alt") ?? "",
})
});
// @ts-expect-error
document.querySelector(
"#footer > div"
).innerHTML += `<a href="https://git.186526.xyz/186526/home-app"><img alt="Update Commit" src="https://blog.186526.xyz/shields.io/badge/commit-${__APP_VERSION__}-blue" /></a> <img alt="Latest Update" src="https://blog.186526.xyz/shields.io/date/${__APP_BUILD_TIME__}?color=sucessful&label=latest%20update" />`;
).innerHTML += `<a href="https://git.186526.xyz/186526/home-app"><img alt="Update Commit" src="https://blog.186526.xyz/shields.io/badge/commit-${APP_VERSION}-blue" /></a> <img alt="Latest Update" src="https://blog.186526.xyz/shields.io/date/${APP_BUILD_TIME}?color=sucessful&label=latest%20update" />`;
// @ts-expect-error
document.querySelector("#footer").innerHTML = document.querySelector("#footer")?.innerHTML.replaceAll("unknown",__APP_BUILD_MACHINE__);
if ("serviceWorker" in navigator) {
navigator.serviceWorker

View File

@ -141,29 +141,6 @@ background {
}
}
tooltiptext {
display: none;
visibility: hidden;
font-family: "Google Sans", Roboto, Noto Sans SC, sans-serif;
width: 120px;
background-color: #555;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
opacity: 0;
transition: opacity 0.6s;
position: absolute;
z-index: 1;
}
:hover > tooltiptext {
display: block;
visibility: visible;
opacity: 1;
}
.toast {
background: var(--mask-color);
border-radius: 8px;

5
src/vite-env.d.ts vendored
View File

@ -1,3 +1,4 @@
/// <reference types="vite/client" />
declare const __APP_VERSION: string;
declare const __APP_BUILD_TIME: string;
declare const __APP_VERSION__: string;
declare const __APP_BUILD_TIME__: string;
declare const __APP_BUILD_MACHINE__: string;

View File

@ -1,5 +1,6 @@
import child_process from "child_process";
import legacy from "@vitejs/plugin-legacy";
import os from "os";
/**
* @type {import('vite').UserConfig}
@ -7,11 +8,12 @@ import legacy from "@vitejs/plugin-legacy";
const config = {
base: "./",
define: {
__APP_VERSION: child_process
__APP_VERSION__: `"${child_process
.execSync("git rev-parse --short HEAD")
.toString()
.replace("\n", ""),
__APP_BUILD_TIME: Math.floor(Date.now() / 1000),
.replace("\n", "")}"`,
__APP_BUILD_TIME__: Math.floor(Date.now() / 1000),
__APP_BUILD_MACHINE__:`"${os.hostname}"`
},
plugins: [
legacy({

View File

@ -7,6 +7,11 @@
resolved "https://registry.npmmirror.com/@babel/standalone/-/standalone-7.17.11.tgz#9cc17674da762332b2e40d469ce37725a6136487"
integrity sha512-47wVYBeTktYHwtzlFuK7qqV/H5X6mU4MUNqpQ9iiJOqnP8rWL0eX0GWLKRsv8D8suYzhuS1K/dtwgGr+26U7Gg==
"@popperjs/core@^2.9.0":
version "2.11.5"
resolved "https://registry.npmmirror.com/@popperjs/core/-/core-2.11.5.tgz#db5a11bf66bdab39569719555b0f76e138d7bd64"
integrity sha512-9X2obfABZuDVLCgPK9aX0a/x4jaOEweTTWE2+9sr0Qqqevj2Uv5XorvusThmc9XGYpS9yI+fhh8RTafBtGposw==
"@trysound/sax@0.2.0":
version "0.2.0"
resolved "https://registry.npmmirror.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad"
@ -749,6 +754,13 @@ systemjs@^6.12.1:
resolved "https://registry.npmmirror.com/systemjs/-/systemjs-6.12.1.tgz#47cdd23a6ec9f1b01cf5b5f70562c8550da229d3"
integrity sha512-hqTN6kW+pN6/qro6G9OZ7ceDQOcYno020zBQKpZQLsJhYTDMCMNfXi/Y8duF5iW+4WWZr42ry0MMkcRGpbwG2A==
tippy.js@^6.3.7:
version "6.3.7"
resolved "https://registry.npmmirror.com/tippy.js/-/tippy.js-6.3.7.tgz#8ccfb651d642010ed9a32ff29b0e9e19c5b8c61c"
integrity sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==
dependencies:
"@popperjs/core" "^2.9.0"
typed.js@^2.0.12:
version "2.0.12"
resolved "https://registry.npmmirror.com/typed.js/-/typed.js-2.0.12.tgz#246aff074c8e18d32ec27acb7be15094ac0bc0e1"