Clean up, handle sentry init fail

This commit is contained in:
Natsumi
2025-11-14 17:45:36 +11:00
parent 747204171a
commit c11a79f76f
3 changed files with 85 additions and 72 deletions
+52 -43
View File
@@ -3,17 +3,22 @@
// This work is licensed under the terms of the MIT license. // This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>. // For a copy, see <https://opensource.org/licenses/MIT>.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace VRCX namespace VRCX
{ {
partial class MainForm partial class MainForm
{ {
/// <summary> /// <summary>
/// 필수 디자이너 변수입니다. /// 필수 디자이너 변수입니다.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private IContainer components = null;
/// <summary> /// <summary>
/// 사용 중인 모든 리소스를 정리합니다. /// 사용 중인 모든 리소스를 정리합니다.
/// </summary> /// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param> /// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
@@ -22,96 +27,100 @@ namespace VRCX
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region Windows Form #region Windows Form
/// <summary> /// <summary>
/// 디자이너 지원에 필요한 메서드입니다. /// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요. /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new Container();
this.TrayMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.TrayMenu = new ContextMenuStrip(this.components);
this.TrayMenu_Open = new System.Windows.Forms.ToolStripMenuItem(); this.TrayMenu_Open = new ToolStripMenuItem();
this.TrayMenu_DevTools = new System.Windows.Forms.ToolStripMenuItem(); this.TrayMenu_DevTools = new ToolStripMenuItem();
this.TrayMenu_Separator = new System.Windows.Forms.ToolStripSeparator(); this.TrayMenu_Separator = new ToolStripSeparator();
this.TrayMenu_Quit = new System.Windows.Forms.ToolStripMenuItem(); this.TrayMenu_Quit = new ToolStripMenuItem();
this.TrayIcon = new System.Windows.Forms.NotifyIcon(this.components); this.TrayIcon = new NotifyIcon(this.components);
this.TrayMenu.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
this.TrayMenu.SuspendLayout(); this.TrayMenu.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// TrayMenu // TrayMenu
// //
this.TrayMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.TrayMenu.Items.AddRange(new ToolStripItem[]
this.TrayMenu_Open, {
this.TrayMenu_DevTools, this.TrayMenu_Open,
this.TrayMenu_Separator, this.TrayMenu_DevTools,
this.TrayMenu_Quit}); this.TrayMenu_Separator,
this.TrayMenu_Quit
});
this.TrayMenu.Name = "TrayMenu"; this.TrayMenu.Name = "TrayMenu";
this.TrayMenu.Size = new System.Drawing.Size(132, 54); this.TrayMenu.Size = new Size(132, 54);
// //
// TrayMenu_Open // TrayMenu_Open
// //
this.TrayMenu_Open.Name = "TrayMenu_Open"; this.TrayMenu_Open.Name = "TrayMenu_Open";
this.TrayMenu_Open.Size = new System.Drawing.Size(131, 22); this.TrayMenu_Open.Size = new Size(131, 22);
this.TrayMenu_Open.Text = "Open"; this.TrayMenu_Open.Text = "Open";
this.TrayMenu_Open.Click += new System.EventHandler(this.TrayMenu_Open_Click); this.TrayMenu_Open.Click += new EventHandler(this.TrayMenu_Open_Click);
// //
// TrayMenu_DevTools // TrayMenu_DevTools
// //
this.TrayMenu_DevTools.Name = "TrayMenu_DevTools"; this.TrayMenu_DevTools.Name = "TrayMenu_DevTools";
this.TrayMenu_DevTools.Size = new System.Drawing.Size(131, 22); this.TrayMenu_DevTools.Size = new Size(131, 22);
this.TrayMenu_DevTools.Text = "DevTools"; this.TrayMenu_DevTools.Text = "DevTools";
this.TrayMenu_DevTools.Click += new System.EventHandler(this.TrayMenu_DevTools_Click); this.TrayMenu_DevTools.Click += new EventHandler(this.TrayMenu_DevTools_Click);
// //
// TrayMenu_Separator // TrayMenu_Separator
// //
this.TrayMenu_Separator.Name = "TrayMenu_Separator"; this.TrayMenu_Separator.Name = "TrayMenu_Separator";
this.TrayMenu_Separator.Size = new System.Drawing.Size(128, 6); this.TrayMenu_Separator.Size = new Size(128, 6);
// //
// TrayMenu_Quit // TrayMenu_Quit
// //
this.TrayMenu_Quit.Name = "TrayMenu_Quit"; this.TrayMenu_Quit.Name = "TrayMenu_Quit";
this.TrayMenu_Quit.Size = new System.Drawing.Size(131, 22); this.TrayMenu_Quit.Size = new Size(131, 22);
this.TrayMenu_Quit.Text = "Quit VRCX"; this.TrayMenu_Quit.Text = "Quit VRCX";
this.TrayMenu_Quit.Click += new System.EventHandler(this.TrayMenu_Quit_Click); this.TrayMenu_Quit.Click += new EventHandler(this.TrayMenu_Quit_Click);
// //
// TrayIcon // TrayIcon
// //
this.TrayIcon.ContextMenuStrip = this.TrayMenu; this.TrayIcon.ContextMenuStrip = this.TrayMenu;
this.TrayIcon.Text = "VRCX"; this.TrayIcon.Text = "VRCX";
this.TrayIcon.Visible = true; this.TrayIcon.Visible = true;
this.TrayIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TrayIcon_MouseClick); this.TrayIcon.MouseClick += new MouseEventHandler(this.TrayIcon_MouseClick);
// //
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(842, 561); this.ClientSize = new Size(842, 561);
this.MinimumSize = new System.Drawing.Size(320, 240); this.MinimumSize = new Size(320, 240);
this.Name = "MainForm"; this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = FormStartPosition.CenterScreen;
this.Text = Program.Version; this.Text = Program.Version;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); this.FormClosing += new FormClosingEventHandler(this.MainForm_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed); this.FormClosed += new FormClosedEventHandler(this.MainForm_FormClosed);
this.Load += new System.EventHandler(this.MainForm_Load); this.Load += new EventHandler(this.MainForm_Load);
this.Move += new System.EventHandler(this.MainForm_Move); this.Move += new EventHandler(this.MainForm_Move);
this.Resize += new System.EventHandler(this.MainForm_Resize); this.Resize += new EventHandler(this.MainForm_Resize);
this.TrayMenu.ResumeLayout(false); this.TrayMenu.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.ContextMenuStrip TrayMenu; private ContextMenuStrip TrayMenu;
private System.Windows.Forms.ToolStripMenuItem TrayMenu_Open; private ToolStripMenuItem TrayMenu_Open;
private System.Windows.Forms.ToolStripMenuItem TrayMenu_DevTools; private ToolStripMenuItem TrayMenu_DevTools;
private System.Windows.Forms.ToolStripSeparator TrayMenu_Separator; private ToolStripSeparator TrayMenu_Separator;
private System.Windows.Forms.ToolStripMenuItem TrayMenu_Quit; private ToolStripMenuItem TrayMenu_Quit;
private System.Windows.Forms.NotifyIcon TrayIcon; private NotifyIcon TrayIcon;
} }
} }
+7 -3
View File
@@ -456,9 +456,13 @@
onMounted(() => { onMounted(() => {
if (!sentryErrorReporting.value) return; if (!sentryErrorReporting.value) return;
const feedback = Sentry.getFeedback(); try {
feedback?.attachTo(document.getElementById('feedback')); const feedback = Sentry.getFeedback();
window.addEventListener('keydown', handleKeydown); feedback?.attachTo(document.getElementById('feedback'));
window.addEventListener('keydown', handleKeydown);
} catch (error) {
console.error('Error setting up Sentry feedback:', error);
}
}); });
onUnmounted(() => { onUnmounted(() => {
+26 -26
View File
@@ -5,33 +5,33 @@ import configRepository from '../service/config';
import * as Sentry from '@sentry/vue'; import * as Sentry from '@sentry/vue';
export async function initSentry(app) { export async function initSentry(app) {
const enabled = await configRepository.getString(
'VRCX_SentryEnabled',
'false'
);
const version = await AppApi.GetVersion();
const isNightly = version.includes('Nightly');
if (enabled !== 'true' || !isNightly) {
return;
}
const vrcxId = await configRepository.getString('VRCX_id', '');
const response = await webApiService.execute({
url: 'https://api0.vrcx.app/errorreporting/getdsn',
method: 'GET',
headers: {
Referer: 'https://vrcx.app',
'VRCX-ID': vrcxId
}
});
if (response.status !== 200) {
console.error(
'Failed to get Sentry DSN:',
response.status,
response.data
);
return;
}
try { try {
const enabled = await configRepository.getString(
'VRCX_SentryEnabled',
'false'
);
const version = await AppApi.GetVersion();
const isNightly = version.includes('Nightly');
if (enabled !== 'true' || !isNightly) {
return;
}
const vrcxId = await configRepository.getString('VRCX_id', '');
const response = await webApiService.execute({
url: 'https://api0.vrcx.app/errorreporting/getdsn',
method: 'GET',
headers: {
Referer: 'https://vrcx.app',
'VRCX-ID': vrcxId
}
});
if (response.status !== 200) {
console.error(
'Failed to get Sentry DSN:',
response.status,
response.data
);
return;
}
const dsn = atob(response.data); const dsn = atob(response.data);
Sentry.init({ Sentry.init({
app, app,