codeskyblue / gohttpserver Goto Github PK
View Code? Open in Web Editor NEWThe best HTTP Static File Server, write with golang+vue
License: MIT License
The best HTTP Static File Server, write with golang+vue
License: MIT License
想要在當前運作目錄底下,隱藏一些必須要存在,但是不想讓user看到的目錄
請問是否有參數可以隱藏這些目錄?
由于只有一个域名abc.example.com,我想让 http://abc.example.com/fileserver 来指向这个gohttpserver,请问gohttpserver需要做什么修改来支持?谢谢。
Lots of friends have same issue, I spend 5 hours to figure it out, just share with friends here.
// run it as background
// create file, save to where you call gohttpserver folder.
// create config file
// use nano to edit, or you can create it at windows, use winSCP to copy over
nano supervisord.conf
// type content
[program:supervisord] command=./gohttpserver -r ./fileRestAPI --cors
If you want to save the changes you've made, press Ctrl + O.
To exit nano, type Ctrl + X. If you ask nano to exit from a modified file, it will ask you if you want to save it.
Just press N in case you don't, or Y in case you do. It will then ask you for a filename.
Just type it in and press Enter.
//start supervisord
supervisord -c supervisord.conf
//stop supervisord
// first switch to root user
sudo su
cd /home/hoogw/gowork/src/github.com/codeskyblue/gohttpserver
https://stackoverflow.com/questions/14479894/stopping-supervisord-shut-down
ps -ef | grep supervisord
kill -s SIGTERM 15923
( only one number a line , line with 2 number are NOT right)
http://supervisord.org/running.html#signals
When you do this:
ps -ef | grep supervisord
//You will get some pid of supervisord just like these
//root 2641 12938 0 04:52 pts/1 00:00:00 grep --color=auto supervisord
//root 29646 1 0 04:45 ? 00:00:00 /usr/bin/python /usr/local/bin/supervisord
if you get output like that, your pid is the second one ( with only one number, it will not change if you run again again, but other number are changing. then if you want to shut down your supervisord you can do this
kill -s SIGTERM 29646
Here is full supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
;logfile=/var/log/supervisord/supervisord.log ; supervisord log file
;logfile_maxbytes=50MB ; maximum size of logfile before rotation
;logfile_backups=10 ; number of backed up logfiles
;loglevel=error ; info, debug, warn, trace
;pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
minfds=1024 ; number of startup file descriptors
minprocs=200 ; number of process descriptors
user=root ; default user
;childlogdir=/var/log/supervisord/ ; where child log files will
[program:fileRestAPI]
command=./gohttpserver -r ./fileRestAPI --cors
;command=gohttpserver -r ./fileRestAPI --port 8000 --upload --delete --cors
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
首先感谢作者分享这么好用的文件服务器,最近有需要上传较大的文件,请问如何解除上传1GB大小的限制?
修正res/js/index.js
genQrcode: function(text, title) {
var urlPath = this.genInstallURL(text);
var str = urlPath;
var arr = str.split("/");
arr[arr.length - 1] = encodeURI(arr[arr.length - 1]);
var dir = arr.join("/");
$("#qrcode-title").html(title || text);
$("#qrcode-link").attr("href", urlPath);
$('#qrcodeCanvas').empty().qrcode({
text: dir
});
$("#qrcode-modal").modal("show");
},
RT.
New feature requested.
我的系统是windows 2008 R2
样式文件不能正常浏览,会提示下载。
.\main.go:140:8: undefined: NewHTTPStaticServer
.\main.go:170:3: undefined: handleOpenID
怎么打开看看效果
localhost:8000? localhost:8000/testdata?
空白和404
Could you provide some releases for windows, linux, mac or android & ios? And also, you can provide a qr code to help mobile phone to visit your file server.
增加分享功能,分享就生成一个临时的带有token(有有效期)的url。也可以设置永久token分享。随时可以取消分享。并且提供curl的方式来直接用。
- foo/
- bar/
`-- .uploadable
匿名访客用户只能查看和下载,
通过登录鉴权的用户可以上传和删除.
This will help to make the dependencies and code a lot cleaner.
<button class="btn btn-xs btn-default" onclick="history.back()">
Back <i class="fa fa-arrow-left"></i>
</button>
我没有找到back函数。谢谢
腾讯跟微博的都是OAuth2这种,好像并不兼容openID。还有什么其他的供应商吗?
感謝您提供的這個程式,非常簡單好用
不過我在嘗試著用 supervisor去啟動這個程式發生問題
2018/10/18 08:25:25 httpstaticserver.go:111: GET /home/neonexus/center_yaml
2018/10/18 08:25:25 httpstaticserver.go:749: Hot load index.html
2018/10/18 08:25:25 server.go:2923: http: panic serving 192.168.11.34:43870: open assets/index.html: no such file or directory
goroutine 76 [running]:
net/http.(*conn).serve.func1(0xc420348280)
/usr/lib/go-1.10/src/net/http/server.go:1726 +0xd0
panic(0x8b0e20, 0xc4204513e0)
/usr/lib/go-1.10/src/runtime/panic.go:502 +0x229
我用底下的指令,在console下啟動沒有問題,可是丟到 supervisor 啟動就會發生上面的錯誤,找不到 assets 底下的內容?
/usr/local/bin/gohttpserver -r /home/neo/center_yaml/ --port 5000 --upload --delete --debug --auth-type http --auth-http abc:abc123
1、列表中的文件是否可以按文件夹和文件名进行排序?如:似windows的文件资源管理器中的显示。
2、文件夹内的总文件大小不正确(服务端在windows系统平台),有些显示“~ 0 B”实际文件夹内是有文件,且文件是有内容大小不为0B的。
I see your code support https, but I am not sure, how and where,
can you write more details how and where on README?
I know this is go and https question, should not be here,
but since your code already support https, your simple a few words will helps alot.
What I don't know is where to setup gcfg.Cert, gcfg.Key?
I have 2 files "public.cert" and "private.key"
where should I put these 2 files for https,
And does config.yml need to update?
how to connect gcfg.Cert, gcfg.Key to those 2 files?
I also try
gcfg.Cert = "./public.cert"
gcfg.Key = "./private.key"
and put those 2 files at ./ , failed.
var err error
if gcfg.Key != "" && gcfg.Cert != "" {
err = http.ListenAndServeTLS(gcfg.Addr, gcfg.Cert, gcfg.Key, nil)
} else {
err = http.ListenAndServe(gcfg.Addr, nil)
}
log.Fatal(err)
at Chrome console I saw the following error message.
Mixed Content: The page at 'https://xxx.com/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://xxx.com/folder-name/'. This request has been blocked; the content must be served over HTTPS.
Is there a way to configure the server to use a custom directory instead of /tmp for uploads?
can you make module to support cashbin,
https://github.com/casbin/casbin
It is a good authentication library for golang
user management is a MUST have feature, open-id is NOT enough, must improve
25个连接时出错,连接数太少。
请问在哪里设置最大连接数?
在本地启动服务,在根目录下点击View in Phone
之后地址是这样的http://127.0.0.1:8000/http:/127.0.0.1:8000/
is a very popular online user management and online authentication, authorization management.
It is have open-id connect supported. ......
If gohttpserver and support okta, then you do NOT need write any code for user management
like sign up, sign in, forget password, retrieve password, reset password, add a new user, assign user a role, role management, etc........ okta can do it for you.
you only need to write a middle ware to connect to okta.
This is best choice for now to add user management to gohttpserver.
可否在 Back/Hidden/Upload 这栏上加上 Create folder 的支持?
Anybody can upload? That is huge risk.
Can you add user sign up and user login?
Only logined user can upload!
Add user management is MUST have feature, for it to be useful.
Super admin can disable other user, add, delete other users.
I try to search file by file name, (NOT text contend inside file).
I want to find all file name, that have "xxxx", but nothing return.
How to use the search box on top right corner?
Can you wrote some details in READ ME, teach us how to use search function?
不是简单的授权,是实时交互的授权,可以做吗?。
https://segmentfault.com/q/1010000008885744
Is it possible add new feature as rest api?
for example:
http://localhost:8000/xxx?f=json
this url will response as a json instead of html.
` {
subfolder: {
{ folder: xxxx1},
{ folder: xxxx1}
},
file: {
{file: yyy1},
{file: yyy2}
.....
}
}`
you also can add other meta data info into this json.
Why do this, is because if you have this rest api, I can write page easy search file name(since all file name, file info are in Json format.)
I mean, you have build the website, if you add rest api for this web site, will be very useful for third party wrote apps to communicate with your site.
For example, twitter rest api, facebook rest api, flickr rest api. etc......
Any chance we can provide an official docker image ?
httpClient = HttpClients.custom().setDefaultCredentialsProvider(provider).build();
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
File file=new File(fileName);
builder.addBinaryBody("file",file,ContentType.APPLICATION_FORM_URLENCODED,file.getName());
HttpEntity reqEntity = builder.build();
httpPost = new HttpPost(serverUrl);
httpPost.setEntity(reqEntity);
response = httpClient.execute(httpPost);
I know I can upload and download file,
But how to delete a file, I just uploaded?
自己申请了个证书,然后启动的时候加上证书参数并监听443端口,浏览器直接用https加域名可以访问,但是如果直接域名访问浏览器会默认访问80端口,然后服务器只监听了443端口所以没办法自动跳转到443。能做一个https模式同时监听443和80吗?监听到80有链接就跳到443
some time, user just use special char, like &, #, @, etc.... as file name.
then failed to load those files.
Please advice a way to work around?
能详细讲讲upload和delete权限控制流程吗?谢谢
Openid half way working, be able to login into yahoo.com,
but failed when opencallback.......
google openid, does not working.
--auth-openid https://www.google.com/accounts/o8/id
// google not working
./gohttpserver -r ../../../../../fileRestAPI --cors --theme green --auth-type openid --auth-openid https://www.google.com/accounts/o8/id
yahoo works
--auth-openid https://me.yahoo.com
// yahoo
./gohttpserver -r ../../../../../fileRestAPI --conf ../../../../../fileRestAPI/config.yml --cors --theme green --auth-type openid --auth-openid https://me.yahoo.com
But, when I successfully login to yahoo.com, when opencallback to gohttpserver, failed.....
http://localhost:8000/-/openidcallback?next=https://localhost:8000/&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.return_to=http%3A%2F%2Flocalhost%3A8000%2F-%2Fopenidcallback%3Fnext%3Dhttps%3A%2F%2Flocalhost%3A8000%2F&openid.claimed_id=https%3A%2F%2Fme.yahoo.com%2Fhoogw%23d0256&openid.identity=https%3A%2F%2Fme.yahoo.com%2Fhoogw&openid.assoc_handle=iLcVVWGjabUDODayEuijpKo3jpFxkVv9JI3xrIfcq3PxxWx0Sg3Ye4d7Hnd3BChYXWANhSEYTSfCaMMuaE.V5rDxZt3kSjJvzHtxzC6Qb3MXC3hkDE8fjvwn5jFWbXWIdj4z&openid.response_nonce=2018-12-21T22%3A44%3A55ZLJJRMAiKQCrRV8GGkWoFej0IGqDKnTzG2A--&openid.signed=assoc_handle%2Cclaimed_id%2Cidentity%2Cmode%2Cns%2Cop_endpoint%2Cresponse_nonce%2Creturn_to%2Csigned%2Cpape.auth_level.nist&openid.op_endpoint=https%3A%2F%2Fopen.login.yahooapis.com%2Fopenid%2Fop%2Fauth&openid.pape.auth_level.nist=0&openid.sig=e5FBX8bstv7U9hVukR4r%2BjpDtLs%3D
I test openid-go, sample login on separate port 8080, it successfully login to yahoo.com and back.
If your project use same code as openid-go, why their sample login page work, but this login page only work half way, when opencallback, it fails.......
Can you try this
--auth-openid https://me.yahoo.com
Did you successfully login and back without error?
passport.js for node.js have 500+ authentication method, it is good.
Does go have similar module?
Or would you make the module to support passport.js ?
related commit: 0fdd7d5?w=1#diff-36f8d737c0d72482b317e9b95c615dc2R352
文件如果含有 # 會發生問題
会在当前地址后面再加文件夹名字。但是当前地址已经包含了文件夹名字了
无语了,不知道为啥传不到图,我晚上回去再传吧
Strikethrough in markdown file seemingly unsupported
I try the demon https://gohttpserver.herokuapp.com
on right top corner, search text box, I type 'readme' it only works one time.
then it stop working.
Then I try type 'image.jpg' in search box right top corner, then nothing. This file is under 'filetypes' folder, why it not find?
Can you advise, why, this happen to me?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.