From e535acc497043538db82ca19a3543b0edea1dfa3 Mon Sep 17 00:00:00 2001 From: Bog Date: Sat, 23 Aug 2025 14:32:07 -0700 Subject: [PATCH 1/3] Associate flatpak+https protocol --- usr/share/applications/mintinstall.desktop | 1 + 1 file changed, 1 insertion(+) diff --git a/usr/share/applications/mintinstall.desktop b/usr/share/applications/mintinstall.desktop index 6f140c6..a5a9415 100644 --- a/usr/share/applications/mintinstall.desktop +++ b/usr/share/applications/mintinstall.desktop @@ -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; From 793d63699886a621b55afe4907e26111c1c32d8b Mon Sep 17 00:00:00 2001 From: Bog Date: Sat, 23 Aug 2025 15:14:22 -0700 Subject: [PATCH 2/3] Pass flatpak URL to main script --- usr/bin/mintinstall | 11 ++++++++++- usr/share/applications/mintinstall.desktop | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/usr/bin/mintinstall b/usr/bin/mintinstall index 860a2c4..24f0681 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,12 @@ if os.path.exists(obsolete_path): except: pass -subprocess.call("/usr/lib/linuxmint/mintinstall/mintinstall.py") +print(f"sys.argv: {sys.argv}") + +if len(sys.argv) > 1: + url = sys.argv[1] + print(f"Received URL: {url}") +else: + print("No URL passed.") + +subprocess.call(["/usr/lib/linuxmint/mintinstall/mintinstall.py"] + sys.argv[1:]) diff --git a/usr/share/applications/mintinstall.desktop b/usr/share/applications/mintinstall.desktop index a5a9415..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 From 489d065a0b9862dbf949532d8a657782da96689d Mon Sep 17 00:00:00 2001 From: Bog Date: Sat, 23 Aug 2025 15:52:33 -0700 Subject: [PATCH 3/3] Open package details when flatpak URL opened --- usr/bin/mintinstall | 8 ------- usr/lib/linuxmint/mintinstall/mintinstall.py | 22 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/usr/bin/mintinstall b/usr/bin/mintinstall index 24f0681..efeb9f6 100755 --- a/usr/bin/mintinstall +++ b/usr/bin/mintinstall @@ -12,12 +12,4 @@ if os.path.exists(obsolete_path): except: pass -print(f"sys.argv: {sys.argv}") - -if len(sys.argv) > 1: - url = sys.argv[1] - print(f"Received URL: {url}") -else: - print("No URL passed.") - 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)