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

This commit is contained in:
Vanessa 2023-02-11 12:33:29 +08:00
commit 515d11019d
33 changed files with 515 additions and 235 deletions

View file

@ -14,10 +14,10 @@ Install pnpm: `npm install -g pnpm`
Set the Electron mirror environment variable and install Electron:
* macOS/Linux: `ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/ pnpm install electron@23.0.0 -D`
* macOS/Linux: `ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/ pnpm install electron@21.4.1 -D`
* Windows:
* `SET ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/`
* `pnpm install electron@23.0.0 -D`
* `pnpm install electron@21.4.1 -D`
NPM mirror:
@ -28,7 +28,7 @@ NPM mirror:
On the desktop, go to the app folder to run:
* `pnpm install electron@23.0.0 -D`
* `pnpm install electron@21.4.1 -D`
* `pnpm run dev`
* `pnpm run start`

View file

@ -16,11 +16,11 @@
* macOS/Linux:
```
ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/ pnpm install electron@23.0.0 -D
ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/ pnpm install electron@21.4.1 -D
```
* Windows:
* `SET ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/`
* `pnpm install electron@23.0.0 -D`
* `pnpm install electron@21.4.1 -D`
NPM 镜像:
@ -30,7 +30,7 @@ NPM 镜像:
桌面端进入 app 文件夹运行:
* `pnpm install electron@23.0.0 -D`
* `pnpm install electron@21.4.1 -D`
* `pnpm run dev`
* `pnpm run start`

View file

@ -24,6 +24,17 @@ body:
我能够在默认主题下重现该问题
I was able to reproduce the issue with the default theme
required: true
- type: checkboxes
attributes:
label: 该问题是否可能是由于扩展功能导致? Could the issue be due to extensions?
description: |
请注意主题、代码片段、挂件或者其他扩展功能可能会导致问题。
Be aware that themes, code snippets, widgets, or other extensions may cause problems.
options:
- label: |
我已经排除了扩展导致问题的可能性
I've ruled out the possibility that the extension is causing the problem.
required: true
- type: textarea
attributes:
label: 描述问题 Describe the problem

View file

@ -1006,7 +1006,7 @@
"105": "Corrupted data repo have been automatically reset",
"106": "Maximum length is limited to 512 characters",
"107": "Moving document [%s]",
"108": "TODO",
"108": "Data sync found conflicts, you can view the generated conflict content in [Data History]",
"109": "Remove reminder completed [%s]",
"110": "Renaming...",
"111": "Saving document [%s]...",

View file

@ -1006,7 +1006,7 @@
"105": "El repositorio de datos corruptos se ha restablecido automáticamente",
"106": "La longitud máxima está limitada a 512 caracteres",
"107": "Moviendo documento [%s]",
"108": "TODO",
"108": "La sincronizaci\u00f3n de datos encontr\u00f3 en conflictos, puede ver el contenido del conflicto generado en [Historial de datos]",
"109": "Eliminación de recordatorios completada [%s]",
"110": "Renombrar...",
"111": "Guardando documento [%s]...",

View file

@ -1006,7 +1006,7 @@
"105": "Le référentiel de données corrompu a été automatiquement réinitialisé",
"106": "La longueur maximale est limitée à 512 caractères",
"107": "Déplacement du document [%s]",
"108": "TODO",
"108": "La synchronisation des données a trouvé des conflits, vous pouvez afficher le contenu du conflit généré dans [Historique des données]",
"109": "Supprimer le rappel terminé [%s]",
"110": "Renommer...",
"111": "Enregistrement du document [%s]...",

View file

@ -1006,7 +1006,7 @@
"105": "已經自動重置損壞的數據倉庫",
"106": "最大長度限制為 512 字元",
"107": "正在移動文檔 [%s]",
"108": "TODO",
"108": "數據同步發現衝突,可在 [數據歷史] 中查看生成的衝突內容",
"109": "移除提醒完畢 [%s]",
"110": "正在重命名...",
"111": "正在保存文檔 [%s]...",

View file

@ -1006,7 +1006,7 @@
"105": "已经自动重置损坏的数据仓库",
"106": "最大长度限制为 512 字符",
"107": "正在移动文档 [%s]",
"108": "TODO",
"108": "数据同步发现冲突,可在 [数据历史] 中查看生成的冲突内容",
"109": "移除提醒完毕 [%s]",
"110": "正在重命名...",
"111": "正在保存文档 [%s]...",

View file

@ -4,7 +4,8 @@
"icon": "1f4d4",
"closed": false,
"refCreateSavePath": "",
"createDocNameTemplate": "",
"docCreateSavePath": "",
"dailyNoteSavePath": "/daily note/{{now | date \"2006/01\"}}/{{now | date \"2006-01-02\"}}",
"dailyNoteTemplatePath": ""
"dailyNoteTemplatePath": "",
"sortMode": 15
}

View file

@ -6,7 +6,7 @@
"id": "20200924100744-br924ar",
"title": "Assets",
"type": "doc",
"updated": "20230203183434"
"updated": "20230211103249"
},
"Children": [
{
@ -724,7 +724,7 @@
"ListData": {},
"Properties": {
"id": "20230202231731-bdh7lab",
"updated": "20230203183434"
"updated": "20230211103249"
},
"Children": [
{
@ -736,7 +736,7 @@
},
"Properties": {
"id": "20230202231732-n7z8jth",
"updated": "20230203183347"
"updated": "20230211103249"
},
"Children": [
{
@ -744,7 +744,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230202231732-f3jkj7p",
"updated": "20230203183347"
"updated": "20230211103249"
},
"Children": [
{
@ -791,7 +791,7 @@
},
"Properties": {
"id": "20230202231800-z8hswmk",
"updated": "20230203183434"
"updated": "20230211103154"
},
"Children": [
{
@ -799,7 +799,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230202231800-c3x45ky",
"updated": "20230203183434"
"updated": "20230211103154"
},
"Children": [
{
@ -881,7 +881,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SIYUAN_TESSERACT_LANGS=chi_sim+eng "
"TextMarkTextContent": "SIYUAN_TESSERACT_LANGS=chi_sim+eng"
},
{
"Type": "NodeText",
@ -890,6 +890,79 @@
]
}
]
},
{
"ID": "20230211102830-9azqf9m",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230211102830-9azqf9m"
},
"Children": [
{
"ID": "20230211102830-sbchex4",
"Type": "NodeParagraph",
"Properties": {
"id": "20230211102830-sbchex4",
"updated": "20230211102832"
},
"Children": [
{
"Type": "NodeText",
"Data": "Only images in png and jpg formats are supported"
}
]
}
]
},
{
"ID": "20230211102834-fx3o5su",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230211102834-fx3o5su",
"updated": "20230211102928"
},
"Children": [
{
"ID": "20230211102834-3jzjdrv",
"Type": "NodeParagraph",
"Properties": {
"id": "20230211102834-3jzjdrv",
"updated": "20230211102928"
},
"Children": [
{
"Type": "NodeText",
"Data": "By default, only images below 2MB are processed. If you need to adjust, you can set the environment variable "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SIYUAN_TESSERACT_MAX_SIZE"
},
{
"Type": "NodeText",
"Data": ", the unit of value is bytes, for example: "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SIYUAN_TESSERACT_MAX_SIZE=4000000"
},
{
"Type": "NodeText",
"Data": " adjust the upper limit to 4MB"
}
]
}
]
}
]
},

View file

@ -4,7 +4,8 @@
"icon": "1f4d4",
"closed": false,
"refCreateSavePath": "",
"createDocNameTemplate": "",
"docCreateSavePath": "",
"dailyNoteSavePath": "/daily note/{{now | date \"2006/01\"}}/{{now | date \"2006-01-02\"}}",
"dailyNoteTemplatePath": ""
"dailyNoteTemplatePath": "",
"sortMode": 15
}

View file

@ -6,7 +6,7 @@
"id": "20200915214115-42b8zma",
"title": "资源文件",
"type": "doc",
"updated": "20230203182839"
"updated": "20230211103308"
},
"Children": [
{
@ -750,7 +750,7 @@
"ListData": {},
"Properties": {
"id": "20230202231309-pcjl7c2",
"updated": "20230203182839"
"updated": "20230211103308"
},
"Children": [
{
@ -762,7 +762,7 @@
},
"Properties": {
"id": "20230202231311-7qdk1za",
"updated": "20230202231842"
"updated": "20230211103308"
},
"Children": [
{
@ -770,7 +770,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230202231311-n1pf7in",
"updated": "20230203182342"
"updated": "20230211103308"
},
"Children": [
{
@ -817,7 +817,7 @@
},
"Properties": {
"id": "20230202231321-q1b1tza",
"updated": "20230203182839"
"updated": "20230211103207"
},
"Children": [
{
@ -825,7 +825,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230202231321-5ugmgf0",
"updated": "20230203182839"
"updated": "20230211103207"
},
"Children": [
{
@ -916,6 +916,80 @@
]
}
]
},
{
"ID": "20230211102440-0qik4dd",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230211102440-0qik4dd",
"updated": "20230211102642"
},
"Children": [
{
"ID": "20230211102440-09cmf75",
"Type": "NodeParagraph",
"Properties": {
"id": "20230211102440-09cmf75",
"updated": "20230211102642"
},
"Children": [
{
"Type": "NodeText",
"Data": "仅支持 png 和 jpg 格式的图片"
}
]
}
]
},
{
"ID": "20230211102601-ifl3ojm",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230211102601-ifl3ojm",
"updated": "20230211102744"
},
"Children": [
{
"ID": "20230211102601-npe6hvh",
"Type": "NodeParagraph",
"Properties": {
"id": "20230211102601-npe6hvh",
"updated": "20230211102744"
},
"Children": [
{
"Type": "NodeText",
"Data": "默认只对 2MB 以下的图片进行处理,如果需要调整,可以通过环境变量 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SIYUAN_TESSERACT_MAX_SIZE"
},
{
"Type": "NodeText",
"Data": " 设置,值的单位是字节,比如:"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SIYUAN_TESSERACT_MAX_SIZE=4000000"
},
{
"Type": "NodeText",
"Data": " 将上限调整为 4MB"
}
]
}
]
}
]
},

View file

@ -4,7 +4,8 @@
"icon": "1f4d4",
"closed": false,
"refCreateSavePath": "",
"createDocNameTemplate": "",
"docCreateSavePath": "",
"dailyNoteSavePath": "/daily note/{{now | date \"2006/01\"}}/{{now | date \"2006-01-02\"}}",
"dailyNoteTemplatePath": ""
"dailyNoteTemplatePath": "",
"sortMode": 15
}

View file

@ -5,7 +5,7 @@
"Properties": {
"id": "20211226123038-4umgpxy",
"title": "資料文件",
"updated": "20230203183310"
"updated": "20230211103259"
},
"Children": [
{
@ -729,7 +729,7 @@
"ListData": {},
"Properties": {
"id": "20230202231516-o6k9mj1",
"updated": "20230203183310"
"updated": "20230211103259"
},
"Children": [
{
@ -741,7 +741,7 @@
},
"Properties": {
"id": "20230202231516-pwj2ndg",
"updated": "20230203183210"
"updated": "20230211103259"
},
"Children": [
{
@ -749,7 +749,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230202231516-8trf08t",
"updated": "20230203183210"
"updated": "20230211103259"
},
"Children": [
{
@ -796,7 +796,7 @@
},
"Properties": {
"id": "20230202231519-x47s7he",
"updated": "20230203183310"
"updated": "20230211103203"
},
"Children": [
{
@ -804,7 +804,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230202231519-04f6dh6",
"updated": "20230203183310"
"updated": "20230211103203"
},
"Children": [
{
@ -895,6 +895,79 @@
]
}
]
},
{
"ID": "20230211102853-w8ykvqx",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230211102853-w8ykvqx"
},
"Children": [
{
"ID": "20230211102853-4lc4az0",
"Type": "NodeParagraph",
"Properties": {
"id": "20230211102853-4lc4az0",
"updated": "20230211102856"
},
"Children": [
{
"Type": "NodeText",
"Data": "僅支持 png 和 jpg 格式的圖片"
}
]
}
]
},
{
"ID": "20230211102858-0lgz6pc",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230211102858-0lgz6pc",
"updated": "20230211102910"
},
"Children": [
{
"ID": "20230211102858-mfhvy7x",
"Type": "NodeParagraph",
"Properties": {
"id": "20230211102858-mfhvy7x",
"updated": "20230211102910"
},
"Children": [
{
"Type": "NodeText",
"Data": "默認只對 2MB 以下的圖片進行處理,如果需要調整,可以通過環境變量 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SIYUAN_TESSERACT_MAX_SIZE"
},
{
"Type": "NodeText",
"Data": " 設置,值的單位是字節,比如:"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SIYUAN_TESSERACT_MAX_SIZE=4000000"
},
{
"Type": "NodeText",
"Data": " 將上限調整為 4MB"
}
]
}
]
}
]
},

View file

@ -58,7 +58,7 @@
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.7.1",
"dayjs": "^1.11.5",
"electron": "23.0.0",
"electron": "21.4.1",
"electron-builder": "^23.3.3",
"encoding": "^0.1.13",
"eslint": "^8.19.0",

191
app/pnpm-lock.yaml generated
View file

@ -15,7 +15,7 @@ specifiers:
clean-webpack-plugin: ^4.0.0
css-loader: ^6.7.1
dayjs: ^1.11.5
electron: 23.0.0
electron: 21.4.1
electron-builder: ^23.3.3
electron-fetch: ^1.7.4
encoding: ^0.1.13
@ -39,7 +39,7 @@ specifiers:
webpack-cli: ^4.10.0
dependencies:
'@electron/remote': 2.0.9_electron@23.0.0
'@electron/remote': 2.0.9_electron@21.4.1
electron-fetch: 1.7.4
pnpm: 7.9.3
@ -57,7 +57,7 @@ devDependencies:
clean-webpack-plugin: 4.0.0_webpack@5.73.0
css-loader: 6.7.1_webpack@5.73.0
dayjs: 1.11.5
electron: 23.0.0
electron: 21.4.1
electron-builder: 23.3.3
encoding: 0.1.13
eslint: 8.19.0
@ -1257,28 +1257,29 @@ packages:
engines: {node: '>=10.0.0'}
dev: true
/@electron/get/2.0.2:
resolution: {integrity: sha512-eFZVFoRXb3GFGd7Ak7W4+6jBl9wBtiZ4AaYOse97ej6mKj5tkyO0dUnUChs1IhJZtx1BENo4/p4WUTXpi6vT+g==}
engines: {node: '>=12'}
/@electron/get/1.14.1:
resolution: {integrity: sha512-BrZYyL/6m0ZXz/lDxy/nlVhQz+WF+iPS6qXolEU8atw7h6v1aYkjwJZ63m+bJMBTxDE66X+r2tPS4a/8C82sZw==}
engines: {node: '>=8.6'}
dependencies:
debug: 4.3.4
env-paths: 2.2.1
fs-extra: 8.1.0
got: 11.8.6
got: 9.6.0
progress: 2.0.3
semver: 6.3.0
sumchecker: 3.0.1
optionalDependencies:
global-agent: 3.0.0
global-tunnel-ng: 2.7.1
transitivePeerDependencies:
- supports-color
/@electron/remote/2.0.9_electron@23.0.0:
/@electron/remote/2.0.9_electron@21.4.1:
resolution: {integrity: sha512-LR0W0ID6WAKHaSs0x5LX9aiG+5pFBNAJL6eQAJfGkCuZPUa6nZz+czZLdlTDETG45CgF/0raSvCtYOYUpr6c+A==}
peerDependencies:
electron: '>= 13.0.0'
dependencies:
electron: 23.0.0
electron: 21.4.1
dev: false
/@electron/universal/1.2.1:
@ -1427,38 +1428,18 @@ packages:
/@sindresorhus/is/0.14.0:
resolution: {integrity: sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==}
engines: {node: '>=6'}
dev: true
/@sindresorhus/is/4.6.0:
resolution: {integrity: sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==}
engines: {node: '>=10'}
/@szmarczak/http-timer/1.1.2:
resolution: {integrity: sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==}
engines: {node: '>=6'}
dependencies:
defer-to-connect: 1.1.3
dev: true
/@szmarczak/http-timer/4.0.6:
resolution: {integrity: sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==}
engines: {node: '>=10'}
dependencies:
defer-to-connect: 2.0.1
/@tootallnate/once/2.0.0:
resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==}
engines: {node: '>= 10'}
dev: true
/@types/cacheable-request/6.0.3:
resolution: {integrity: sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==}
dependencies:
'@types/http-cache-semantics': 4.0.1
'@types/keyv': 3.1.4
'@types/node': 17.0.45
'@types/responselike': 1.0.0
/@types/debug/4.1.7:
resolution: {integrity: sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==}
dependencies:
@ -1500,9 +1481,6 @@ packages:
resolution: {integrity: sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg==}
dev: true
/@types/http-cache-semantics/4.0.1:
resolution: {integrity: sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==}
/@types/json-schema/7.0.11:
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
dev: true
@ -2236,10 +2214,6 @@ packages:
- supports-color
dev: true
/cacheable-lookup/5.0.4:
resolution: {integrity: sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==}
engines: {node: '>=10.6.0'}
/cacheable-request/6.1.0:
resolution: {integrity: sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==}
engines: {node: '>=8'}
@ -2251,19 +2225,6 @@ packages:
lowercase-keys: 2.0.0
normalize-url: 4.5.1
responselike: 1.0.2
dev: true
/cacheable-request/7.0.2:
resolution: {integrity: sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==}
engines: {node: '>=8'}
dependencies:
clone-response: 1.0.2
get-stream: 5.2.0
http-cache-semantics: 4.1.0
keyv: 4.5.2
lowercase-keys: 2.0.0
normalize-url: 6.1.0
responselike: 2.0.1
/call-bind/1.0.2:
resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==}
@ -2489,6 +2450,13 @@ packages:
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
dev: true
/config-chain/1.1.13:
resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==}
dependencies:
ini: 1.3.8
proto-list: 1.2.4
optional: true
/configstore/5.0.1:
resolution: {integrity: sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==}
engines: {node: '>=8'}
@ -2616,13 +2584,6 @@ packages:
engines: {node: '>=4'}
dependencies:
mimic-response: 1.0.1
dev: true
/decompress-response/6.0.0:
resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==}
engines: {node: '>=10'}
dependencies:
mimic-response: 3.1.0
/deep-extend/0.6.0:
resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==}
@ -2635,11 +2596,6 @@ packages:
/defer-to-connect/1.1.3:
resolution: {integrity: sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==}
dev: true
/defer-to-connect/2.0.1:
resolution: {integrity: sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==}
engines: {node: '>=10'}
/define-properties/1.1.4:
resolution: {integrity: sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==}
@ -2789,7 +2745,6 @@ packages:
/duplexer3/0.1.5:
resolution: {integrity: sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==}
dev: true
/ejs/3.1.8:
resolution: {integrity: sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==}
@ -2861,13 +2816,13 @@ packages:
resolution: {integrity: sha512-YoVeFrGd/7ROjz4R9uPoND1K/hSRC/xADy9639ZmIZeJSaBnKdYx3I6LMPsY7CXLpK7JFgKQVzeZ/dk2br6Eaw==}
dev: true
/electron/23.0.0:
resolution: {integrity: sha512-S6hVtTAjauMiiWP9sBVR5RpcUC464cNZ06I2EMUjeZBq+KooS6tLmNsfw0zLpAXDp1qosjlBP3v71NTZ3gd9iA==}
engines: {node: '>= 12.20.55'}
/electron/21.4.1:
resolution: {integrity: sha512-uhFf3vpE6th6X2E1NSIy1+dWVeS9gb7W8EWd/cn5MacEiv4aVY3gtypaglTaVhYPfnJfcD+v3Ql6gGvx4Efh6A==}
engines: {node: '>= 10.17.0'}
hasBin: true
requiresBuild: true
dependencies:
'@electron/get': 2.0.2
'@electron/get': 1.14.1
'@types/node': 16.11.43
extract-zip: 2.0.1
transitivePeerDependencies:
@ -2882,6 +2837,11 @@ packages:
engines: {node: '>= 4'}
dev: true
/encodeurl/1.0.2:
resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==}
engines: {node: '>= 0.8'}
optional: true
/encoding/0.1.13:
resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==}
dependencies:
@ -3266,7 +3226,6 @@ packages:
engines: {node: '>=6'}
dependencies:
pump: 3.0.0
dev: true
/get-stream/5.2.0:
resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==}
@ -3323,6 +3282,17 @@ packages:
ini: 2.0.0
dev: true
/global-tunnel-ng/2.7.1:
resolution: {integrity: sha512-4s+DyciWBV0eK148wqXxcmVAbFVPqtc3sEtUE/GTQfuU80rySLcMhUmHKSHI7/LDj8q0gDYI1lIhRRB7ieRAqg==}
engines: {node: '>=0.10'}
requiresBuild: true
dependencies:
encodeurl: 1.0.2
lodash: 4.17.21
npm-conf: 1.1.3
tunnel: 0.0.6
optional: true
/globals/11.12.0:
resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==}
engines: {node: '>=4'}
@ -3365,22 +3335,6 @@ packages:
pinkie-promise: 2.0.1
dev: true
/got/11.8.6:
resolution: {integrity: sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==}
engines: {node: '>=10.19.0'}
dependencies:
'@sindresorhus/is': 4.6.0
'@szmarczak/http-timer': 4.0.6
'@types/cacheable-request': 6.0.3
'@types/responselike': 1.0.0
cacheable-lookup: 5.0.4
cacheable-request: 7.0.2
decompress-response: 6.0.0
http2-wrapper: 1.0.3
lowercase-keys: 2.0.0
p-cancelable: 2.1.1
responselike: 2.0.1
/got/9.6.0:
resolution: {integrity: sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==}
engines: {node: '>=8.6'}
@ -3398,7 +3352,6 @@ packages:
p-cancelable: 1.1.0
to-readable-stream: 1.0.0
url-parse-lax: 3.0.0
dev: true
/graceful-fs/4.2.10:
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
@ -3532,13 +3485,6 @@ packages:
- supports-color
dev: true
/http2-wrapper/1.0.3:
resolution: {integrity: sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==}
engines: {node: '>=10.19.0'}
dependencies:
quick-lru: 5.1.1
resolve-alpn: 1.2.1
/https-proxy-agent/5.0.1:
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
engines: {node: '>= 6'}
@ -3636,7 +3582,6 @@ packages:
/ini/1.3.8:
resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==}
dev: true
/ini/2.0.0:
resolution: {integrity: sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==}
@ -3819,10 +3764,6 @@ packages:
/json-buffer/3.0.0:
resolution: {integrity: sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ==}
dev: true
/json-buffer/3.0.1:
resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==}
/json-parse-even-better-errors/2.3.1:
resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==}
@ -3870,12 +3811,6 @@ packages:
resolution: {integrity: sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==}
dependencies:
json-buffer: 3.0.0
dev: true
/keyv/4.5.2:
resolution: {integrity: sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==}
dependencies:
json-buffer: 3.0.1
/kind-of/6.0.3:
resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==}
@ -3946,7 +3881,6 @@ packages:
/lodash/4.17.21:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
dev: true
/lower-case/2.0.2:
resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==}
@ -3957,7 +3891,6 @@ packages:
/lowercase-keys/1.0.1:
resolution: {integrity: sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==}
engines: {node: '>=0.10.0'}
dev: true
/lowercase-keys/2.0.0:
resolution: {integrity: sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==}
@ -4022,10 +3955,6 @@ packages:
resolution: {integrity: sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==}
engines: {node: '>=4'}
/mimic-response/3.1.0:
resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
engines: {node: '>=10'}
/mini-css-extract-plugin/2.3.0_webpack@5.73.0:
resolution: {integrity: sha512-uzWaOwC+gJrnKbr23J1ZRWx/Wd9W9Ce1mKPlsBGBV/r8zG7/G7oKMxGmxbI65pVGbae2cR7CUx9Ulk0HQt8BfQ==}
engines: {node: '>= 12.13.0'}
@ -4135,11 +4064,14 @@ packages:
/normalize-url/4.5.1:
resolution: {integrity: sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==}
engines: {node: '>=8'}
dev: true
/normalize-url/6.1.0:
resolution: {integrity: sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==}
engines: {node: '>=10'}
/npm-conf/1.1.3:
resolution: {integrity: sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==}
engines: {node: '>=4'}
dependencies:
config-chain: 1.1.13
pify: 3.0.0
optional: true
/nth-check/2.1.1:
resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}
@ -4191,11 +4123,6 @@ packages:
/p-cancelable/1.1.0:
resolution: {integrity: sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==}
engines: {node: '>=6'}
dev: true
/p-cancelable/2.1.1:
resolution: {integrity: sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==}
engines: {node: '>=8'}
/p-limit/2.3.0:
resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==}
@ -4305,6 +4232,11 @@ packages:
engines: {node: '>=0.10.0'}
dev: true
/pify/3.0.0:
resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==}
engines: {node: '>=4'}
optional: true
/pify/4.0.1:
resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==}
engines: {node: '>=6'}
@ -4413,7 +4345,6 @@ packages:
/prepend-http/2.0.0:
resolution: {integrity: sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==}
engines: {node: '>=4'}
dev: true
/pretty-error/4.0.0:
resolution: {integrity: sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==}
@ -4426,6 +4357,10 @@ packages:
resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==}
engines: {node: '>=0.4.0'}
/proto-list/1.2.4:
resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==}
optional: true
/pump/3.0.0:
resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==}
dependencies:
@ -4448,10 +4383,6 @@ packages:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
dev: true
/quick-lru/5.1.1:
resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==}
engines: {node: '>=10'}
/randombytes/2.1.0:
resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==}
dependencies:
@ -4576,9 +4507,6 @@ packages:
engines: {node: '>=0.10.0'}
dev: true
/resolve-alpn/1.2.1:
resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==}
/resolve-cwd/3.0.0:
resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==}
engines: {node: '>=8'}
@ -4609,12 +4537,6 @@ packages:
resolution: {integrity: sha512-/Fpe5guzJk1gPqdJLJR5u7eG/gNY4nImjbRDaVWVMRhne55TCmj2i9Q+54PBRfatRC8v/rIiv9BN0pMd9OV5EQ==}
dependencies:
lowercase-keys: 1.0.1
dev: true
/responselike/2.0.1:
resolution: {integrity: sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==}
dependencies:
lowercase-keys: 2.0.0
/reusify/1.0.4:
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
@ -5003,7 +4925,6 @@ packages:
/to-readable-stream/1.0.0:
resolution: {integrity: sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==}
engines: {node: '>=6'}
dev: true
/to-regex-range/5.0.1:
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
@ -5056,6 +4977,11 @@ packages:
typescript: 4.7.4
dev: true
/tunnel/0.0.6:
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
optional: true
/type-check/0.4.0:
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
engines: {node: '>= 0.8.0'}
@ -5166,7 +5092,6 @@ packages:
engines: {node: '>=4'}
dependencies:
prepend-http: 2.0.0
dev: true
/utf8-byte-length/1.0.4:
resolution: {integrity: sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==}

View file

@ -424,6 +424,7 @@ declare interface IConfig {
container: "std" | "android" | "docker" | "ios"
isMicrosoftStore: boolean
os: "windows" | "linux" | "darwin"
osPlatform: string
homeDir: string
xanadu: boolean
udanax: boolean

View file

@ -23,10 +23,10 @@ const loadThirdIcon = (iconURL: string, data: IAppearance) => {
export const loadAssets = (data: IAppearance) => {
const htmlElement = document.getElementsByTagName("html")[0];
htmlElement.setAttribute("lang",window.siyuan.config.appearance.lang);
htmlElement.setAttribute("data-theme-mode",getThemeMode());
htmlElement.setAttribute("data-light-theme",window.siyuan.config.appearance.themeLight);
htmlElement.setAttribute("data-dark-theme",window.siyuan.config.appearance.themeDark);
htmlElement.setAttribute("lang", window.siyuan.config.appearance.lang);
htmlElement.setAttribute("data-theme-mode", getThemeMode());
htmlElement.setAttribute("data-light-theme", window.siyuan.config.appearance.themeLight);
htmlElement.setAttribute("data-dark-theme", window.siyuan.config.appearance.themeDark);
const OSTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
if (window.siyuan.config.appearance.modeOS && (
(window.siyuan.config.appearance.mode === 1 && OSTheme === "light") ||
@ -172,6 +172,7 @@ export const addGA = () => {
version: Constants.SIYUAN_VERSION,
container: window.siyuan.config.system.container,
os: window.siyuan.config.system.os,
osPlatform: window.siyuan.config.system.osPlatform,
isLoggedIn: false,
subscriptionStatus: -1,
subscriptionPlan: -1,

View file

@ -24,6 +24,7 @@ type System struct {
ID string `json:"id"`
KernelVersion string `json:"kernelVersion"`
OS string `json:"os"`
OSPlatform string `json:"osPlatform"`
Container string `json:"container"` // docker, android, ios, std
IsMicrosoftStore bool `json:"isMicrosoftStore"`
IsInsider bool `json:"isInsider"`

View file

@ -40,11 +40,11 @@ require (
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/radovskyb/watcher v1.0.7
github.com/shirou/gopsutil/v3 v3.23.1
github.com/siyuan-note/dejavu v0.0.0-20230209152349-4c833183cb3c
github.com/siyuan-note/dejavu v0.0.0-20230211034120-c61245065d20
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
github.com/siyuan-note/eventbus v0.0.0-20230203085647-fb624740be03
github.com/siyuan-note/filelock v0.0.0-20221117095924-e1947438a35e
github.com/siyuan-note/httpclient v0.0.0-20230201041143-5c2b2b88b985
github.com/siyuan-note/httpclient v0.0.0-20230211023949-b9d36c2da3ea
github.com/siyuan-note/logging v0.0.0-20221031125421-9b7234d79d8a
github.com/siyuan-note/riff v0.0.0-20221228031102-17d458a1217b
github.com/steambap/captcha v1.4.1
@ -63,7 +63,7 @@ require (
github.com/alecthomas/chroma v0.10.0 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect
github.com/aws/aws-sdk-go v1.44.197 // indirect
github.com/aws/aws-sdk-go v1.44.199 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dlclark/regexp2 v1.8.0 // indirect
github.com/dsnet/compress v0.0.1 // indirect
@ -94,6 +94,7 @@ require (
github.com/juju/errors v1.0.0 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
@ -114,18 +115,20 @@ require (
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/ugorji/go/codec v1.2.8 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect
golang.org/x/exp v0.0.0-20230210204819-062eb4c674ab // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.6.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/tools v0.5.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

View file

@ -37,6 +37,8 @@ github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef h1:2JGTg6JapxP
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef/go.mod h1:JS7hed4L1fj0hXcyEejnW57/7LCetXggd+vwrRnYeII=
github.com/aws/aws-sdk-go v1.44.197 h1:pkg/NZsov9v/CawQWy+qWVzJMIZRQypCtYjUBXFomF8=
github.com/aws/aws-sdk-go v1.44.197/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.199 h1:hYuQmS4zLMJR9v2iOp2UOD6Vi/0V+nwyR/Uhrkrtlbc=
github.com/aws/aws-sdk-go v1.44.199/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
@ -188,6 +190,7 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
@ -263,16 +266,16 @@ github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5g
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
github.com/siyuan-note/dejavu v0.0.0-20230209152349-4c833183cb3c h1:uGQr2/KV+yIzJxQfz9CY6SrHPfCy9a76kt2QTyrPpAw=
github.com/siyuan-note/dejavu v0.0.0-20230209152349-4c833183cb3c/go.mod h1:Hp/96PrZAiG2zSscNbrdu8Iyzw4nCIu2/fOtzNVtbpU=
github.com/siyuan-note/dejavu v0.0.0-20230211034120-c61245065d20 h1:dU9TvaIMpVonfTPqlub63dzPBxKreBfttAFoespg5JA=
github.com/siyuan-note/dejavu v0.0.0-20230211034120-c61245065d20/go.mod h1:cqtscX5+nWrRW83+pV6DRkMrmV75FbdVKgj6MV/yMpc=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
github.com/siyuan-note/eventbus v0.0.0-20230203085647-fb624740be03 h1:W7nGGluE6sBrFSVkmucGsh2NruleOPsQle7fcAW115o=
github.com/siyuan-note/eventbus v0.0.0-20230203085647-fb624740be03/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI=
github.com/siyuan-note/filelock v0.0.0-20221117095924-e1947438a35e h1:i3RKrdrddr4AuaHJtoWYAEVNuR7Y9wIsEqPmuFFbJC4=
github.com/siyuan-note/filelock v0.0.0-20221117095924-e1947438a35e/go.mod h1:NmpSIVtIGy8eNWapjDIiiCw5+5r5wxC76k40oG+WRXQ=
github.com/siyuan-note/httpclient v0.0.0-20230201041143-5c2b2b88b985 h1:L5NArfUHYrY43OQ1dreuzuBe8UXP2an94AYqk553f+w=
github.com/siyuan-note/httpclient v0.0.0-20230201041143-5c2b2b88b985/go.mod h1:oXSO1zqTwj/vHlo9xkuLwtBxkuBDhuHjHhn+RbOPM+s=
github.com/siyuan-note/httpclient v0.0.0-20230211023949-b9d36c2da3ea h1:Q6cuN3L4zWR+MwQVdMKeUnfusd+W0LLu1KeqSB3vfdQ=
github.com/siyuan-note/httpclient v0.0.0-20230211023949-b9d36c2da3ea/go.mod h1:x4XRAUIRqxe3wUhUK4ov/Ze20rPMMP4ueGCdwmF3X8k=
github.com/siyuan-note/logging v0.0.0-20221031125421-9b7234d79d8a h1:b9VJCE8IccYjsadwNBI11he+Wn25hI9lCma4uYoIYEM=
github.com/siyuan-note/logging v0.0.0-20221031125421-9b7234d79d8a/go.mod h1:t1zRGxK13L/9ZFoGyTD39IbFCbee3CsypDj4b5dt4qM=
github.com/siyuan-note/riff v0.0.0-20221228031102-17d458a1217b h1:JDpKOdiyocNsgKFfrF3mB7UoBJz4qcHBUKBig78kVjc=
@ -301,7 +304,9 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/studio-b12/gowebdav v0.0.0-20230203202212-3282f94193f2 h1:VsBj3UD2xyAOu7kJw6O/2jjG2UXLFoBzihqDU9Ofg9M=
github.com/studio-b12/gowebdav v0.0.0-20230203202212-3282f94193f2/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE=
github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM=
github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI=
github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms=
github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4=
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
@ -333,8 +338,8 @@ golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
golang.org/x/exp v0.0.0-20230206171751-46f607a40771 h1:xP7rWLUr1e1n2xkK5YB4LI0hPEy3LJC6Wk+D4pGlOJg=
golang.org/x/exp v0.0.0-20230206171751-46f607a40771/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20230210204819-062eb4c674ab h1:628ME69lBm9C6JY2wXhAph/yjN3jezx1z7BIDLUwxjo=
golang.org/x/exp v0.0.0-20230210204819-062eb4c674ab/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20190823064033-3a9bac650e44/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
@ -415,8 +420,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.5.0 h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4=
golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View file

@ -18,13 +18,13 @@ package mobile
import (
"fmt"
"github.com/siyuan-note/siyuan/kernel/cache"
"github.com/siyuan-note/siyuan/kernel/job"
"os"
"path/filepath"
"strings"
"time"
"github.com/siyuan-note/siyuan/kernel/cache"
"github.com/siyuan-note/siyuan/kernel/job"
"github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/server"
"github.com/siyuan-note/siyuan/kernel/sql"
@ -36,10 +36,10 @@ func StartKernelFast(container, appDir, workspaceBaseDir, localIPs string) {
go server.Serve(true)
}
func StartKernel(container, appDir, workspaceBaseDir, timezoneID, localIPs, lang string) {
func StartKernel(container, appDir, workspaceBaseDir, timezoneID, localIPs, lang, osVer string) {
SetTimezone(container, appDir, timezoneID)
util.Mode = "prod"
util.MobileOSVer = osVer
util.LocalIPs = strings.Split(localIPs, ",")
util.BootMobile(container, appDir, workspaceBaseDir, lang)

View file

@ -236,6 +236,7 @@ func InitConf() {
logging.LogInfof("using Microsoft Store edition")
}
Conf.System.OS = runtime.GOOS
Conf.System.OSPlatform, _ = util.GetOSPlatform()
Conf.Newbie = util.IsNewbie
if "" != Conf.UserData {

View file

@ -209,7 +209,7 @@ func IndexRefs() {
// IndexEmbedBlockJob 嵌入块支持搜索 https://github.com/siyuan-note/siyuan/issues/7112
func IndexEmbedBlockJob() {
embedBlocks := sql.QueryEmptyContentEmbedBlocks()
task.AppendTask(task.DatabaseIndexEmbedBlock, autoIndexEmbedBlock, embedBlocks)
task.AppendTaskWithTimeout(task.DatabaseIndexEmbedBlock, 30*time.Second, autoIndexEmbedBlock, embedBlocks)
}
func autoIndexEmbedBlock(embedBlocks []*sql.Block) {

View file

@ -21,7 +21,7 @@ func OCRAssetsJob() {
return
}
task.AppendTask(task.OCRImage, autoOCRAssets)
task.AppendTaskWithTimeout(task.OCRImage, 7*time.Second, autoOCRAssets)
}
func autoOCRAssets() {
@ -39,7 +39,7 @@ func autoOCRAssets() {
util.AssetsTextsLock.Unlock()
util.AssetsTextsChanged = true
if 16 <= i { // 一次任务中最多处理 16 张图片,防止卡顿
if 4 <= i { // 一次任务中最多处理 4 张图片,防止卡顿
break
}
}

View file

@ -105,7 +105,9 @@ func getAttachedUIProcCount() (ret int) {
procName := strings.ToLower(proc.Executable())
uiProcOk := false
for _, name := range uiProcNames {
uiProcOk = strings.Contains(procName, name)
if uiProcOk = strings.Contains(procName, name); uiProcOk {
break
}
}
if uiProcOk {
ret++
@ -122,7 +124,9 @@ func getUIProcCount() (ret int) {
procName := strings.ToLower(proc.Executable())
uiProcOk := false
for _, name := range uiProcNames {
uiProcOk = strings.Contains(procName, name)
if uiProcOk = strings.Contains(procName, name); uiProcOk {
break
}
}
if uiProcOk {
ret++

View file

@ -1071,35 +1071,38 @@ func syncRepo(exit, byHand bool) (err error) {
func processSyncMergeResult(exit, byHand bool, start time.Time, mergeResult *dejavu.MergeResult) {
//logSyncMergeResult(mergeResult)
if 0 < len(mergeResult.Conflicts) && Conf.Sync.GenerateConflictDoc {
// 云端同步发生冲突时生成副本 https://github.com/siyuan-note/siyuan/issues/5687
if 0 < len(mergeResult.Conflicts) {
luteEngine := util.NewLute()
if Conf.Sync.GenerateConflictDoc {
// 云端同步发生冲突时生成副本 https://github.com/siyuan-note/siyuan/issues/5687
for _, file := range mergeResult.Conflicts {
if !strings.HasSuffix(file.Path, ".sy") {
continue
}
parts := strings.Split(file.Path[1:], "/")
if 2 > len(parts) {
continue
}
boxID := parts[0]
absPath := filepath.Join(util.TempDir, "repo", "sync", "conflicts", mergeResult.Time.Format("2006-01-02-150405"), file.Path)
tree, loadTreeErr := loadTree(absPath, luteEngine)
if nil != loadTreeErr {
logging.LogErrorf("load conflicted file [%s] failed: %s", absPath, loadTreeErr)
continue
}
tree.Box = boxID
tree.Path = strings.TrimPrefix(file.Path, "/"+boxID)
resetTree(tree, "Conflicted")
createTreeTx(tree)
}
}
historyDir := filepath.Join(util.HistoryDir, mergeResult.Time.Format("2006-01-02-150405")+"-sync")
luteEngine := util.NewLute()
for _, file := range mergeResult.Conflicts {
if !strings.HasSuffix(file.Path, ".sy") {
continue
}
parts := strings.Split(file.Path[1:], "/")
if 2 > len(parts) {
continue
}
boxID := parts[0]
absPath := filepath.Join(util.TempDir, "repo", "sync", "conflicts", mergeResult.Time.Format("2006-01-02-150405"), file.Path)
tree, loadTreeErr := loadTree(absPath, luteEngine)
if nil != loadTreeErr {
logging.LogErrorf("load conflicted file [%s] failed: %s", absPath, loadTreeErr)
continue
}
tree.Box = boxID
tree.Path = strings.TrimPrefix(file.Path, "/"+boxID)
resetTree(tree, "Conflicted")
createTreeTx(tree)
indexHistoryDir(filepath.Base(historyDir), luteEngine)
}
indexHistoryDir(filepath.Base(historyDir), luteEngine)
}
if 1 > len(mergeResult.Upserts) && 1 > len(mergeResult.Removes) && 1 > len(mergeResult.Conflicts) { // 没有数据变更
@ -1171,6 +1174,21 @@ func processSyncMergeResult(exit, byHand bool, start time.Time, mergeResult *dej
go func() {
time.Sleep(2 * time.Second)
util.PushStatusBar(fmt.Sprintf(Conf.Language(149), elapsed.Seconds()))
if 0 < len(mergeResult.Conflicts) {
syConflict := false
for _, file := range mergeResult.Conflicts {
if strings.HasSuffix(file.Path, ".sy") {
syConflict = true
break
}
}
if syConflict {
// 数据同步发生冲突时在界面上进行提醒 https://github.com/siyuan-note/siyuan/issues/7332
util.PushMsg(Conf.Language(108), 7000)
}
}
}()
}
}

View file

@ -97,7 +97,7 @@ func searchEmbedBlock(embedBlockID, stmt string, excludeIDs []string, headingMod
}
// 嵌入块支持搜索 https://github.com/siyuan-note/siyuan/issues/7112
task.AppendTask(task.DatabaseIndexEmbedBlock, updateEmbedBlockContent, embedBlockID, ret)
task.AppendTaskWithTimeout(task.DatabaseIndexEmbedBlock, 30*time.Second, updateEmbedBlockContent, embedBlockID, ret)
// 添加笔记本名称
var boxIDs []string

View file

@ -37,9 +37,14 @@ type Task struct {
Handler reflect.Value
Args []interface{}
Created time.Time
Timeout time.Duration
}
func AppendTask(action string, handler interface{}, args ...interface{}) {
AppendTaskWithTimeout(action, 24*time.Hour, handler, args...)
}
func AppendTaskWithTimeout(action string, timeout time.Duration, handler interface{}, args ...interface{}) {
if util.IsExiting {
//logging.LogWarnf("task queue is paused, action [%s] will be ignored", action)
return
@ -53,16 +58,13 @@ func AppendTask(action string, handler interface{}, args ...interface{}) {
queueLock.Lock()
defer queueLock.Unlock()
taskQueue = append(taskQueue, newTask(action, handler, args...))
}
func newTask(action string, handler interface{}, args ...interface{}) *Task {
return &Task{
taskQueue = append(taskQueue, &Task{
Action: action,
Timeout: timeout,
Handler: reflect.ValueOf(handler),
Args: args,
Created: time.Now(),
}
})
}
func getCurrentActions() (ret []string) {
@ -166,8 +168,6 @@ func ExecTaskJob() {
execTask(task)
}
var currentTaskAction string
func popTask() (ret *Task) {
queueLock.Lock()
defer queueLock.Unlock()
@ -181,6 +181,8 @@ func popTask() (ret *Task) {
return
}
var currentTaskAction string
func execTask(task *Task) {
defer logging.Recover()
@ -195,7 +197,7 @@ func execTask(task *Task) {
currentTaskAction = task.Action
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), task.Timeout)
defer cancel()
ch := make(chan bool, 1)
go func() {

33
kernel/util/os.go Normal file
View file

@ -0,0 +1,33 @@
// SiYuan - Build Your Eternal Digital Garden
// Copyright (c) 2020-present, b3log.org
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//go:build !ios && !android
package util
import (
"github.com/shirou/gopsutil/v3/host"
"github.com/siyuan-note/logging"
)
func GetOSPlatform() (plat, ver string) {
plat, _, ver, err := host.PlatformInformation()
if nil != err {
logging.LogWarnf("get os platform failed: %s", err)
return "Unknown", ""
}
return
}

29
kernel/util/os_mobile.go Normal file
View file

@ -0,0 +1,29 @@
// SiYuan - Build Your Eternal Digital Garden
// Copyright (c) 2020-present, b3log.org
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//go:build ios || android
package util
func GetOSPlatform() (plat, ver string) {
if ContainerIOS == Container {
return "iOS", MobileOSVer
}
if ContainerAndroid == Container {
return "Android", MobileOSVer
}
return "Unknown", MobileOSVer
}

View file

@ -45,10 +45,19 @@ const (
// IsExiting 是否正在退出程序。
var IsExiting = false
// MobileOSVer 移动端操作系统版本。
var MobileOSVer string
func logBootInfo() {
plat, platVer := GetOSPlatform()
osInfo := plat
if "" != platVer {
osInfo += " " + platVer
}
logging.LogInfof("kernel is booting:\n"+
" * ver [%s]\n"+
" * arch [%s]\n"+
" * os [%s]\n"+
" * pid [%d]\n"+
" * runtime mode [%s]\n"+
" * working directory [%s]\n"+
@ -56,7 +65,7 @@ func logBootInfo() {
" * container [%s]\n"+
" * database [ver=%s]\n"+
" * workspace directory [%s]",
Ver, runtime.GOARCH, os.Getpid(), Mode, WorkingDir, ReadOnly, Container, DatabaseVer, WorkspaceDir)
Ver, runtime.GOARCH, osInfo, os.Getpid(), Mode, WorkingDir, ReadOnly, Container, DatabaseVer, WorkspaceDir)
}
func IsMutexLocked(m *sync.Mutex) bool {

View file

@ -23,17 +23,20 @@ import (
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
"github.com/88250/gulu"
"github.com/dustin/go-humanize"
"github.com/siyuan-note/logging"
)
var (
TesseractBin = "tesseract"
TesseractEnabled bool
TesseractMaxSize = 2 * 1000 * uint64(1000)
AssetsTexts = map[string]string{}
AssetsTextsLock = sync.Mutex{}
AssetsTextsChanged = false
@ -85,6 +88,10 @@ func Tesseract(imgAbsPath string) string {
return ""
}
if TesseractMaxSize < uint64(info.Size()) {
return ""
}
defer logging.Recover()
ctx, cancel := context.WithTimeout(context.Background(), 7*time.Second)
@ -124,8 +131,15 @@ func initTesseract() {
return
}
maxSizeVal := os.Getenv("SIYUAN_TESSERACT_MAX_SIZE")
if "" != maxSizeVal {
if maxSize, parseErr := strconv.ParseUint(maxSizeVal, 10, 64); nil == parseErr {
TesseractMaxSize = maxSize
}
}
TesseractLangs = filterTesseractLangs(langs)
logging.LogInfof("tesseract-ocr enabled [ver=%s, langs=%s]", ver, strings.Join(TesseractLangs, "+"))
logging.LogInfof("tesseract-ocr enabled [ver=%s, maxSize=%s, langs=%s]", ver, humanize.Bytes(TesseractMaxSize), strings.Join(TesseractLangs, "+"))
}
func filterTesseractLangs(langs []string) (ret []string) {