This commit is contained in:
Liang Ding 2014-08-31 13:31:26 +08:00
parent 96df2619b9
commit a47b02db66
18 changed files with 19 additions and 3 deletions

View File

@ -12,6 +12,10 @@ import (
"strings" "strings"
) )
type user struct {
Name string
}
type conf struct { type conf struct {
Server string Server string
StaticServer string StaticServer string
@ -24,6 +28,7 @@ type conf struct {
RuntimeMode string RuntimeMode string
Repos string Repos string
UserRepos string UserRepos string
Users []user
} }
var Wide conf var Wide conf

View File

@ -9,5 +9,10 @@
"StaticPath": "", "StaticPath": "",
"RuntimeMode": "dev", "RuntimeMode": "dev",
"Repos": "{pwd}/data/repos/src", "Repos": "{pwd}/data/repos/src",
"UserRepos": "{pwd}/data/user_repos/{user}/src" "UserRepos": "{pwd}/data/user_repos/{user}/src",
"Users": [{
"Name": "daniel"
}, {
"Name": "vanessa"
}]
} }

View File

@ -5,5 +5,5 @@ import (
) )
func main() { func main() {
fmt.Println("Hello, 世界")1 fmt.Println("Hello, 世界")
} }

Binary file not shown.

View File

@ -21,6 +21,11 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
session, _ := session.Store.Get(r, "wide-session") session, _ := session.Store.Get(r, "wide-session")
if session.IsNew { if session.IsNew {
// TODO: 以 daniel 作为用户登录
name := conf.Wide.Users[0].Name
glog.Infof("[%s] logged in", name)
session.Values["name"] = name
session.Values["id"] = strconv.Itoa(rand.Int()) session.Values["id"] = strconv.Itoa(rand.Int())
} }

View File

@ -73,6 +73,7 @@ ul {
} }
.shell { .shell {
display: none;
float: right; float: right;
width: 49% width: 49%
} }