Go to file
2017-09-11 12:59:02 +08:00
Godeps sync to new androidbinary lib 2017-06-01 17:00:23 +08:00
res fix js error 2017-05-22 23:00:40 +08:00
scripts add plist proxy 2016-08-01 10:24:06 +08:00
testdata fix #8 2016-12-22 14:42:24 +08:00
vendor sync to new androidbinary lib 2017-06-01 17:00:23 +08:00
.fsw.yml support .ghs.yml add google analytics 2016-08-02 13:34:02 +08:00
.gitignore update vendor 2016-07-28 16:30:39 +08:00
.goreleaser.yml add travis and goreleaser 2017-09-11 12:59:02 +08:00
.travis.yml add travis and goreleaser 2017-09-11 12:59:02 +08:00
build.sh fix when EX_LDFLAGS not null 2016-08-04 09:46:24 +08:00
httpstaticserver.go return json response when upload 2017-06-14 23:06:24 +08:00
ipa.go add ipa qrcode generate support 2016-07-28 15:24:41 +08:00
LICENSE Initial commit 2016-07-21 16:41:10 +08:00
main.go quick hot fix androidbinary panic bug 2017-05-17 14:59:32 +08:00
openid-login.go add openid support2 2016-12-22 11:46:29 +08:00
Procfile fix procfile 2016-07-30 10:47:40 +08:00
README.md update doc 2017-08-31 23:35:42 +08:00
res.go add ipa qrcode generate support 2016-07-28 15:24:41 +08:00
res_bindata.go add ipa qrcode generate support 2016-07-28 15:24:41 +08:00
res_nobindata.go fix tests 2016-07-30 09:31:00 +08:00
utils.go remove some useless code 2016-08-06 22:25:08 +08:00
utils_test.go fix tests 2016-07-30 09:31:00 +08:00
zip.go add ipa qrcode generate support 2016-07-28 15:24:41 +08:00
zip_test.go fix tests 2016-07-30 09:31:00 +08:00

gohttpserver

Build Status

  • Goal: Make the best HTTP File Server.
  • Features: Human-friendly UI, file uploading support, direct QR-code generation for Apple & Android install package.

Demo site

  • 目标: 做最好的HTTP文件服务器
  • 功能: 人性化的UI体验文件的上传支持安卓和苹果安装包的二维码直接生成。

Binaries can be downloaded from this repo releases

Notes

If using go1.5, ensure you set GO15VENDOREXPERIMENT=1

Screenshots

screen

Features

  1. Support QRCode code generate
  2. Breadcrumb path quick change
  3. All assets package to Standalone binary
  4. Different file type different icon
  5. Support show or hide hidden files
  6. Upload support (for security reason, you need enabled it by option --upload)
  7. README.md preview
  8. HTTP Basic Auth
  9. Partial reload pages when directory change
  10. When only one dir under dir, path will combine two together
  11. Directory zip download
  12. Apple ipa auto generate .plist file, qrcode can be recognized by iphone (Require https)
  13. Plist proxy
  14. Download count statistics
  15. CORS enabled
  16. Offline download
  17. Code file preview
  18. Edit file support
  19. Global file search
  20. Hidden work download and qrcode in small screen
  21. Theme select support
  22. OK to working behide Nginx
  23. .ghs.yml support (like .htaccess)
  24. Calculate md5sum and sha
  25. Folder upload
  26. Support sort by size or modified time
  27. Add version info into index page
  28. Add api /-/info/some.(apk|ipa) to get detail info
  29. Add api /-/apk/info/some.apk to get android package info
  30. Auto tag version
  31. Custom title support
  32. Support setting from conf file
  33. Quick copy download link
  34. Show folder size

Installation

go get -v github.com/codeskyblue/gohttpserver
cd $GOPATH/src/github.com/codeskyblue/gohttpserver
go build && ./gohttpserver

Usage

Listen on port 8000 of all interfaces, and enable file uploading.

./gohttpserver -r ./ --addr :8000 --upload

Authentication options

  • Enable basic http authentication

    $ gohttpserver --auth-type http --auth-http username:password
    
  • Use openid auth

    $ 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.

Advanced usage

Add access rule by creating a .ghs.yml file under a sub-directory. An example:

---
upload: false
delete: false
users:
- email: "codeskyblue@codeskyblue.com"
  delete: true
  upload: true

In this case, if openid auth is enabled and user "codeskyblue@codeskyblue.com" has logged in, he/she can delete/upload files under the directory where the .ghs.yml file exits.

For example, in the following directory hierarchy, users can delete/uploade files in directory foo, but he/she cannot do this in directory bar.

root -
  |-- foo
  |    |-- .ghs.yml
  |    `-- world.txt 
  `-- bar
       `-- hello.txt

User can specify config file name with --conf, see example config.yml.

To specify which files is hidden and which file is visible, add the following lines to .ghs.yml

accessTables:
- regex: block.file
  allow: false
- regex: visual.file
  allow: true

ipa plist proxy

This is used for server on which https is enabled. default use https://plistproxy.herokuapp.com/plist

./gohttpserver --plistproxy=https://someproxyhost.com/

Test if proxy works:

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

Upload with CURL

For example, upload a file named foo.txt to directory somedir

$ curl -F file=@foo.txt localhost:8000/somedir

FAQ

How the query is formated

The search query follows common format rules just like Google. Keywords are seperated with space(s), keywords with prefix - will be excluded in search results.

  1. hello world means must contains hello and world
  2. hello -world means must contains hello but not contains world

Developer Guide

Depdencies are managed by godep

go get -v github.com/tools/godep
go get github.com/jteeuwen/go-bindata/...
go get github.com/elazarl/go-bindata-assetfs/...

Theme are all defined in res/themes directory. Now only two themes are available, "black" and "green".

How to build single binary release

go-bindata-assetfs -tags bindata res/...
go build -tags bindata

Reference Web sites

Go Libraries

History

The old version is hosted at https://github.com/codeskyblue/gohttp

LICENSE

This project is licensed under MIT.