This commit is contained in:
Daniel 2024-11-22 20:15:47 +08:00
parent 909b36d380
commit acbbd8ca5d
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
15 changed files with 59 additions and 38 deletions

View file

@ -195,7 +195,7 @@ func getMobileWorkspaces(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
if util.ContainerIOS != util.Container && util.ContainerAndroid != util.Container {
if util.ContainerIOS != util.Container && util.ContainerAndroid != util.Container && util.ContainerHarmony != util.Container {
return
}
@ -315,7 +315,7 @@ func setWorkspaceDir(c *gin.Context) {
return
}
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container || util.ContainerHarmony == util.Container {
util.PushMsg(model.Conf.Language(42), 1000*15)
time.Sleep(time.Second * 1)
model.Close(false, false, 1)

View file

@ -269,6 +269,8 @@ func getCurrentBackend() string {
return "ios"
case util.ContainerAndroid:
return "android"
case util.ContainerHarmony:
return "harmony"
default:
return runtime.GOOS
}

View file

@ -765,7 +765,7 @@ func (parser *PdfAssetParser) getTextPageWorker(id int, instance pdfium.Pdfium,
// Parse will parse a PDF document using PDFium webassembly module using a worker pool
func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult) {
if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container {
if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container || util.ContainerHarmony == util.Container {
// PDF asset content searching is not supported on mobile platforms
return
}

View file

@ -33,7 +33,7 @@ import (
var assetsWatcher *fsnotify.Watcher
func WatchAssets() {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container || util.ContainerHarmony == util.Container {
return
}

View file

@ -284,7 +284,7 @@ func RecentUpdatedBlocks() (ret []*Block) {
ret = []*Block{}
sqlStmt := "SELECT * FROM blocks WHERE type = 'p' AND length > 1"
if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container {
if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container || util.ContainerHarmony == util.Container {
sqlStmt = "SELECT * FROM blocks WHERE type = 'd'"
}

View file

@ -134,7 +134,7 @@ func InitConf() {
if "" != util.Lang {
initialized := false
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container || util.ContainerHarmony == util.Container {
// 移动端以上次设置的外观语言为准
if "" != Conf.Lang && util.Lang != Conf.Lang {
util.Lang = Conf.Lang
@ -485,7 +485,7 @@ func InitConf() {
// 上次未正常完成数据索引
go func() {
util.WaitForUILoaded()
if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container {
if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container || util.ContainerHarmony == util.Container {
task.AppendAsyncTaskWithDelay(task.PushMsg, 2*time.Second, util.PushMsg, Conf.language(245), 15000)
} else {
task.AppendAsyncTaskWithDelay(task.PushMsg, 2*time.Second, util.PushMsg, Conf.language(244), 15000)

View file

@ -32,7 +32,7 @@ import (
var emojisWatcher *fsnotify.Watcher
func WatchEmojis() {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container || util.ContainerHarmony == util.Container {
return
}

View file

@ -372,7 +372,7 @@ func subscribeSQLEvents() {
// util.ContextPushMsg(context, msg)
//})
eventbus.Subscribe(eventbus.EvtSQLInsertBlocksFTS, func(context map[string]interface{}, blockCount int, hash string) {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container || util.ContainerHarmony == util.Container {
// Android/iOS 端不显示数据索引和搜索索引状态提示 https://github.com/siyuan-note/siyuan/issues/6392
return
}
@ -384,7 +384,7 @@ func subscribeSQLEvents() {
util.ContextPushMsg(context, msg)
})
eventbus.Subscribe(eventbus.EvtSQLDeleteBlocks, func(context map[string]interface{}, rootID string) {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container || util.ContainerHarmony == util.Container {
return
}
@ -395,7 +395,7 @@ func subscribeSQLEvents() {
util.ContextPushMsg(context, msg)
})
eventbus.Subscribe(eventbus.EvtSQLUpdateBlocksHPaths, func(context map[string]interface{}, blockCount int, hash string) {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container || util.ContainerHarmony == util.Container {
return
}
@ -407,7 +407,7 @@ func subscribeSQLEvents() {
})
eventbus.Subscribe(eventbus.EvtSQLInsertHistory, func(context map[string]interface{}) {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container || util.ContainerHarmony == util.Container {
return
}
@ -419,7 +419,7 @@ func subscribeSQLEvents() {
})
eventbus.Subscribe(eventbus.EvtSQLInsertAssetContent, func(context map[string]interface{}) {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container || util.ContainerHarmony == util.Container {
return
}

View file

@ -238,7 +238,7 @@ func CheckAuth(c *gin.Context) {
return
}
if strings.HasPrefix(c.Request.RequestURI, "/api/sync/performSync") {
if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container {
if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container || util.ContainerHarmony == util.Container {
c.Set(RoleContextKey, RoleAdministrator)
c.Next()
return

View file

@ -351,7 +351,7 @@ var (
AccessAuthCode string
Lang = ""
Container string // docker, android, ios, std
Container string // docker, android, ios, harmony, std
ISMicrosoftStore bool // 桌面端是否是微软商店版
)
@ -360,6 +360,7 @@ const (
ContainerDocker = "docker" // Docker 容器端
ContainerAndroid = "android" // Android 端
ContainerIOS = "ios" // iOS 端
ContainerHarmony = "harmony" // 鸿蒙端
LocalHost = "127.0.0.1" // 伺服地址
FixedPort = "6806" // 固定端口