用户库
This commit is contained in:
parent
9664a7cada
commit
8eb51f5cc4
|
@ -5,5 +5,5 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("Hello, 世界")1
|
fmt.Println("Hello, daniel")
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package file
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/b3log/wide/conf"
|
"github.com/b3log/wide/conf"
|
||||||
|
"github.com/b3log/wide/session"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -13,9 +14,17 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetFiles(w http.ResponseWriter, r *http.Request) {
|
func GetFiles(w http.ResponseWriter, r *http.Request) {
|
||||||
|
session, _ := session.Store.Get(r, "wide-session")
|
||||||
|
|
||||||
|
username := session.Values["name"].(string)
|
||||||
|
|
||||||
|
glog.Info(username)
|
||||||
|
|
||||||
|
userRepos := strings.Replace(conf.Wide.UserRepos, "{user}", username, -1)
|
||||||
|
|
||||||
data := map[string]interface{}{"succ": true}
|
data := map[string]interface{}{"succ": true}
|
||||||
|
|
||||||
root := FileNode{"projects", conf.Wide.Repos, "d", []*FileNode{}}
|
root := FileNode{"projects", userRepos, "d", []*FileNode{}}
|
||||||
fileInfo, _ := os.Lstat(conf.Wide.Repos)
|
fileInfo, _ := os.Lstat(conf.Wide.Repos)
|
||||||
|
|
||||||
walk(conf.Wide.Repos, fileInfo, &root)
|
walk(conf.Wide.Repos, fileInfo, &root)
|
||||||
|
|
Loading…
Reference in New Issue