diff --git a/apps/siyuan/README.md b/apps/siyuan/README.md new file mode 100644 index 00000000..358cb2ac --- /dev/null +++ b/apps/siyuan/README.md @@ -0,0 +1,53 @@ +# 使用说明 + +### 安装方法 + +请根据安装时的表单填写以下内容: +| 表单填写项 | 内容解释 | +| --------------------------------------------- | ------------------------------------------------------------ | +| 工作空间文件夹路径(WORKSPACE_PATH) | 主机上的工作空间文件夹路径 | +| 容器中的文件夹路径(WORKSPACE_DIR_CONTAINER) | 工作空间文件夹在容器中的路径,与指定的参数 --workspace 相同 | +| 访问授权码(ACCESS_AUTH_CODE) | 访问授权码,请务必填写,且需要足够复杂。否则任何人都可以读写您的数据 | +| 端口(SIYUAN_PORT) | 指定思源端口号,默认为:6806 | + +勾选【端口外部访问】选项。安装完毕后,您可以通过【IP/域名:端口】这种形式服务。例:http://127.0.0.1:6806。 + + +### 安装好后,我的笔记数据在哪? + +在您设置的工作空间文件夹(WORKSPACE_PATH)下。为了防止您更新/删除思源笔记导致的数据丢失问题,默认笔记数据将放置在主机的文件夹 /opt/siyuan/ 下,以确保在卸载时不会将其删除。 + + +### 我该如何修改访问授权码? + +请您在【应用商店】内【已安装】选项卡中找到思源笔记,然后点击参数,选择编辑且修改访问授权码,保存即可。 + + +### 网页版和客户端有什么区别? + +网页版和客户端相比,局限性在于: +1. 不支持桌面和移动应用程序连接,仅支持在浏览器上使用 +2. 不支持导出为 PDF、HTML 和 Word 格式 +3. 不支持导入 Markdown 文件 + +以上内容来自[Docker Siyuan](https://hub.docker.com/r/b3log/siyuan),如果你需要以上部分或全部内容,请使用客户端。 + + +### 如何隐藏端口 + +首先先关闭思源笔记的【端口外部访问】功能,然后在左侧【网站】选项卡内找到【创建网站】,选择【反向代理】功能,最后填写上主域名和代理地址(HTTP)保存即可。 + +其中主域名是您可以正常访问的域名,如:siyuan.mydomain.com。 +代理地址中的端口是您在前面配置的思源端口号,如:127.0.0.1:6806。 + +如果您使用 NGINX 进行反向代理,您可能还需要手动配置下 WebSocket 反代 /ws 域名。你可以参考以下配置: + +```conf +location /ws { + proxy_pass http://127.0.0.1:6806; + proxy_read_timeout 60s; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'Upgrade'; +} +``` diff --git a/apps/siyuan/data.yml b/apps/siyuan/data.yml new file mode 100644 index 00000000..ecf51e8c --- /dev/null +++ b/apps/siyuan/data.yml @@ -0,0 +1,18 @@ +name: 思源笔记 +tags: + - 实用工具 +title: 隐私优先的个人知识管理系统 +description: 隐私优先的个人知识管理系统 +additionalProperties: + key: siyuan + name: 思源笔记 + tags: + - WebSite + shortDescZh: 隐私优先的个人知识管理系统 + shortDescEn: Privacy-Prioritized Personal Knowledge Management System + type: website + crossVersionUpdate: true + limit: 1 + website: https://b3log.org/siyuan/ + github: https://github.com/siyuan-note/siyuan + document: https://b3log.org/siyuan/community.html diff --git a/apps/siyuan/latest/data.yml b/apps/siyuan/latest/data.yml new file mode 100644 index 00000000..38c885ea --- /dev/null +++ b/apps/siyuan/latest/data.yml @@ -0,0 +1,30 @@ +additionalProperties: + formFields: + - default: "/opt/siyuan/" + envKey: WORKSPACE_PATH + labelEn: Workspace Folder PATH + labelZh: 工作空间文件夹路径 + required: true + type: text + - default: "/siyuan/workspace/" + envKey: WORKSPACE_DIR_CONTAINER + labelEn: Workspace Folder PATH + labelZh: 容器中的文件夹路径 + required: true + type: text + - default: "" + envKey: ACCESS_AUTH_CODE + labelEn: Access Authorization Code + labelZh: 访问授权码 + required: true + edit: true + rule: paramComplexity + type: password + - default: 6806 + edit: true + envKey: SIYUAN_PORT + labelEn: Port + labelZh: 端口 + required: true + rule: paramPort + type: number diff --git a/apps/siyuan/latest/docker-compose.yml b/apps/siyuan/latest/docker-compose.yml new file mode 100644 index 00000000..fcb8dec9 --- /dev/null +++ b/apps/siyuan/latest/docker-compose.yml @@ -0,0 +1,23 @@ +version: '3.9' +services: + siyuan: + image: b3log/siyuan:latest + container_name: ${CONTAINER_NAME} + restart: unless-stopped + networks: + - 1panel-network + command: [ + '--workspace=${WORKSPACE_DIR_CONTAINER}', + '--accessAuthCode=${ACCESS_AUTH_CODE}' + ] + user: '1000:1000' + environment: + - TZ=${TimeZone} + volumes: + - ${WORKSPACE_PATH}:${WORKSPACE_DIR_CONTAINER} + ports: + - "${SIYUAN_PORT}:6806" + +networks: + 1panel-network: + external: true diff --git a/apps/siyuan/latest/scripts/init.sh b/apps/siyuan/latest/scripts/init.sh new file mode 100644 index 00000000..4d280218 --- /dev/null +++ b/apps/siyuan/latest/scripts/init.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 检查并加载环境变量 +if [ -f .env ]; then + source .env +else + echo ".env file not found. Please create one with the WORKSPACE_PATH variable defined." + exit 1 +fi + +# 判断 WORKSPACE_PATH 变量是否被设置 +if [ -z "${WORKSPACE_PATH}" ]; then + echo "WORKSPACE_PATH is not set." + exit 1 +fi + +# 检查 WORKSPACE_PATH 指定的文件夹是否存在,不存在则创建 +if [ ! -d "${WORKSPACE_PATH}" ]; then + echo "Creating workspace directory at ${WORKSPACE_PATH}" + mkdir -p "${WORKSPACE_PATH}" +fi + +# 修改 WORKSPACE_PATH 文件夹及其内容的所有者为用户ID 1000 和组ID 1000 +echo "Setting ownership of ${WORKSPACE_PATH} to user 1000 and group 1000" +chown -R 1000:1000 "${WORKSPACE_PATH}" 2>/dev/null + +# 检查是否成功设置了所有权 +if [ $? -eq 0 ]; then + echo "Ownership set successfully." +else + echo "Failed to set ownership." + exit 1 +fi + +exit 0 diff --git a/apps/siyuan/logo.png b/apps/siyuan/logo.png new file mode 100644 index 00000000..ccd66c0e Binary files /dev/null and b/apps/siyuan/logo.png differ