Merge pull request #82 from Snapmaker/dev_bury_point_alves

Dev bury point alves
This commit is contained in:
Alves
2025-12-23 11:30:27 +08:00
committed by GitHub
4 changed files with 29 additions and 8 deletions

View File

@@ -44,6 +44,17 @@
#define BP_SLICE_DURATION "bury_point_slice_duration" #define BP_SLICE_DURATION "bury_point_slice_duration"
#define BP_SLICE_DURATION_TIME "slice_duration_time" #define BP_SLICE_DURATION_TIME "slice_duration_time"
#define BP_WEB_VIEW "bury_point_webview"
#define BP_LOCAL_SERVER "bury_point_local_server"
#define BP_LOCAL_SERVER_STATUS "bury_point_local_server_status"
#define BP_LOCAL_SERVER_ERROR_CODE "bury_point_local_server_error_code"
#define BP_LOCAL_SERVER "bury_point_local_server"
#define BP_LOCAL_SERVER_ERR_CODE "bury_local_server_err_code"
//webview bury point //webview bury point
BURY_API bool get_privacy_policy(); BURY_API bool get_privacy_policy();

View File

@@ -210,15 +210,15 @@ void initSentryEx()
sentry_options_set_sample_rate(options, 1.0); sentry_options_set_sample_rate(options, 1.0);
sentry_options_set_traces_sample_rate(options, 1.0); sentry_options_set_traces_sample_rate(options, 1.0);
sentry_set_tag("version", Snapmaker_VERSION); sentry_init(options);
sentry_start_session();
sentry_set_tag("snapmaker_version", Snapmaker_VERSION);
std::string flutterVersion = common::get_flutter_version(); std::string flutterVersion = common::get_flutter_version();
if (!flutterVersion.empty()) if (!flutterVersion.empty())
set_sentry_tags("flutter_version", flutterVersion); sentry_set_tag("flutter_version", flutterVersion.c_str());
sentry_init(options);
sentry_start_session();
//sentryReportLog(SENTRY_LOG_ERROR, "init sentry error", "initSentry module"); //sentryReportLog(SENTRY_LOG_ERROR, "init sentry error", "initSentry module");
} }
} }

View File

@@ -4,6 +4,7 @@
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "slic3r/Utils/Http.hpp" #include "slic3r/Utils/Http.hpp"
#include "slic3r/Utils/NetworkAgent.hpp" #include "slic3r/Utils/NetworkAgent.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <io.h> #include <io.h>
@@ -292,6 +293,7 @@ void HttpServer::start()
server_->io_service.run(); server_->io_service.run();
} catch (const std::exception& e) { } catch (const std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "HTTP server error: " << e.what(); BOOST_LOG_TRIVIAL(error) << "HTTP server error: " << e.what();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL,std::string("HttpServer::start ") + e.what(), BP_LOCAL_SERVER);
start_http_server = false; start_http_server = false;
} }
}); });
@@ -313,6 +315,8 @@ void HttpServer::start()
} catch (const std::exception& e) { } catch (const std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "Failed to start HTTP server: " << e.what(); BOOST_LOG_TRIVIAL(error) << "Failed to start HTTP server: " << e.what();
std::string error_msg = "Failed to start HTTP server on port " + std::to_string(port) + ": " + e.what();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, error_msg.c_str(), BP_LOCAL_SERVER);
start_http_server = false; start_http_server = false;
throw; throw;
} }
@@ -460,6 +464,8 @@ void HttpServer::start_health_check()
BOOST_LOG_TRIVIAL(info) << "HTTP server restart completed by health check thread"; BOOST_LOG_TRIVIAL(info) << "HTTP server restart completed by health check thread";
} catch (const std::exception& e) { } catch (const std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "Failed to restart HTTP server: " << e.what(); BOOST_LOG_TRIVIAL(error) << "Failed to restart HTTP server: " << e.what();
std::string error_msg = "HTTP server restart failed after health check on port " + std::to_string(port) + ": " + e.what();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_ERROR, error_msg.c_str(), BP_LOCAL_SERVER);
} }
} else if (start_http_server) { } else if (start_http_server) {
BOOST_LOG_TRIVIAL(debug) << "HTTP server health check passed"; BOOST_LOG_TRIVIAL(debug) << "HTTP server health check passed";
@@ -654,8 +660,10 @@ std::shared_ptr<HttpServer::Response> HttpServer::bbl_auth_handle_request(const
user_avatar = user_j["avatar"].get<std::string>(); user_avatar = user_j["avatar"].get<std::string>();
if (user_j.contains("account")) if (user_j.contains("account"))
user_account = user_j["account"].get<std::string>(); user_account = user_j["account"].get<std::string>();
} catch (...) { } catch (const std::exception& e) {
; BOOST_LOG_TRIVIAL(error) << "Failed to parse user profile JSON: " << e.what();
std::string error_msg = "User profile JSON parse error: " + std::string(e.what());
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_ERROR, error_msg.c_str(), BP_LOCAL_SERVER);
} }
json j; json j;
j["data"]["refresh_token"] = refresh_token; j["data"]["refresh_token"] = refresh_token;

View File

@@ -16,6 +16,7 @@
#include "wx/private/jsscriptwrapper.h" #include "wx/private/jsscriptwrapper.h"
#endif #endif
#include "sentry_wrapper/SentryWrapper.hpp"
#ifdef __WIN32__ #ifdef __WIN32__
#include <WebView2.h> #include <WebView2.h>
#include <Shellapi.h> #include <Shellapi.h>
@@ -312,7 +313,8 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
#endif #endif
webView->EnableContextMenu(true); webView->EnableContextMenu(true);
} else { } else {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": failed. Use fake web view."; BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__ << ": failed. Use fake web view.";
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "create webview fail and use fakewebview", BP_WEB_VIEW);
webView = new FakeWebView; webView = new FakeWebView;
} }
webView->SetRefData(new WebViewRef(webView)); webView->SetRefData(new WebViewRef(webView));