mirror of
https://github.com/afoim/fuwari.git
synced 2026-01-31 09:03:18 +08:00
feat(umami): 迁移umami统计到自建实例并更新相关配置
更新所有umami API调用路径,移除`/analytics/us`前缀 将统计链接和配置从云服务迁移到自建实例 在todo列表中标记umami迁移任务为已完成 启用自建umami统计脚本并禁用云服务脚本
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
localStorage.removeItem(cacheKey);
|
||||
}
|
||||
}
|
||||
const res = await fetch(`${baseUrl}/analytics/us/api/share/${shareId}`);
|
||||
const res = await fetch(`${baseUrl}/api/share/${shareId}`);
|
||||
if (!res.ok) {
|
||||
throw new Error('获取 Umami 分享信息失败');
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ const { remarkPluginFrontmatter } = await entry.render();
|
||||
|
||||
// 第二步:获取统计数据
|
||||
const currentTimestamp = Date.now();
|
||||
const statsUrl = `${umamiConfig.baseUrl}/analytics/us/api/websites/${websiteId}/stats?startAt=0&endAt=${currentTimestamp}&unit=hour&timezone=${encodeURIComponent(umamiConfig.timezone)}&path=eq.%2Fposts%2F${slug}%2F&compare=false`;
|
||||
const statsUrl = `${umamiConfig.baseUrl}/api/websites/${websiteId}/stats?startAt=0&endAt=${currentTimestamp}&unit=hour&timezone=${encodeURIComponent(umamiConfig.timezone)}&path=eq.%2Fposts%2F${slug}%2F&compare=false`;
|
||||
|
||||
const statsResponse = await fetch(statsUrl, {
|
||||
headers: {
|
||||
|
||||
@@ -99,7 +99,7 @@ const className = Astro.props.class;
|
||||
|
||||
// 第二步:获取统计数据
|
||||
const currentTimestamp = Date.now();
|
||||
const statsUrl = `${umamiConfig.baseUrl}/analytics/us/api/websites/${websiteId}/stats?startAt=0&endAt=${currentTimestamp}&unit=hour&timezone=${encodeURIComponent(umamiConfig.timezone)}&path=eq.%2Fposts%2F${slug}%2F&compare=false`;
|
||||
const statsUrl = `${umamiConfig.baseUrl}/api/websites/${websiteId}/stats?startAt=0&endAt=${currentTimestamp}&unit=hour&timezone=${encodeURIComponent(umamiConfig.timezone)}&path=eq.%2Fposts%2F${slug}%2F&compare=false`;
|
||||
|
||||
const statsResponse = await fetch(statsUrl, {
|
||||
headers: {
|
||||
|
||||
@@ -68,7 +68,7 @@ const config = profileConfig;
|
||||
|
||||
// 第二步:获取全站统计数据(不指定url参数获取全站数据)
|
||||
const currentTimestamp = Date.now();
|
||||
const statsUrl = `${umamiConfig.baseUrl}/analytics/us/api/websites/${websiteId}/stats?startAt=0&endAt=${currentTimestamp}&unit=hour&timezone=${encodeURIComponent(umamiConfig.timezone)}&compare=false`;
|
||||
const statsUrl = `${umamiConfig.baseUrl}/api/websites/${websiteId}/stats?startAt=0&endAt=${currentTimestamp}&unit=hour&timezone=${encodeURIComponent(umamiConfig.timezone)}&compare=false`;
|
||||
|
||||
const statsResponse = await fetch(statsUrl, {
|
||||
headers: {
|
||||
|
||||
@@ -82,7 +82,7 @@ export const navBarConfig: NavBarConfig = {
|
||||
},
|
||||
{
|
||||
name: "统计",
|
||||
url: "https://cloud.umami.is/share/hN3l7PGcxsUCBHfU", // Internal links should not include the base path, as it is automatically added
|
||||
url: "https://umami.2b2x.cn/share/CdkXbGgZr6ECKOyK", // Internal links should not include the base path, as it is automatically added
|
||||
external: true, // Show an external link icon and will open in a new tab
|
||||
},
|
||||
{
|
||||
@@ -125,8 +125,8 @@ export const imageFallbackConfig: ImageFallbackConfig = {
|
||||
|
||||
export const umamiConfig: UmamiConfig = {
|
||||
enable: true,
|
||||
baseUrl: "https://cloud.umami.is",
|
||||
shareId: "hN3l7PGcxsUCBHfU",
|
||||
baseUrl: "https://umami.2b2x.cn",
|
||||
shareId: "CdkXbGgZr6ECKOyK",
|
||||
timezone: "Asia/Shanghai",
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export const todoConfig: TodoConfig = {
|
||||
{ content: "做视频:如何使用OBS优雅的录视频", completed: false },
|
||||
{ content: "做视频:博客时光流逝卡片", completed: false },
|
||||
{ content: "做视频:博客访客统计新UI", completed: false },
|
||||
{ content: "自建Umami并从云迁移到自建", completed: false },
|
||||
{ content: "自建Umami并从云迁移到自建", completed: true },
|
||||
{ content: "更改文章底下的链接,用正则删去查询(?=xxx)", completed: false },
|
||||
{ content: "做视频:anuneko.com米哈游AI上手体验", completed: true },
|
||||
{ content: "完善Bot插件:anuneko.com米哈游AI聊天机器人(支持pick)", completed: true },
|
||||
|
||||
@@ -241,10 +241,10 @@ const bannerOffset =
|
||||
<slot name="head"></slot>
|
||||
|
||||
<link rel="alternate" type="application/rss+xml" title={profileConfig.name} href={`${Astro.site}rss.xml`}/>
|
||||
{/* <!-- Umami分析(自建) -->
|
||||
<script defer src="https://umami.2x.nz/script.js" data-website-id="4b4e430d-a12c-4a5c-8cf9-df48eb20fd6d"></script> */}
|
||||
<!-- Umami分析(云-备用) -->
|
||||
<script defer src="https://cloud.umami.is/script.js" data-website-id="5d710dbd-3a2e-43e3-a553-97b415090c63" data-swup-ignore-script></script>
|
||||
<!-- Umami分析(自建) -->
|
||||
<script defer src="https://umami.2b2x.cn/script.js" data-website-id="5d710dbd-3a2e-43e3-a553-97b415090c63" data-swup-ignore-script></script>
|
||||
{/* <!-- Umami分析(云-备用) -->
|
||||
<script defer src="https://cloud.umami.is/script.js" data-website-id="5d710dbd-3a2e-43e3-a553-97b415090c63" data-swup-ignore-script></script> */}
|
||||
<!-- 百度统计 -->
|
||||
<script data-swup-ignore-script>
|
||||
var _hmt = _hmt || [];
|
||||
|
||||
Reference in New Issue
Block a user