feat: PC 화면 해상도 변경 — 설정에서 창 크기 프리셋 선택
CI / build (push) Failing after 14m21s

- electron/preload.cjs: contextBridge 로 window.desktop.setWindowSize 노출
- main.cjs: preload 연결 + ipcMain 'window:setSize'/'getSize' 핸들러
- SettingsView: PC(window.desktop 존재 시)에서 해상도 선택 추가
  (1024×720 ~ 1920×1080), 선택 시 창 크기 변경+가운데 정렬

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ByungCheol
2026-06-27 23:57:41 +09:00
parent f34980048b
commit e4e1be49ca
3 changed files with 58 additions and 1 deletions
+16 -1
View File
@@ -1,7 +1,7 @@
// Slim Budget 데스크톱(Electron) 메인 프로세스.
// 라이브 사이트(https://app.sblog.kr)를 직접 로드한다 → 프론트 변경이 자동 반영(재설치 불필요),
// 같은 출처라 CORS 우회도 불필요. 배포된 웹 게이트가 Electron 을 감지해 안내페이지 대신 전체 앱을 띄운다.
const { app, BrowserWindow, shell, session } = require('electron')
const { app, BrowserWindow, shell, session, ipcMain } = require('electron')
const fs = require('fs')
const path = require('path')
@@ -58,6 +58,7 @@ function createWindow() {
webPreferences: {
contextIsolation: true,
nodeIntegration: false,
preload: path.join(__dirname, 'preload.cjs'),
// 한글 IME 첫 글자 중복 입력 방지 — Chromium 맞춤법 검사기가 조합을 방해하는 Electron 알려진 버그 회피
spellcheck: false,
},
@@ -91,6 +92,20 @@ function createWindow() {
})
}
// 데스크톱 창 크기(해상도) 변경 — 렌더러(설정 화면)에서 호출
ipcMain.handle('window:setSize', (e, w, h) => {
const win = BrowserWindow.fromWebContents(e.sender)
if (!win) return false
if (win.isMaximized()) win.unmaximize()
win.setSize(Math.max(360, Math.round(w)), Math.max(560, Math.round(h)))
win.center()
return true
})
ipcMain.handle('window:getSize', (e) => {
const win = BrowserWindow.fromWebContents(e.sender)
return win ? win.getSize() : [0, 0]
})
app.whenReady().then(async () => {
// 시작 시 HTTP 캐시 비움 → 라이브 사이트의 최신 프론트를 항상 로드(옛 HTML 캐시로 인한 미반영 방지).
// localStorage(로그인 세션)는 캐시가 아니라 영향 없음.