diff --git a/usr/bin/mintinstall b/usr/bin/mintinstall index 860a2c4..efeb9f6 100755 --- a/usr/bin/mintinstall +++ b/usr/bin/mintinstall @@ -1,6 +1,7 @@ #!/usr/bin/python3 import subprocess +import sys import os # Remove any obsolete configuration file @@ -11,4 +12,4 @@ if os.path.exists(obsolete_path): except: pass -subprocess.call("/usr/lib/linuxmint/mintinstall/mintinstall.py") +subprocess.call(["/usr/lib/linuxmint/mintinstall/mintinstall.py"] + sys.argv[1:]) diff --git a/usr/lib/linuxmint/mintinstall/mintinstall.py b/usr/lib/linuxmint/mintinstall/mintinstall.py index 3542e08..e8b8d44 100755 --- a/usr/lib/linuxmint/mintinstall/mintinstall.py +++ b/usr/lib/linuxmint/mintinstall/mintinstall.py @@ -3,6 +3,8 @@ # -*- coding: UTF-8 -*- import sys +import requests +import tempfile import os import gettext import threading @@ -714,6 +716,26 @@ def do_command_line(self, command_line, data=None): print("MintInstall: file not found", args[2]) sys.exit(1) + elif num > 1 and args[1].startswith("flatpak+https"): + # Download flatpakref file + url = args[1] + filename = "ref.flatpakref" + response = requests.get(url[8:]) + file_path = f"{tempfile.gettempdir()}/{filename}" + # Check if the request was successful (status code 200) + if response.status_code == 200: + # Open the file in binary write mode and save the content + with open(file_path, 'wb') as file: + file.write(response.content) + print(f"File downloaded and saved to {file_path}") + else: + print(f"Failed to download file. HTTP Status code: {response.status_code}") + + file = Gio.File.new_for_path(file_path) + + self.activate() + self.installer.get_pkginfo_from_ref_file(file, self.on_pkginfo_from_uri_complete) + elif num > 1: print("MintInstall: Unknown arguments", args[1:]) sys.exit(1) diff --git a/usr/share/applications/mintinstall.desktop b/usr/share/applications/mintinstall.desktop index 6f140c6..89cfc5c 100644 --- a/usr/share/applications/mintinstall.desktop +++ b/usr/share/applications/mintinstall.desktop @@ -194,7 +194,7 @@ Comment[zgh]=ⵙⵔⵙ ⵜⵉⵙⵏⵙⵉⵡⵉⵏ ⵜⵉⵎⴰⵢⵏⵓⵜⵉ Comment[zh_CN]=安装新程序 Comment[zh_HK]=安裝新應用程式 Comment[zh_TW]=安裝新應用程式 -Exec=mintinstall +Exec=mintinstall %u Icon=mintinstall Terminal=false Type=Application @@ -202,3 +202,4 @@ Encoding=UTF-8 Categories=Application;System;Settings;XFCE;X-XFCE-SettingsDialog;X-XFCE-SystemSettings; NotShowIn=KDE; StartupNotify=true +MimeType=x-scheme-handler/flatpak+https;