[v1.3] updateResource 相关代码调整#1193
Open
cyfung1031 wants to merge 28 commits intoscriptscat:release/v1.3from
Open
[v1.3] updateResource 相关代码调整#1193cyfung1031 wants to merge 28 commits intoscriptscat:release/v1.3from
cyfung1031 wants to merge 28 commits intoscriptscat:release/v1.3from
Conversation
Collaborator
Author
|
UI 部份另行处理 |
cyfung1031
commented
Feb 4, 2026
Comment on lines
409
to
431
| await this.scriptCodeDAO.save({ | ||
| uuid: script.uuid, | ||
| code: param.code, | ||
| }); | ||
| logger.info("install success"); | ||
|
|
||
| // Cache更新 & 下载资源 | ||
| await Promise.all([ | ||
| compiledResourceUpdatePromise, | ||
| this.resourceService.updateResourceByType(script, "require"), | ||
| this.resourceService.updateResourceByType(script, "require-css"), | ||
| this.resourceService.updateResourceByType(script, "resource"), | ||
| this.resourceService.updateResourceByTypes(script, ["require", "require-css", "resource"]), | ||
| ]); | ||
| // 如果资源不完整,还是要接受安装吗??? | ||
|
|
||
| // 广播一下 | ||
| // Runtime 會負責更新 CompiledResource | ||
| this.publishInstallScript(script, { update, upsertBy }); | ||
|
|
||
| return { update }; | ||
| }) | ||
| .catch((e: any) => { | ||
| logger.error("install error", Logger.E(e)); | ||
| throw e; | ||
| }); |
Collaborator
Author
There was a problem hiding this comment.
@CodFrm scriptDAO 先 save 了显示成功。 如果资源下载失败,忽略掉是故意的吗?
是的话我就不改这做法
否则就改成下载不了不安装不更新
Collaborator
Author
There was a problem hiding this comment.
那我这个 PR 先不处理这个,先维持
cyfung1031
commented
Feb 4, 2026
Comment on lines
192
to
195
| const updateTime = oldResources?.updatetime; | ||
| // 资源最后更新是24小时内则不更新 | ||
| // 这里是假设 resources 都是 static. 使用者应该加 ?d=xxxx 之类的方式提示SC要更新资源 | ||
| if (updateTime && updateTime > Date.now() - 86400_000) return; |
Collaborator
Author
There was a problem hiding this comment.
@CodFrm 原代码有这个 updateTime 检查操作。但脚本更新可以是每6小时做一次。如果脚本更新了但资源不更新,好像有点奇怪
Member
There was a problem hiding this comment.
之前考虑过不做这个检查,感觉也可以,资源加载下来就不再失效,除非修改url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
概述 Descriptions
我都不知道要怎么说明了
反正就是有问题的部份改了
有些觉得奇怪的,我没有改,只加了 comment
变更内容 Changes
截图 Screenshots