Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Local HTTPS + HTTP/2 support https://github.com/siyuan-note/siyuan/issues/17822

Daniel1b443779c4b1
diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts
index 155f1fe5e4..e98711875f 100644
--- a/app/src/protyle/export/index.ts
+++ b/app/src/protyle/export/index.ts
@@ -478,9 +478,15 @@ ${getIconScript(servePath)}
method: "POST",
body: JSON.stringify(data)
}).then((response) => {
+ if (!response.ok) {
+ cb({ code: -response.status, msg: response.statusText, data: null });
+ return;
+ }
return response.json();
}).then((response) => {
- cb(response);
+ if (response) {
+ cb(response);
+ }
})
}
const renderPreview = (data) => {
@@ -510,7 +516,7 @@ ${getIconScript(servePath)}
keepFold: ${localData.keepFold},
merge: ${localData.mergeSubdocs},
}, response => {
- if (response.code === 1) {
+ if (response.code !== 0) {
alert(response.msg)
return;
}
@@ -570,7 +576,7 @@ ${getIconScript(servePath)}
keepFold: keepFoldElement.checked,
merge: mergeSubdocsElement.checked,
}, response2 => {
- if (response2.code === 1) {
+ if (response2.code !== 0) {
alert(response2.msg)
return;
}
diff --git a/kernel/api/export.go b/kernel/api/export.go
index d8b95e28dc..d86c892542 100644
--- a/kernel/api/export.go
+++ b/kernel/api/export.go
@@ -654,7 +654,7 @@ func exportTempContent(c *gin.Context) {
}
urlPath := path.Join("/export/temp/", filepath.Base(p))
ret.Data = map[string]any{
- "url": "http://" + util.LocalHost + ":" + util.ServerPort + urlPath,
+ "url": util.ServerURL.Scheme + "://" + util.LocalHost + ":" + util.ServerPort + urlPath,
}
}