feat: update deps and insight

This commit is contained in:
Haoyu Xu
2025-01-28 22:10:02 +08:00
parent 07e7cd2bd1
commit 075087e733
6 changed files with 1264 additions and 1312 deletions

View File

@@ -5,11 +5,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>aklive2d directory</title>
<script
id="counterscale-script"
src="https://insight.halyul.dev/on-demand.js"
defer
></script>
<link rel="canonical" href="https://arknights.halyul.dev/">
<style>
.loader {
position: fixed;

View File

@@ -1,13 +1,19 @@
import * as Counterscale from "@counterscale/tracker";
import React from 'react';
export default (path = null, skipPageView = false) => {
Counterscale.init({
siteId: "aklive2d",
reporterUrl: "https://insight.halyul.dev/collect",
autoTrackPageviews: false,
});
export default (path = "", skipPageView = false) => {
React.useEffect(() => {
if (!skipPageView && import.meta.env.MODE !== 'development') {
try {
window.counterscale = {
q: [["set", "siteId", import.meta.env.VITE_INSIGHT_ID], ["trackPageview", {path}]],
};
window.counterscaleOnDemandTrack()
Counterscale.trackPageview({
url: `/${path}`
});
} catch (err) {
console.warn && console.warn(err.message)
}

View File

@@ -18,36 +18,38 @@
"cf:download": "node aklive2d cf:download"
},
"devDependencies": {
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react-swc": "^3.7.2",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.1",
"eslint-plugin-react": "^7.37.3",
"eslint-plugin-react-hooks": "^4.6.2",
"postcss": "^8.4.49",
"eslint": "^9.19.0",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
"postcss": "^8.5.1",
"prop-types": "^15.8.1",
"rollup": "^3.29.5",
"sass": "^1.83.1",
"stylelint": "^16.12.0",
"stylelint-config-standard": "^36.0.1",
"stylelint-config-standard-scss": "^13.1.0",
"vite": "^5.4.11",
"wrangler": "^3.99.0"
"rollup": "^4.32.1",
"sass": "^1.83.4",
"stylelint": "^16.14.1",
"stylelint-config-standard": "^37.0.0",
"stylelint-config-standard-scss": "^14.0.0",
"vite": "^6.0.11",
"wrangler": "^3.106.0"
},
"dependencies": {
"@counterscale/tracker": "^2.5.1",
"dotenv": "^16.4.7",
"jotai": "^2.11.0",
"jsdom": "^22.1.0",
"jotai": "^2.11.1",
"jsdom": "^26.0.0",
"node-fetch": "^3.3.2",
"p-throttle": "^6.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-refresh": "^0.14.2",
"react-router-dom": "^6.28.1",
"p-throttle": "^7.0.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-refresh": "^0.16.0",
"react-router-dom": "^7.1.3",
"react-simple-typewriter": "^5.0.1",
"reset-css": "^5.0.2",
"sharp": "^0.32.6",
"sharp": "^0.33.5",
"yaml": "^2.7.0"
}
}
},
"packageManager": "pnpm@9.5.0+sha512.140036830124618d624a2187b50d04289d5a087f326c9edfc0ccd733d76c4f52c3a313d4fc148794a2a9d81553016004e6742e8cf850670268a7387fc220c903"
}

2478
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,11 +6,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="renderer" content="webkit">
<title>aklive2d</title>
<script
id="counterscale-script"
src="https://insight.halyul.dev/on-demand.js"
defer
></script>
<link rel="canonical" href="https://arknights.halyul.dev/">
</head>
<body>
<div id="app"></div>

View File

@@ -1,4 +1,5 @@
import {createCustomEvent} from "@/components/helper"
import * as Counterscale from "@counterscale/tracker";
import { createCustomEvent } from "@/components/helper"
export default class Insight {
#isInsightInited = false
@@ -12,14 +13,19 @@ export default class Insight {
this.#isInsightInited = true
if (doNotTrack) return
try {
const config = {
path: `/${import.meta.env.VITE_LINK}`
const canonical = document.querySelector('link[rel="canonical"][href]')
if (!canonical) {
return;
}
if (isFromWallpaperEngine) config.hostname = "file://wallpaperengine.local";
window.counterscale = {
q: [["set", "siteId", import.meta.env.VITE_INSIGHT_ID], ["trackPageview", config]],
};
window.counterscaleOnDemandTrack();
if (isFromWallpaperEngine) canonical.href = "file://wallpaperengine.local/";
Counterscale.init({
siteId: "aklive2d",
reporterUrl: "https://insight.halyul.dev/collect",
autoTrackPageviews: false,
});
Counterscale.trackPageview({
url: `/${import.meta.env.VITE_LINK}`
});
} catch (e) {
console.warn && console.warn(e.message)
}