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

This commit is contained in:
Vanessa 2025-10-14 18:01:50 +08:00
commit bef1decc1a
4 changed files with 57 additions and 39 deletions

View file

@ -1,52 +1,60 @@
FROM node:21 AS NODE_BUILD FROM --platform=$BUILDPLATFORM node:21 AS node-build
WORKDIR /go/src/github.com/siyuan-note/siyuan/ ARG NPM_REGISTRY=
ADD . /go/src/github.com/siyuan-note/siyuan/
RUN apt-get update && \ WORKDIR /app
apt-get install -y jq ADD app/package.json app/pnpm* app/.npmrc .
RUN cd app && \
packageManager=$(jq -r '.packageManager' package.json) && \ RUN <<EORUN
if [ -n "$packageManager" ]; then \ #!/bin/bash -e
npm install -g $packageManager; \ corepack enable
else \ corepack install --global $(node -e 'console.log(require("./package.json").packageManager)')
echo "No packageManager field found in package.json"; \ npm config set registry ${NPM_REGISTRY}
npm install -g pnpm; \ pnpm install --silent
fi && \ EORUN
pnpm install --registry=http://registry.npmjs.org/ --silent && \
ADD app/ .
RUN <<EORUN
#!/bin/bash -e
pnpm run build pnpm run build
RUN apt-get purge -y jq mkdir /artifacts
RUN apt-get autoremove -y mv appearance stage guide changelogs /artifacts/
RUN rm -rf /var/lib/apt/lists/* EORUN
FROM golang:1.24-alpine AS GO_BUILD FROM golang:1.24-alpine AS go-build
WORKDIR /go/src/github.com/siyuan-note/siyuan/
COPY --from=NODE_BUILD /go/src/github.com/siyuan-note/siyuan/ /go/src/github.com/siyuan-note/siyuan/ ARG GOPROXY=
ENV GO111MODULE=on
ENV CGO_ENABLED=1 RUN <<EORUN
RUN apk add --no-cache gcc musl-dev && \ #!/bin/sh -e
cd kernel && go build --tags fts5 -v -ldflags "-s -w" && \ apk add --no-cache gcc musl-dev
mkdir /opt/siyuan/ && \ go env -w GO111MODULE=on
mv /go/src/github.com/siyuan-note/siyuan/app/appearance/ /opt/siyuan/ && \ go env -w GOPROXY=${GOPROXY}
mv /go/src/github.com/siyuan-note/siyuan/app/stage/ /opt/siyuan/ && \ go env -w CGO_ENABLED=1
mv /go/src/github.com/siyuan-note/siyuan/app/guide/ /opt/siyuan/ && \ EORUN
mv /go/src/github.com/siyuan-note/siyuan/app/changelogs/ /opt/siyuan/ && \
mv /go/src/github.com/siyuan-note/siyuan/kernel/kernel /opt/siyuan/ && \ WORKDIR /kernel
mv /go/src/github.com/siyuan-note/siyuan/kernel/entrypoint.sh /opt/siyuan/entrypoint.sh && \ ADD kernel/go.* .
find /opt/siyuan/ -name .git | xargs rm -rf RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg \
go mod download
ADD kernel/ .
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg \
go build --tags fts5 -v -ldflags "-s -w"
FROM alpine:latest FROM alpine:latest
LABEL maintainer="Liang Ding<845765@qq.com>" LABEL maintainer="Liang Ding<845765@qq.com>"
WORKDIR /opt/siyuan/ RUN apk add --no-cache ca-certificates tzdata su-exec
COPY --from=GO_BUILD /opt/siyuan/ /opt/siyuan/
RUN apk add --no-cache ca-certificates tzdata su-exec && \
chmod +x /opt/siyuan/entrypoint.sh
ENV TZ=Asia/Shanghai ENV TZ=Asia/Shanghai
ENV HOME=/home/siyuan ENV HOME=/home/siyuan
ENV RUN_IN_CONTAINER=true ENV RUN_IN_CONTAINER=true
EXPOSE 6806 EXPOSE 6806
WORKDIR /opt/siyuan/
COPY --from=go-build --chmod=755 /kernel/kernel /kernel/entrypoint.sh .
COPY --from=node-build /artifacts .
ENTRYPOINT ["/opt/siyuan/entrypoint.sh"] ENTRYPOINT ["/opt/siyuan/entrypoint.sh"]
CMD ["/opt/siyuan/kernel"] CMD ["/opt/siyuan/kernel"]

View file

@ -1674,8 +1674,8 @@ export class Gutter {
blockRender(protyle, nodeElement); blockRender(protyle, nodeElement);
} }
}, { }, {
id: "showHeadingWithBlocks", id: "showHeadingOnlyBlocks",
label: window.siyuan.languages.showHeadingWithBlocks, label: window.siyuan.languages.showHeadingOnlyBlocks,
iconHTML: "", iconHTML: "",
checked: nodeElement.getAttribute("custom-heading-mode") === "2", checked: nodeElement.getAttribute("custom-heading-mode") === "2",
click() { click() {

View file

@ -323,6 +323,11 @@ func ListDocTree(boxID, listPath string, sortMode int, flashcard, showHidden boo
} }
continue continue
} else {
if strings.HasSuffix(file.name, ".sy") && !ast.IsNodeIDPattern(strings.TrimSuffix(file.name, ".sy")) {
// 不以块 ID 命名的 .sy 文件不应该被加载到思源中 https://github.com/siyuan-note/siyuan/issues/16089
continue
}
} }
subFolder := filepath.Join(boxLocalPath, strings.TrimSuffix(file.path, ".sy")) subFolder := filepath.Join(boxLocalPath, strings.TrimSuffix(file.path, ".sy"))

View file

@ -201,6 +201,11 @@ func indexBox(boxID string) {
continue continue
} }
if !ast.IsNodeIDPattern(strings.TrimSuffix(file.name, ".sy")) {
// 不以块 ID 命名的 .sy 文件不应该被加载到思源中 https://github.com/siyuan-note/siyuan/issues/16089
continue
}
waitGroup.Add(1) waitGroup.Add(1)
invokeErr := p.Invoke(file) invokeErr := p.Invoke(file)
if nil != invokeErr { if nil != invokeErr {