Replacing the communication (switch to cloud, another server, account
turned off) used log_out_locally(), which for Connect Local kept the
credential in the secret store and valid on the server. That function is
removed; every logout now goes through do_log_out(), as with Prusa
Account.
Connect Local do_log_out() empties the store whatever it holds, before
the other instances are notified.
The revocation request is created by the logout itself instead of on the
worker thread. The certificate trust is looked up when a request is
created, and a service switch changes the server address and trust right
after the logout, so a request created later would not reach an https
server with a pinned key or a custom certificate.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
save_secret() overwrote its file from the start without truncating it,
so a shorter secret left the tail of the previous one in place and an
empty secret changed nothing. A signed out Connect Local credential
stayed in the store; the next sign-in took it for the sign-in of
another instance, revoked the newly approved credential and adopted
the revoked one, which the server refused. For the Prusa Account
tokens a shorter record left the old tail in the master PID field.
The record is now written to a temporary file and renamed over the
old one, so a reader sees either the complete old or the complete new
record and a failed write leaves the old record intact.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Connect Local: Rename on-premise to Prusa Connect (local) and (cloud) in UI texts
The service switch reads "Prusa Connect (cloud)" and "Prusa Connect (local)",
the pill under the logo says "local" or "cloud" and the cloud sign-in page
gets one too. The local sign-in heading is just "Sign in to Prusa Connect".
All other texts that said "on-premise" use "Prusa Connect (local)" as a name
and "local Prusa Connect server" inside sentences.
Preferences: "Enable Printables" is now "Printables".
Connect: Remove the spinning spool from the signed-out pages
The spool above the "Sign in" button looked like a loading indicator, so
people waited instead of signing in. It is removed from the signed-out pages
of the Connect tab (cloud and local) and from the page shown while the
sign-in is redirected to the external browser. The loading pages keep it.
ExportDestinationButton: Name the active Connect service and keep it current
The export destination button and its menu say "Prusa Connect (cloud)" or
"Prusa Connect (local)" for the active service, and plain "Prusa Connect"
while the destination cannot be chosen because nobody is signed in.
The menu labels were built once and never changed; now the button listens
to the account service switcher and the labels are also recomputed when the
menu opens. MenuItem gets set_label for that.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
unzip_repository() appended archive entry names to the extraction
directory without validation, so an entry like "../../x" or an absolute
path could write anywhere the user can write (e.g. an autostart entry)
as soon as a local repository ZIP was picked. The manifest and data
structure checks only ran after extraction.
Reuse stays_inside_destination(), which the bundle-zip extraction in
PresetUpdaterRepositorySync.cpp already used, and refuse the whole
archive if any entry is rooted or contains a ".." component. The helper
is moved unchanged to PresetUpdaterUtils so both call sites share it.
Thanks to @Alejandr0ar for participating in our responsible disclosure program.
Port of prusa3d/PrusaSlicer#15607.
Mouse wheel:
- Hovered ComboBox steps through its items.
- Hovered InputTextWithSpin steps its value, Ctrl uses the fast step.
- Ignored on disabled controls, while typing and while the popup is open.
- At most one step per frame, fractional wheel deltas are summed.
- A page that is already being scrolled keeps the wheel.
- ScrollArea does not remap a wheel owned by a control.
ComboBox:
- set_item_numbers() gives each item the number it stands for.
- With numbers, the wheel selects the nearest larger or smaller item,
also from a typed value that is not in the list.
- Without numbers, the wheel selects the next or previous item.
- On a Mixed value, wheel up selects the first item, wheel down the last.
- set_wheel_enabled() turns the wheel off for one combo.
- set_current_label() takes the number of the label and selects the item
with the same number or text.
- A selected item with a number shows its own text, the validator gets the
number. Item text is no longer parsed as a number.
- Focusing the text shows the number, leaving it unchanged restores the text.
- Text reverted with Escape does not fire text_edited.
- Label copies into the text buffer are bounded.
ConfigItemComboBox:
- Passes the numbers of def().choices and of the current value.
- A value listed in the choices shows the choice text, other values the number.
- Typed value updates the shown text even when the value did not change.
- A percentage of a FloatOrPercentage item is not stepped.
TextDialog:
- Wheel is off for the font combo, set_font() snaps the selection back to
the first style of the family.
InputTextWithSpin:
- Mixed value is not stepped.
- Spin buttons no longer fire text_edited when the value is clamped.
Preferences:
- New "Scroll wheel changes value" option (scroll_wheel_changes_value), on by default.
- When off, ComboBox, InputTextWithSpin and Slider ignore the wheel and the page scrolls.
- Read on start and applied right after it is changed.
Yoga::Item:
- Static members moved to a private YogaConfiguration (imgui render, debug item,
test mode, wheel changes value).
- Subclasses use imgui_render(), wheel_changes_value() and take_debug_item().
Tests:
- ComboBox and InputTextWithSpin wheel cases.
- ComboBox item numbers and shown text.
- New ConfigItemComboBoxTests.cpp.
- Wheel is ignored when the option is off, new SliderTests.cpp.
Co-authored-by: louispires <louisppires@gmail.com>
PhysicalPrinterInteractor::create_connect_printer_config() completed the
Connect hw config from the evaluated bundle config, but feeders missing in
the Connect data were default-constructed via operator[] with only the id
set. Their slot_count stayed 0, so HwPrinterConfig::material_slot_count()
underflowed (slot_count - 1 on uint32_t) and returned ~4.3e9 material
slots, crashing slicing and UI code that sizes containers by it.
Copy slot_count for every feeder and take tool_count from the evaluated
config as well.
Reworks how the app chooses between Prusa Account with Prusa Connect and
a self-hosted Prusa Connect on-premise server (Connect Local), and
removes the service mode checks that the original work spread over the
code.
Account service
- Preferences have two switches, enable_prusa_account and
enable_connect_local. Both can be on. The hidden account_service
setting holds the active one while both are enabled.
- App::AccountServiceSwitcher is the one owner of a change: it ends the
account, switches the service URLs and the server trust, starts the
account of the new service and tells its listeners once per change.
The account menu, the switch on the signed-out pages, the server
setup and the welcome dialog call it; settings written by the
Preferences go the same way. It asks before signing the person out.
- The account button is shown while a service is enabled. With both it
offers three states: Signed out, Prusa Account, Prusa Connect
on-premise. With one it has sign in / sign out, as before.
- The Connect tab is created again when the active service or its
server changes, and reloads its page when the enabled services change.
A removed tab is destroyed, once its web view is no longer being
created, and leaves the account listeners.
- The welcome dialog enables both services online and Connect Local
only offline. The printer list has no Connect filter without a
service.
- The service is "Prusa Connect on-premise" in every text and
ConnectLocal in the code (ServiceMode, AccountService, the
connect_local_* getters, ConnectLocalCredential).
Browser logic
- BrowserLogicConnectPage is split: AbstractConnectPageLogic holds what
the tab does for any service, BrowserLogicConnectPage shows Prusa
Connect, BrowserLogicConnectLocalPage a Connect Local server with its
setup, certificate flow and page session.
- AbstractConnectRequestHandler gets its page authentication as an
IConnectPageAuth: the access token for Prusa Connect, a page session
cookie for Connect Local.
- ConnectNavigationLock holds the navigation rules of the tab. Pages of
the service are told by parsed URLs, not by a string prefix. The
Connect Local tab lets the app's own pages through, so a failed load
shows the error page.
- The pairing events left AbstractBrowserLogic and WebViewDialog; the
sign-in dialog logic listens to the account itself.
User account
- The pairing side is behind IPairingCommunication and IPairingListener;
IUserAccountSessionListener is back to session events and the OAuth
methods of IUserAccountCommunication are pure virtual again.
- A refused Prusa Account token is refreshed only when it has expired.
- An account the communication did not accept is not announced.
- Sign in with a held but unconfirmed Connect Local credential checks
that credential again and does not revoke it. A newly adopted
credential is always verified. A page session refused for a replaced
credential is asked for again.
- The preset updater sends a token only for a Prusa Account.
Printers and upload
- ConnectPrinterService takes printer updates from an
IConnectPrinterUpdates: MQTT for Prusa Connect, polling for Connect
Local. A printer list refused with 401 is fetched again after the
token refresh.
- PrintHostPrusaConnectLocal uploads through the legacy team API, the
only one Connect Local serves; PrintHostPrusaConnect keeps the REST
flow.
- An upload carries the URLs of the service it was started with and
asks for the account's token before each request, so a service switch
or a token refresh during a long upload does not break it.
Server trust and global state
- The trust of the Connect Local certificate lives in
Biz::Network::ServerTrustStore, owned by AppServices. It belongs to
its server and survives a switch to the other service. A trust is
stored only after its server accepted it.
- Requests get their trust through the HTTP factory; the static lookup
in HttpCurl and the file-global registries of web views are gone.
- Biz::Lifetime replaces the alive tokens seven classes had rolled on
their own.
- A Connect Local server URL is stored without its default port, and a
discovered IPv6 address is bracketed.
Tests
- New: AccountServiceSwitcher, ConnectNavigationLock, ConnectPageAuth,
the Connect Local print host, the split and migration of the account
settings.
- Changed: the pairing test for signing in with an unconfirmed
credential, the trust test for a changed server, the cloud upload
fixture.
Not built on macOS and Linux. The narration comments in the platform
web view files, HttpCurl.cpp and Tls.cpp are still to be turned into
doxygen comments.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The upload-finished notification of a Prusa Connect upload gets a
"Show printer" button that opens the printer's page in the Connect tab,
as PrusaSlicer 2.x did. It was lost in the PrintHost refactor (SPE-3004).
ServiceConfig builds the page URL for both modes: the cloud dashboard
online, /printers/{id} of the Connect Local web app offline, loaded
through the page session like the other Connect Local pages.
The service mode is applied at startup and switched live from
Preferences; the Connect tab follows the account setting. Printables
stays logged out offline; a notification warns before the Connect
Local sign-in expires.
Connect Local has no MQTT, so the printer list is polled offline. A
401 from the printer list or an upload logs out, the Connect Local
credential cannot be renewed. Favorite materials are skipped offline
and the UI names Prusa Connect Local.
Offline without a usable server the Connect tab shows a setup page:
the server address, the certificate check of an https server with the
choice to trust it, and a search of the network (Bonjour) on request.
The logged-out page offline offers sign-in and a server change. The
slicer's logged-out pages share one design with a switch between
Prusa Connect and Prusa Connect (on-premise).
The Connect Local web pages never get the credential: the app trades
it for a page session cookie and sets it before loading the Connect
page or the printer selection, also when the page asks for its config
again.
In offline mode the sign-in dialog runs the app pairing: it shows the
server's approval page with the code and closes once the credential is
collected. make_log_in_logic() picks the dialog for the mode, the
dialog gets hooks for load errors, closing and async commands.
ConnectLocalTrust keeps the trust chosen for the Connect Local server
(stored in AppConfig) and serves it to curl requests and to the web
views. The web views accept a certificate matching that trust and
leave any other one to the platform.
Adds SetCookie and DeleteCookie browser commands, implemented on the
native cookie stores (WKHTTPCookieStore, WebView2, WebKitGTK). Commands
after a SetCookie wait until the cookie is stored, WebViewHost queues
them until the web view exists.
Connect Local has no OAuth: the app starts a pairing, the person
approves its code on the server and the app collects a credential.
UserAccountCommunicationPairing runs this on the session, stores the
credential per server in the token store, revokes it on logout and
opens page sessions for the server's web pages.
Moves the session thread and the account data (username, email, avatar)
from UserAccountCommunicationTokenBase and UserAccountCommunication into
UserAccountCommunicationBase, so the Connect Local communication can
reuse them. No behaviour change.
A Connect Local server often has a self-signed or private CA
certificate. Tls reads certificates and pins (OpenSSL libcrypto),
ServerTrust describes a pinned key or a loaded certificate for one
server, ServerTrustProbe checks a server's certificate in the
background. HttpCurl applies the trust a lookup returns for a URL.
ServiceConfig gets a service mode: Online keeps the cloud URLs, Offline
derives the Account and Connect URLs from a self-hosted Connect Local
server. The mode URLs are guarded by a mutex as the mode can change at
runtime. AppConfig gets the connect_mode and connect_local_url settings,
AppConfigInteractor a setter for the mode.
Adds parse_url() returning scheme, host, port and path of a URL,
parsed by curl's own URL API so it matches what the requests use.
Used by the Connect Local server URL validation and the certificate
trust that follow.
Detail view adds material breakdown, per extruder table (ListView), "with spool"
weights, stealth mode, first layer time and tool changes.
Hide the panel when the selected bed has no statistics.
Add ProjectSettingsInteractor::get_spool_weights() with tests.
LoadingProgressDialog lives only in PlaterRenderModule. Loading switches to
the plater through Navigator::ensure_module_type(), which keeps an opened
dialog when the plater is already shown. Removed
Navigator::move_loading_progress_dialog_to_current_module() and the navigation
in MenuCommandRegistrar::load_object().
LoadingProgressController is merged into LoadingProgressDialog, which tracks
the loading jobs and updates its widgets directly. PlaterRenderModule::shutdown()
stops the tracking before the platform services close.
- start_file_read_job: apply returns FileLoadResult, a throw is reported as
Failed, so the job always ends and the dialog closes (also restored projects)
- Models report Failed/Cancelled, dropped volumes are reported to the user
- A project which models are still read into isn't empty for new project/Replace
- Shared handle_file_load_job_exception() and report_file_load_failure()
- LoadingProgressController stops only newly started jobs while cancelling
- Renamed FileLoadProgress.hpp -> FileLoadJob.hpp
- Tests: LoadingProgressController, FileLoadJob, FileOpeningInteractor, DispatchUtils.hpp
+ Project load jobs get unique names, so a following job keeps its status and
a second project load doesn't replace a running one.
+ Cancelling a batch of projects stops the remaining ones; backups of the not
loaded projects stay for the next recovery.
+ LoadingProgressController tracks all loading jobs: Cancel stops all of them,
the dialog closes after a short delay, so it stays open between jobs.
+ The label shows the order of the project in a batch, the progress covers it.
+ on_done callbacks get FileLoadResult (Loaded/Failed/Cancelled): a cancelled
archive load skips its remaining projects and removes the extracted files,
the SVG gizmo opens only after a successful import.
+ Project, model and volume loading runs in "file_load*" jobs reporting stages
and progress (FileLoadStage, FileLoadProgressPayload).
+ Cancel stops the job; a cancelled load isn't reported as an error.
+ Model/volume import: files are read in the job (read_files_for_import) and added
to the scene on the main thread; on_done callbacks run the follow-up actions
(SVG gizmo, removal of extracted archive files).
+ MainThreadDialogProvider asks questions on the main thread while the job waits.
+ STEP import settings are read and stored on the main thread.
+ LoadingProgressController opens the dialog through the Navigator after 400 ms;
the Navigator moves it to the render module switched to.
+ PopNotificationCenter skips "file_load*" jobs.
PD-28183: MqttSubscriber, ServiceConfig: Use a unique client id, wake the worker on new credentials, and add an MQTT URL override
PD-28183: MqttSubscriber: Keep the worker alive on non-MQTT exceptions
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
PD-28183: ServiceConfig: Switch to production addresses
PD-28183: PrintHostPrusaConnect: Cancel the bucket upload without a progress callback and drop the login hint on storage errors
PD-28183: HttpCurl: Send empty header values instead of dropping the field
PD-28183: ConnectPrinter, ProjectInteractor: Move the printer list out of its parse buffer and drop the unused upload result
PD-28183: PrintHostPrusaConnect: Tolerate the unconfirmed finish PATCH, drop organization_id from the queue body, and delete the file record after a failed upload
PD-28183: HwConfigConnectJson, PrintHostPrusaConnectTests: Skip non-string tool types and clear the mock HTTP provider on teardown
PD-28183: PrintHostPrusaConnect: Send organization_id to the queue again and drop the file delete and finish tolerance that the API does not support
PD-28183: PrintHost: Guard empty API keys in PrusaLink and Moonraker and ignore the post-cancel progress callback
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>