🌱 尝试引入Sentry进行分析

This commit is contained in:
BTMuli
2025-12-29 18:24:21 +08:00
parent e247c6a058
commit cfea47f11c
13 changed files with 1221 additions and 40 deletions

View File

@@ -1,27 +1,31 @@
<template>
<div class="tab-box">
<img class="tab-icon" src="/icon.webp" alt="App" />
<img alt="App" class="tab-icon" src="/icon.webp" />
<div class="tab-info click" title="点击前往 Github Release" @click="toRelease()">
TeyvatGuide Beta
</div>
<div class="tab-info">v{{ versionApp }}.{{ buildTime === "" ? "Dev" : buildTime }}</div>
<div class="tab-links">
<div class="tab-link" @click="toGroup()" title="点击加入反馈群">
<img src="/platforms/other/qq.webp" alt="qq" />
<div class="tab-link" title="反馈BUG" @click="toReport()">
<v-icon color="white">mdi-contactless-payment-circle-outline</v-icon>
</div>
<div class="tab-link" @click="toGithub()" title="点击查看仓库">
<img src="/platforms/other/github.webp" alt="github" />
<div class="tab-link" title="点击加入反馈群" @click="toGroup()">
<img alt="qq" src="/platforms/other/qq.webp" />
</div>
<div class="tab-link" @click="toStore()" title="点击查看商店页面">
<img src="/platforms/other/microsoft-store.webp" alt="store" />
<div class="tab-link" title="点击查看仓库" @click="toGithub()">
<img alt="github" src="/platforms/other/github.webp" />
</div>
<div class="tab-link" @click="toSite()" title="点击查看更新说明">
<div class="tab-link" title="点击查看商店页面" @click="toStore()">
<img alt="store" src="/platforms/other/microsoft-store.webp" />
</div>
<div class="tab-link" title="点击查看更新说明" @click="toSite()">
<v-icon color="white">mdi-update</v-icon>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import * as Sentry from "@sentry/vue";
import useAppStore from "@store/app.js";
import { app } from "@tauri-apps/api";
import { openUrl } from "@tauri-apps/plugin-opener";
@@ -33,6 +37,11 @@ const versionApp = ref<string>();
onMounted(async () => (versionApp.value = await app.getVersion()));
async function toReport(): Promise<void> {
const eventId = Sentry.captureMessage("设置页反馈", "info");
Sentry.showReportDialog({ eventId: eventId });
}
async function toRelease(): Promise<void> {
await openUrl("https://github.com/BTMuli/TeyvatGuide/releases/latest");
}

View File

@@ -1,11 +1,14 @@
/**
* 应用入口
* @since Beta v0.7.2
* @since Beta v0.9.1
*/
import * as Sentry from "@sentry/vue";
import { createApp } from "vue";
import { createVuetify } from "vuetify";
import pkgJson from "../package.json" with { type: "json" };
import App from "./App.vue";
import router from "./router/index.js";
import store from "./store/index.js";
@@ -14,4 +17,16 @@ import "@mdi/font/css/materialdesignicons.css";
import "vuetify/styles";
import "./assets/index.scss";
createApp(App).use(router).use(store).use(createVuetify()).mount("#app");
const app = createApp(App);
Sentry.init({
app,
dsn: "https://8d59057c08ff381e1fccf3c9e97c6a6c@o4510617609175040.ingest.de.sentry.io/4510617659506768",
release: `TeyvatGuide@${pkgJson.version}`,
integrations: [],
// Setting this option to true will send default PII data to Sentry.
// For example, automatic IP address collection on events
sendDefaultPii: true,
});
app.use(router).use(store).use(createVuetify()).mount("#app");