Don't use pkexec for user flatpak downgrades. Fixes #156

This commit is contained in:
heliguy
2024-12-12 16:00:46 -05:00
parent c3c8bb7972
commit c76ac8f481

View File

@@ -24,14 +24,19 @@ class ChangeVersionWorker:
@classmethod
def change_version_thread(this, should_mask, package, commit):
try:
cmd = ["flatpak-spawn", "--host", "pkexec", "sh", "-c"]
cmd = ["flatpak-spawn", "--host"]
installation = package.info["installation"]
real_installation = ""
if installation == "user" or installation == "system":
if installation == "user":
real_installation = f"--{installation}"
elif installation == "system":
cmd.append("pkexec")
real_installation = f"--{installation}"
else:
real_installation = f"--installation={installation}"
cmd += ["sh", "-c"]
suffix = ""
unmask_cmd = f"flatpak mask --remove {real_installation} {package.info['id']} && "
@@ -45,6 +50,7 @@ class ChangeVersionWorker:
suffix += mask_cmd
cmd.append(suffix)
this.process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
percent_pattern = r"\d{1,3}%"
amount_pattern = r"(\d+)/(\d+)"