This commit is contained in:
parent
96df2619b9
commit
a47b02db66
|
@ -12,6 +12,10 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
type user struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
type conf struct {
|
||||
Server string
|
||||
StaticServer string
|
||||
|
@ -24,6 +28,7 @@ type conf struct {
|
|||
RuntimeMode string
|
||||
Repos string
|
||||
UserRepos string
|
||||
Users []user
|
||||
}
|
||||
|
||||
var Wide conf
|
||||
|
|
|
@ -9,5 +9,10 @@
|
|||
"StaticPath": "",
|
||||
"RuntimeMode": "dev",
|
||||
"Repos": "{pwd}/data/repos/src",
|
||||
"UserRepos": "{pwd}/data/user_repos/{user}/src"
|
||||
"UserRepos": "{pwd}/data/user_repos/{user}/src",
|
||||
"Users": [{
|
||||
"Name": "daniel"
|
||||
}, {
|
||||
"Name": "vanessa"
|
||||
}]
|
||||
}
|
||||
|
|
|
@ -5,5 +5,5 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello, 世界")1
|
||||
fmt.Println("Hello, 世界")
|
||||
}
|
Binary file not shown.
5
main.go
5
main.go
|
@ -21,6 +21,11 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
|
|||
session, _ := session.Store.Get(r, "wide-session")
|
||||
|
||||
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())
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ ul {
|
|||
}
|
||||
|
||||
.shell {
|
||||
display: none;
|
||||
float: right;
|
||||
width: 49%
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
<div>
|
||||
<textarea id="output" class="output" rows="7"></textarea>
|
||||
|
||||
|
||||
<div class="shell">
|
||||
<div>
|
||||
<input id="shellInput" class="shellInput" placeholder=" Command...." />
|
||||
|
|
Loading…
Reference in New Issue