mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-20 15:20:39 -07:00
Refactor getLatestRelease function to improve file filtering for downloads
- Added logic to skip non-downloadable files such as signature, JSON, and text files. - Updated conditions for identifying downloadable files for macOS, Windows, and Linux platforms to use `endsWith` for better accuracy.
This commit is contained in:
@@ -52,13 +52,18 @@ export async function getLatestRelease(): Promise<ReleaseInfo> {
|
|||||||
const name = asset.name.toLowerCase();
|
const name = asset.name.toLowerCase();
|
||||||
const url = asset.browser_download_url;
|
const url = asset.browser_download_url;
|
||||||
|
|
||||||
if ((name.includes('aarch64') || name.includes('arm64')) && name.includes('.app.tar.gz')) {
|
// Skip signature files and other non-downloadable files
|
||||||
|
if (name.endsWith('.sig') || name.endsWith('.json') || name.endsWith('.txt')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((name.includes('aarch64') || name.includes('arm64')) && name.endsWith('.app.tar.gz')) {
|
||||||
downloadLinks.macArm = url;
|
downloadLinks.macArm = url;
|
||||||
} else if (name.includes('x64') && name.includes('.app.tar.gz')) {
|
} else if (name.includes('x64') && name.endsWith('.app.tar.gz')) {
|
||||||
downloadLinks.macIntel = url;
|
downloadLinks.macIntel = url;
|
||||||
} else if (name.includes('.msi')) {
|
} else if (name.endsWith('.msi')) {
|
||||||
downloadLinks.windows = url;
|
downloadLinks.windows = url;
|
||||||
} else if (name.includes('.appimage') || name.includes('.deb')) {
|
} else if (name.endsWith('.appimage') || name.endsWith('.deb')) {
|
||||||
downloadLinks.linux = url;
|
downloadLinks.linux = url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user