mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-04 16:52:29 +00:00
* 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
139 lines
7.2 KiB
C++
139 lines
7.2 KiB
C++
#ifndef __BBL_CLOUD_SERVICE_AGENT_HPP__
|
|
#define __BBL_CLOUD_SERVICE_AGENT_HPP__
|
|
|
|
#include "ICloudServiceAgent.hpp"
|
|
#include <string>
|
|
#include <map>
|
|
|
|
namespace Slic3r {
|
|
|
|
/**
|
|
* BBLCloudServiceAgent - BBL DLL wrapper implementation of ICloudServiceAgent.
|
|
*
|
|
* Delegates all cloud service and authentication operations to the proprietary
|
|
* BBL network DLL through function pointers obtained from BBLNetworkPlugin singleton.
|
|
* This class combines the functionality of the former BBLAuthAgent and BBLCloudServiceAgent.
|
|
*/
|
|
class BBLCloudServiceAgent : public ICloudServiceAgent {
|
|
public:
|
|
BBLCloudServiceAgent();
|
|
~BBLCloudServiceAgent() override;
|
|
|
|
std::string get_id() const override { return BBL_CLOUD_PROVIDER; }
|
|
|
|
// ========================================================================
|
|
// ICloudServiceAgent Interface Implementation - Auth Methods
|
|
// ========================================================================
|
|
|
|
// Lifecycle
|
|
int init_log() override;
|
|
int set_config_dir(std::string config_dir) override;
|
|
int set_cert_file(std::string folder, std::string filename) override;
|
|
int set_country_code(std::string country_code) override;
|
|
int start() override;
|
|
|
|
// User Session Management
|
|
int change_user(std::string user_info) override;
|
|
bool is_user_login() override;
|
|
int user_logout(bool request = false) override;
|
|
std::string get_user_id() override;
|
|
std::string get_user_name() override;
|
|
std::string get_user_avatar() override;
|
|
std::string get_user_nickname() override;
|
|
|
|
// Login UI Support
|
|
std::string build_login_cmd() override;
|
|
std::string build_logout_cmd() override;
|
|
std::string build_login_info() override;
|
|
|
|
// Token Access (BBL manages tokens internally)
|
|
std::string get_access_token() const override;
|
|
std::string get_refresh_token() const override;
|
|
bool ensure_token_fresh(const std::string& reason) override;
|
|
|
|
// ========================================================================
|
|
// ICloudServiceAgent Interface Implementation - Cloud Methods
|
|
// ========================================================================
|
|
|
|
// Server Connectivity
|
|
std::string get_cloud_service_host() override;
|
|
std::string get_cloud_login_url(const std::string& language = "") override;
|
|
int connect_server() override;
|
|
bool is_server_connected() override;
|
|
int refresh_connection() override;
|
|
int start_subscribe(std::string module) override;
|
|
int stop_subscribe(std::string module) override;
|
|
int add_subscribe(std::vector<std::string> dev_list) override;
|
|
int del_subscribe(std::vector<std::string> dev_list) override;
|
|
void enable_multi_machine(bool enable) override;
|
|
|
|
// Settings Synchronization
|
|
int get_user_presets(std::map<std::string, std::map<std::string, std::string>>* user_presets) override;
|
|
std::string request_setting_id(std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code) override;
|
|
int put_setting(std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code) override;
|
|
int get_setting_list(std::string bundle_version, ProgressFn pro_fn = nullptr, WasCancelledFn cancel_fn = nullptr) override;
|
|
int get_setting_list2(std::string bundle_version, CheckFn chk_fn, ProgressFn pro_fn = nullptr, WasCancelledFn cancel_fn = nullptr) override;
|
|
int delete_setting(std::string setting_id) override;
|
|
|
|
// Cloud User Services
|
|
int get_my_message(int type, int after, int limit, unsigned int* http_code, std::string* http_body) override;
|
|
int check_user_task_report(int* task_id, bool* printable) override;
|
|
int get_user_print_info(unsigned int* http_code, std::string* http_body) override;
|
|
int get_user_tasks(TaskQueryParams params, std::string* http_body) override;
|
|
int get_printer_firmware(std::string dev_id, unsigned* http_code, std::string* http_body) override;
|
|
int get_task_plate_index(std::string task_id, int* plate_index) override;
|
|
int get_user_info(int* identifier) override;
|
|
int get_subtask_info(std::string subtask_id, std::string* task_json, unsigned int* http_code, std::string* http_body) override;
|
|
int get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json) override;
|
|
int query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body) override;
|
|
int modify_printer_name(std::string dev_id, std::string dev_name) override;
|
|
|
|
// Model Mall & Publishing
|
|
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback) override;
|
|
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback) override;
|
|
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out) override;
|
|
int get_model_publish_url(std::string* url) override;
|
|
int get_subtask(BBLModelTask* task, OnGetSubTaskFn getsub_fn) override;
|
|
int get_model_mall_home_url(std::string* url) override;
|
|
int get_model_mall_detail_url(std::string* url, std::string id) override;
|
|
int get_my_profile(std::string token, unsigned int* http_code, std::string* http_body) override;
|
|
int get_my_token(std::string ticket, unsigned int* http_code, std::string* http_body) override;
|
|
|
|
// Analytics & Tracking
|
|
int track_enable(bool enable) override;
|
|
int track_remove_files() override;
|
|
int track_event(std::string evt_key, std::string content) override;
|
|
int track_header(std::string header) override;
|
|
int track_update_property(std::string name, std::string value, std::string type = "string") override;
|
|
int track_get_property(std::string name, std::string& value, std::string type = "string") override;
|
|
bool get_track_enable() override;
|
|
|
|
// Ratings & Reviews
|
|
int put_model_mall_rating(int design_id, int score, std::string content, std::vector<std::string> images, unsigned int& http_code, std::string& http_error) override;
|
|
int get_oss_config(std::string& config, std::string country_code, unsigned int& http_code, std::string& http_error) override;
|
|
int put_rating_picture_oss(std::string& config, std::string& pic_oss_path, std::string model_id, int profile_id, unsigned int& http_code, std::string& http_error) override;
|
|
int get_model_mall_rating_result(int job_id, std::string& rating_result, unsigned int& http_code, std::string& http_error) override;
|
|
|
|
// Extra Features
|
|
int get_mw_user_preference(std::function<void(std::string)> callback) override;
|
|
int get_mw_user_4ulist(int seed, int limit, std::function<void(std::string)> callback) override;
|
|
std::string get_version() override;
|
|
|
|
// Cloud Callbacks
|
|
int set_on_server_connected_fn(AppOnServerConnectedFn fn) override;
|
|
int set_on_http_error_fn(AppOnHttpErrorFn fn) override;
|
|
int set_get_country_code_fn(GetCountryCodeFn fn) override;
|
|
int set_queue_on_main_fn(QueueOnMainFn fn) override;
|
|
|
|
private:
|
|
int set_extra_http_header();
|
|
static std::map<std::string, std::string> get_extra_header();
|
|
bool m_enable_track{false};
|
|
AppOnServerConnectedFn m_app_on_server_connected_fn;
|
|
AppOnHttpErrorFn m_app_on_http_error_fn;
|
|
};
|
|
|
|
} // namespace Slic3r
|
|
|
|
#endif // __BBL_CLOUD_SERVICE_AGENT_HPP__
|