Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions frontend/electron/modules/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ export function startBackend(): void {
appendBackendLog(`[Backend] Starting from ${cwd}`)
appendBackendLog(`[Backend] Command: ${cmd} ${args.join(' ')}`)

const env: Record<string, string | undefined> = { ...process.env, PYTHONUNBUFFERED: '1' }
const env: Record<string, string | undefined> = {
...process.env,
PYTHONUNBUFFERED: '1',
PYTHONIOENCODING: 'utf-8',
PYTHONUTF8: '1',
}

const useDebugConsole = process.platform === 'win32' && shouldOpenDebugConsole()

Expand Down Expand Up @@ -200,14 +205,15 @@ export function startBackend(): void {
detached: process.platform !== 'win32',
})

backendProcess.stdout?.on('data', (data: Buffer) => {
const text = data.toString()
backendProcess.stdout?.setEncoding('utf-8')
backendProcess.stderr?.setEncoding('utf-8')

backendProcess.stdout?.on('data', (text: string) => {
consumeStdoutChunk(text)
console.log(`[Backend] ${text.trimEnd()}`)
})

backendProcess.stderr?.on('data', (data: Buffer) => {
const text = data.toString()
backendProcess.stderr?.on('data', (text: string) => {
console.error(`[Backend] ${text.trimEnd()}`)
consumeStderrChunk(text)
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"lint": "node scripts/run-eslint.mjs",
"lint:fix": "node scripts/run-eslint.mjs --fix",
"dev": "vite",
"dev": "node scripts/dev.mjs",
"dev:web": "npx cross-env WEB_ONLY=1 vite",
"build": "node scripts/run-build.mjs",
"preview": "vite preview",
Expand Down
16 changes: 16 additions & 0 deletions frontend/scripts/dev.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { execSync, spawn } from 'node:child_process'
import process from 'node:process'

if (process.platform === 'win32') {
try {
execSync('chcp 65001', { stdio: 'ignore' })
}
catch {}
}

const child = spawn('npx', ['vite'], {
stdio: 'inherit',
shell: true,
})

child.on('exit', code => process.exit(code ?? 0))
6 changes: 3 additions & 3 deletions frontend/src/components/LoginDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function handleSkip() {
trackTelemetry('login_skip', {
mode: mode.value,
})
window.open('https://github.com/RTGS2017/NagaAgent.git', '_blank')
emit('skip')
}

function openForgotPassword() {
Expand Down Expand Up @@ -314,7 +314,7 @@ const stopWatch = watch(backendConnected, (connected) => {
<span class="login-link" @click="openForgotPassword">忘记密码</span>
</div>
<div class="login-skip" @click="handleSkip">
不登录,使用开源版本
不登录,直接进入
</div>
</template>

Expand Down Expand Up @@ -407,7 +407,7 @@ const stopWatch = watch(backendConnected, (connected) => {
<span class="login-link" @click="openForgotPassword">忘记密码</span>
</div>
<div class="login-skip" @click="handleSkip">
不登录,使用开源版本
不登录,直接进入
</div>
</template>
</div>
Expand Down
Loading