diff --git a/cmd/miner-proxy/main.go b/cmd/miner-proxy/main.go index bce5b42..0366076 100644 --- a/cmd/miner-proxy/main.go +++ b/cmd/miner-proxy/main.go @@ -93,10 +93,23 @@ func (p *proxyService) startHttpServer() { app := gin.New() app.Use(gin.Recovery(), middleware.Cors()) + skipAuthPaths := []string{ + "/download/", + } + if p.args.String("p") != "" { - app.Use(gin.BasicAuth(gin.Accounts{ + middlewareFunc := gin.BasicAuth(gin.Accounts{ "admin": p.args.String("p"), - })) + }) + app.Use(func(ctx *gin.Context) { + for _, v := range skipAuthPaths { + if strings.HasPrefix(ctx.Request.URL.Path, v) { + return + } + } + middlewareFunc(ctx) + return + }) } port := strings.Split(p.args.String("l"), ":")[1] diff --git a/docs/index.html b/docs/index.html index 19c07a2..3ac0c45 100644 --- a/docs/index.html +++ b/docs/index.html @@ -232,7 +232,9 @@
${count}. 复制命令, 并在机器上运行 chmod +x ./miner-proxy_${params.client_system_type}_${params.client_system_struct}
`)
let cmd = `./miner-proxy_${params.client_system_type}_${params.client_system_struct} -l :${params.port} -a :${params.web_port} -k "${params.password}"`
if (params.client_run_type === "service"){
- cmd = `sudo su && ${cmd} install`
+ count++
+ alert_text.append(`
${count}. 复制命令, 并在机器上运行 sudo su
并输入密码, 如果已经是root用户则不需要输入`)
+ cmd = `${cmd} install`
}
if (params.client_run_type === "backend"){
cmd = `nohup ${cmd} > miner.log 2>& 1&`