Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa
2026-05-06 18:34:46 +08:00
13 changed files with 113 additions and 63 deletions
+4 -4
View File
@@ -8,17 +8,17 @@
## NPM dependencies
Install pnpm: `npm install -g pnpm@10.33.0`
Install pnpm: `npm install -g pnpm@10.33.3`
<details>
<summary>For China mainland</summary>
Set the Electron mirror environment variable and install Electron:
* macOS/Linux: `ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@40.9.3 -D`
* macOS/Linux: `ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@41.5.0 -D`
* Windows:
* `SET ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/`
* `pnpm install electron@40.9.3 -D`
* `pnpm install electron@41.5.0 -D`
NPM mirror:
@@ -28,7 +28,7 @@ NPM mirror:
Enter the app folder and execute:
* `pnpm install electron@40.9.3 -D`
* `pnpm install electron@41.5.0 -D`
* `pnpm run dev`
* `pnpm run start`
+4 -4
View File
@@ -8,17 +8,17 @@
## NPM 依赖
安装 pnpm:`npm install -g pnpm@10.33.0`
安装 pnpm:`npm install -g pnpm@10.33.3`
<details>
<summary>适用于中国大陆</summary>
设置 Electron 镜像环境变量并安装 Electron:
* macOS/Linux:`ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@40.9.3 -D`
* macOS/Linux:`ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@41.5.0 -D`
* Windows:
* `SET ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/`
* `pnpm install electron@40.9.3 -D`
* `pnpm install electron@41.5.0 -D`
NPM 镜像:
@@ -28,7 +28,7 @@ NPM 镜像:
进入 app 文件夹执行:
* `pnpm install electron@40.9.3 -D`
* `pnpm install electron@41.5.0 -D`
* `pnpm run dev`
* `pnpm run start`
+20 -11
View File
@@ -90,23 +90,14 @@ jobs:
matrix:
config:
- os: ubuntu-24.04
name: ubuntu build linux.AppImage
name: ubuntu build linux
kernel_path: "../app/kernel-linux/SiYuan-Kernel"
build_args_prefix: "-s -w -X"
build_args_suffix: "Mode=prod"
electron_args: "dist-linux"
goos: "linux"
goarch: "amd64"
suffix: "linux.AppImage"
- os: ubuntu-24.04
name: ubuntu build linux.tar.gz
kernel_path: "../app/kernel-linux/SiYuan-Kernel"
build_args_prefix: "-s -w -X"
build_args_suffix: "Mode=prod"
electron_args: "dist-linux"
goos: "linux"
goarch: "amd64"
suffix: "linux.tar.gz"
suffix: "linux"
- os: macos-latest
name: macos build mac.dmg
kernel_path: "../app/kernel-darwin/SiYuan-Kernel"
@@ -222,11 +213,16 @@ jobs:
GOPATH: ${{ github.workspace }}/go
GOARCH: ${{ matrix.config.goarch }}
- name: Install RPM build tools
if: matrix.config.goos == 'linux'
run: sudo apt-get install -y rpm
- name: Building Electron App
run: pnpm run ${{ matrix.config.electron_args }}
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app
- name: Upload Release
if: matrix.config.goos != 'linux'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -235,3 +231,16 @@ jobs:
asset_name: siyuan-${{ needs.create_release.outputs.release_version }}-${{ matrix.config.suffix }}
asset_path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/build/siyuan-${{ needs.create_release.outputs.version }}-${{ matrix.config.suffix }}
asset_content_type: application/octet-stream
- name: Upload Linux Release Assets
if: matrix.config.goos == 'linux'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ needs.create_release.outputs.version }}"
BUILD_DIR="${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/build"
for ext in AppImage tar.gz deb rpm; do
asset="${BUILD_DIR}/siyuan-${VERSION}-linux.${ext}"
echo "Uploading linux.${ext}..."
gh release upload "${{ github.ref_name }}" "${asset}" --clobber
done
+3
View File
@@ -37,5 +37,8 @@ logs
package-lock.json
yarn.lock
# musl toolchain
muslbin/
# Workflows
**/__pycache__
-2
View File
@@ -404,7 +404,6 @@ const initMainWindow = () => {
fullscreenable: true,
fullscreen: windowState.fullscreen,
trafficLightPosition: {x: 8, y: 8},
transparent: "darwin" === process.platform, // 避免缩放窗口时出现边框
webPreferences: {
nodeIntegration: true,
webviewTag: true,
@@ -1147,7 +1146,6 @@ app.whenReady().then(() => {
minWidth: 493,
minHeight: 376,
fullscreenable: true,
transparent: "darwin" === process.platform, // 避免缩放窗口时出现边框
frame: "darwin" === process.platform,
icon: path.join(appDir, "stage", "icon-large.png"),
titleBarStyle: "hidden",
+2 -2
View File
@@ -4,7 +4,7 @@
"description": "Refactor your thinking",
"homepage": "https://b3log.org/siyuan",
"main": "./electron/main.js",
"packageManager": "pnpm@10.33.0",
"packageManager": "pnpm@10.33.3",
"scripts": {
"lint": "eslint . --fix --cache",
"dev": "webpack --mode development",
@@ -57,7 +57,7 @@
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^7.1.2",
"dayjs": "^1.11.5",
"electron": "40.9.3",
"electron": "41.5.0",
"electron-builder": "26.0.12",
"encoding": "^0.1.13",
"esbuild-loader": "^3.0.1",
+8 -8
View File
@@ -10,7 +10,7 @@ importers:
dependencies:
'@electron/remote':
specifier: ^2.1.3
version: 2.1.3(electron@40.9.3)
version: 2.1.3(electron@41.5.0)
devDependencies:
'@eslint/eslintrc':
specifier: ^3.3.1
@@ -40,8 +40,8 @@ importers:
specifier: ^1.11.5
version: 1.11.19
electron:
specifier: 40.9.3
version: 40.9.3
specifier: 41.5.0
version: 41.5.0
electron-builder:
specifier: 26.0.12
version: 26.0.12(electron-builder-squirrel-windows@26.0.12)
@@ -1186,8 +1186,8 @@ packages:
resolution: {integrity: sha512-bO3y10YikuUwUuDUQRM4KfwNkKhnpVO7IPdbsrejwN9/AABJzzTQ4GeHwyzNSrVO+tEH3/Np255a3sVZpZDjvg==}
engines: {node: '>=8.0.0'}
electron@40.9.3:
resolution: {integrity: sha512-rDcJOT6BBE689Ada+4jD3rVr05pMv9MZOgT0x/rIMVDF9c4ttx4RTb6lVARTyxZC7uqpirttCtcli1eg1DX5qg==}
electron@41.5.0:
resolution: {integrity: sha512-x9j9//PubUA4EjDtQbZhtk3prolandqCKgit0uCIqc1jb8FTskPbnJtxcDFB1aejczJcuERgjPixBUaMwoWyJg==}
engines: {node: '>= 12.20.55'}
hasBin: true
@@ -2835,9 +2835,9 @@ snapshots:
- bluebird
- supports-color
'@electron/remote@2.1.3(electron@40.9.3)':
'@electron/remote@2.1.3(electron@41.5.0)':
dependencies:
electron: 40.9.3
electron: 41.5.0
'@electron/universal@2.0.1':
dependencies:
@@ -3964,7 +3964,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
electron@40.9.3:
electron@41.5.0:
dependencies:
'@electron/get': 2.0.3
'@types/node': 24.12.0
-1
View File
@@ -150,7 +150,6 @@ export const openDocHistory = (options: {
.replace("${time}", target.previousElementSibling.previousElementSibling.textContent.trim());
confirmDialog("⚠️ " + window.siyuan.languages.rollback, confirmTip, () => {
fetchPost("/api/history/rollbackDocHistory", {
notebook: options.notebookId,
historyPath: dataPath
});
});
-1
View File
@@ -581,7 +581,6 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
});
} else if (dataType === "doc") {
fetchPost("/api/history/rollbackDocHistory", {
notebook: target.parentElement.getAttribute("data-notebook-id"),
historyPath: target.parentElement.getAttribute("data-path")
});
} else if (dataType === "av") {
+2 -7
View File
@@ -185,23 +185,18 @@ func rollbackDocHistory(c *gin.Context) {
return
}
var notebook, historyPath string
var historyPath string
if !util.ParseJsonArgs(arg, ret,
util.BindJsonArg("notebook", &notebook, true, true),
util.BindJsonArg("historyPath", &historyPath, true, true),
) {
return
}
err := model.RollbackDocHistory(notebook, historyPath)
err := model.RollbackDocHistory(historyPath)
if err != nil {
ret.Code = -1
ret.Msg = err.Error()
return
}
ret.Data = map[string]any{
"box": notebook,
}
}
func rollbackAssetsHistory(c *gin.Context) {
+12 -6
View File
@@ -227,7 +227,7 @@ func GetDocHistoryContent(historyPath, keyword string, highlight bool) (id, root
return
}
func RollbackDocHistory(boxID, historyPath string) (err error) {
func RollbackDocHistory(historyPath string) (err error) {
if !gulu.File.IsExist(historyPath) {
logging.LogWarnf("doc history [%s] not exist", historyPath)
return
@@ -235,6 +235,16 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
FlushTxQueue()
relPath := strings.TrimPrefix(historyPath, util.HistoryDir)
relPath = strings.TrimPrefix(relPath, string(os.PathSeparator))
relPath = filepath.ToSlash(relPath)
parts := strings.SplitN(relPath, "/", 3)
if len(parts) < 3 {
logging.LogWarnf("invalid history path [%s]", historyPath)
return
}
boxID := parts[1]
box, needResetTree, err := getRollbackBox(boxID)
if err != nil {
logging.LogErrorf("get rollback box [%s] failed: %s", boxID, err)
@@ -258,11 +268,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
var avIDs []string
tree, _ := loadTree(srcPath, util.NewLute())
if nil != tree {
historyDir := strings.TrimPrefix(historyPath, util.HistoryDir+string(os.PathSeparator))
if strings.Contains(historyDir, string(os.PathSeparator)) {
historyDir = historyDir[:strings.Index(historyDir, string(os.PathSeparator))]
}
historyDir = filepath.Join(util.HistoryDir, historyDir)
historyDir := filepath.Join(util.HistoryDir, parts[0])
avNodes := tree.Root.ChildrenByType(ast.NodeAttributeView)
for _, avNode := range avNodes {
+22 -15
View File
@@ -243,7 +243,7 @@ func resolveEmbedR(n *ast.Node, blockEmbedMode int, luteEngine *lute.Lute, resol
for _, child := range children {
var unlinks []*ast.Node
parentHeadingLevel := 0
parentHeadingLevel := 1
for prev := child; nil != prev; prev = prev.Previous {
if ast.NodeHeading == prev.Type {
parentHeadingLevel = prev.HeadingLevel
@@ -283,19 +283,25 @@ func resolveEmbedR(n *ast.Node, blockEmbedMode int, luteEngine *lute.Lute, resol
if "d" == sqlBlock.Type {
if 0 == blockEmbedMode {
// 嵌入块中出现了大于等于上方非嵌入块的标题时需要降低嵌入块中的标题级别
// Improve export of heading levels in embedded blocks https://github.com/siyuan-note/siyuan/issues/12233 https://github.com/siyuan-note/siyuan/issues/12741
// Improve export of heading levels in embedded blocks
// https://github.com/siyuan-note/siyuan/issues/12233
// https://github.com/siyuan-note/siyuan/issues/12741
// https://github.com/siyuan-note/siyuan/issues/17629
embedTopLevel := 0
embedFirstHeading := subTree.Root.ChildByType(ast.NodeHeading)
if nil != embedFirstHeading {
embedTopLevel = embedFirstHeading.HeadingLevel
}
ast.Walk(subTree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering || ast.NodeHeading != n.Type {
return ast.WalkContinue
}
embedTopLevel = n.HeadingLevel
if parentHeadingLevel >= embedTopLevel {
n.HeadingLevel += parentHeadingLevel - embedTopLevel + 1
if 6 < n.HeadingLevel {
n.HeadingLevel = 6
}
n.HeadingLevel += parentHeadingLevel - embedTopLevel + 1
if 2 > n.HeadingLevel {
n.HeadingLevel = 2
} else if 6 < n.HeadingLevel {
n.HeadingLevel = 6
}
return ast.WalkContinue
})
@@ -344,13 +350,14 @@ func resolveEmbedR(n *ast.Node, blockEmbedMode int, luteEngine *lute.Lute, resol
break
}
}
if parentHeadingLevel >= embedTopLevel {
for _, hChild := range hChildren {
if ast.NodeHeading == hChild.Type {
hChild.HeadingLevel += parentHeadingLevel - embedTopLevel + 1
if 6 < hChild.HeadingLevel {
hChild.HeadingLevel = 6
}
for _, hChild := range hChildren {
if ast.NodeHeading == hChild.Type {
hChild.HeadingLevel += parentHeadingLevel - embedTopLevel + 1
if 2 > hChild.HeadingLevel {
hChild.HeadingLevel = 2
} else if 6 < hChild.HeadingLevel {
hChild.HeadingLevel = 6
}
}
}
+36 -2
View File
@@ -66,18 +66,52 @@ export GOPROXY=https://mirrors.aliyun.com/goproxy/
export CGO_ENABLED=1
export GOOS=linux
setup_cc() {
local arch=$1
local target_prefix
if [[ "$arch" == "amd64" ]]; then
target_prefix="x86_64-linux-musl"
elif [[ "$arch" == "arm64" ]]; then
target_prefix="aarch64-linux-musl"
fi
local original_cc=~/${target_prefix}-cross/bin/${target_prefix}-gcc
if [ -x "$original_cc" ]; then
export CC="$original_cc"
elif command -v ${target_prefix}-gcc >/dev/null 2>&1; then
export CC=$(command -v ${target_prefix}-gcc)
elif [[ "$arch" == "amd64" && "$(uname -m)" == "x86_64" ]] && command -v musl-gcc >/dev/null 2>&1; then
export CC=$(command -v musl-gcc)
elif [[ "$arch" == "arm64" && "$(uname -m)" == "aarch64" ]] && command -v musl-gcc >/dev/null 2>&1; then
export CC=$(command -v musl-gcc)
else
local muslbin_dir="$PROJECT_ROOT/muslbin"
local toolchain_dir="$muslbin_dir/${target_prefix}-cross"
local downloaded_cc="$toolchain_dir/bin/${target_prefix}-gcc"
if [ ! -x "$downloaded_cc" ]; then
echo "CC not found, downloading ${target_prefix}-cross..."
mkdir -p "$muslbin_dir"
curl -L "https://musl.cc/${target_prefix}-cross.tgz" | tar -xz -C "$muslbin_dir"
fi
export CC="$downloaded_cc"
fi
echo "Using CC=$CC"
}
if [[ "$TARGET" == 'amd64' || "$TARGET" == 'all' ]]; then
echo
echo 'Building Kernel amd64'
export GOARCH=amd64
export CC=~/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc
setup_cc amd64
go build -buildmode=pie -tags fts5 -v -o "../app/kernel-linux/SiYuan-Kernel" -ldflags "-s -w -extldflags -static-pie" .
fi
if [[ "$TARGET" == 'arm64' || "$TARGET" == 'all' ]]; then
echo
echo 'Building Kernel arm64'
export GOARCH=arm64
export CC=~/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc
setup_cc arm64
go build -buildmode=pie -tags fts5 -v -o "../app/kernel-linux-arm64/SiYuan-Kernel" -ldflags "-s -w -extldflags -static-pie" .
fi