-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(website): 临时修复些小问题和不太顺眼的地方 #658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,9 @@ | |
| <div class="card-header"> | ||
| <span class="magic-icon">✨</span> | ||
| <div class="header-text"> | ||
| 您的设备应该是 <strong>{{ platformName }}</strong> | ||
| 您的设备应该是 | ||
| <span class="spacer"></span> | ||
| <strong>{{ platformName }}</strong> | ||
| <span class="spacer"></span> | ||
| <span v-if="archName" class="tag tag-theme"> | ||
| {{ archName }} | ||
|
|
@@ -242,7 +244,7 @@ const getExtensionName = (name: string) => { | |
| const getArchDisplay = (name: string, platformId: string) => { | ||
| const n = name.toLowerCase(); | ||
| if (n.includes("arm64") || n.includes("aarch64")) return "ARM64"; | ||
| if (n.includes("x64") || n.includes("amd64")) return "x64"; | ||
| if (n.includes("x64") || n.includes("x86_64") || n.includes("amd64")) return "x64"; | ||
| if (n.includes("ia32") || n.includes("x86")) return "32位 (x86)"; | ||
|
|
||
| if (platformId === "windows") return "x86 / x64 兼容"; | ||
|
|
@@ -260,8 +262,8 @@ const sortAssets = (assets: GitHubAsset[]) => { | |
| return assets.sort((a, b) => { | ||
| const nA = a.name.toLowerCase(); | ||
| const nB = b.name.toLowerCase(); | ||
| const isX64A = nA.includes("x64") || nA.includes("amd64"); | ||
| const isX64B = nB.includes("x64") || nB.includes("amd64"); | ||
| const isX64A = nA.includes("x64") || nA.includes("x86_64") || nA.includes("amd64"); | ||
| const isX64B = nB.includes("x64") || nB.includes("x86_64") || nB.includes("amd64"); | ||
| if (isX64A && !isX64B) return -1; | ||
| if (!isX64A && isX64B) return 1; | ||
| return 0; | ||
|
|
@@ -271,7 +273,7 @@ const sortAssets = (assets: GitHubAsset[]) => { | |
| const isArchCompatible = (name: string, targetArch: string) => { | ||
| const n = name.toLowerCase(); | ||
| const isArmAsset = n.includes("arm64") || n.includes("aarch64"); | ||
| const is32BitAsset = n.includes("ia32") || n.includes("x86"); | ||
| const is32BitAsset = n.includes("ia32") || (n.includes("x86") && !n.includes("x86_64")); | ||
|
|
||
| if (targetArch === "arm64") { | ||
| return isArmAsset; | ||
|
|
@@ -330,7 +332,7 @@ const recommendedAssets = computed(() => { | |
| if (dmg) result.push(dmg); | ||
| } else if (p === "linux") { | ||
| const appImage = assets.find( | ||
| (f) => f.name.toLowerCase().endsWith(".appimage") && isArchCompatible(f.name, arch), | ||
| (f) => f.name.endsWith(".AppImage") && isArchCompatible(f.name, arch), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ); | ||
| const deb = assets.find((f) => f.name.endsWith(".deb") && isArchCompatible(f.name, arch)); | ||
|
|
||
|
|
@@ -404,23 +406,23 @@ const classifiedAssets = computed<PlatformGroup[]>(() => { | |
| icon: "🐧", | ||
| groups: [ | ||
| { | ||
| title: "通用运行包", | ||
| desc: "AppImage", | ||
| assets: sortAssets(rawAssets.filter((f) => f.name.endsWith(".appimage"))), | ||
| title: "AppImage", | ||
| desc: "通用运行包", | ||
| assets: sortAssets(rawAssets.filter((f) => f.name.endsWith(".AppImage"))), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| }, | ||
| { | ||
| title: "Debian / Ubuntu / Linux Mint...", | ||
| desc: "DEB 安装包", | ||
| title: "Debian 包", | ||
| desc: "Debian / Ubuntu / Linux Mint...", | ||
| assets: sortAssets(rawAssets.filter((f) => f.name.endsWith(".deb"))), | ||
| }, | ||
| { | ||
| title: "RedHat / Fedora / AlmaLinux...", | ||
| desc: "RPM 安装包", | ||
| title: "RPM 包", | ||
| desc: "Red Hat / Fedora / AlmaLinux...", | ||
| assets: sortAssets(rawAssets.filter((f) => f.name.endsWith(".rpm"))), | ||
| }, | ||
| { | ||
| title: "Arch Linux / Manjaro...", | ||
| desc: "Pacman 安装包", | ||
| title: "Pacman 包", | ||
| desc: "Arch Linux / Manjaro...", | ||
| assets: sortAssets(rawAssets.filter((f) => f.name.endsWith(".pacman"))), | ||
| }, | ||
| { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个架构检查逻辑修复了
x86_64被错误识别为32位的问题,做得很好。不过,我注意到类似的架构检测逻辑(如 ARM64、x64)散布在getArchDisplay、sortAssets和isArchCompatible等多个函数中。为了提高代码的可维护性并避免重复,可以考虑将这些检测逻辑提取为独立的辅助函数,例如
isArmAsset,isX64Asset,is32BitAsset。这样可以让代码更清晰,也更容易在未来进行修改。