Skip to content

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

:white_check_mark: Resolve release test failures

Daniela58f63f4d75f
diff --git a/app/tests/avAttributeCarrier.test.js b/app/tests/avAttributeCarrier.test.js
index d2f239b239..58509c0fb9 100644
--- a/app/tests/avAttributeCarrier.test.js
+++ b/app/tests/avAttributeCarrier.test.js
@@ -223,7 +223,7 @@ const runElectron = async () => {
const sources = [extract("cellValue"), extract("dragFillValue", ["rebindAVCellValue"]),
extract("blockAttr", ["renderAVAttribute", "renderAttributeViewBacklinks"]),
extract("openMenuPanel", ["openMenuPanel"]), extract("cell", ["updateCellsValue"]),
- extract("primaryFocus", ["focusNewDatabasePrimary"]),
+ extract("primaryFocus", ["focusDatabasePrimary"]),
extract("../../../editor/databaseRow", ["newDatabaseRowModel"]),
extract("openDatabaseRow", ["closeMobileDatabaseRow", "openMobileDatabaseRow"])].map(source =>
ts.transpileModule(source, {compilerOptions: {module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020}}).outputText);
diff --git a/app/tests/compositionCaret.test.js b/app/tests/compositionCaret.test.js
index 7187b93f8c..187df0e202 100644
--- a/app/tests/compositionCaret.test.js
+++ b/app/tests/compositionCaret.test.js
@@ -94,7 +94,8 @@ const runCases = async () => {
setPlatform(profile);
document.body.innerHTML = `<div class="protyle-wysiwyg" contenteditable="true">${html}</div>`;
const element = document.body.firstElementChild;
- const protyle = {wysiwyg: {element, lastHTMLs: {}, escapeInline() {}}, transactions: [], inputs: 0};
+ const protyle = {wysiwyg: {element, lastHTMLs: {}, escapeInline() {},
+ runInput(callback) { return Promise.resolve(callback()); }}, transactions: [], inputs: 0};
const flush = bind(protyle);
const setRange = (node, start, end = start) => {
const range = document.createRange();
diff --git a/kernel/model/session.go b/kernel/model/session.go
index 4f1413e293..dc7372d289 100644
--- a/kernel/model/session.go
+++ b/kernel/model/session.go
@@ -269,7 +269,7 @@ func CheckAuth(c *gin.Context) {
if localhost {
// 校验浏览器来源,防止恶意网页借助受害者浏览器作为环回客户端绕过锁屏鉴权
// https://github.com/siyuan-note/siyuan/security/advisories/GHSA-9gpj-3rm3-x42m
- if util.IsCrossSiteFetchSite(c.GetHeader("Sec-Fetch-Site")) {
+ if util.IsCrossSiteFetchSite(c.GetHeader("Sec-Fetch-Site")) && !util.IsSessionOriginAllowedRequest(c.Request) {
logging.LogWarnf("invalid local host pass-through request [ip=%s, origin=%s, host=%s, uri=%s]",
c.ClientIP(), c.GetHeader("Origin"), c.Request.Host, c.Request.RequestURI)
c.JSON(http.StatusUnauthorized, map[string]any{"code": -1, "msg": "Auth failed: invalid request origin"})
diff --git a/kernel/model/session_test.go b/kernel/model/session_test.go
index 09b730ac4e..135aa3451d 100644
--- a/kernel/model/session_test.go
+++ b/kernel/model/session_test.go
@@ -428,6 +428,7 @@ func TestCheckAuthLoopbackProxy(t *testing.T) {
want int
}{
{name: "page redirects to login", method: http.MethodGet, path: "/stage/build/desktop/", site: "none", want: http.StatusFound},
+ {name: "same-site app navigation still requires login", method: http.MethodGet, path: "/stage/build/desktop/", site: "same-site", mode: "navigate", dest: "document", want: http.StatusFound},
{name: "login page accessible", method: http.MethodGet, path: "/check-auth", site: "same-origin", want: http.StatusNoContent},
{name: "assets require login", method: http.MethodGet, path: "/assets/icon.png", want: http.StatusFound},
{name: "local API requires credentials", method: http.MethodPost, path: "/api/system/exit", want: http.StatusUnauthorized},
diff --git a/kernel/model/tabs_guide_test.go b/kernel/model/tabs_guide_test.go
index 1f605a4353..7bd130447e 100644
--- a/kernel/model/tabs_guide_test.go
+++ b/kernel/model/tabs_guide_test.go
@@ -3,6 +3,7 @@ package model
import (
"os"
"path/filepath"
+ "strconv"
"strings"
"testing"
@@ -31,8 +32,9 @@ func TestTabsUserGuideExamplesRoundTrip(t *testing.T) {
if err != nil {
return err
}
- if tree.Root.Spec != "3" {
- t.Fatalf("%s: tabs require spec 3", path)
+ spec, err := strconv.Atoi(tree.Root.Spec)
+ if err != nil || spec < 3 {
+ t.Fatalf("%s: tabs require spec 3 or newer, got %q", path, tree.Root.Spec)
}
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering || n.Type != ast.NodeTabs {