From e78adb2b63083ecd30f9102169b251a6adcad7fc Mon Sep 17 00:00:00 2001 From: Arlieeee Date: Thu, 5 Feb 2026 11:14:41 +0800 Subject: [PATCH] feat: add orcaflashforge:// URL scheme for external app integration Register orcaflashforge:// as a system-level URL scheme alongside the existing orcaslicer:// scheme. This enables external applications (such as web apps) to launch Orca-Flashforge and trigger model imports using the orcaflashforge:// protocol. Changes: - macOS: Register orcaflashforge and orcaflashforgeopen schemes in plist files - Linux: Add x-scheme-handler/orcaflashforge to .desktop file - Windows: Register orcaflashforge:// in system registry on startup - Add is_orcaflashforge_open() detection function in Utils.hpp - Update is_supported_open_protocol() to include the new scheme Usage: orcaflashforge://open/?file=https://example.com/model.3mf --- cmake/modules/MacOSXBundleInfo.plist.in | 9 +++++++++ src/libslic3r/Utils.hpp | 3 ++- src/platform/osx/Info.plist.in | 2 ++ src/platform/unix/Orca-Flashforge.desktop | 2 +- src/slic3r/GUI/GUI_App.cpp | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cmake/modules/MacOSXBundleInfo.plist.in b/cmake/modules/MacOSXBundleInfo.plist.in index c0e3fd1acf..37d5af6e31 100644 --- a/cmake/modules/MacOSXBundleInfo.plist.in +++ b/cmake/modules/MacOSXBundleInfo.plist.in @@ -36,6 +36,7 @@ CFBundleURLSchemes orcaslicer + orcaflashforge @@ -46,6 +47,14 @@ bambustudioopen + + CFBundleURLName + Orca-Flashforge Downloads + CFBundleURLSchemes + + orcaflashforgeopen + + CFBundleDocumentTypes diff --git a/src/libslic3r/Utils.hpp b/src/libslic3r/Utils.hpp index e9408e1a02..33a77682ce 100644 --- a/src/libslic3r/Utils.hpp +++ b/src/libslic3r/Utils.hpp @@ -218,10 +218,11 @@ extern bool is_json_file(const std::string& path); // Orca: custom protocal support utils inline bool is_orca_open(const std::string& url) { return boost::starts_with(url, "orcaslicer://open"); } +inline bool is_orcaflashforge_open(const std::string& url) { return boost::starts_with(url, "orcaflashforge://open") || boost::starts_with(url, "orcaflashforgeopen://"); } inline bool is_prusaslicer_open(const std::string& url) { return boost::starts_with(url, "prusaslicer://open"); } inline bool is_bambustudio_open(const std::string& url) { return boost::starts_with(url, "bambustudio://open") || boost::starts_with(url, "bambustudioopen://"); } inline bool is_cura_open(const std::string& url) { return boost::starts_with(url, "cura://open"); } -inline bool is_supported_open_protocol(const std::string& url) { return is_orca_open(url) || is_prusaslicer_open(url) || is_bambustudio_open(url) || is_cura_open(url); } +inline bool is_supported_open_protocol(const std::string& url) { return is_orca_open(url) || is_orcaflashforge_open(url) || is_prusaslicer_open(url) || is_bambustudio_open(url) || is_cura_open(url); } inline bool is_printables_link(const std::string& url) { const std::regex url_regex("(http|https)://printables.com", std::regex_constants::icase); return std::regex_match(url, url_regex); diff --git a/src/platform/osx/Info.plist.in b/src/platform/osx/Info.plist.in index 629dc870fe..a275376f52 100644 --- a/src/platform/osx/Info.plist.in +++ b/src/platform/osx/Info.plist.in @@ -34,6 +34,8 @@ orcasliceropen orcaslicer bambustudioopen + orcaflashforgeopen + orcaflashforge diff --git a/src/platform/unix/Orca-Flashforge.desktop b/src/platform/unix/Orca-Flashforge.desktop index be9c293fdf..fc07f97ea7 100644 --- a/src/platform/unix/Orca-Flashforge.desktop +++ b/src/platform/unix/Orca-Flashforge.desktop @@ -5,7 +5,7 @@ Icon=Orca-Flashforge Exec=flash-slicer %F Terminal=false Type=Application -MimeType=model/stl;model/3mf;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;application/x-amf;x-scheme-handler/orcaslicer; +MimeType=model/stl;model/3mf;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;application/x-amf;x-scheme-handler/orcaslicer;x-scheme-handler/orcaflashforge; Categories=Graphics;3DGraphics;Engineering; Keywords=3D;Printing;Slicer;slice;3D;printer;convert;gcode;stl;obj;amf;SLA StartupNotify=false diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 30566ed862..e40ef4af46 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2569,6 +2569,7 @@ bool GUI_App::on_init_inner() associate_files(L"stp"); } associate_url(L"orcaslicer"); + associate_url(L"orcaflashforge"); if (app_config->get("associate_gcode") == "true") associate_files(L"gcode"); @@ -6497,6 +6498,7 @@ void GUI_App::open_preferences(size_t open_on_tab, const std::string& highlight_ associate_files(L"stp"); } associate_url(L"orcaslicer"); + associate_url(L"orcaflashforge"); } else { if (app_config->get("associate_gcode") == "true")