-
Notifications
You must be signed in to change notification settings - Fork 335
修正本机档案拖拉安装时错误设置origin问题 #1371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
修正本机档案拖拉安装时错误设置origin问题 #1371
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -409,6 +409,31 @@ export class ScriptService { | |||||
| if (updatetime) { | ||||||
| script.updatetime = updatetime; | ||||||
| } | ||||||
| // 拖拉安装等同本地创建脚本 | ||||||
| if (script.origin?.startsWith("file:///*from-local*/")) { | ||||||
| script.origin = ""; | ||||||
| script.originDomain = ""; | ||||||
| script.downloadUrl = ""; | ||||||
| script.checkUpdateUrl = ""; | ||||||
| } | ||||||
| // 处理 ScriptCat 旧版本进行安装时的 origin 错误 ( 1.0.0-beta.2 ~ 1.4.x - 自 commit d9b0eeede1a8b114f79a43fade99d825323c63f6 @ 2025.07.23 ) | ||||||
| if (oldScript?.origin?.startsWith("file:///*from-local*/") || oldScript?.origin?.startsWith("file://-/")) { | ||||||
| oldScript.origin = ""; | ||||||
| oldScript.originDomain = ""; | ||||||
| oldScript.downloadUrl = ""; | ||||||
| oldScript.checkUpdateUrl = ""; | ||||||
| } | ||||||
| // 现存的脚本:以最初的安装(即creationtime)为标准 | ||||||
| if (oldScript && script.createtime === oldScript.createtime) { | ||||||
| // 如果最初是从网络安装,之后拖拉安装本机档案,则保留origin资讯。用于更新检查。 | ||||||
| // 如果本机安装的版本号较低,则会在下次更新检查时提醒有更新。那个时候,用户可以选择更新至网络上最新版本,或忽略并保留本机版本 | ||||||
| if (oldScript && oldScript.origin && !script.origin) { | ||||||
|
||||||
| if (oldScript && oldScript.origin && !script.origin) { | |
| if (oldScript.origin && !script.origin) { |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里对 oldScript 的 origin/downloadUrl/checkUpdateUrl 做“旧版本错误”清理是在后面才执行的,但 installScript 前面已经可能把 oldScript.origin 复制到 script(例如 subscribeUrl 分支)。如果 oldScript.origin 已经是错误的 file://-/...,就会被继续保存到新 script,导致本次修复失效。建议在任何读取/复制 oldScript.origin 之前先做统一的 origin 归一化,并且同样对 script.origin 处理 file://-/ 这种旧前缀。