feature add privacy policy for guide

This commit is contained in:
alves
2025-12-17 18:24:23 +08:00
parent 5ed729e27c
commit 941c924329
13 changed files with 150 additions and 76 deletions
+15 -6
View File
@@ -4,6 +4,15 @@
#include <iomanip>
#include <sstream>
bool get_privacy_policy()
{
return isAgreeSlice;
}
void set_privacy_policy(bool isAgree) {
isAgreeSlice = isAgree;
}
std::string get_timestamp_seconds()
{
auto now = std::chrono::system_clock::now();
@@ -26,16 +35,16 @@ long long get_time_timestamp()
return timestamp;
}
std::string get_works_time(const uint64_t& timestamp)
std::string get_works_time(const long long& timestamp)
{
uint64_t hours = timestamp / 3600000;
uint64_t remaining_ms = timestamp % 3600000;
long long hours = timestamp / 3600000;
long long remaining_ms = timestamp % 3600000;
uint64_t minutes = remaining_ms / 60000;
long long minutes = remaining_ms / 60000;
remaining_ms = remaining_ms % 60000;
uint64_t seconds = remaining_ms / 1000;
uint64_t ms = remaining_ms % 1000;
long long seconds = remaining_ms / 1000;
long long ms = remaining_ms % 1000;
char buffer[32] = {0};
std::snprintf(buffer, sizeof(buffer), "%02llu:%02llu:%02llu.%03llu", hours, minutes, seconds, ms);
+6 -2
View File
@@ -2,6 +2,7 @@
#define _BURY_POINT_hpp_
#include <string>
#include <iostream>
#include <atomic>
#define BURY_POINT "bury_point"
@@ -37,9 +38,12 @@
static bool isAgreeSlice = false;
static std::atomic<bool> isAgreeSlice = true;
bool get_privacy_policy();
void set_privacy_policy(bool isAgree);
extern std::string get_timestamp_seconds();
extern long long get_time_timestamp();
extern std::string get_works_time(const uint64_t& timestamp);
extern std::string get_works_time(const long long& timestamp);
#endif
+6
View File
@@ -57,6 +57,12 @@ static sentry_value_t on_crash_callback(const sentry_ucontext_t* uctx, sentry_va
static sentry_value_t before_send(sentry_value_t event, void* hint, void* data)
{
if (!get_privacy_policy())
{
sentry_value_decref(event);
return sentry_value_new_null();
}
sentry_value_t level_val = sentry_value_get_by_key(event, SENTRY_KEY_LEVEL);
std::string levelName = sentry_value_as_string(level_val);
+7 -1
View File
@@ -120,7 +120,7 @@
#include "PrivacyUpdateDialog.hpp"
#include "ModelMall.hpp"
#include "HintNotification.hpp"
#include "bury_cfg/bury_point.hpp"
//#ifdef WIN32
//#include "BaseException.h"
//#endif
@@ -3754,6 +3754,9 @@ if (res) {
} catch (std::exception &) {
// wxMessageBox(e.what(), "", MB_OK);
}
auto isAgree = wxGetApp().app_config->get("snapmaker_privacy_policy", "isagree");
set_privacy_policy(isAgree == "true");
}
void GUI_App::ShowDownNetPluginDlg() {
@@ -7059,6 +7062,9 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
mainframe->refresh_plugin_tips();
// BBS: remove SLA related message
}
auto isAgree = wxGetApp().app_config->get("snapmaker_privacy_policy", "isagree");
set_privacy_policy(isAgree == "true");
return res;
}
+1 -1
View File
@@ -7746,7 +7746,7 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
if (m_slice_timing_active) {
auto end_time = std::chrono::steady_clock::now();
auto duration_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - m_slice_start_time).count();
uint64_t timess = duration_ms;
auto timess = duration_ms;
if (evt.cancelled()) {
BOOST_LOG_TRIVIAL(info) << "Slicing cancelled after " << duration_ms << " ms";
m_slice_start_time = {};
+10 -1
View File
@@ -492,6 +492,15 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt)
this->Close();
} else if (strCmd == "save_region") {
m_Region = j["region"];
m_ProfileJson["region"] = m_Region;
}
else if (strCmd == "common_openurl") {
std::string url = j["url"];
std::string local = j["local"];
if (!url.empty()) {
wxLaunchDefaultBrowser(url);
}
}
else if (strCmd == "network_plugin_install") {
std::string sAction = j["data"]["action"];
@@ -617,7 +626,7 @@ int GuideFrame::SaveProfile()
// m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "1");
// } else
// m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "0");
m_MainPtr->app_config->set("snapmaker_privacy_policy", "isagree", PrivacyUse);
m_MainPtr->app_config->set("region", m_Region);
m_MainPtr->app_config->set_bool("stealth_mode", StealthMode);
+8
View File
@@ -588,6 +588,14 @@ void WebPresetDialog::OnScriptMessage(wxWebViewEvent& evt)
this->Close();
} else if (strCmd == "save_region") {
m_Region = j["region"];
m_ProfileJson["region"] = m_Region;
}
else if (strCmd == "common_openurl") {
std::string url = j["url"];
if (!url.empty()) {
wxLaunchDefaultBrowser(url);
}
} else if (strCmd == "network_plugin_install") {
std::string sAction = j["data"]["action"];