forked from TrueCloudLab/rclone
config: do not open browser on headless if google fs
On google fs (drive, google photos, and google cloud storage), if headless is selected, do not open browser. This also supplies a new option "auth-no-open-browser" for authorize if the user does not want it. This should fix #3323.
This commit is contained in:
parent
1ce1ea34aa
commit
520ddbcceb
4 changed files with 32 additions and 7 deletions
|
@ -386,6 +386,8 @@ func doConfig(id, name string, m configmap.Mapper, oauthConfig *oauth2.Config, o
|
|||
oauthConfig, changed := overrideCredentials(name, m, oauthConfig)
|
||||
authorizeOnlyValue, ok := m.Get(config.ConfigAuthorize)
|
||||
authorizeOnly := ok && authorizeOnlyValue != "" // set if being run by "rclone authorize"
|
||||
authorizeNoAutoBrowserValue, ok := m.Get(config.ConfigAuthNoBrowser)
|
||||
authorizeNoAutoBrowser := ok && authorizeNoAutoBrowserValue != ""
|
||||
|
||||
// See if already have a token
|
||||
tokenString, ok := m.Get("token")
|
||||
|
@ -470,9 +472,13 @@ func doConfig(id, name string, m configmap.Mapper, oauthConfig *oauth2.Config, o
|
|||
authURL = "http://" + bindAddress + "/auth?state=" + state
|
||||
}
|
||||
|
||||
// Open the URL for the user to visit
|
||||
_ = open.Start(authURL)
|
||||
fmt.Printf("If your browser doesn't open automatically go to the following link: %s\n", authURL)
|
||||
if !authorizeNoAutoBrowser && oauthConfig.RedirectURL != TitleBarRedirectURL {
|
||||
// Open the URL for the user to visit
|
||||
_ = open.Start(authURL)
|
||||
fmt.Printf("If your browser doesn't open automatically go to the following link: %s\n", authURL)
|
||||
} else {
|
||||
fmt.Printf("Please go to the following link: %s\n", authURL)
|
||||
}
|
||||
fmt.Printf("Log in and authorize rclone for access\n")
|
||||
|
||||
// Read the code via the webserver or manually
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue