feat: implement app icon management and caching mechanism #11719
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it?
#11697
已完成测试,对远端同步改动较大,合并需要慎重考虑对其他情景整体流程无误再合并!
Summary of your change
更改图标存储位置,数据库不再存图标b64,只存图标文件名+etag。
支持 etag 更新
做了向下兼容,base64图标读取仍然可用
流程图 By AI
flowchart TD Start([开始: SyncAppListFromRemote]) --> CheckCustomApp{是否使用<br/>自定义应用?} CheckCustomApp -->|是| ReturnNil1[返回 nil] CheckCustomApp -->|否| CreateTask[创建同步任务] CreateTask --> CheckTaskErr{创建任务<br/>是否成功?} CheckTaskErr -->|失败| ReturnError[返回错误] CheckTaskErr -->|成功| InitSharedCtx[初始化共享上下文] InitSharedCtx --> AddSubTask1[添加子任务1:<br/>基础同步] AddSubTask1 --> AddSubTask2[添加子任务2:<br/>元数据同步] AddSubTask2 --> AsyncExecute[异步执行任务] AsyncExecute --> ReturnNil2[主函数返回 nil] AsyncExecute -.-> SubTask1Start([子任务1: 基础同步]) SubTask1Start --> GetUpdate[检查应用商店更新] GetUpdate --> CheckCanUpdate{可以更新?} CheckCanUpdate -->|否-正在同步| LogSyncing[记录日志并返回] CheckCanUpdate -->|否-已是最新| SetSkipFlag[设置跳过标志] SetSkipFlag --> Task1End[子任务1完成] CheckCanUpdate -->|是| GetAppListData[获取应用列表数据] GetAppListData --> UpdateStatus1[更新状态为同步中] UpdateStatus1 --> InitContext[初始化同步上下文] InitContext --> SyncTags[同步应用标签] SyncTags --> LoadOldApps[加载本地应用] LoadOldApps --> CallGetApps[构建应用映射] CallGetApps --> ClassifyPersist1[分类并持久化应用] ClassifyPersist1 --> UpdateStatusSuccess[更新状态为成功] UpdateStatusSuccess --> AssignSharedCtx[保存共享上下文] AssignSharedCtx --> Task1End Task1End -.-> SubTask2Start([子任务2: 元数据同步]) SubTask2Start --> CheckSharedCtx{共享上下文<br/>是否有效?} CheckSharedCtx -->|否| ReturnNil3[返回 nil] CheckSharedCtx -->|是| CheckSkipFlag{是否跳过<br/>元数据同步?} CheckSkipFlag -->|是| ReturnNil4[返回 nil] CheckSkipFlag -->|否| SyncIconsDetails[同步图标和详情] SyncIconsDetails --> LoopApps[遍历所有应用] LoopApps --> DownloadIcon[下载图标<br/>支持ETag缓存] DownloadIcon --> UpdateDetails[更新应用详情<br/>README/版本等] UpdateDetails --> DownloadCompose[下载docker-compose] DownloadCompose --> ClassifyPersist2[分类并持久化详情] ClassifyPersist2 --> Task2End[子任务2完成] LogSyncing --> Task1End Task2End --> End([结束]) ReturnNil1 --> End ReturnNil2 --> End ReturnNil3 --> End ReturnNil4 --> End ReturnError --> End style Start fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#fff style End fill:#c62828,stroke:#b71c1c,stroke-width:2px,color:#fff style SubTask1Start fill:#1565c0,stroke:#0d47a1,stroke-width:2px,color:#fff style SubTask2Start fill:#ef6c00,stroke:#e65100,stroke-width:2px,color:#fff style AsyncExecute fill:#6a1b9a,stroke:#4a148c,stroke-width:2px,color:#fff style CheckCustomApp fill:#f57f17,stroke:#f57f17,stroke-width:2px,color:#fff style CheckCanUpdate fill:#f57f17,stroke:#f57f17,stroke-width:2px,color:#fff style CheckSharedCtx fill:#f57f17,stroke:#f57f17,stroke-width:2px,color:#fff style CheckSkipFlag fill:#f57f17,stroke:#f57f17,stroke-width:2px,color:#fffPlease indicate you've done the following: