mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Improve detecting Pad device, treat it as desktop device https://github.com/siyuan-note/siyuan/issues/8435
This commit is contained in:
parent
697462e306
commit
1d1661167d
8 changed files with 39 additions and 32 deletions
|
|
@ -36,7 +36,7 @@ import (
|
|||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-contrib/sessions/cookie"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/mssola/user_agent"
|
||||
"github.com/mssola/useragent"
|
||||
"github.com/olahol/melody"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/api"
|
||||
|
|
@ -205,10 +205,17 @@ func serveAppearance(ginServer *gin.Engine) {
|
|||
|
||||
if strings.Contains(userAgentHeader, "Electron") {
|
||||
location.Path = "/stage/build/app/"
|
||||
} else if user_agent.New(userAgentHeader).Mobile() {
|
||||
location.Path = "/stage/build/mobile/"
|
||||
} else {
|
||||
location.Path = "/stage/build/desktop/"
|
||||
ua := useragent.New(userAgentHeader)
|
||||
if ua.Mobile() {
|
||||
if strings.Contains(strings.ToLower(ua.Platform()), "pad") {
|
||||
location.Path = "/stage/build/desktop/"
|
||||
} else {
|
||||
location.Path = "/stage/build/mobile/"
|
||||
}
|
||||
} else {
|
||||
location.Path = "/stage/build/desktop/"
|
||||
}
|
||||
}
|
||||
|
||||
c.Redirect(302, location.String())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue