mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-02 19:00:15 +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
|
|
@ -6,7 +6,7 @@ require (
|
|||
github.com/88250/clipboard v0.1.5
|
||||
github.com/88250/css v0.1.2
|
||||
github.com/88250/gulu v1.2.3-0.20230501031728-4d62370997cd
|
||||
github.com/88250/lute v1.7.6-0.20230528141918-0435fd1d81f0
|
||||
github.com/88250/lute v1.7.6-0.20230601122257-d3e47350b348
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
||||
github.com/ClarkThan/ahocorasick v0.0.0-20230220142845-f237b6348b3e
|
||||
|
|
@ -36,7 +36,7 @@ require (
|
|||
github.com/json-iterator/go v1.1.12
|
||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible
|
||||
github.com/mitchellh/go-ps v1.0.0
|
||||
github.com/mssola/user_agent v0.6.0
|
||||
github.com/mssola/useragent v1.0.0
|
||||
github.com/olahol/melody v1.1.3
|
||||
github.com/open-spaced-repetition/go-fsrs v0.1.1
|
||||
github.com/panjf2000/ants/v2 v2.7.4
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXS
|
|||
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/88250/gulu v1.2.3-0.20230501031728-4d62370997cd h1:PgbmnoTqfVbYyhUljovnAz6l/oWPlbM1d5yrkVDHO1w=
|
||||
github.com/88250/gulu v1.2.3-0.20230501031728-4d62370997cd/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=
|
||||
github.com/88250/lute v1.7.6-0.20230528141918-0435fd1d81f0 h1:M3kT6G/+CAkYjytDesKE3fGM5/HYDzJGT6oR/mD41KQ=
|
||||
github.com/88250/lute v1.7.6-0.20230528141918-0435fd1d81f0/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
|
||||
github.com/88250/lute v1.7.6-0.20230601122257-d3e47350b348 h1:hozOX6EnSiOkf93eWdbVXKHL6fz7NqOjqT2cme0t7sY=
|
||||
github.com/88250/lute v1.7.6-0.20230601122257-d3e47350b348/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
||||
|
|
@ -220,8 +220,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
|
|||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/mssola/user_agent v0.6.0 h1:uwPR4rtWlCHRFyyP9u2KOV0u8iQXmS7Z7feTrstQwk4=
|
||||
github.com/mssola/user_agent v0.6.0/go.mod h1:TTPno8LPY3wAIEKRpAtkdMT0f8SE24pLRGPahjCH4uw=
|
||||
github.com/mssola/useragent v1.0.0 h1:WRlDpXyxHDNfvZaPEut5Biveq86Ze4o4EMffyMxmH5o=
|
||||
github.com/mssola/useragent v1.0.0/go.mod h1:hz9Cqz4RXusgg1EdI4Al0INR62kP7aPSRNHnpU+b85Y=
|
||||
github.com/olahol/melody v1.1.3 h1:7Eo8egmejdrhdCM64uPgWj7NLSAVKl7Iv9NloFlzb60=
|
||||
github.com/olahol/melody v1.1.3/go.mod h1:GgkTl6Y7yWj/HtfD48Q5vLKPVoZOH+Qqgfa7CvJgJM4=
|
||||
github.com/onsi/ginkgo/v2 v2.9.7 h1:06xGQy5www2oN160RtEZoTvnP2sPhEfePYmCDc2szss=
|
||||
|
|
|
|||
|
|
@ -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