Skip to content

Commit

Permalink
Add support for OD v2.4.20 - Temp hotfix for #42
Browse files Browse the repository at this point in the history
  • Loading branch information
bpozdena committed Jul 21, 2022
1 parent 1cb36f1 commit eaca0da
Show file tree
Hide file tree
Showing 5 changed files with 314 additions and 227 deletions.
2 changes: 1 addition & 1 deletion AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ AppDir:
id: io.github.bpozdena.OneDriveGUI
name: OneDriveGUI
icon: OneDriveGUI
version: 0.0.1
version: 0.2.1
exec: usr/bin/python3
exec_args: "$APPDIR/usr/src/OneDriveGUI.py $@"

Expand Down
19 changes: 15 additions & 4 deletions src/OneDriveGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,8 @@ def __init__(self, profile):
self.checkBox_upload_only.setChecked(self.get_check_box_state("upload_only"))
self.checkBox_upload_only.stateChanged.connect(self.set_check_box_state)

self.checkBox_force_http_2.setChecked(self.get_check_box_state("force_http_2"))
self.checkBox_force_http_2.stateChanged.connect(self.set_check_box_state)
self.checkBox_force_http_11.setChecked(self.get_check_box_state("force_http_11"))
self.checkBox_force_http_11.stateChanged.connect(self.set_check_box_state)

self.checkBox_disable_upload_validation.setChecked(self.get_check_box_state("disable_upload_validation"))
self.checkBox_disable_upload_validation.stateChanged.connect(self.set_check_box_state)
Expand Down Expand Up @@ -1802,23 +1802,33 @@ def create_global_config():
_default_od_config = read_config(dir_path + "/resources/default_config")
_default_profile_config = {"auto_sync": False}
default_od_config = _default_od_config._sections
logging.debug(f"[GUI] - loading default config {default_od_config}")

# Load existing user profiles.
_profiles = ConfigParser()
_profiles.read(PROFILES_FILE)
profiles = _profiles._sections
change_detected = False

for profile in profiles:
profile_config_file = profiles[profile]["config_file"]
_od_config = read_config(profile_config_file)
od_config = _od_config._sections

if "auto_sync" not in profiles[profile]: # add 'auto_sync' value if from older versions
if "auto_sync" not in profiles[profile]: # add 'auto_sync' value if missing from older versions
profiles[profile].update(_default_profile_config)

profiles[profile].update(default_od_config)
profiles[profile].update(od_config)

logging.debug(profiles)
# this option is not supported since OneDrive v2.4.20 - #42
if "force_http_2" in profiles[profile]["onedrive"]:
logging.debug("[GUI] - removing obsolete option 'force_http_2' from config")
profiles[profile]["onedrive"].pop("force_http_2")
profiles[profile]["onedrive"]["force_http_11"] = '"false"'
change_detected = True

logging.debug(f"[GUI]{profiles}")
return profiles


Expand Down Expand Up @@ -1886,6 +1896,7 @@ def save_global_config():

if __name__ == "__main__":
global_config = create_global_config()
save_global_config()
gui_settings = read_gui_settings()

app = QApplication(sys.argv)
Expand Down
2 changes: 1 addition & 1 deletion src/resources/default_config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ download_only = "false"
disable_notifications = "false"
disable_upload_validation = "false"
enable_logging = "false"
force_http_2 = "false"
force_http_11 = "false"
local_first = "false"
no_remote_delete = "false"
skip_symlinks = "false"
Expand Down
4 changes: 2 additions & 2 deletions src/ui/profile_settings_page.ui
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,9 @@
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="1">
<widget class="QCheckBox" name="checkBox_force_http_2">
<widget class="QCheckBox" name="checkBox_force_http_11">
<property name="text">
<string>Force HTTP2</string>
<string>Force HTTP 1.1</string>
</property>
</widget>
</item>
Expand Down
Loading

0 comments on commit eaca0da

Please sign in to comment.