mirror of
https://github.com/boringproxy/boringproxy.git
synced 2026-11-03 20:56:44 -06:00
Automatically log in after getting admin domain
This commit is contained in:
1 parent
46bb670b8f
commit
d2ad2571f5
1 file changed
+13
-1
+13
-1
@@ -224,7 +224,19 @@ func Listen() {
|
||||
}
|
||||
}
|
||||
|
||||
http.Redirect(w, r, fmt.Sprintf("https://%s", fqdn), 303)
|
||||
url := fmt.Sprintf("https://%s", fqdn)
|
||||
|
||||
// Automatically log using the first found admin token. This is safe to do here
|
||||
// because we know that retrieving the admin domain was initiating from the CLI.
|
||||
tokens := db.GetTokens()
|
||||
for token, tokenData := range tokens {
|
||||
if tokenData.Owner == "admin" {
|
||||
url = url + "/login?access_token=" + token
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
http.Redirect(w, r, url, 303)
|
||||
} else {
|
||||
adminDomain := db.GetAdminDomain()
|
||||
http.Redirect(w, r, fmt.Sprintf("https://%s/edit-tunnel?domain=%s", adminDomain, fqdn), 303)
|
||||
|
||||
Reference in new issue
Block a user