Skip to content

Commit dee8ec8

Browse files
feat(stage-tamagotchi): debugger
Co-authored-by: Makito <5277268+sumimakito@users.noreply.github.com>
1 parent bf7495e commit dee8ec8

File tree

5 files changed

+53
-33
lines changed

5 files changed

+53
-33
lines changed

apps/stage-tamagotchi/src/main/index.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import http from 'node:http'
2+
13
import { dirname, join } from 'node:path'
24
import { env, platform } from 'node:process'
35
import { fileURLToPath } from 'node:url'
@@ -80,6 +82,40 @@ function createWindow(): void {
8082
// initialization and is ready to create browser windows.
8183
// Some APIs can only be used after this event occurs.
8284
app.whenReady().then(() => {
85+
if (/^true$/i.test(env.APP_REMOTE_DEBUG || '')) {
86+
const remoteDebugEndpoint = `http://localhost:${env.APP_REMOTE_DEBUG_PORT || '9222'}`
87+
88+
http.get(`${remoteDebugEndpoint}/json`, (res) => {
89+
let data = ''
90+
res.on('data', chunk => data += chunk)
91+
res.on('end', () => {
92+
try {
93+
const targets = JSON.parse(data)
94+
if (targets.length <= 0) {
95+
console.warn('[Remote Debugging] No targets found')
96+
return
97+
}
98+
99+
let wsUrl = targets[0].webSocketDebuggerUrl
100+
if (!wsUrl.startsWith('ws://')) {
101+
console.warn('[Remote Debugging] Invalid WebSocket URL:', wsUrl)
102+
return
103+
}
104+
105+
wsUrl = wsUrl.substring(5)
106+
// eslint-disable-next-line no-console
107+
console.log(`Inspect remotely: ${remoteDebugEndpoint}/devtools/inspector.html?ws=${wsUrl}`)
108+
shell.openExternal(`${remoteDebugEndpoint}/devtools/inspector.html?ws=${wsUrl}`)
109+
}
110+
catch (err) {
111+
console.error('[Remote Debugging] Failed to parse metadata from /json:', err)
112+
}
113+
})
114+
}).on('error', (err) => {
115+
console.error('[Remote Debugging] Failed to fetch metadata from /json:', err)
116+
})
117+
}
118+
83119
// Set app user model id for windows
84120
electronApp.setAppUserModelId('ai.moeru.airi')
85121

apps/stage-tamagotchi/src/renderer/components/Settings/CheckBar.vue

Lines changed: 0 additions & 29 deletions
This file was deleted.

apps/stage-tamagotchi/src/renderer/components/Widgets/ResourceStatusIsland/LoadingModules.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { storeToRefs } from 'pinia'
33
import { computed } from 'vue'
44
import { useI18n } from 'vue-i18n'
55
6-
import WindowRouterLink from '../../Tauri/WindowRouterLink.vue'
6+
import WindowRouterLink from '../../WindowRouterLink.vue'
77
import LoadingComponent from './LoadingComponent.vue'
88
99
import { useResourcesStore } from '../../../stores/resources'

apps/stage-tamagotchi/src/renderer/pages/index.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,23 @@ const modeIndicatorClass = computed(() => {
7474
<div v-show="isLoading" h-full w-full>
7575
<div class="absolute left-0 top-0 z-99 h-full w-full flex cursor-grab items-center justify-center overflow-hidden">
7676
<div
77-
class="absolute h-24 w-full flex items-center justify-center overflow-hidden rounded-xl"
78-
bg="white/80 dark:neutral-950/80" backdrop-blur="md"
77+
:class="[
78+
'absolute h-24 w-full overflow-hidden rounded-xl',
79+
'flex items-center justify-center',
80+
'bg-white/80 dark:bg-neutral-950/80',
81+
'backdrop-blur-md',
82+
]"
7983
>
80-
<div class="drag-region absolute left-0 top-0 h-full w-full flex animate-flash animate-duration-5s animate-count-infinite select-none items-center justify-center text-1.5rem text-primary-400 font-normal">
84+
<div
85+
:class="[
86+
'drag-region',
87+
'absolute left-0 top-0',
88+
'h-full w-full flex items-center justify-center',
89+
'text-1.5rem text-primary-600 dark:text-primary-400 font-normal',
90+
'select-none',
91+
'animate-flash animate-duration-5s animate-count-infinite',
92+
]"
93+
>
8194
Loading...
8295
</div>
8396
</div>

0 commit comments

Comments
 (0)