Fix Login
This commit is contained in:
9
main.go
9
main.go
@@ -402,10 +402,12 @@ func (a *App) auth(next http.Handler) http.Handler {
|
||||
r.Header.Get("X-API-Token"),
|
||||
r.Header.Get("X-Bridge-Token"),
|
||||
r.Header.Get("X-Auth-Token"),
|
||||
r.Header.Get("X-Bridge-Password"),
|
||||
bearer,
|
||||
}
|
||||
for _, tok := range staticTokens {
|
||||
if strings.TrimSpace(tok) != "" && strings.TrimSpace(tok) == a.cfg.Token {
|
||||
tok = strings.TrimSpace(tok)
|
||||
if tok != "" && (tok == a.cfg.Token || tok == a.cfg.Password) {
|
||||
a.learnPanelFromRequest(r)
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
@@ -561,7 +563,7 @@ func (a *App) pushOnlineSnapshot() {
|
||||
"sent_at": time.Now().Format(time.RFC3339),
|
||||
}
|
||||
b, _ := json.Marshal(body)
|
||||
endpoint := panelURL + "/api/bridge_onlines.php"
|
||||
endpoint := panelURL + "/brigdge_onlines"
|
||||
req, err := http.NewRequest(http.MethodPost, endpoint, bytes.NewReader(b))
|
||||
if err != nil {
|
||||
return
|
||||
@@ -573,7 +575,8 @@ func (a *App) pushOnlineSnapshot() {
|
||||
req.Header.Set("Senha", a.cfg.Password)
|
||||
req.Header.Set("X-API-Token", a.cfg.Token)
|
||||
req.Header.Set("X-Bridge-Password", a.cfg.Password)
|
||||
client := &http.Client{Timeout: 15 * time.Second}
|
||||
req.Header.Set("Authorization", "Bearer "+a.cfg.Token)
|
||||
client := &http.Client{Timeout: 60 * time.Second}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Printf("online push failed: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user