Skip to content

Commit

Permalink
Improve assets name, and add missing portable assets
Browse files Browse the repository at this point in the history
  • Loading branch information
typeling1578 committed Dec 22, 2024
1 parent de7d0cb commit b64e44e
Showing 1 changed file with 46 additions and 25 deletions.
71 changes: 46 additions & 25 deletions lib/gh-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,35 @@ export type Release = {
}

const getReadableName = (name: string): string => {
if (name.includes('aarch64')) {
return 'Linux ARM';
}
if (name.includes('x86_64') && name.includes('linux')) {
return 'Linux x86/x64';
}
if (name.includes('stub') && name.includes('exe')) {
return 'Windows 64bit Online Installer';
}
if (name.includes('exe') && name.includes('win32')) {
return 'Windows 32-bit';
}
if (name.includes('exe') && name.includes('win64')) {
return 'Windows 64-bit';
}
if (name.includes('portable') && name.includes('zip') && name.includes('win')) {
return 'Windows Portable';
}
if (name.includes('dmg')) {
return 'macOS';
if (!name.includes('portable')) {
if (name.includes('aarch64') && name.includes('linux')) {
return 'Linux ARM64';
}
if (name.includes('x86_64') && name.includes('linux')) {
return 'Linux x86/x64';
}
if (name.includes('stub') && name.includes('exe')) {
return 'Windows 64bit Online Installer';
}
if (name.includes('exe') && name.includes('win32')) {
return 'Windows 32-bit';
}
if (name.includes('exe') && name.includes('win64')) {
return 'Windows 64-bit';
}
if (name.includes('dmg')) {
return 'macOS';
}
} else {
if (name.includes('tar.zst') && name.includes('aarch64') && name.includes('linux')) {
return 'Linux ARM64 Portable';
}
if (name.includes('tar.zst') && name.includes('x86_64') && name.includes('linux')) {
return 'Linux 64-bit Portable';
}
if (name.includes('zip') && name.includes('x86_64') && name.includes('win')) {
return 'Windows 64-bit Portable';
}
}

return name;
Expand Down Expand Up @@ -163,12 +172,24 @@ export async function getRelease(): Promise<Release | null> {
owner: 'Floorp-Projects',
repo: 'Floorp-Portable',
});
let targetAsset = portableResponse?.assets.find((asset) => asset.name.includes('windows'));
if (targetAsset) {
if (!assets[Platform.Windows]) {
assets[Platform.Windows] = [];
if (portableResponse?.assets) {
for (let i = 0; i < portableResponse.assets.length; i++) {
const asset = portableResponse.assets[i];

if (asset.name.includes("windows")) {
if (!assets[Platform.Windows]) {
assets[Platform.Windows] = [];
}
assets[Platform.Windows].push(getAssetInfo(asset));
}

if (asset.name.includes("linux")) {
if (!assets[Platform.Linux]) {
assets[Platform.Linux] = [];
}
assets[Platform.Linux].push(getAssetInfo(asset));
}
}
assets[Platform.Windows].push(getAssetInfo(targetAsset));
}

return {
Expand Down

0 comments on commit b64e44e

Please sign in to comment.