From 477f6829d9cc2a82cd1d7a1b36aeafa6bf1660a6 Mon Sep 17 00:00:00 2001
From: Rhen Cloud
Date: Sun, 18 Jan 2026 12:32:55 +0800
Subject: [PATCH] update
---
.gitignore | 6 +-
app/app.vue | 30 ++++++++-
app/components/main/footer.vue | 76 +++++------------------
app/config/index.ts | 14 ++---
app/plugins/umami.client.ts | 29 ---------
app/types/nav.ts | 15 ++---
content/about.md | 4 +-
content/posts/my-browser-hostory/index.md | 2 +-
nuxt.config.ts | 8 ---
9 files changed, 60 insertions(+), 124 deletions(-)
delete mode 100644 app/plugins/umami.client.ts
diff --git a/.gitignore b/.gitignore
index b5141ca..c781343 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,6 @@ node_modules
bun.lock
yarn.lock
-
-.vercel
-.env*.local
+.edgeone/
+.vercel
+.env*.local
diff --git a/app/app.vue b/app/app.vue
index 4e70374..90c876f 100644
--- a/app/app.vue
+++ b/app/app.vue
@@ -9,8 +9,8 @@ useHead({
// meta: () => siteMetaData,
});
-const desktopBg = siteConfig.theme.background || "";
-const mobileBg = siteConfig.theme.backgroundMobile || "";
+const desktopBg = siteConfig.theme?.background || "";
+const mobileBg = siteConfig.theme?.backgroundMobile || "";
// 将 siteConfig.theme.color 转换为 CSS 变量
const hexToRgb = (hex: string) => {
@@ -20,15 +20,39 @@ const hexToRgb = (hex: string) => {
: "189, 131, 243";
};
-const primaryColor = siteConfig.theme.color || "#bd83f3";
+const primaryColor = siteConfig.theme?.color || "#bd83f3";
const primaryRgb = hexToRgb(primaryColor);
+// Parse traceConfig.script (which may contain raw
diff --git a/app/components/main/footer.vue b/app/components/main/footer.vue
index dcc8bcf..493cf41 100644
--- a/app/components/main/footer.vue
+++ b/app/components/main/footer.vue
@@ -9,11 +9,6 @@
· {{ fromWho }}
-
-
- 👁️ {{ visitors }} · 📊 {{ pageviews }}
-
-
-
-
+
@@ -86,15 +81,22 @@ const contact = siteConfig.footer || {};
const quote = ref("");
const from = ref("");
const fromWho = ref("");
-const pageviews = ref(0);
-const visitors = ref(0);
-const statsError = ref(true);
const showHitokoto = siteConfig.footer?.hitokoto?.enable;
-const showStats = ref(siteConfig.umami?.enable);
const adStats = siteConfig.ad?.enable;
const ads = siteConfig.ad?.ads || [];
+// processedAds: replace root-relative src ("/...") with full site URL to
+// avoid issues when deployed under different hosts/base paths or when
+// root-relative assets are unavailable. Keeps existing HTML otherwise.
+const processedAds = (ads || []).map((ad) => {
+ const html =
+ typeof ad.body === "string"
+ ? ad.body.replace(/src="\/(?!\/)/g, `src="${siteConfig.siteMeta.url}/`)
+ : ad.body;
+ return { ...ad, html };
+});
+
const buildHitokotoUrl = () => {
const type = siteConfig.footer?.hitokoto?.type;
const url = new URL("https://v1.hitokoto.cn/");
@@ -122,59 +124,11 @@ const fetchHitokoto = async () => {
}
};
-const fetchStats = async () => {
- try {
- if (!siteConfig.umami?.apiEndpoint || !siteConfig.umami?.websiteId) {
- return;
- }
- const apiEndpoint = siteConfig.umami.apiEndpoint;
- const websiteId = siteConfig.umami.websiteId;
- const apiKey = siteConfig.umami.apiKey;
-
- if (!apiKey) return;
-
- // 获取统计数据
-
- const startAt = new Date(siteConfig.siteMeta.startTime);
- const endAt = Date.now();
-
- const resp = await fetch(
- `${apiEndpoint}/v1/websites/${websiteId}/stats?startAt=${startAt}&endAt=${endAt}`,
- {
- headers: {
- Authorization: `Bearer ${apiKey}`,
- },
- },
- );
-
- if (!resp.ok) {
- console.warn(`Stats API returned ${resp.status}`);
- statsError.value = true;
- return;
- }
-
- const data = await resp.json();
- if (data) {
- statsError.value = false;
- pageviews.value = data.pageviews;
- visitors.value = data.visitors;
- }
-
- if (pageviews.value === 0 && visitors.value === 0) {
- showStats.value = false;
- }
- } catch (e) {
- statsError.value = true;
- console.debug("Stats fetch failed (this is normal if blocked by ad blocker):", e.message);
- }
-};
-
const isExternal = (url) => {
return typeof url === "string" && /^https?:\/\//.test(url);
};
onMounted(() => {
if (showHitokoto) fetchHitokoto();
- if (showStats.value) fetchStats();
});
diff --git a/app/config/index.ts b/app/config/index.ts
index ae74b8e..78b63cc 100644
--- a/app/config/index.ts
+++ b/app/config/index.ts
@@ -78,6 +78,12 @@ const siteConfig: SiteConfig = {
},
},
+ traceConfig: {
+ enable: true,
+ script: `
+`,
+ },
+
comment: {
twikoo: {
enable: true,
@@ -85,14 +91,6 @@ const siteConfig: SiteConfig = {
},
},
- umami: {
- enable: false,
- scriptUrl: "https://cloud.umami.is/script.js",
- apiKey: "api_MGcpRPYMcBmTKZOKdUVpr7mlBoWkck5g",
- websiteId: "b33dfd14-7e62-498b-a199-de0ac38a1d44",
- apiEndpoint: "https://api.umami.is",
- },
-
ad: {
enable: true,
ads: [
diff --git a/app/plugins/umami.client.ts b/app/plugins/umami.client.ts
deleted file mode 100644
index f324ea0..0000000
--- a/app/plugins/umami.client.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { defineNuxtPlugin } from "#app";
-import { VueUmamiPlugin } from "@jaseeey/vue-umami-plugin";
-import type { Router } from "vue-router";
-import siteConfig from "~/config";
-
-export default defineNuxtPlugin((nuxtApp) => {
- if (!import.meta.client) return;
- if (!siteConfig.umami?.enable) return;
-
- // 跳过在 localhost 环境下加载 Umami
- if (
- typeof window !== "undefined" &&
- (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1")
- ) {
- console.log("Umami plugin skipped on localhost");
- return;
- }
-
- const router = nuxtApp.$router as Router | undefined;
- if (!router) return;
-
- nuxtApp.vueApp.use(
- VueUmamiPlugin({
- websiteID: siteConfig.umami.websiteId,
- scriptSrc: siteConfig.umami.scriptUrl,
- router,
- }),
- );
-});
diff --git a/app/types/nav.ts b/app/types/nav.ts
index 231111a..824b227 100644
--- a/app/types/nav.ts
+++ b/app/types/nav.ts
@@ -63,6 +63,11 @@ export interface Footer {
};
}
+export interface TraceConfig {
+ enable?: boolean;
+ script?: string;
+}
+
export interface CommentConfig {
twikoo?: {
enable?: boolean;
@@ -70,14 +75,6 @@ export interface CommentConfig {
};
}
-export interface UmamiConfig {
- enable?: boolean;
- scriptUrl?: string;
- apiKey?: string;
- websiteId?: string;
- apiEndpoint?: string;
-}
-
export interface AdConfig {
enable?: boolean;
ads?: [{ body?: string; link?: string }];
@@ -94,7 +91,7 @@ export interface SiteConfig {
lines?: LineInfo[];
theme?: Theme;
footer?: Footer;
+ traceConfig?: TraceConfig;
comment?: CommentConfig;
- umami?: UmamiConfig;
ad?: AdConfig;
}
diff --git a/content/about.md b/content/about.md
index 0f9d5cb..db859cd 100644
--- a/content/about.md
+++ b/content/about.md
@@ -1,6 +1,6 @@
# 关于我
-大家好!👋 我是 **RhenCloud**,一名热爱技术和开源的开发者。
+大家好!👋 我是 **@RhenCloud**、**@泠云**,一名热爱技术和开源的开发者。
## 个人简介
@@ -66,7 +66,7 @@
- ✅ SEO 优化(Meta、OG、Sitemap、RSS)
- ✅ 文章搜索(Fuse.js)
- ✅ 评论系统(Twikoo)
-- ✅ 访客统计(Umami)
+- ✅ 访客统计
- ✅ 响应式设计
- ✅ 快速加载速度
diff --git a/content/posts/my-browser-hostory/index.md b/content/posts/my-browser-hostory/index.md
index ff98af1..ac29069 100644
--- a/content/posts/my-browser-hostory/index.md
+++ b/content/posts/my-browser-hostory/index.md
@@ -26,7 +26,7 @@ categories: ["Technology"]
### Firefox
-是我 ~~(抛弃 360 极速浏览器后)~~最早使用的浏览器,后来由于缺少插件以及兼容性不佳放弃使用
+是我~~抛弃 360 极速浏览器后~~最早使用的浏览器,后来由于缺少插件以及兼容性不佳放弃使用
优点:
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 3ca14d3..d235401 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -26,7 +26,6 @@ export default defineNuxtConfig({
"@nuxt/content",
"@nuxtjs/color-mode",
"@nuxt/ui",
- // "nuxt-umami",
"@formkit/auto-animate",
],
@@ -117,13 +116,6 @@ export default defineNuxtConfig({
minify: true,
},
- // umami: {
- // id: siteConfig.umami.websiteId,
- // host: siteConfig.umami.apiBase,
- // autoTrack: true,
- // enabled: siteConfig.umami.enable,
- // },
-
colorMode: {
classSuffix: "",
preference: "system",