mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-02 06:02:53 +02:00
Make user-agent string a configuration option (#673)
* Make user-agent string a configuration option * Set default User-Agent to OneDrive Client for Linux v{version} * Add 'user_agent' to default config file
This commit is contained in:
parent
a1f4fec3cf
commit
ca9a6b6ac0
1
config
1
config
|
@ -30,3 +30,4 @@
|
|||
# monitor_log_frequency = "5"
|
||||
# monitor_fullscan_frequency = "10"
|
||||
# sync_root_files = "false"
|
||||
# user_agent = ""
|
||||
|
|
|
@ -178,6 +178,11 @@ Only upload to OneDrive, do not sync changes from OneDrive locally
|
|||
.br
|
||||
Configuration file key: \fBupload_only\fP (default: \fBfalse\fP)
|
||||
.TP
|
||||
\fB\-\-user\-agent\fP ARG
|
||||
Set the used User Agent identifier
|
||||
.br
|
||||
Configuration file key: \fBuser_agent\fP (default: don't change)
|
||||
.TP
|
||||
\fB\-v \-\-verbose\fP
|
||||
Print more details, useful for debugging. Given two times (or more)
|
||||
enables even more verbose debug statements.
|
||||
|
|
|
@ -37,6 +37,7 @@ final class Config
|
|||
stringValues["skip_dir"] = defaultSkipDir;
|
||||
stringValues["log_dir"] = "/var/log/onedrive/";
|
||||
stringValues["drive_id"] = "";
|
||||
stringValues["user_agent"] = "";
|
||||
boolValues["upload_only"] = false;
|
||||
boolValues["check_nomount"] = false;
|
||||
boolValues["check_nosync"] = false;
|
||||
|
@ -292,6 +293,9 @@ final class Config
|
|||
"upload-only",
|
||||
"Only upload to OneDrive, do not sync changes from OneDrive locally",
|
||||
&boolValues["upload_only"],
|
||||
"user-agent",
|
||||
"Specify a User Agent string to the http client",
|
||||
&stringValues["user_agent"],
|
||||
// duplicated from main.d to get full help output!
|
||||
"confdir",
|
||||
"Set the directory used to store the configuration files",
|
||||
|
@ -430,7 +434,8 @@ void outputLongHelp(Option[] opt)
|
|||
"--single-directory",
|
||||
"--skip-file",
|
||||
"--source-directory",
|
||||
"--syncdir" ];
|
||||
"--syncdir",
|
||||
"--user-agent" ];
|
||||
writeln(`OneDrive - a client for OneDrive Cloud Services
|
||||
|
||||
Usage:
|
||||
|
|
|
@ -98,7 +98,14 @@ final class OneDriveApi
|
|||
if (cfg.getValueBool("debug_https")) {
|
||||
http.verbose = true;
|
||||
.debugResponse = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Custom User Agent
|
||||
if (cfg.getValueString("user_agent") != "") {
|
||||
http.setUserAgent = cfg.getValueString("user_agent");
|
||||
} else {
|
||||
http.setUserAgent = "OneDrive Client for Linux " ~ strip(import("version"));
|
||||
}
|
||||
|
||||
// What version of HTTP protocol do we use?
|
||||
// Curl >= 7.62.0 defaults to http2 for a significant number of operations
|
||||
|
|
Loading…
Reference in a new issue