mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 02:41:17 +00:00
Allow use offline when logged in to Orca Cloud (#14235)
* Store user session information along with refresh token, to allow offline use once user is logged in * Don't bother with avatar because we won't see it when offline anyway * Fix offline Sync Presets freezing the UI on repeat clicks Ignore restart_sync_user_preset() while a manual sync's progress dialog is on screen, so a second app-modal dialog can't stack on the first. Offline the dialog blocks on a long, uncancellable HTTP timeout; on macOS the global menu stays live while the window is disabled, so a second click otherwise wedges the app (force-quit only). * Skip redundant user-secret re-write on startup set_user_session() always re-encrypts and writes the secret to disk; on the startup restore path that just rewrites the bytes it was loaded from. Add a persist flag so the restore path skips it. Also drop an unused catch binding and a stray blank line. --------- Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
@@ -279,9 +279,9 @@ public:
|
||||
const PkceBundle& pkce();
|
||||
void regenerate_pkce();
|
||||
|
||||
void persist_refresh_token(const std::string& token);
|
||||
bool load_refresh_token(std::string& out_token);
|
||||
void clear_refresh_token();
|
||||
void persist_user_secret(const std::string& secret);
|
||||
bool load_user_secret(std::string& out_secret);
|
||||
void clear_user_secret();
|
||||
|
||||
// Token refresh helpers
|
||||
bool refresh_if_expiring(std::chrono::seconds skew, const std::string& reason);
|
||||
@@ -295,7 +295,8 @@ public:
|
||||
const std::string& username,
|
||||
const std::string& nickname,
|
||||
const std::string& avatar,
|
||||
const std::string& refresh_token = "");
|
||||
const std::string& refresh_token = "",
|
||||
bool persist = true);
|
||||
// Accepts either nested Orca cloud / GoTrue session JSON or flat WebView token JSON.
|
||||
bool set_user_session(const nlohmann::json& session_json, bool notify_login = true);
|
||||
void clear_session();
|
||||
@@ -363,7 +364,7 @@ private:
|
||||
|
||||
// Member variables - auth state
|
||||
PkceBundle pkce_bundle;
|
||||
std::string refresh_fallback_path;
|
||||
std::string secret_fallback_path;
|
||||
SessionHandler session_handler;
|
||||
OnLoginCompleteHandler on_login_complete_handler;
|
||||
SessionInfo session;
|
||||
|
||||
Reference in New Issue
Block a user