Skip to content

Commit

Permalink
change /-/json/ to /?json=true
Browse files Browse the repository at this point in the history
  • Loading branch information
hzsunshx committed Jan 24, 2019
1 parent e0ced3f commit 0fdd7d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ function loadFileList(pathname) {
// console.log("load filelist:", pathname)
if (getQueryString("raw") !== "false") { // not a file preview
$.ajax({
url: pathJoin(["/-/json", pathname]),
url: pathname + "?json=true",
dataType: "json",
cache: false,
success: function (res) {
Expand Down
5 changes: 5 additions & 0 deletions httpstaticserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ func (s *HTTPStaticServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func (s *HTTPStaticServer) hIndex(w http.ResponseWriter, r *http.Request) {
path := mux.Vars(r)["path"]
relPath := filepath.Join(s.Root, path)
if r.FormValue("json") == "true" {
s.hJSONList(w, r)
return
}

log.Println("GET", path, relPath)
if r.FormValue("raw") == "false" || isDir(relPath) {
if r.Method == "HEAD" {
Expand Down

0 comments on commit 0fdd7d5

Please sign in to comment.