mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-19 04:29:45 +08:00
🧑💻 调整Sentry数据
This commit is contained in:
@@ -1 +1,3 @@
|
||||
VITE_SENTRY_RELEASE=TeyvatGuide@0.9.0_0c8eda3f_windows
|
||||
VITE_SENTRY_RELEASE=TeyvatGuide@0.9.0
|
||||
VITE_COMMIT_HASH=7423f6f2
|
||||
VITE_BUILD_TIME=1767161892
|
||||
|
||||
@@ -25,24 +25,16 @@ console.log(`🍄 SkipUpload:${skipUpload}`);
|
||||
// 获取提交哈希
|
||||
const commitHash = execSync("git rev-parse --short HEAD").toString().trim();
|
||||
|
||||
// 获取当前平台
|
||||
let platform = "unknown";
|
||||
if (process.platform === "win32") {
|
||||
platform = "windows";
|
||||
} else if (process.platform === "darwin") {
|
||||
platform = process.arch === "arm64" ? "macos-arm" : "macos-intel";
|
||||
} else {
|
||||
platform = `${process.platform}-${process.arch}`;
|
||||
}
|
||||
|
||||
// 构建 Release 字符串
|
||||
const release = `TeyvatGuide@${pkgVersion}_${commitHash}_${platform}`;
|
||||
console.log(`🍄 gen sentry release ${release}`);
|
||||
const release = `TeyvatGuide@${pkgVersion}`;
|
||||
console.log(`🍄 gen sentry release ${release} env`);
|
||||
|
||||
// 修改 .env.production
|
||||
const envPath = resolve(__dirname, "../.env.production");
|
||||
const envRead = parse(readFileSync(envPath, "utf-8"));
|
||||
envRead.VITE_SENTRY_RELEASE = release;
|
||||
envRead.VITE_COMMIT_HASH = commitHash;
|
||||
envRead.VITE_BUILD_TIME = Math.floor(Date.now() / 1000).toString();
|
||||
writeFileSync(envPath, stringify(envRead), "utf-8");
|
||||
console.log("✅ .env.production updated!");
|
||||
|
||||
|
||||
@@ -18,18 +18,8 @@ const pkgVersion = pkgJson.version;
|
||||
// 获取提交哈希
|
||||
const commitHash = execSync("git rev-parse --short HEAD").toString().trim();
|
||||
|
||||
// 获取当前平台
|
||||
let platform = "unknown";
|
||||
if (process.platform === "win32") {
|
||||
platform = "windows";
|
||||
} else if (process.platform === "darwin") {
|
||||
platform = process.arch === "arm64" ? "macos-arm" : "macos-intel";
|
||||
} else {
|
||||
platform = `${process.platform}-${process.arch}`;
|
||||
}
|
||||
|
||||
// 构建 Release 字符串
|
||||
const release = `TeyvatGuide@${pkgVersion}_dev_${commitHash}_${platform}`;
|
||||
const release = `TeyvatGuide@${pkgVersion}`;
|
||||
console.log(`🍄 gen sentry dev release ${release}`);
|
||||
|
||||
// 修改 .env.development.local
|
||||
@@ -39,6 +29,8 @@ if (!existsSync(envPath)) {
|
||||
} else {
|
||||
const envRead = parse(readFileSync(envPath, "utf-8"));
|
||||
envRead.VITE_SENTRY_RELEASE = release;
|
||||
envRead.VITE_COMMIT_HASH = commitHash;
|
||||
envRead.VITE_BUILD_TIME = Math.floor(Date.now() / 1000).toString();
|
||||
writeFileSync(envPath, stringify(envRead), "utf-8");
|
||||
}
|
||||
console.log("✅ .env.development.local updated!");
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="tab-info click" title="点击前往 Github Release" @click="toRelease()">
|
||||
TeyvatGuide Beta
|
||||
</div>
|
||||
<div class="tab-info">{{ buildTime.replace("TeyvatGuide@", "") }}</div>
|
||||
<div class="tab-info">{{ versionApp }}_{{ buildTime }}</div>
|
||||
<div class="tab-links">
|
||||
<div class="tab-link" title="点击加入反馈群" @click="toGroup()">
|
||||
<img alt="qq" src="/platforms/other/qq.webp" />
|
||||
@@ -27,7 +27,7 @@ import { openUrl } from "@tauri-apps/plugin-opener";
|
||||
import { onMounted, ref } from "vue";
|
||||
|
||||
// @ts-expect-error import.meta
|
||||
const buildTime = import.meta.env.VITE_SENTRY_RELEASE;
|
||||
const buildTime = import.meta.env.VITE_BUILD_TIME;
|
||||
const versionApp = ref<string>();
|
||||
|
||||
onMounted(async () => (versionApp.value = await app.getVersion()));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 数据文件入口
|
||||
* @since Beta v0.8.4
|
||||
* @since Beta v0.9.1
|
||||
*/
|
||||
|
||||
import type { Schema } from "ajv";
|
||||
@@ -53,8 +53,10 @@ const avatarFiles = import.meta.glob("./WIKI/character/*.json");
|
||||
export async function getWikiCharacterById(
|
||||
id: number,
|
||||
): Promise<TGApp.App.Character.WikiItem | false> {
|
||||
const key = `./WIKI/character/${id}.json`;
|
||||
if (!(key in avatarFiles)) return false;
|
||||
try {
|
||||
const data = await avatarFiles[`./WIKI/character/${id}.json`]();
|
||||
const data = await avatarFiles[key]();
|
||||
if (data && typeof data === "object" && "default" in data) {
|
||||
console.log(data.default);
|
||||
return <TGApp.App.Character.WikiItem>data.default;
|
||||
|
||||
@@ -22,7 +22,8 @@ Sentry.init({
|
||||
app,
|
||||
dsn: "https://8d59057c08ff381e1fccf3c9e97c6a6c@o4510617609175040.ingest.de.sentry.io/4510617659506768",
|
||||
release: import.meta.env.VITE_SENTRY_RELEASE,
|
||||
enableLogs: process.env.NODE_ENV === "production",
|
||||
enableLogs: true,
|
||||
environment: process.env.NODE_ENV,
|
||||
integrations: [
|
||||
Sentry.feedbackAsyncIntegration(<FeedbackInternalOptions>{
|
||||
// 🌗 主题与注入行为
|
||||
@@ -55,6 +56,7 @@ Sentry.init({
|
||||
hideToolText: "遮挡敏感信息",
|
||||
}),
|
||||
Sentry.consoleLoggingIntegration({ levels: ["error"] }),
|
||||
Sentry.browserTracingIntegration({ router }),
|
||||
],
|
||||
beforeSend(event, hint) {
|
||||
console.log(hint);
|
||||
@@ -69,4 +71,7 @@ Sentry.init({
|
||||
sendDefaultPii: true,
|
||||
});
|
||||
|
||||
Sentry.setTag("commitHash", import.meta.env.VITE_COMMIT_HASH);
|
||||
Sentry.setTag("buildTime", import.meta.env.VITE_BUILD_TIME);
|
||||
|
||||
app.use(router).use(store).use(createVuetify()).mount("#app");
|
||||
|
||||
@@ -292,7 +292,7 @@ async function confirmUpdate(title?: string): Promise<void> {
|
||||
await showLoading.start("正在更新数据库", "");
|
||||
await TGSqlite.update();
|
||||
// @ts-expect-error import.meta
|
||||
buildTime.value = import.meta.env.VITE_SENTRY_RELEASE;
|
||||
buildTime.value = import.meta.env.VITE_BUILD_TIME;
|
||||
await showLoading.end();
|
||||
showSnackbar.success("数据库已更新!即将刷新页面");
|
||||
await TGLogger.Info("[Config][confirmUpdate] 数据库更新完成");
|
||||
|
||||
@@ -16,7 +16,7 @@ async function initAppData(): Promise<Array<string>> {
|
||||
const sqlRes: Array<string> = [];
|
||||
const appVersion = await app.getVersion();
|
||||
// @ts-expect-error import.meta
|
||||
const buildTime: string = import.meta.VITE_SENTRY_RELEASE;
|
||||
const buildTime: string = import.meta.VITE_BUILD_TIME;
|
||||
// 初始化应用版本
|
||||
sqlRes.push(`
|
||||
INSERT INTO AppData (key, value, updated)
|
||||
|
||||
Reference in New Issue
Block a user