This commit is contained in:
parent
d19698a42e
commit
2c3ee7ded4
|
@ -30,7 +30,7 @@ type snippet struct {
|
|||
|
||||
// 建立编辑器通道.
|
||||
func WSHandler(w http.ResponseWriter, r *http.Request) {
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
sid := session.Values["id"].(string)
|
||||
|
||||
editorWS[sid], _ = websocket.Upgrade(w, r, nil, 1024, 1024)
|
||||
|
@ -99,7 +99,7 @@ func AutocompleteHandler(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
username := session.Values["username"].(string)
|
||||
|
||||
path := args["path"].(string)
|
||||
|
@ -174,7 +174,7 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) {
|
|||
data := map[string]interface{}{"succ": true}
|
||||
defer util.RetJSON(w, r, data)
|
||||
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
username := session.Values["username"].(string)
|
||||
|
||||
decoder := json.NewDecoder(r.Body)
|
||||
|
@ -255,7 +255,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
|
|||
data := map[string]interface{}{"succ": true}
|
||||
defer util.RetJSON(w, r, data)
|
||||
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
username := session.Values["username"].(string)
|
||||
|
||||
decoder := json.NewDecoder(r.Body)
|
||||
|
|
|
@ -23,7 +23,7 @@ func GetFiles(w http.ResponseWriter, r *http.Request) {
|
|||
data := map[string]interface{}{"succ": true}
|
||||
defer util.RetJSON(w, r, data)
|
||||
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
|
||||
username := session.Values["username"].(string)
|
||||
userSrc := conf.Wide.GetUserWorkspace(username) + string(os.PathSeparator) + "src"
|
||||
|
|
2
main.go
2
main.go
|
@ -47,7 +47,7 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
|
|||
model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(r), "locale": i18n.GetLocale(r),
|
||||
"session": wideSession}
|
||||
|
||||
httpSession, _ := user.Session.Get(r, "wide-session")
|
||||
httpSession, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
|
||||
if httpSession.IsNew {
|
||||
// TODO: 写死以 admin 作为用户登录
|
||||
|
|
|
@ -67,7 +67,7 @@ func event2Notification(e *event.Event) {
|
|||
|
||||
// 建立通知通道.
|
||||
func WSHandler(w http.ResponseWriter, r *http.Request) {
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
sid := session.Values["id"].(string)
|
||||
|
||||
conn, _ := websocket.Upgrade(w, r, nil, 1024, 1024)
|
||||
|
|
|
@ -26,7 +26,7 @@ var outputWS = map[string]*util.WSChannel{}
|
|||
|
||||
// 建立输出通道.
|
||||
func WSHandler(w http.ResponseWriter, r *http.Request) {
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
sid := session.Values["id"].(string)
|
||||
|
||||
conn, _ := websocket.Upgrade(w, r, nil, 1024, 1024)
|
||||
|
@ -45,7 +45,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
|||
data := map[string]interface{}{"succ": true}
|
||||
defer util.RetJSON(w, r, data)
|
||||
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
sid := session.Values["id"].(string)
|
||||
|
||||
decoder := json.NewDecoder(r.Body)
|
||||
|
@ -150,7 +150,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
|||
data := map[string]interface{}{"succ": true}
|
||||
defer util.RetJSON(w, r, data)
|
||||
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
sid := session.Values["id"].(string)
|
||||
username := session.Values["username"].(string)
|
||||
|
||||
|
@ -314,7 +314,7 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) {
|
|||
data := map[string]interface{}{"succ": true}
|
||||
defer util.RetJSON(w, r, data)
|
||||
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
sid := session.Values["id"].(string)
|
||||
username := session.Values["username"].(string)
|
||||
|
||||
|
@ -439,7 +439,7 @@ func GoGetHandler(w http.ResponseWriter, r *http.Request) {
|
|||
data := map[string]interface{}{"succ": true}
|
||||
defer util.RetJSON(w, r, data)
|
||||
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
sid := session.Values["id"].(string)
|
||||
username := session.Values["username"].(string)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(r), "locale": i18n.GetLocale(r)}
|
||||
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
|
||||
if session.IsNew {
|
||||
// TODO: 写死以 admin 作为用户登录
|
||||
|
@ -60,7 +60,7 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
// 建立 Shell 通道.
|
||||
func WSHandler(w http.ResponseWriter, r *http.Request) {
|
||||
session, _ := user.Session.Get(r, "wide-session")
|
||||
session, _ := user.HTTPSession.Get(r, "wide-session")
|
||||
username := session.Values["username"].(string)
|
||||
sid := session.Values["id"].(string)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ const (
|
|||
)
|
||||
|
||||
// 用户 HTTP 会话,用于验证登录.
|
||||
var Session = sessions.NewCookieStore([]byte("BEYOND"))
|
||||
var HTTPSession = sessions.NewCookieStore([]byte("BEYOND"))
|
||||
|
||||
// Wide 会话,对应一个浏览器 tab.
|
||||
type WideSession struct {
|
||||
|
|
|
@ -48,7 +48,7 @@ func InitGitRepos(w http.ResponseWriter, r *http.Request) {
|
|||
data := map[string]interface{}{"succ": true}
|
||||
defer util.RetJSON(w, r, data)
|
||||
|
||||
session, _ := Session.Get(r, "wide-session")
|
||||
session, _ := HTTPSession.Get(r, "wide-session")
|
||||
|
||||
username := session.Values["username"].(string)
|
||||
userRepos := conf.Wide.GetUserWorkspace(username) + string(os.PathSeparator) + "src"
|
||||
|
|
Loading…
Reference in New Issue