Skip to content

chore: 合并 dev 到 preview#11

Merged
YueerMoe merged 8 commits into
previewfrom
dev
Mar 22, 2026
Merged

chore: 合并 dev 到 preview#11
YueerMoe merged 8 commits into
previewfrom
dev

Conversation

@YueerMoe
Copy link
Copy Markdown
Member

准备将 dev 分支当前变更合并到 preview,用于后续预发布流程。

主要改动请查看本次 PR 的 commits 与 diff。

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在将 dev 分支的最新开发成果合并到 preview 分支,为即将进行的预发布做准备。本次合并包含了对项目核心结构的重大调整,例如品牌重塑和数据管理机制的优化,旨在提升应用的灵活性和用户体验。通过引入原生文件对话框,用户现在可以更直观地管理其数据存储位置。此外,对抽卡统计逻辑的改进,将为用户提供更精确的游戏数据分析。

Highlights

  • 项目名称重构: 项目名称从 endfield-cat 全面更名为 endcat,此变更已体现在代码库、文档和配置文件的多个位置。
  • 数据目录管理: 引入了可配置的用户数据目录功能,支持用户自定义数据存储路径,并实现了对旧版数据目录的自动迁移。同时,新增了在操作系统中直接打开数据目录的命令。
  • Tauri 对话框插件集成: 集成了 @tauri-apps/plugin-dialog 插件,为应用提供了原生的文件选择对话框功能,提升了用户体验,尤其是在选择数据目录时。
  • 抽卡数据统计优化: 在抽卡记录中新增了 is_free 字段,用于区分免费抽卡。抽卡统计逻辑已更新,免费抽卡将不再计入保底和平均抽数等相关计算,使统计结果更准确。
  • 文档和版本更新: 更新了 AGENTS.mdREADME.mddocs/README_EN.md 等文档,包含了新的版本号约定、发布流程、支持平台和功能特性。项目版本号已从 0.2.1 提升至 0.3.1
Ignored Files
  • Ignored by pattern: .github/workflows/** (3)
    • .github/workflows/dev.yml
    • .github/workflows/preview.yml
    • .github/workflows/release.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

你好,感谢你为项目做出的贡献。这次的 PR 包含了一系列重要的更新,包括项目重命名、版本号提升,以及对数据存储路径管理的重大重构。整体来看,这些改动提升了应用的健壮性和用户体验,特别是新的路径管理和迁移逻辑考虑得很周到。

我发现了一些可以改进的地方,主要集中在文档一致性、后端代码可读性和前端代码复用性上。具体建议请看下面的评论。

Comment thread src/pages/GuidePage/Resource.vue Outdated
Comment on lines +103 to +183
// GitHub 镜像配置(引导页中也可设置)
const githubMirrorEnabled = computed({
get: () => appStore.githubMirrorEnabled,
set: (val) => appStore.githubMirrorEnabled = val
})

const githubMirrorSource = computed({
get: () => appStore.githubMirrorSource,
set: (val) => appStore.githubMirrorSource = val
})

const githubMirrorCustomTemplate = computed({
get: () => appStore.githubMirrorCustomTemplate,
set: (val) => appStore.githubMirrorCustomTemplate = val
})

const githubMirrorSourceOptions = computed(() => [
{ label: t('settings.githubMirror.sources.gh-proxy-cf'), value: 'gh-proxy-cf' as const },
{ label: t('settings.githubMirror.sources.gh-proxy-fastly'), value: 'gh-proxy-fastly' as const },
{ label: t('settings.githubMirror.sources.gh-proxy-edgeone'), value: 'gh-proxy-edgeone' as const },
{ label: t('settings.githubMirror.sources.ghfast'), value: 'ghfast' as const },
{ label: t('settings.githubMirror.sources.custom'), value: 'custom' as const },
])

const githubMirrorConnectivity = ref<{ status: 'idle' | 'testing' | 'success' | 'failed'; latency: number; error: string }>({
status: 'idle',
latency: 0,
error: ''
})

const getGithubMirrorTemplate = () => {
if (githubMirrorSource.value === 'custom') {
return githubMirrorCustomTemplate.value || '{url}'
}
return GITHUB_MIRROR_TEMPLATES[githubMirrorSource.value]
}

const testGithubMirrorConnection = async () => {
if (!TAURI_OK || !githubMirrorEnabled.value) {
githubMirrorConnectivity.value = { status: 'idle', latency: 0, error: '' }
return
}

const template = getGithubMirrorTemplate()
if (!template || template === '{url}') {
githubMirrorConnectivity.value = { status: 'idle', latency: 0, error: '' }
return
}

githubMirrorConnectivity.value = { status: 'testing', latency: 0, error: '' }
try {
const latency = await testGithubMirror(template)
githubMirrorConnectivity.value = { status: 'success', latency, error: '' }
} catch (e: any) {
console.error('GitHub mirror test failed:', e)
githubMirrorConnectivity.value = {
status: 'failed',
latency: 0,
error: typeof e === 'string' ? e : t('guide.connectionFailed')
}
}
}

const selectGithubMirrorSource = async (source: GithubMirrorSourceType) => {
githubMirrorSource.value = source
await testGithubMirrorConnection()
}

watch(githubMirrorEnabled, (enabled) => {
if (enabled) {
void testGithubMirrorConnection()
} else {
githubMirrorConnectivity.value = { status: 'idle', latency: 0, error: '' }
}
})

watch(githubMirrorCustomTemplate, () => {
if (githubMirrorSource.value === 'custom') {
githubMirrorConnectivity.value = { status: 'idle', latency: 0, error: '' }
}
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

这部分关于 GitHub 镜像配置的逻辑(包括计算属性、响应式引用和方法)与 src/pages/SettingsPage.vue 中的代码几乎完全重复。大量的代码重复会增加维护成本,未来如果需要修改逻辑,不得不在两个地方同步进行,容易出错。

建议:将这部分共享的逻辑和状态提取到一个独立的 Vue Composable 函数中(例如,创建一个 src/composables/useGithubMirror.ts 文件)。这样,Resource.vueSettingsPage.vue 都可以导入并使用这个 Composable,从而实现代码复用,并确保逻辑的单一来源。

Comment thread README.md Outdated
<img src="https://img.shields.io/badge/License-GPL_v2-blue.svg" alt="License">
</a>
<img src="https://img.shields.io/badge/Version-0.1.2-green.svg" alt="Version">
<img src="https://img.shields.io/badge/Version-0.2.1-green.svg" alt="Version">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

版本号徽章显示的 0.2.1package.json 及其他配置文件中的版本 0.3.1 不一致。为了避免用户困惑,请保持文档中的版本号与项目实际版本同步。

Suggested change
<img src="https://img.shields.io/badge/Version-0.2.1-green.svg" alt="Version">
<img src="https://img.shields.io/badge/Version-0.3.1-green.svg" alt="Version">

Comment thread docs/README_EN.md Outdated
<img src="https://img.shields.io/badge/License-GPL_v2-blue.svg" alt="License">
</a>
<img src="https://img.shields.io/badge/Version-0.1.2-green.svg" alt="Version">
<img src="https://img.shields.io/badge/Version-0.2.1-green.svg" alt="Version">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The version badge shows 0.2.1, which is inconsistent with the project version 0.3.1 defined in package.json and other configuration files. Please update the version in the documentation to match the actual project version to avoid confusion.

Suggested change
<img src="https://img.shields.io/badge/Version-0.2.1-green.svg" alt="Version">
<img src="https://img.shields.io/badge/Version-0.3.1-green.svg" alt="Version">

Comment on lines +40 to +57
fn legacy_db_paths(app: &AppHandle, exe_dir: &Path) -> Vec<PathBuf> {
let mut paths = Vec::new();

if !config_dir.exists() {
fs::create_dir_all(&config_dir).map_err(|e| e.to_string())?;
// Prefer the unconfigured default (portable `exe_dir/data` first, then `Documents/endcat`).
if let Ok(default_dir) = default_data_dir(app) {
paths.push(default_dir.join("database").join("endcat.db"));
}
if !db_dir.exists() {
fs::create_dir_all(&db_dir).map_err(|e| e.to_string())?;

// Legacy portable paths (old versions).
paths.push(exe_dir.join("data").join("database").join("endcat.db"));
paths.push(exe_dir.join("userData").join("endcat.db"));

if let Ok(dir) = app_config_dir(app) {
paths.push(dir.join("endcat.db"));
}

Ok(StoragePaths {
config: config_dir.join("config.json").to_string_lossy().to_string(),
database: db_dir.join("endcat.db").to_string_lossy().to_string(),
})
paths
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

此函数 legacy_db_paths 的命名暗示它只返回旧的数据库路径,但实际上它返回的第一个路径是当前的默认路径。虽然这对于处理从默认路径到自定义路径的迁移是有效的,但函数名和内部逻辑可能会让其他开发者感到困惑。

建议添加详细的注释来解释这里的逻辑:即这个路径列表不仅包含了真正的旧版路径,也包含了“默认位置”作为一种可能的迁移来源。或者,可以考虑将“从默认路径迁移”的逻辑与“从旧版路径迁移”的逻辑分开处理,以提高代码的清晰度和可维护性。

@YueerMoe YueerMoe merged commit 6c105aa into preview Mar 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants