mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 改进多工作空间鉴权
This commit is contained in:
parent
59bd919b0c
commit
4e9e111ee7
4 changed files with 33 additions and 11 deletions
|
|
@ -30,6 +30,10 @@ func NeedCaptcha() bool {
|
|||
|
||||
// SessionData represents the session.
|
||||
type SessionData struct {
|
||||
Workspaces map[string]*WorkspaceSession // <WorkspacePath, WorkspaceSession>
|
||||
}
|
||||
|
||||
type WorkspaceSession struct {
|
||||
AccessAuthCode string
|
||||
Captcha string
|
||||
}
|
||||
|
|
@ -63,3 +67,16 @@ func GetSession(c *gin.Context) *SessionData {
|
|||
c.Set("session", ret)
|
||||
return ret
|
||||
}
|
||||
|
||||
func GetWorkspaceSession(session *SessionData) (ret *WorkspaceSession) {
|
||||
ret = &WorkspaceSession{}
|
||||
if nil == session.Workspaces {
|
||||
session.Workspaces = map[string]*WorkspaceSession{}
|
||||
}
|
||||
ret = session.Workspaces[WorkspaceDir]
|
||||
if nil == ret {
|
||||
ret = &WorkspaceSession{}
|
||||
session.Workspaces[WorkspaceDir] = ret
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue