diff --git a/changelog.md b/changelog.md index db4b568..b515a04 100644 --- a/changelog.md +++ b/changelog.md @@ -5,3 +5,4 @@ ### New Features - YAML覆写功能支持对数组进行覆盖/前置/追加操作 +- 缓存代理组图标 diff --git a/src/renderer/src/pages/proxies.tsx b/src/renderer/src/pages/proxies.tsx index 72b1001..9836065 100644 --- a/src/renderer/src/pages/proxies.tsx +++ b/src/renderer/src/pages/proxies.tsx @@ -179,8 +179,23 @@ const Proxies: React.FC = () => { { + const img = new Image() + img.crossOrigin = 'anonymous' + img.onload = (): void => { + const canvas = document.createElement('canvas') + const ctx = canvas.getContext('2d') + canvas.width = img.width + canvas.height = img.height + ctx?.drawImage(img, 0, 0) + const data = canvas.toDataURL('image/png') + console.log('set') + localStorage.setItem(groups[index].icon, data) + } + img.src = groups[index].icon + }} radius="sm" - src={groups[index].icon} + src={localStorage.getItem(groups[index].icon) || groups[index].icon} /> ) : null}