Files
sb-front/electron/main.cjs
T
ByungCheol cb5cf1f0bf
CI / build (push) Failing after 12m35s
feat: 브랜드 앱 아이콘 + Windows 데스크톱(Electron) 클라이언트
- 앱 아이콘: 브랜드(초록 #00bc7e + 흰 막대 차트) 적응형 아이콘 생성(@capacitor/assets)
  · assets/ 에 SVG 소스 + 전 해상도 mipmap 재생성, 적응형 XML 인셋 제거(배경 풀블리드)
- 데스크톱: Electron 로 dist 를 감싼 Windows 설치파일(.exe)
  · vite electron 모드(상대 base)·라우터 해시 히스토리·App 게이트 Electron 감지
  · webSecurity:false 로 file:// CORS 우회, 백엔드는 https://app.sblog.kr/api
  · scripts: build:electron / electron:dev / electron:build(electron-builder NSIS)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-07 16:20:55 +09:00

44 lines
1.4 KiB
JavaScript

// Slim Budget 데스크톱(Electron) 메인 프로세스.
// dist(웹 빌드, --mode electron)를 창에 로드한다. 백엔드는 https://app.sblog.kr/api 사용.
const { app, BrowserWindow, shell } = require('electron')
const path = require('path')
function createWindow() {
const win = new BrowserWindow({
width: 1200,
height: 820,
minWidth: 360,
minHeight: 560,
backgroundColor: '#1a1a1a',
title: 'Slim Budget',
webPreferences: {
contextIsolation: true,
nodeIntegration: false,
// file:// 출처에서 자기 백엔드(https://app.sblog.kr/api) 호출 시 CORS 차단을 피한다.
// 신뢰된 로컬 dist + 자체 API 만 로드하는 데스크톱 클라이언트라 허용 가능한 완화.
webSecurity: false,
},
})
// 기본 메뉴바 제거(앱 자체 내비게이션 사용)
win.removeMenu()
win.loadFile(path.join(__dirname, '..', 'dist', 'index.html'))
// 외부 링크(target=_blank 등)는 기본 브라우저로 열기
win.webContents.setWindowOpenHandler(({ url }) => {
if (/^https?:\/\//i.test(url)) shell.openExternal(url)
return { action: 'deny' }
})
}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})