From c3218a122f0e8765bd08c464dcd4c1b00aa46fbb Mon Sep 17 00:00:00 2001 From: codeskyblue Date: Tue, 25 Sep 2018 14:35:41 +0800 Subject: [PATCH] update doc to latest --- .goreleaser.yml | 6 +- Dockerfile | 3 +- Godeps/Godeps.json | 94 - Godeps/Readme | 5 - README.md | 87 +- assets/index.html | 17 +- httpstaticserver.go | 2 +- main.go | 33 +- openid-login.go | 9 +- utils.go | 18 + .../DHowett/go-plist/.gitlab-ci.yml | 39 - .../github.com/DHowett/go-plist/.travis.yml | 8 - vendor/github.com/DHowett/go-plist/README.md | 2 +- .../DHowett/go-plist/bplist_generator.go | 19 +- .../DHowett/go-plist/bplist_parser.go | 31 +- .../github.com/DHowett/go-plist/unmarshal.go | 5 +- .../DHowett/go-plist/xml_generator.go | 212 +- .../github.com/alecthomas/kingpin/.travis.yml | 4 - .../github.com/alecthomas/kingpin/README.md | 17 +- vendor/github.com/alecthomas/kingpin/app.go | 44 +- vendor/github.com/alecthomas/kingpin/args.go | 11 +- vendor/github.com/alecthomas/kingpin/doc.go | 2 +- vendor/github.com/alecthomas/kingpin/flags.go | 6 +- .../github.com/alecthomas/kingpin/global.go | 2 + vendor/github.com/alecthomas/kingpin/model.go | 16 +- .../github.com/alecthomas/kingpin/parser.go | 40 +- vendor/github.com/alecthomas/kingpin/usage.go | 8 +- .../github.com/alecthomas/kingpin/values.go | 4 + .../alecthomas/kingpin/values_generated.go | 32 +- .../codeskyblue/dockerignore/.gitignore | 26 - .../codeskyblue/go-accesslog/.gitignore | 1 - .../codeskyblue/openid-go/.travis.yml | 14 - vendor/github.com/go-yaml/yaml/.travis.yml | 9 - vendor/github.com/go-yaml/yaml/LICENSE | 208 +- vendor/github.com/go-yaml/yaml/NOTICE | 13 + vendor/github.com/go-yaml/yaml/README.md | 4 +- vendor/github.com/go-yaml/yaml/apic.go | 55 +- vendor/github.com/go-yaml/yaml/decode.go | 246 +- vendor/github.com/go-yaml/yaml/emitterc.go | 20 +- vendor/github.com/go-yaml/yaml/encode.go | 136 +- vendor/github.com/go-yaml/yaml/go.mod | 5 + vendor/github.com/go-yaml/yaml/parserc.go | 1 - vendor/github.com/go-yaml/yaml/readerc.go | 20 +- vendor/github.com/go-yaml/yaml/resolve.go | 91 +- vendor/github.com/go-yaml/yaml/scannerc.go | 40 +- vendor/github.com/go-yaml/yaml/sorter.go | 9 + vendor/github.com/go-yaml/yaml/writerc.go | 65 +- vendor/github.com/go-yaml/yaml/yaml.go | 136 +- vendor/github.com/go-yaml/yaml/yamlh.go | 32 +- vendor/github.com/goji/httpauth/.travis.yml | 22 - vendor/github.com/gorilla/context/.travis.yml | 19 - .../github.com/gorilla/handlers/.travis.yml | 18 - vendor/github.com/gorilla/handlers/README.md | 2 + vendor/github.com/gorilla/handlers/cors.go | 54 +- .../github.com/gorilla/handlers/handlers.go | 229 - .../gorilla/handlers/handlers_go18.go | 21 + .../gorilla/handlers/handlers_pre18.go | 7 + vendor/github.com/gorilla/handlers/logging.go | 252 + vendor/github.com/gorilla/mux/.travis.yml | 21 - .../github.com/gorilla/mux/ISSUE_TEMPLATE.md | 11 + vendor/github.com/gorilla/mux/README.md | 423 +- vendor/github.com/gorilla/mux/doc.go | 81 +- vendor/github.com/gorilla/mux/middleware.go | 30 + vendor/github.com/gorilla/mux/mux.go | 113 +- vendor/github.com/gorilla/mux/regexp.go | 88 +- vendor/github.com/gorilla/mux/route.go | 161 +- vendor/github.com/gorilla/mux/test_helpers.go | 19 + .../gorilla/securecookie/.travis.yml | 19 - .../github.com/gorilla/securecookie/AUTHORS | 19 + .../github.com/gorilla/securecookie/LICENSE | 2 +- .../github.com/gorilla/securecookie/README.md | 12 +- vendor/github.com/gorilla/securecookie/go.mod | 1 + .../gorilla/securecookie/securecookie.go | 6 +- .../github.com/gorilla/sessions/.travis.yml | 22 - vendor/github.com/gorilla/sessions/AUTHORS | 43 + vendor/github.com/gorilla/sessions/LICENSE | 2 +- vendor/github.com/gorilla/sessions/README.md | 72 +- vendor/github.com/gorilla/sessions/doc.go | 11 +- vendor/github.com/gorilla/sessions/go.mod | 6 + vendor/github.com/gorilla/sessions/options.go | 18 + .../gorilla/sessions/options_go111.go | 22 + .../github.com/gorilla/sessions/sessions.go | 23 +- vendor/github.com/gorilla/sessions/store.go | 3 - vendor/github.com/pkg/errors/.gitignore | 24 - vendor/github.com/pkg/errors/.travis.yml | 11 - vendor/github.com/pkg/errors/README.md | 4 +- vendor/github.com/pkg/errors/errors.go | 2 +- vendor/github.com/pkg/errors/stack.go | 51 +- .../shogo82148/androidbinary/.travis.yml | 12 - .../shogo82148/androidbinary/README.md | 2 +- .../shogo82148/androidbinary/apk/apk.go | 20 +- .../shogo82148/androidbinary/apk/apkxml.go | 73 +- .../shogo82148/androidbinary/table.go | 11 +- .../shurcooL/httpfs/vfsutil/file.go | 21 + .../shurcooL/httpfs/vfsutil/vfsutil.go | 39 + .../shurcooL/httpfs/vfsutil/walk.go | 146 + .../shurcooL/vfsgen/CONTRIBUTING.md | 10 + vendor/github.com/shurcooL/vfsgen/README.md | 178 + .../shurcooL/vfsgen/commentwriter.go | 45 + vendor/github.com/shurcooL/vfsgen/doc.go | 15 + .../github.com/shurcooL/vfsgen/generator.go | 486 ++ vendor/github.com/shurcooL/vfsgen/options.go | 45 + .../shurcooL/vfsgen/stringwriter.go | 27 + vendor/golang.org/x/net/context/context.go | 56 + .../x/net/context/ctxhttp/ctxhttp.go | 74 + .../x/net/context/ctxhttp/ctxhttp_pre17.go | 147 + vendor/golang.org/x/net/context/go17.go | 72 + vendor/golang.org/x/net/context/go19.go | 20 + vendor/golang.org/x/net/context/pre_go17.go | 300 ++ vendor/golang.org/x/net/context/pre_go19.go | 109 + vendor/golang.org/x/net/html/atom/atom.go | 2 +- vendor/golang.org/x/net/html/atom/gen.go | 138 +- vendor/golang.org/x/net/html/atom/table.go | 1474 +++--- vendor/golang.org/x/net/html/const.go | 6 +- vendor/golang.org/x/net/html/doc.go | 10 +- vendor/golang.org/x/net/html/entity.go | 4154 ++++++++--------- vendor/golang.org/x/net/html/foreign.go | 6 +- vendor/golang.org/x/net/html/node.go | 33 +- vendor/golang.org/x/net/html/parse.go | 354 +- vendor/golang.org/x/net/html/token.go | 4 +- vendor/golang.org/x/{net => oauth2}/AUTHORS | 0 vendor/golang.org/x/oauth2/CONTRIBUTING.md | 26 + .../golang.org/x/{net => oauth2}/CONTRIBUTORS | 0 vendor/golang.org/x/oauth2/LICENSE | 27 + vendor/golang.org/x/oauth2/README.md | 77 + vendor/golang.org/x/oauth2/github/github.go | 16 + .../x/oauth2/internal/client_appengine.go | 13 + vendor/golang.org/x/oauth2/internal/doc.go | 6 + vendor/golang.org/x/oauth2/internal/oauth2.go | 37 + vendor/golang.org/x/oauth2/internal/token.go | 272 ++ .../golang.org/x/oauth2/internal/transport.go | 34 + vendor/golang.org/x/oauth2/oauth2.go | 362 ++ vendor/golang.org/x/oauth2/token.go | 175 + vendor/golang.org/x/oauth2/transport.go | 144 + vendor/vendor.json | 169 + 135 files changed, 9006 insertions(+), 4292 deletions(-) delete mode 100644 Godeps/Godeps.json delete mode 100644 Godeps/Readme delete mode 100644 vendor/github.com/DHowett/go-plist/.gitlab-ci.yml delete mode 100644 vendor/github.com/DHowett/go-plist/.travis.yml delete mode 100644 vendor/github.com/alecthomas/kingpin/.travis.yml delete mode 100644 vendor/github.com/codeskyblue/dockerignore/.gitignore delete mode 100644 vendor/github.com/codeskyblue/go-accesslog/.gitignore delete mode 100644 vendor/github.com/codeskyblue/openid-go/.travis.yml delete mode 100644 vendor/github.com/go-yaml/yaml/.travis.yml create mode 100644 vendor/github.com/go-yaml/yaml/NOTICE create mode 100644 vendor/github.com/go-yaml/yaml/go.mod delete mode 100644 vendor/github.com/goji/httpauth/.travis.yml delete mode 100644 vendor/github.com/gorilla/context/.travis.yml delete mode 100644 vendor/github.com/gorilla/handlers/.travis.yml create mode 100644 vendor/github.com/gorilla/handlers/handlers_go18.go create mode 100644 vendor/github.com/gorilla/handlers/handlers_pre18.go create mode 100644 vendor/github.com/gorilla/handlers/logging.go delete mode 100644 vendor/github.com/gorilla/mux/.travis.yml create mode 100644 vendor/github.com/gorilla/mux/ISSUE_TEMPLATE.md create mode 100644 vendor/github.com/gorilla/mux/middleware.go create mode 100644 vendor/github.com/gorilla/mux/test_helpers.go delete mode 100644 vendor/github.com/gorilla/securecookie/.travis.yml create mode 100644 vendor/github.com/gorilla/securecookie/AUTHORS create mode 100644 vendor/github.com/gorilla/securecookie/go.mod delete mode 100644 vendor/github.com/gorilla/sessions/.travis.yml create mode 100644 vendor/github.com/gorilla/sessions/AUTHORS create mode 100644 vendor/github.com/gorilla/sessions/go.mod create mode 100644 vendor/github.com/gorilla/sessions/options.go create mode 100644 vendor/github.com/gorilla/sessions/options_go111.go delete mode 100644 vendor/github.com/pkg/errors/.gitignore delete mode 100644 vendor/github.com/pkg/errors/.travis.yml delete mode 100644 vendor/github.com/shogo82148/androidbinary/.travis.yml create mode 100644 vendor/github.com/shurcooL/httpfs/vfsutil/file.go create mode 100644 vendor/github.com/shurcooL/httpfs/vfsutil/vfsutil.go create mode 100644 vendor/github.com/shurcooL/httpfs/vfsutil/walk.go create mode 100644 vendor/github.com/shurcooL/vfsgen/CONTRIBUTING.md create mode 100644 vendor/github.com/shurcooL/vfsgen/README.md create mode 100644 vendor/github.com/shurcooL/vfsgen/commentwriter.go create mode 100644 vendor/github.com/shurcooL/vfsgen/doc.go create mode 100644 vendor/github.com/shurcooL/vfsgen/generator.go create mode 100644 vendor/github.com/shurcooL/vfsgen/options.go create mode 100644 vendor/github.com/shurcooL/vfsgen/stringwriter.go create mode 100644 vendor/golang.org/x/net/context/context.go create mode 100644 vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go create mode 100644 vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go create mode 100644 vendor/golang.org/x/net/context/go17.go create mode 100644 vendor/golang.org/x/net/context/go19.go create mode 100644 vendor/golang.org/x/net/context/pre_go17.go create mode 100644 vendor/golang.org/x/net/context/pre_go19.go rename vendor/golang.org/x/{net => oauth2}/AUTHORS (100%) create mode 100644 vendor/golang.org/x/oauth2/CONTRIBUTING.md rename vendor/golang.org/x/{net => oauth2}/CONTRIBUTORS (100%) create mode 100644 vendor/golang.org/x/oauth2/LICENSE create mode 100644 vendor/golang.org/x/oauth2/README.md create mode 100644 vendor/golang.org/x/oauth2/github/github.go create mode 100644 vendor/golang.org/x/oauth2/internal/client_appengine.go create mode 100644 vendor/golang.org/x/oauth2/internal/doc.go create mode 100644 vendor/golang.org/x/oauth2/internal/oauth2.go create mode 100644 vendor/golang.org/x/oauth2/internal/token.go create mode 100644 vendor/golang.org/x/oauth2/internal/transport.go create mode 100644 vendor/golang.org/x/oauth2/oauth2.go create mode 100644 vendor/golang.org/x/oauth2/token.go create mode 100644 vendor/golang.org/x/oauth2/transport.go create mode 100644 vendor/vendor.json diff --git a/.goreleaser.yml b/.goreleaser.yml index cb9ff9d..8451b5a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -17,10 +17,12 @@ builds: - "6" main: . ldflags: -s -w -X main.VERSION={{.Version}} - flags: -tags bindata + flags: -tags vfs binary: gohttpserver + hooks: + pre: go generate . archive: - format: tar.gz + format: zip name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' files: diff --git a/Dockerfile b/Dockerfile index 12fefff..e3d579f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,4 +12,5 @@ VOLUME /app/public ADD assets ./assets COPY --from=0 /go/src/github.com/codeskyblue/gohttpserver/gohttpserver . EXPOSE 8000 -CMD ["/app/gohttpserver", "--root=/app/public"] +ENTRYPOINT [ "/app/gohttpserver" ] +CMD ["--root=/app/public"] diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json deleted file mode 100644 index d0e6ac0..0000000 --- a/Godeps/Godeps.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "ImportPath": "github.com/codeskyblue/gohttpserver", - "GoVersion": "go1.9", - "GodepVersion": "v79", - "Deps": [ - { - "ImportPath": "github.com/DHowett/go-plist", - "Rev": "233df3c4f07b0c562da0e8a6fb850681ac49bb90" - }, - { - "ImportPath": "github.com/alecthomas/kingpin", - "Comment": "v2.2.0", - "Rev": "92b2733684bc5f1971162349ce098fe0d070e2a9" - }, - { - "ImportPath": "github.com/alecthomas/template", - "Rev": "a0175ee3bccc567396460bf5acd36800cb10c49c" - }, - { - "ImportPath": "github.com/alecthomas/template/parse", - "Rev": "a0175ee3bccc567396460bf5acd36800cb10c49c" - }, - { - "ImportPath": "github.com/alecthomas/units", - "Rev": "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a" - }, - { - "ImportPath": "github.com/codeskyblue/dockerignore", - "Rev": "de82dee623d9207f906d327172149cba50427a88" - }, - { - "ImportPath": "github.com/codeskyblue/go-accesslog", - "Rev": "6188d3bd9371c3caba018648c6acd9cdf805787e" - }, - { - "ImportPath": "github.com/codeskyblue/openid-go", - "Rev": "0d30842b2fb4704849cd07f6fba862a7a9f4b403" - }, - { - "ImportPath": "github.com/go-yaml/yaml", - "Rev": "e4d366fc3c7938e2958e662b4258c7a89e1f0e3e" - }, - { - "ImportPath": "github.com/goji/httpauth", - "Rev": "2da839ab0f4df05a6db5eb277995589dadbd4fb9" - }, - { - "ImportPath": "github.com/gorilla/context", - "Comment": "v1.1-7-g08b5f42", - "Rev": "08b5f424b9271eedf6f9f0ce86cb9396ed337a42" - }, - { - "ImportPath": "github.com/gorilla/handlers", - "Comment": "v1.2", - "Rev": "3a5767ca75ece5f7f1440b1d16975247f8d8b221" - }, - { - "ImportPath": "github.com/gorilla/mux", - "Comment": "v1.1-27-g757bef9", - "Rev": "757bef944d0f21880861c2dd9c871ca543023cba" - }, - { - "ImportPath": "github.com/gorilla/securecookie", - "Comment": "v1.1-5-gfa5329f", - "Rev": "fa5329f913702981df43dcb2a380bac429c810b5" - }, - { - "ImportPath": "github.com/gorilla/sessions", - "Comment": "v1.1", - "Rev": "ca9ada44574153444b00d3fd9c8559e4cc95f896" - }, - { - "ImportPath": "github.com/pkg/errors", - "Comment": "v0.8.0-1-g839d9e9", - "Rev": "839d9e913e063e28dfd0e6c7b7512793e0a48be9" - }, - { - "ImportPath": "github.com/shogo82148/androidbinary", - "Rev": "2fb750de4ec6a45853fcc5f85694eab47e1007f9" - }, - { - "ImportPath": "github.com/shogo82148/androidbinary/apk", - "Rev": "2fb750de4ec6a45853fcc5f85694eab47e1007f9" - }, - { - "ImportPath": "golang.org/x/net/html", - "Rev": "a625e3953219464fdd5611bb48bf87c927717295" - }, - { - "ImportPath": "golang.org/x/net/html/atom", - "Rev": "a625e3953219464fdd5611bb48bf87c927717295" - } - ] -} diff --git a/Godeps/Readme b/Godeps/Readme deleted file mode 100644 index 4cdaa53..0000000 --- a/Godeps/Readme +++ /dev/null @@ -1,5 +0,0 @@ -This directory tree is generated automatically by godep. - -Please do not edit. - -See https://github.com/tools/godep for more information. diff --git a/README.md b/README.md index a99fe46..8310623 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ **Binaries** can be downloaded from [this repo releases](https://github.com/codeskyblue/gohttpserver/releases/) -## Notes -If using go1.5, ensure you set GO15VENDOREXPERIMENT=1 +## Requirements +Tested with go-1.10, go-1.11 ## Screenshots ![screen](testdata/filetypes/gohttpserver.gif) @@ -61,21 +61,38 @@ cd $GOPATH/src/github.com/codeskyblue/gohttpserver go build && ./gohttpserver ``` +Or download binaries from [github releases](https://github.com/codeskyblue/gohttpserver/releases) + +## Usage +Listen on port 8000 of all interfaces, and enable file uploading. + +``` +./gohttpserver -r ./ --port 8000 --upload +``` + +Use command `gohttpserver --help` to see more usage. + ## Docker Usage share current directory + ```bash docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver codeskyblue/gohttpserver ``` -share current directory with http oauth + +Share current directory with http basic auth + ```bash -docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver codeskyblue/gohttpserver ./gohttpserver --root /app/public --auth-type http --auth-http username:password +docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver \ + codeskyblue/gohttpserver --root /app/public \ + --auth-type http --auth-http username:password ``` -## Usage -Listen on port 8000 of all interfaces, and enable file uploading. +Share current directory with openid auth. (Works only in netease company.) -``` -./gohttpserver -r ./ --addr :8000 --upload +```bash +docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver \ + codeskyblue/gohttpserver --root /app/public \ + --auth-type openid ``` ## Authentication options @@ -91,8 +108,6 @@ Listen on port 8000 of all interfaces, and enable file uploading. $ gohttpserver --auth-type openid --auth-openid https://login.example-hostname.com/openid/ ``` - The openid returns url using "http" instead of "https", but I am not planing to fix this currently. - - Enable upload ```sh @@ -156,11 +171,11 @@ This is used for server on which https is enabled. default use + ## FAQ - [How to generate self signed certificate with openssl](http://stackoverflow.com/questions/10175812/how-to-create-a-self-signed-certificate-with-openssl) @@ -185,20 +223,23 @@ The search query follows common format rules just like Google. Keywords are sepe 1. `hello -world` means must contains `hello` but not contains `world` ## Developer Guide -Depdencies are managed by godep +Depdencies are managed by [govendor](https://github.com/kardianos/govendor) -```sh -go generate . -go build -tags vfs -``` +1. Build develop version. **assets** directory must exists -Theme are all defined in [res/themes](res/themes) directory. Now only two themes are available, "black" and "green". + ```sh + go build + ./gohttpserver + ``` +2. Build single binary release + + ```sh + go generate . + go build -tags vfs + ``` + +Theme are defined in [assets/themes](assets/themes) directory. Now only two themes are available, "black" and "green". -## How to build single binary release -```sh -go-bindata-assetfs -tags bindata res/... -go build -tags bindata -``` ## Reference Web sites diff --git a/assets/index.html b/assets/index.html index 251b52b..c3aa6ca 100644 --- a/assets/index.html +++ b/assets/index.html @@ -37,16 +37,17 @@ [[if eq .AuthType "openid"]] -