Skip to content

Commit

Permalink
update doc to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Sep 25, 2018
1 parent 65bb5c6 commit c3218a1
Show file tree
Hide file tree
Showing 135 changed files with 9,006 additions and 4,292 deletions.
6 changes: 4 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
94 changes: 0 additions & 94 deletions Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions Godeps/Readme

This file was deleted.

87 changes: 64 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -156,11 +171,11 @@ This is used for server on which https is enabled. default use <https://plistpro
Test if proxy works:

```sh
$ http POST https://proxyhost.com/plist < app.plist
$ http POST https://someproxyhost.com/plist < app.plist
{
"key": "18f99211"
}
$ http GET https://proxyhost.com/plist/18f99211
$ http GET https://someproxyhost.com/plist/18f99211
# show the app.plist content
```

Expand All @@ -175,6 +190,29 @@ $ curl -F [email protected] -F token=12312jlkjafs localhost:8000/somedir
{"destination":"somedir/foo.txt","success":true}
```

### Deploy with nginx
Recommended configuration, assume your gohttpserver listening on `127.0.0.1:8200`

```
server {
listen 80;
server_name your-domain-name.com;
location / {
proxy_pass http://127.0.0.1:8200; # here need to change
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0; # disable upload limit
}
}
```

Refs: <http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size>

## FAQ
- [How to generate self signed certificate with openssl](http://stackoverflow.com/questions/10175812/how-to-create-a-self-signed-certificate-with-openssl)

Expand All @@ -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

Expand Down
17 changes: 9 additions & 8 deletions assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@
</a>
</li>
[[if eq .AuthType "openid"]]
<li class="hidden-xs">
<a href="/-/logout" v-if="user.email">
<span v-text="user.name"></span>
<span class="glyphicon glyphicon-indent-left"></span>
<template v-if="!user.email">
<a href="/-/login" class="btn btn-sm btn-default navbar-btn">
Sign in <span class="glyphicon glyphicon-user"></span>
</a>
<a href="/-/login" v-else>
Login
<span class="glyphicon glyphicon-user"></span>
</template>
<template v-else>
<a href="/-/logout" class="btn btn-sm btn-default navbar-btn">
<span v-text="user.name"></span>
<i class="fa fa-sign-out"></i>
</a>
</li>
</template>
[[end]]
</ul>
<form class="navbar-form navbar-right">
Expand Down
2 changes: 1 addition & 1 deletion httpstaticserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func parseApkInfo(path string) (ai *ApkInfo) {
return
}
ai = &ApkInfo{}
ai.MainActivity, _ = apkf.MainAcitivty()
ai.MainActivity, _ = apkf.MainActivity()
ai.PackageName = apkf.PackageName()
ai.Version.Code = apkf.Manifest().VersionCode
ai.Version.Name = apkf.Manifest().VersionName
Expand Down
Loading

0 comments on commit c3218a1

Please sign in to comment.