diff --git a/conf/wide.go b/conf/wide.go index 17b4440..61221ba 100644 --- a/conf/wide.go +++ b/conf/wide.go @@ -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 diff --git a/conf/wide.json b/conf/wide.json index 0fb58e3..af4f9d6 100644 --- a/conf/wide.json +++ b/conf/wide.json @@ -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" + }] } diff --git a/data/repos/src/hello/main - 副本 (10).go b/data/repos/src/hello/main1.go similarity index 100% rename from data/repos/src/hello/main - 副本 (10).go rename to data/repos/src/hello/main1.go diff --git a/data/repos/src/hello/main - 副本 (11).go b/data/repos/src/hello/main10.go similarity index 100% rename from data/repos/src/hello/main - 副本 (11).go rename to data/repos/src/hello/main10.go diff --git a/data/repos/src/hello/main - 副本 (12).go b/data/repos/src/hello/main11.go similarity index 100% rename from data/repos/src/hello/main - 副本 (12).go rename to data/repos/src/hello/main11.go diff --git a/data/repos/src/hello/main - 副本 (2).go b/data/repos/src/hello/main12.go similarity index 100% rename from data/repos/src/hello/main - 副本 (2).go rename to data/repos/src/hello/main12.go diff --git a/data/repos/src/hello/main - 副本 (3).go b/data/repos/src/hello/main2.go similarity index 100% rename from data/repos/src/hello/main - 副本 (3).go rename to data/repos/src/hello/main2.go diff --git a/data/repos/src/hello/main - 副本 (4).go b/data/repos/src/hello/main3.go similarity index 100% rename from data/repos/src/hello/main - 副本 (4).go rename to data/repos/src/hello/main3.go diff --git a/data/repos/src/hello/main - 副本 (5).go b/data/repos/src/hello/main4.go similarity index 100% rename from data/repos/src/hello/main - 副本 (5).go rename to data/repos/src/hello/main4.go diff --git a/data/repos/src/hello/main - 副本 (6).go b/data/repos/src/hello/main5.go similarity index 100% rename from data/repos/src/hello/main - 副本 (6).go rename to data/repos/src/hello/main5.go diff --git a/data/repos/src/hello/main - 副本 (7).go b/data/repos/src/hello/main6.go similarity index 100% rename from data/repos/src/hello/main - 副本 (7).go rename to data/repos/src/hello/main6.go diff --git a/data/repos/src/hello/main - 副本 (8).go b/data/repos/src/hello/main7.go similarity index 100% rename from data/repos/src/hello/main - 副本 (8).go rename to data/repos/src/hello/main7.go diff --git a/data/repos/src/hello/main - 副本 (9).go b/data/repos/src/hello/main8.go similarity index 100% rename from data/repos/src/hello/main - 副本 (9).go rename to data/repos/src/hello/main8.go diff --git a/data/repos/src/hello/main - 副本.go b/data/repos/src/hello/main9.go similarity index 61% rename from data/repos/src/hello/main - 副本.go rename to data/repos/src/hello/main9.go index ae3e566..4b8553a 100644 --- a/data/repos/src/hello/main - 副本.go +++ b/data/repos/src/hello/main9.go @@ -5,5 +5,5 @@ import ( ) func main() { - fmt.Println("Hello, 世界")1 + fmt.Println("Hello, 世界") } diff --git a/data/repos/src/time/main.exe b/data/repos/src/time/main.exe new file mode 100644 index 0000000..5d1fab9 Binary files /dev/null and b/data/repos/src/time/main.exe differ diff --git a/main.go b/main.go index 428fe20..135badf 100644 --- a/main.go +++ b/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()) } diff --git a/static/css/base.css b/static/css/base.css index 256000d..d27fdf5 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -73,6 +73,7 @@ ul { } .shell { + display: none; float: right; width: 49% } diff --git a/templates/index.html b/templates/index.html index 92eaeed..8f7519c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -52,7 +52,7 @@
- +