fix(ui): unknown app ids fall back to the A mark, not a 404 png guess
resolveAppIcon's final arm guessed /assets/img/app-icons/<id>.png — strfry 404'd live. DEFAULT_APP_ICON already existed; the chain now ends on it. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { ref } from 'vue'
|
||||
import { PackageState, type PackageDataEntry } from '@/types/api'
|
||||
import { canLaunch, filterEntriesForTab, hasFrontendUi, isServiceContainer, isServicePackage, isWebsitePackage, launchBlockedReason, resolveAppIcon, useCategoriesWithApps } from '../appsConfig'
|
||||
import { canLaunch, filterEntriesForTab, hasFrontendUi, isServiceContainer, isServicePackage, isWebsitePackage, launchBlockedReason, resolveAppIcon, useCategoriesWithApps, DEFAULT_APP_ICON } from '../appsConfig'
|
||||
|
||||
function makePkg(id: string, title: string, category: string): PackageDataEntry {
|
||||
return {
|
||||
@@ -82,6 +82,13 @@ describe('appsConfig service filtering', () => {
|
||||
expect(resolveAppIcon('gitea', pkg)).toBe('/assets/img/app-icons/gitea.svg')
|
||||
})
|
||||
|
||||
it('an unmapped id gets the A mark, not a guessed png that 404s', () => {
|
||||
// strfry 404'd live on 2026-08-07: no curated entry, no fallback entry,
|
||||
// no service prefix — the old `${id}.png` guess produced a broken tile.
|
||||
const pkg = makePkg('strfry', 'strfry', 'nostr')
|
||||
expect(resolveAppIcon('strfry', pkg)).toBe(DEFAULT_APP_ICON)
|
||||
})
|
||||
|
||||
it('classifies an unknown app by whether its manifest declares a UI (#45)', () => {
|
||||
// Headless: a LAN address but no declared UI → Website.
|
||||
const headless = makePkg('some-backend', 'Some Backend', 'other')
|
||||
|
||||
@@ -249,7 +249,9 @@ export function resolveAppIcon(id: string, pkg: PackageDataEntry, curatedIcon?:
|
||||
curatedIcon ||
|
||||
APP_ICON_FALLBACKS[id] ||
|
||||
serviceParentIcon(id) ||
|
||||
`/assets/img/app-icons/${id}.png`
|
||||
// Never guess `${id}.png` — an unmapped id 404s (strfry did, 2026-08-07).
|
||||
// The A mark is the honest unknown-app tile.
|
||||
DEFAULT_APP_ICON
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user