Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

fix: use dashboard icons only as final fallback

Tw931ec5a33e41d5
diff --git a/bin/options/icon.ts b/bin/options/icon.ts
index 863e14fa..eb7da50e 100644
--- a/bin/options/icon.ts
+++ b/bin/options/icon.ts
@@ -400,12 +400,11 @@ function generateIconServiceUrls(domain: string): string[] {
/**
* Generates dashboard-icons URLs for an app name.
- * Uses walkxcode/dashboard-icons, the most popular icon set for selfhosted dashboards.
- * Tries multiple slug variations to maximize match rate.
+ * Uses walkxcode/dashboard-icons as a final fallback for selfhosted apps.
+ * Keeps matching conservative to avoid overriding valid site-specific icons.
*/
function generateDashboardIconUrls(appName: string): string[] {
- const baseUrl =
- 'https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png';
+ const baseUrl = 'https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png';
const name = appName.toLowerCase().trim();
const slugs = new Set<string>();
@@ -413,8 +412,6 @@ function generateDashboardIconUrls(appName: string): string[] {
slugs.add(name);
// Replace spaces with hyphens
slugs.add(name.replace(/\s+/g, '-'));
- // Remove common suffixes
- slugs.add(name.replace(/[-\s]?(ng|ngx|web|app|server|ui)$/i, ''));
return [...slugs]
.filter((s) => s.length > 0)
@@ -438,40 +435,6 @@ async function tryGetFavicon(
? ICON_CONFIG.downloadTimeout.ci
: ICON_CONFIG.downloadTimeout.default;
- // Try dashboard-icons first (accurate match by app name, covers
- // selfhosted apps behind auth where domain-based services fail)
- if (appName) {
- const dashboardIconUrls = generateDashboardIconUrls(appName);
- for (const iconUrl of dashboardIconUrls) {
- try {
- const iconPath = await downloadIcon(iconUrl, false, downloadTimeout);
- if (!iconPath) continue;
-
- const convertedPath = await convertIconFormat(iconPath, appName);
- if (convertedPath) {
- const finalPath = await copyWindowsIconIfNeeded(
- convertedPath,
- appName,
- );
- spinner.succeed(
- chalk.green(
- `Icon found via dashboard-icons for "${appName}"!`,
- ),
- );
- return finalPath;
- }
- } catch (error: unknown) {
- if (error instanceof Error) {
- logger.debug(
- `Dashboard icon ${iconUrl} failed: ${error.message}`,
- );
- }
- continue;
- }
- }
- }
-
- // Fall back to domain-based icon services
const serviceUrls = generateIconServiceUrls(domain);
for (const serviceUrl of serviceUrls) {
@@ -502,6 +465,37 @@ async function tryGetFavicon(
}
}
+ // Final fallback for selfhosted apps behind auth where domain-based
+ // services cannot access the site favicon.
+ if (appName) {
+ const dashboardIconUrls = generateDashboardIconUrls(appName);
+ for (const iconUrl of dashboardIconUrls) {
+ try {
+ const iconPath = await downloadIcon(iconUrl, false, downloadTimeout);
+ if (!iconPath) continue;
+
+ const convertedPath = await convertIconFormat(iconPath, appName);
+ if (convertedPath) {
+ const finalPath = await copyWindowsIconIfNeeded(
+ convertedPath,
+ appName,
+ );
+ spinner.succeed(
+ chalk.green(
+ `Icon found via dashboard-icons fallback for "${appName}"!`,
+ ),
+ );
+ return finalPath;
+ }
+ } catch (error: unknown) {
+ if (error instanceof Error) {
+ logger.debug(`Dashboard icon ${iconUrl} failed: ${error.message}`);
+ }
+ continue;
+ }
+ }
+ }
+
spinner.warn(`No favicon found for ${domain}. Using default.`);
return null;
} catch (error) {