Commit Graph
176 Commits
Author SHA1 Message Date
peachismomo 0bff760df7 fix: correct plugin profile cleanup and warnings 2026-11-22 00:23:45 +08:00
peachismomo a7e146786f refactor: remove unused keep-local unsubscribe path 2026-11-21 22:10:20 +08:00
peachismomo b8069c37df fix: isolate plugin browser profile lifecycle 2026-11-21 01:34:57 +08:00
Ian Chua fc2a88ba72 fix: isolate browser sessions in plugin ui callbacks 2026-11-19 14:26:05 +08:00
Ian Chua 113b42da33 Merge branch 'main' into fix/isolate-plugin-browser-session 2026-11-18 18:14:21 +08:00
Ian Chua 3838002bc8 feat: serialize permission grant for create and delete files (#17478)
* feat: serialize permission grant for create and delete files

* test: expect saved copytree permissions in hardlink audit test

* refactor: simplify plugin filesystem and permission handling

* fix: show triggering paths in plugin permission prompts

* fix: require subtree consent for recursive plugin deletes

* fix: tests

* fix: Windows short-path aliases in plugin audit checks

* fix: correct plugin folder permission display and consent text
2026-11-18 17:50:29 +08:00
HanifKoh 47c67e1c44 Hide a Plugin Page When the Overflow Tab Swaps It Out (#17626) 2026-11-17 16:45:26 +08:00
Ian Chua 0ab2785f6d feat: keep plugins activated/deactivated based on pre-update state (#17473)
* feat: keep plugins activated/deactivated based on pre-update state

* fix: preserve plugin capability choices across updates

Cloud plugin replacement resets the install-state sidecar, which silently
re-enabled capabilities the user had disabled. Snapshot the installed sidecar
before replacing the package, then write the pre-update capability choices and
activation intent back after the install. Permissions stay cleared so the new
package must request them again, and the reload now waits until that state is
persisted.

Add regression tests for updating both an active and a deactivated cloud
plugin.

* fix: roll back a failed plugin update and keep the old package usable

Download the replacement before unloading or deleting the installed package, so
a download failure leaves the old package and its sidecar untouched. Refuse to
replace a package whose sidecar exists but cannot be read, rather than resetting
the user's capability choices and grants.

Extract the install-from-package step so the updater can reuse it. When the
install fails, restore the previous sidecar (activation intent, capability
choices and grants) that the unload step overwrote, and reload the old package
if it was active. Keep a stale package from another cloud directory until the
new one is committed.

In install_plugin, use one rollback helper for every failure path and give
backups a "__" prefix so an abandoned backup is never discovered as a plugin.

Add regression tests for failed download and failed install.

* fix: prevent a plugin load and an update from racing

Claim a plugin key for the duration of update_cloud_plugin under m_mutex, and
make load_plugin refuse a key that an update owns. An update that starts while
a load is still running now fails with a clear error instead of unloading the
package underneath the loader; the claim is released before the replacement is
reloaded and on every failure path.

Keep the dialog's Update button disabled while the selected plugin is loading,
so the UI cannot start an update the manager would refuse. Add a JavaScript
test for the button state and a C++ test for the load refusal and claim
release.

* fix: clang-tidy

* fix: plugin update safety and simplify state handling

* fix: plugin update rollback and error reporting

* refactor: simplify plugin update state handling and tests

* fix: avoid marking plugins as errored on update conflicts
2026-11-17 16:36:52 +08:00
Ian Chua 0aa479f27c fix: overlapping permission dialogs (#17318)
* fix: queue permissions dialogs

* fix: serialize plugin permission dialogs across prompt types

* fix: unit tests

* fix: move audit prompt stuff to PluginAuditManager

* fix: discard pending permission requests when plugin load is cancelled

* fix: simplify audit prompt cancellation and align denial tests with prod

* fix: queued permission prompts lost after plugin load failure
2026-11-17 14:33:17 +08:00
Ian Chua d6ec712c2e fix: windows plugin update deletion failure (#17462)
* fix: windows plugin update deletion failure

* fix: retry transient Windows plugin deletion failures
2026-11-16 13:54:55 +08:00
Ian Bassi db9968b9ee Painted modifiers (#16213) 2026-11-12 10:38:03 -03:00
DIEHARDave bb81f6b39a Fix: Run slicing pipeline plugins whose manifest reference is missing (#16884)
When a capability named in `slicing_pipeline_plugin` has no entry in the derived `plugins` manifest, the slicing pipeline now finds it by name among the loaded plugins instead of skipping it. The lookup moved into `PluginManager::resolve_capability_ref()`, so the manifest resolver and this fallback use the same rule.

A capability that isn't loaded is still skipped. So is a manifest entry that points at a plugin that isn't installed. No local plugin with the same capability name runs in its place.

Adds a test that slices with an empty manifest and checks that the capability ran.
2026-11-10 22:07:56 -06:00
HanifKoh 9199df0811 Fix a Crash at Exit When an Earlier Python Thread Wait Timed Out (#17437)
join_non_daemon_threads() runs the threading exit hooks on a daemon thread and
gives up on it at the deadline. A later call started a new hook thread and
returned 0 without waiting for the old one, so shutdown() could run Py_Finalize
while the old thread was still running the hooks. Python then stops that daemon
thread when it reaches for the GIL; it unwinds through the hook lambda and
releases a Python list without the GIL while finalization's garbage collection
walks it, which crashes the process.

A call now first waits, within its deadline, for a hook thread an earlier call
left running, and counts it as still running if it does not end, so shutdown()
leaves the interpreter unfinalized instead.

This was the intermittent segfault at exit of the "ends idle
concurrent.futures workers" test, which calls the function more than once. The
app calls it once, from shutdown().
2026-11-10 16:02:22 +08:00
932b492252 feat: Add plugin permission management to the Plugins dialog (#17285)
* feat: permissions tab in plugin dialog ui draft

* feat: allow full access, make threading a boolean

* fix: clang-tidy

* feat: save changes button

* fix: clang-tidy

* fix: only allow permission editing when plugin not loaded

* fix: plugin permission drafts, target validation, and sidecar synchronization

* fix: minor html/css changes

* fix: Make plugin permission edits immediate and thread-safe

* refactor: rehaul UI

* fix: add don't show again to request permission dialog

* fix: permission request dialog ui

* fix: clean up plugin permission dialog and mutation APIs

* fix: retry Windows plugin permission file replacement

* test: extract and cover plugin permission validators

* fix: show clear denial for worker plugin file operations

* fix: clang-tidy

* docs: clarify plugin filesystem permissions and clean up declaration

* fix: handle the 3 states of install state read

* fix: match equivalent paths for exact filesystem grants

* fix: preserve unreadable plugin state and allow socket grant editing

* Recover plugins whose install-state file cannot be parsed

---------

Co-authored-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
2026-11-07 00:00:18 +08:00
2ec1a0732f Plugin audit: keep non-Latin path names intact in the keyword check (#16925)
* Keep non-Latin path names intact in the plugin audit keyword check

is_denied_path_keyword() lowercased every path component with
std::tolower(), which follows the C locale. With a single-byte locale,
which the UI language sets on Windows (Russian_Russia.1251), that
rewrites bytes of UTF-8 sequences: "Новая папка" is no longer valid
UTF-8, and has_denied_config_extension() then throws "boost::filesystem
::path codecvt to wstring: partial" while turning it back into a path.
The exception left the CPython audit hook, so the plugin call never
returned, and the app crashed later in PyFrame_GetCode.

The keyword check now uses the file's ascii_lower(), which lowercases
A-Z only; the keywords are ASCII, so matching stays case-insensitive.
ascii_lower() itself no longer goes through a locale-aware
boost::algorithm::to_lower(), so the network permission keys get the
same guarantee. The audit hook also no longer lets any C++ exception
reach the interpreter: a check that fails denies the event, like an
unanswered prompt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Address review: narrower try in audit_hook, shorter comments, a test for the catch

- Wrap only audit_plugin_event() in the try, so release_frames() is called
  once after the event is decided.
- Shorten the ascii_lower() comment and drop the one that repeated it.
- Use only the .1251 locale in the non-Latin path test.
- Test that a permission prompt that throws denies the event, which
  reaches the new catch on every platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: GNUGiminot <215263196+GNUGiminot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
2026-11-06 20:35:44 +08:00
Ian Chua e740246f7e Merge branch 'main' into fix/isolate-plugin-browser-session 2026-11-04 14:42:59 +08:00
Ian Chua 9281032fdc feat: add plater notifications for orcacloud plugin updates (#17168) 2026-11-04 14:41:23 +08:00
SoftFever 55e760a483 Split .py plugin dependencies only at the commas between items (#17196) 2026-11-03 16:07:56 +08:00
Ian ChuaandLam Wei Lun 3a0517831f fix: warn on preset save when plugin not found (#16929)
* fix: warn on preset save when plugin not found

* refactor: build the unsaved-changes save config in one place

* Fixes clang-tidy

---------

Co-authored-by: Lam Wei Lun <weilun.lam@gmail.com>
2026-10-28 13:02:05 +08:00
Lam Wei Lun 0b4e7e9e2a Handle Unreadable Bundled uv Path in Python Plugin Init (#16888)
boost::filesystem::exists() threw on Windows error 1005 for the build-time uv path, which skipped the packaged uv fallback. Use the error_code overloads so an unreadable path counts as absent, and look up uv before scoped_interpreter is created so a failure there cannot leave the interpreter running.
2026-10-27 00:28:53 +08:00
HanifKoh 5817a76da6 Trim pybind11 Includes From the Plugin Headers (#16839)
* Move Plugin JSON-Python Helpers Out of PluginFsUtils to Trim pybind11 Includes

* Forward Declare pybind11 module_ in PagesPluginCapability Header
2026-10-26 12:40:52 +08:00
Gazi Faysal Jubayer 6c36861a6b Fix MSVC build of PluginHostUi.cpp (#16870)
`run_on_ui_blocking()`, added in #16763, declared its call states in an enum inside the function template. MSVC does not find those enumerators from the default member initializer of the local `struct Call`, so `libslic3r_gui` failed to compile with cl (C2065, C2280). The states are now at namespace scope as `UiCallPending`, `UiCallClaimed` and `UiCallAbandoned`. Behavior is unchanged.
2026-10-25 21:44:10 -05:00
HanifKoh 75252a70f7 Bound Plugin Disconnect and Python Shutdown When OrcaSlicer Exits (#16765)
* Bound Plugin Disconnect and Python Shutdown When OrcaSlicer Exits

A Python printer agent whose disconnect_printer() never returned froze
the closing app, and a plugin thread that never ended kept the process
alive after its window closed, because Py_Finalize joins every
non-daemon thread.

At shutdown a Python agent's disconnect_printer() now runs once per
agent on a helper thread with a 3 second deadline, holding a reference
that keeps the plugin object alive if the call outlives a forced
unload. PythonInterpreter::shutdown() waits up to 3 seconds for running
plugin calls and for non-daemon threads; if either is still going, the
interpreter is left unfinalized for the process exit to end.

* Run the Threading Atexit Hooks Before Waiting for Plugin Threads

An idle concurrent.futures worker only ends when the hooks registered with
threading._register_atexit() tell it to, and Py_Finalize runs those after
the shutdown wait, so a plugin that left an executor open made every exit
wait the full deadline and skip finalization. The hooks now run first, on a
daemon thread joined within the same deadline, since they join their
workers without a timeout.
2026-10-26 03:52:09 +08:00
Kenneth Raplee 88890b9bb1 Build against recent system Boost (>= 1.87) (#15835)
Boost 1.87 removed io_service and io_context::reset(), and 1.88 moved the classic Boost.Process API under boost/process/v1/ and dropped deadline_timer from boost/asio.hpp. Use io_context, restart() and steady_timer, and include Boost.Process only through the new slic3r/Utils/BoostProcessCompat.hpp, which picks the v1 headers on 1.88+. The bundled Boost 1.84 build is unchanged.
2026-10-25 14:33:17 -05:00
HanifKoh 9cb9f9694f Keep nlohmann/json.hpp Out of Widely Included Headers (#16843) 2026-10-26 02:33:27 +08:00
HanifKoh 9f85357ade Fail Plugin UI Calls From Worker Threads Once the App Is Closing (#16763)
A host UI call from a plugin thread queued work on the UI thread and
waited with no limit. If the UI thread was itself waiting for that
thread while closing (a printer agent joining its worker in
disconnect_printer), the app hung forever. Once closing has started, a
call the UI thread has not picked up yet now raises RuntimeError
instead; the shared call state keeps an abandoned queued task from
touching the caller's stack.
2026-10-25 03:40:36 +08:00
Ian Bassi 258ddc15e8 Fix a crash from the Russian extruder range warning, and check plural placeholders in CI (#16815) 2026-10-24 15:44:49 -03:00
SoftFever f1011098ca Clarify how permission requests match network targets 2026-10-25 00:03:23 +08:00
SoftFever 54afdaf887 Merge branch 'main' into fix/plugin-network-permissions 2026-10-24 23:58:51 +08:00
Ian Chua 20c01cfc7e Merge branch 'main' into fix/isolate-plugin-browser-session 2026-10-23 18:28:35 +08:00
Ian Chua f3f872281e fix: clang-tidy 2026-10-23 18:27:48 +08:00
Ian Chua 9739d3a9c4 fix: reject symlink and resolve relative paths to absolute 2026-10-23 16:48:34 +08:00
Ian Chua 3ba5ddfe19 fix: Share isolated WebView sessions per plugin profile 2026-10-23 16:34:44 +08:00
Ian Chua 83de33416e Merge branch 'main' into fix/isolate-plugin-browser-session 2026-10-23 16:17:08 +08:00
Ian Chua 3bb40bc007 Merge branch 'main' into feat/plugin-wildcard-permissions 2026-10-23 16:15:30 +08:00
Ian Chua 6a0223f055 fix: Tighten plugin network grants and clarify consent scope 2026-10-23 16:12:57 +08:00
Ian Chua 0439578fca Merge branch 'main' into fix/plugin-network-permissions 2026-10-23 13:56:09 +08:00
Ian Chua 557feba649 feat: introduce plugin APIs for mutable presets (#16518)
* feat: introduce plugin APIs for mutable presets

* fix: tests

* fix: tests

* doc: HLSD for preset plugin APIs

* feat: preset APIs

* fix: remove async behavior and clang-tidy

* fix: update demo plugins
2026-10-23 13:54:08 +08:00
Ian Chua 2410112046 feat: add wildcard permissions for fs 2026-10-22 20:49:57 +08:00
Ian Chua 0ae2b4840b Merge branch 'main' into fix/plugin-network-permissions 2026-10-22 13:55:07 +08:00
Ian Chua 59e96b71d0 fix: shim python create thread to audit threads (#16682)
* fix: shim python create thread to audit threads

* fix: Python thread audit shim kwargs forwarding
2026-10-22 13:39:48 +08:00
Ian Chua 1086b771b5 fix: tets 2026-10-21 19:12:28 +08:00
Ian Chua 1abb2a0fd9 fix: flatpak audit denial because of config in path (#16685) 2026-10-21 17:48:19 +08:00
Ian Chua b728e79f26 fix: expand request_permissions API to accept other permission types (#16688) 2026-10-21 17:46:56 +08:00
Ian Chua 9f030a9559 Merge branch 'main' into fix/plugin-network-permissions 2026-10-21 15:46:07 +08:00
Ian ChuaandSoftFever 37dcc65752 fix: Allow plugins to read the embedded Python stdlib (#16669)
* Stop re-asking for plugin permissions granted in an earlier session

* fix: Allow plugins to read the embedded Python stdlib

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
2026-10-20 21:31:25 +08:00
Ian Chua 4a0d5e5edd Merge branch 'main' into fix/plugin-network-permissions 2026-10-20 18:23:02 +08:00
Ian Chua e7d6cc32a7 fix: deny plugin from modifying plugin sidecar (#16634) 2026-10-20 18:04:42 +08:00
SoftFever 6626377abc Stop re-asking for plugin permissions granted in an earlier session (#16658) 2026-10-20 13:38:44 +08:00
yw4z 0585836550 Fetch cloud plugin metadata faster (#16645)
When logged in to Orca Cloud, the plugin fetch at startup no longer refreshes the token a second time while start() is already refreshing it. It now waits for that refresh and checks the token again. The subscribed and owned plugin requests also run in parallel, so the fetch takes about half as long.
2026-10-19 15:56:52 -05:00