Commit graph

889 commits

Author SHA1 Message Date
Remco Burema
b685bc6ff6 At least log an error if anything goes wrong here.
Some checks failed
conan-package-resources / conan-package (push) Has been cancelled
conan-package / conan-package (push) Has been cancelled
printer-linter-format / Printer linter auto format (push) Has been cancelled
unit-test / Run unit tests (push) Has been cancelled
conan-package-resources / signal-curator (push) Has been cancelled
Defensive programming.

part of CURA-12924
2026-01-28 14:37:54 +01:00
HellAholic
cdbebefc52
Merge branch 'main' into CURA-12924 2026-01-21 21:37:18 +01:00
Remco Burema
902f2b1ebe Add functionality to cancel print-job-upload in progress.
Sometimes this got stuck, and there was no way for users to get rid of (or even retry).

CURA-11196
2026-01-20 14:27:16 +01:00
HellAholic
d313e371b9 Refactor reply handling to use _trackReply method
Replaced usage of _addCallback with a new _trackReply method for fire-and-forget network requests. This change improves reply tracking and error logging, and prevents premature garbage collection of QNetworkReply objects.
2026-01-20 10:12:46 +01:00
HellAholic
e7f6ac0bfe Add callbacks to print job queue operations
Added _addCallback with a no-op lambda to the move, force, delete, and set state print job methods to ensure proper handling of asynchronous replies from the network manager.
2026-01-20 09:39:58 +01:00
Remco Burema
0cc855b4d5 Review comments. (Restore secret-settings list, re-remove user-name.)
part of CURA-12862
2026-01-07 12:27:41 +01:00
c.lamboo
1967003979 Merge branch 'main' into CURA-12862-II
# Conflicts:
#	plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDevice.py
2026-01-07 10:27:12 +01:00
c.lamboo
3d1b598fe7 Remove authentication flow when communicating with locally connected printer
CURA-12862
2026-01-07 10:22:10 +01:00
c.lamboo
f0e899e7ce Add improved authentication flow
Some checks failed
conan-package / conan-package (push) Has been cancelled
unit-test / Run unit tests (push) Has been cancelled
- Only make auth tokens active once `request/check` endpoint returns `authorized`
- Only invalidate tokens once authentication has failed 5 times and `request/check` endpoint returns `unauthorized`
- Don't store short-lived nonce counter

CURA-12862
2025-12-10 17:31:02 +01:00
c.lamboo
3d9485d834 Add missing import
Some checks failed
conan-package / conan-package (push) Has been cancelled
unit-test / Run unit tests (push) Has been cancelled
CURA-12862
2025-12-02 15:40:22 +01:00
c.lamboo
36f58a5876 Reset status timer properly
CURA-12862
2025-12-02 15:39:53 +01:00
c.lamboo
dbf87d2d61 Show error when print job was not send succesfully
CURA-12862
2025-12-01 16:54:01 +01:00
HellAholic
ebb91b3651
Merge branch 'main' into CURA-12718_dont_send_username
Some checks failed
conan-package-resources / conan-package (push) Has been cancelled
conan-package / conan-package (push) Has been cancelled
printer-linter-format / Printer linter auto format (push) Has been cancelled
unit-test / Run unit tests (push) Has been cancelled
conan-package-resources / signal-curator (push) Has been cancelled
2025-10-31 14:11:19 +01:00
Remco Burema
89ba272adf Don't send username for local printer connections.
CURA-12718
2025-10-23 11:51:41 +02:00
Remco Burema
cd3aa02440 Show the user a warning when the printer requires authentication.
Also hide it when appropriate.

part of CURA-12717
2025-10-22 12:19:26 +02:00
Remco Burema
6f41127628 Make sure to require authentication again.
... even if it was previously obtained in the session, but something changed (on, say, the printers side).

done as part of CURA-12717
2025-10-22 12:16:59 +02:00
Remco Burema
fb574bba25 Reduce log-spam.
Some checks failed
conan-package / conan-package (push) Has been cancelled
unit-test / Run unit tests (push) Has been cancelled
done as part of CURA-12708
2025-09-30 11:38:33 +02:00
Remco Burema
971fb9d104 Save authorization per-cluster instead of in 1 value.
This would otherwise invalidate all authorization information when switching printers.

part of CURA-12708
2025-09-30 11:37:36 +02:00
Remco Burema
c1fd3c9aba Store printer-API creds is prefs.
It's OK to do this in this manner and not via for example the keyring, since we there's no actual user-name involved, only the machine-name -- anyone on the same machine is _already_ capable of sending the basically the exact same request that originated the access in the first place.

part of CURA-12708 (alt implementation)
2025-09-23 16:01:25 +02:00
Remco Burema
a8ac8e9332 Forgot to update this (needed for authentication).
part of CURA-12624
2025-09-10 10:26:39 +02:00
Remco Burema
70a8f9b0a3 Use machine-node-ID as username.
Otherwise there's _still_ personal information in there.

part of CURA-12624
2025-09-10 10:26:12 +02:00
Remco Burema
7fc87cb4c1 Fill in correct nonce and nonce-count for cluster-auth.
part of CURA-12624
2025-09-10 10:25:55 +02:00
Frederic Meeuwissen
6b1f29cdb1 Fix crash on AttributeError 2025-09-10 10:25:08 +02:00
Remco Burema
75fc0782da Code review: Replace string with enum.
First use of 3.11's StrEnum in the code base I think -- anyway, Python autoboxes these (maybe even the old str,enum things as well, but irrelevant now), so there's nothing in the way of making this an enum and have type-_checking_ instead of type-_o_'s.

done as part of CURA-12624
2025-09-10 10:24:00 +02:00
Remco Burema
7f35a5074b Make authentication info a little less brittle.
Otherwise if the server (on the printer) gives back something that can be parsed into JSON, but _isn't_ the authorization digest info, the thing breaks.

part of CURA-12624
2025-09-10 10:23:25 +02:00
Remco Burema
115d2d5b77 Fix 2 calls w.r.t. new authorization workflow _outside_ of the API.
New rules means we have to put printjobs and such behind a little authentication, as these contain personally identifiable info. These two effected calls where found _outside_ of the API class where I thought to be able to fix it 100%. See also the TODO's in the neighbourhood -- but I'm not sure I can just do what those say (move the relevant methods to the API), as those methods to be moved are _inside_ the larger Cura SDK (and they're public) and the place where I'm meant to move them to (the ClusterAPIClient) is _not_ (as they're in a plugin).

part of CURA-12624
2025-09-10 10:23:14 +02:00
Remco Burema
34eac462bd More authentication, since printer-API call-responses can include user-info.
The new regulations make a decent amount of sense -- but just because we agree with them doesn't mean we'd implemented this yet. Anyway, information wich can be used to personally identify people should be kept behind (virtual) locks and bars. The new firmware will only allow certain operations _after_ a request has been made to the .../auth/request endpoint, and someone in the physical vicinity (of the printer) has pressed ALLOW on a popup (with the application and name of the requester shown, on the printers' UI). After that, _as long as you put the relevant Authorization Digest in your HTTP headers_ (and use at least SHA-256), you may proceed to make other requests without the printer-server flipping out with a FORBIDDEN error.

The current commit _should_ also still work with printers that still have old (well, current I guess...) firmware -- but I didn't test that yet.

CURA-12624
2025-09-10 10:22:59 +02:00
Erwan MATHIEU
ae2a189c14 Replace "cloudActive" property by generic "active"
CURA-12557
2025-06-30 09:53:54 +02:00
HellAholic
9cf75648ab Review comment
Some checks failed
conan-package / conan-package (push) Has been cancelled
unit-test / Run unit tests (push) Has been cancelled
- Set default to `""` for `Optional[str]` to remove the `or ""`
-The FW version can be returned as None which requires the fallback `or ""`
2025-06-25 13:54:56 +02:00
HellAholic
6a230b3df5 ClusterPrinterStatus: optional init args
Prevents a cura crash if any of the args are not returned from api call
2025-06-24 14:03:07 +02:00
Erwan MATHIEU
2e9999ed2d Display the printer activation status
CURA-12557
2025-06-11 13:51:45 +02:00
Erwan MATHIEU
65b0e4f080 Add specific message when sending a print to an inactive printer
CURA-12557
2025-06-11 10:51:47 +02:00
Erwan MATHIEU
01fd82e8e5
Merge branch 'main' into fix_qml_py_re 2025-02-11 13:19:50 +01:00
Frederic98
0917f10105 Fix cloud connection for Sketch Sprint and Large 2024-12-19 11:43:29 +01:00
David Fries
6e3e3e6742 Use raw strings for regular expressions with invalid escape sequences
If "T(\d*)" was "T(\n*)" it would search for newlines.  There isn't
any such \d escape character.

It should be "T(\\d*)" or r"T(\d*)" going with the latter, to be
easier to read and be consistent with other Cura usage.

Start python with -Wd or for python 3.12 will raise a SyntaxWarning.
2024-08-31 12:11:59 -05:00
Remco Burema
77e0d705db The easy way to fix a slow response is to up the timeout.
This might on one hand have (other) consequences, and given the slowness we encounter not even be enough in some cases (may be related to the size of the messages?) May need to be fixed on server side.

attempt to adress CURA-11956
2024-08-07 18:04:18 +02:00
Saumya Jain
f7f56e8766 Add sketch to cloud
CURA-11777
2024-05-06 13:32:52 +02:00
Paul Kuiper
87c15b0d35 Updating name translation tables for Factor 4.
PP-470
2024-04-22 10:55:01 +02:00
Frederic Meeuwissen
f665281a6a Only load machine_id_to_name.json when it's needed for the first time 2024-03-27 11:19:59 +01:00
Frederic Meeuwissen
484cc6d42f Clean up CloudApiClient.py 2024-03-27 11:19:48 +01:00
Frederic Meeuwissen
8012df6518 Convert str.format to f-string 2024-03-27 11:19:36 +01:00
Frederic Meeuwissen
1bc8b90b56 Move definition ID to cloud name map to json file 2024-03-27 11:19:22 +01:00
Erwan MATHIEU
fa2257aaa3 Add fallback for uuid retrieval from DF
CURA-11655
2024-03-07 16:48:47 +01:00
saumya.jain
1e230ffef1 Printer name changed to printer type
printer names can be different for same type of printer.
Also, printer type is coming from cloud here so the type search is changed accordingly

CURA-11432
2024-01-03 14:19:22 +01:00
c.lamboo
a071795f9e Fix monitor page
CURA-11426
2023-12-15 12:43:54 +01:00
c.lamboo
0225f92ae0 Fix local cloud printing for um printers
CURA-11390
2023-11-27 13:47:08 +01:00
c.lamboo
e66a3cda67 Only extend file formats for um3
This was a mistake in the previous implementation. The relevant piece of code was adding ufp support for um3 printers. This is legacy support for this printer since the printer didn't know it supported ufp, but through the digital factory it could support ufp files. However, with the addition of method printers we should have added an additional check where we also check if the printer is an um3. Instead an additional check was added that did the same for makerbot printers. Because of this check didn't have a "is method" check support for makerbot format is also added to s-line printers and legacy um printers.

(fyi @saumyaj3)

CURA-11377
2023-11-24 15:40:11 +01:00
c.lamboo
31976e591f All method printers are cloud connected
CURA-11377
2023-11-24 15:35:31 +01:00
saumya.jain
ce132e4c3f Function name changed to make it a bit generic
CURA-11138
2023-10-31 11:48:44 +01:00
saumya.jain
39ec9c9279 printertype Parsing function made static
CURA-11138
2023-10-30 14:31:17 +01:00