From 44c3e680422de42a221011de2611e9f247ab3add Mon Sep 17 00:00:00 2001 From: Manuel Ruwe Date: Sat, 7 Jan 2023 19:14:40 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20icon=20migrator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tools/config/migrateConfig.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tools/config/migrateConfig.ts b/src/tools/config/migrateConfig.ts index 13d811523..edf62c7e1 100644 --- a/src/tools/config/migrateConfig.ts +++ b/src/tools/config/migrateConfig.ts @@ -120,7 +120,7 @@ const migrateService = ( okStatus: oldService.status?.map((str) => parseInt(str, 10)) ?? [200], }, appearance: { - iconUrl: oldService.icon, + iconUrl: migrateIcon(oldService.icon), }, integration: { type: null, @@ -133,3 +133,14 @@ const migrateService = ( sm: getShapeForColumnCount(serviceIndex, 3), }, }); + +const migrateIcon = (iconUrl: string) => { + if (iconUrl.startsWith('https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/')) { + console.log('migrating icon:'); + const icon = iconUrl.split('/').at(-1); + console.log(`${iconUrl} -> ${icon}`); + return `https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/${icon}`; + } + + return iconUrl; +};