Revert "feat: update deps and insight"

This reverts commit 075087e733.
This commit is contained in:
Haoyu Xu
2025-02-09 11:58:28 +08:00
parent d10ce9c298
commit e011005e67
6 changed files with 1316 additions and 1268 deletions

View File

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

View File

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

View File

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

2486
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

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

View File

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