Files
OrcaSlicer-KX/src/slic3r/GUI/UserManager.cpp
SoftFever c04be9ab37 Introducing Orca Cloud: https://cloud.orcaslicer.com (#13414)
* Add OrcaCloud sync platform and preset bundle sharing system

  Introduce OrcaCloud, a cloud sync platform for user presets, alongside
  a preset bundle system that enables sharing printer/filament/process
  profiles as local exportable bundles or subscribed cloud bundles.

  OrcaCloud platform:
  - Auth to Orca Cloud
  - Encrypted token storage (file-based or system keychain)
  - User preset sync with
  - Profile migration from default/bambu folders on first login
  - Homepage integration with entrance to cloud.orcaslicer.com

  Preset bundles:
  - Local bundle import/export with bundle_structure.json metadata
  - Subscribed cloud bundles with version-based update checking
  - Thread-safe concurrent bundle access with read-write mutex
  - Canonical bundle preset naming (_local/<id>/... and _subscribed/<id>/...)
  - Bundle presets are read-only; grouped under subheaders in combo boxes
  - PresetBundleDialog with auto-sync toggle, refresh, update notifications
  - Hyperlinked bundle names to cloud bundle pages

  Co-authored-by: Sabriel Koh <sabrielkcr@gmail.com>
  Co-authored-by: Derrick <derrick992110@gmail.com>
  Co-authored-by: Mykola Nahirnyi <mnahirnyi@amcbridge.com>
  Co-authored-by: Ian Chua <iancrb00@gmail.com>
  Co-authored-by: Draginraptor <draginraptor@gmail.com>
  Co-authored-by: ExPikaPaka <112851715+ExPikaPaka@users.noreply.github.com>
  Co-authored-by: Ian Bassi <ian.bassi@outlook.com>
  Co-authored-by: Ocraftyone <Ocraftyone@users.noreply.github.com>
  Co-authored-by: yw4z <ywsyildiz@gmail.com>
  Co-authored-by: peterm-m <101202951+peterm-m@users.noreply.github.com>

* Fixed an issue on Windows it failed to login Orca Cloud with Google account
2026-05-01 18:01:29 +08:00

79 lines
2.1 KiB
C++

#include "libslic3r/libslic3r.h"
#include "UserManager.hpp"
#include "DeviceManager.hpp"
#include "NetworkAgent.hpp"
#include "GUI.hpp"
#include "GUI_App.hpp"
#include "MsgDialog.hpp"
#include "DeviceCore/DevManager.h"
namespace Slic3r {
UserManager::UserManager(NetworkAgent* agent)
{
m_agent = agent;
}
UserManager::~UserManager()
{
}
void UserManager::set_agent(NetworkAgent* agent)
{
m_agent = agent;
}
int UserManager::parse_json(std::string payload)
{
bool restored_json = false;
json j;
json j_pre = json::parse(payload);
if (j_pre.empty()) {
return -1;
}
//bind/unbind
try {
if (j_pre.contains("bind")) {
if (j_pre["bind"].contains("command")) {
//bind
if (j_pre["bind"]["command"].get<std::string>() == "bind") {
std::string dev_id;
std::string result;
if (j_pre["bind"].contains("dev_id")) {
dev_id = j_pre["bind"]["dev_id"].get<std::string>();
}
if (j_pre["bind"].contains("result")) {
result = j_pre["bind"]["result"].get<std::string>();
}
if (result == "success") {
DeviceManager* dev = GUI::wxGetApp().getDeviceManager();
if (!dev) {return -1;}
if (GUI::wxGetApp().m_ping_code_binding_dialog && GUI::wxGetApp().m_ping_code_binding_dialog->IsShown()) {
GUI::wxGetApp().m_ping_code_binding_dialog->EndModal(wxCLOSE);
GUI::MessageDialog msgdialog(nullptr, _L("Log in successful."), "", wxAPPLY | wxOK);
msgdialog.ShowModal();
}
dev->update_user_machine_list_info(GUI::wxGetApp().get_printer_cloud_provider());
dev->set_selected_machine(dev_id);
return 0;
}
}
}
}
}
catch (...){}
return -1;
}
} // namespace Slic3r