Skip to content
Merged
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
27 changes: 22 additions & 5 deletions .github/workflows/deploy-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:
jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 전체 git 히스토리 가져오기
fetch-depth: 0 # 전체 git 히스토리 가져오기

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -22,11 +22,28 @@ jobs:
cache-dependency-path: |
package-lock.json

- name: Enable corepack
run: corepack enable

- name: Verify package-lock.json exists
run: |
if [ ! -f package-lock.json ]; then
echo "❌ package-lock.json not found!"
echo "📁 Current directory contents:"
ls -la
exit 1
fi
echo "✅ package-lock.json found"
echo "📋 Lockfile version:"
node -p "require('./package-lock.json').lockfileVersion"
echo "📦 npm version:"
npm --version

- name: Install workspace dependencies
run: |
# 전체 workspace 의존성 설치 (husky 스크립트 무시)
npm ci --ignore-scripts

- name: Verify workspace setup
run: |
echo "✅ Workspace dependencies installed successfully"
Expand All @@ -48,7 +65,7 @@ jobs:
run: |
mkdir -p output
cp -r apps/web/dist/* output/

# Vercel 설정 파일 생성
cat > output/vercel.json << 'EOF'
{
Expand Down Expand Up @@ -121,7 +138,7 @@ jobs:
destination-github-username: choihooo
destination-repository-name: gubugionandon-FE
user-email: ${{ secrets.EMAIL }}
commit-message: "🚀 Deploy web app: ${{ github.event.commits[0].message }}"
commit-message: '🚀 Deploy web app: ${{ github.event.commits[0].message }}'
target-branch: main

- name: Deploy info
Expand Down
8 changes: 4 additions & 4 deletions apps/electron/.electron-builder.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ if (process.env.VITE_APP_VERSION === undefined) {
* @see https://www.electron.build/configuration/configuration
*/
const config = {
appId: 'com.yerba.electron',
productName: 'Yerba',
appId: 'co.kr.bugi.electron',
productName: 'bugi',
directories: {
output: 'dist',
buildResources: 'buildResources',
Expand Down Expand Up @@ -60,7 +60,7 @@ const config = {
],
icon: 'buildResources/icon.icns',
artifactName: '${productName}-${version}-${arch}.${ext}',
hardenedRuntime: true,
hardenedRuntime: false, // 코드 서명 없이 개발 시 false
gatekeeperAssess: false,
entitlements: 'buildResources/entitlements.mac.plist',
entitlementsInherit: 'buildResources/entitlements.mac.plist',
Expand All @@ -84,7 +84,7 @@ const config = {
],
icon: 'buildResources/icon.png',
artifactName: '${productName}-${version}-${arch}.${ext}',
publisherName: 'Yerba',
publisherName: 'Bugi',
},
nsis: {
oneClick: false,
Expand Down
44 changes: 42 additions & 2 deletions apps/electron/layers/main/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ElectronAPI } from 'api';
import { app, ipcMain } from 'electron';
import { appendFile, mkdir } from 'fs/promises';
import { join } from 'path';
import './security-restrictions';
import { restoreOrCreateWindow } from '/@/mainWindow';

Expand All @@ -16,6 +18,7 @@ function setupAPIHandlers() {
ipcMain.removeAllListeners('api:hash');
ipcMain.removeAllListeners('api:hash:batch');
ipcMain.removeAllListeners('api:platform');
ipcMain.removeAllListeners('api:writeLog');

// Health check handler
ipcMain.handle('api:health', async () => {
Expand Down Expand Up @@ -72,6 +75,37 @@ function setupAPIHandlers() {
electron: process.versions.electron,
};
});

// Write log file handler
ipcMain.handle(
'api:writeLog',
async (_event, data: string, filename?: string) => {
try {
const userDataPath = app.getPath('userData');
const logDir = join(userDataPath, 'logs');
await mkdir(logDir, { recursive: true });

const logFilename =
filename || `score_${new Date().toISOString().split('T')[0]}.log`;
const logPath = join(logDir, logFilename);

const timestamp = new Date().toISOString();
const logLine = `[${timestamp}] ${data}\n`;

await appendFile(logPath, logLine, 'utf-8');

// 개발 환경에서 경로 출력
if (import.meta.env.DEV) {
console.log(`📝 Log written to: ${logPath}`);
}

return { success: true, path: logPath };
} catch (error) {
console.error('Failed to write log:', error);
throw error;
}
},
);
}

/**
Expand All @@ -85,9 +119,15 @@ if (!isSingleInstance) {
app.on('second-instance', restoreOrCreateWindow);

/**
* Disable Hardware Acceleration for more power-save
* Enable Hardware Acceleration for GPU support (required for WebGL)
*/
app.disableHardwareAcceleration();
// app.disableHardwareAcceleration(); // GPU 사용을 위해 주석 처리

// GPU 가속 활성화를 위한 command line switches
app.commandLine.appendSwitch('enable-gpu');
app.commandLine.appendSwitch('enable-webgl');
app.commandLine.appendSwitch('enable-accelerated-2d-canvas');
app.commandLine.appendSwitch('ignore-gpu-blacklist'); // GPU 블랙리스트 무시

/**
* Shout down background process if all windows was closed
Expand Down
28 changes: 19 additions & 9 deletions apps/electron/layers/main/src/mainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ async function createWindow() {
nodeIntegration: false,
contextIsolation: true,
allowRunningInsecureContent: false,
// GPU 가속은 app.commandLine.appendSwitch로 활성화됨
},
});

Expand Down Expand Up @@ -40,18 +41,27 @@ async function createWindow() {
// Set Content Security Policy for renderer
browserWindow.webContents.session.webRequest.onHeadersReceived(
(details, callback) => {
const csp = [
"default-src 'self' data: https://www.bugi.co.kr https://api.bugi.co.kr",
"script-src 'self' 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval' https://cdn.jsdelivr.net https://www.bugi.co.kr https://api.bugi.co.kr",
"script-src-elem 'self' 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval' https://cdn.jsdelivr.net https://www.bugi.co.kr https://api.bugi.co.kr",
"worker-src 'self' blob:",
// ★ 여기 추가
"connect-src 'self' https://cdn.jsdelivr.net https://storage.googleapis.com https://www.bugi.co.kr https://api.bugi.co.kr",
"style-src 'self' 'unsafe-inline' https://www.bugi.co.kr",
"img-src 'self' data: blob: https://www.bugi.co.kr https://api.bugi.co.kr",
"font-src 'self' data: https://www.bugi.co.kr",
"object-src 'none'",
"frame-ancestors 'none'",
].join('; ');

callback({
responseHeaders: {
...details.responseHeaders,
'Content-Security-Policy': [
"default-src 'self' 'unsafe-inline' data: https://www.bugi.co.kr https://api.bugi.co.kr;",
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.bugi.co.kr https://api.bugi.co.kr;",
"style-src 'self' 'unsafe-inline' https://www.bugi.co.kr;",
"img-src 'self' data: https://www.bugi.co.kr https://api.bugi.co.kr;",
"connect-src 'self' https://www.bugi.co.kr https://api.bugi.co.kr;",
"font-src 'self' data: https://www.bugi.co.kr;",
"object-src 'none';",
],
'Content-Security-Policy': [csp],
// (SharedArrayBuffer 쓰면) COOP/COEP도 함께 설정
// "Cross-Origin-Opener-Policy": ["same-origin"],
// "Cross-Origin-Embedder-Policy": ["require-corp"],
},
});
},
Expand Down
4 changes: 4 additions & 0 deletions apps/electron/layers/preload/exposedInMainWorld.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@ interface Window {
generateHash: (data: string) => Promise<HashResponse>;
generateBatchHash: (dataList: string[]) => Promise<BatchHashResponse>;
getPlatform: () => Promise<PlatformResponse>;
writeLog: (
data: string,
filename?: string,
) => Promise<{ success: boolean; path: string }>;
};
}
4 changes: 4 additions & 0 deletions apps/electron/layers/preload/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@ contextBridge.exposeInMainWorld('electronAPI', {

// Platform info
getPlatform: () => ipcRenderer.invoke('api:platform'),

// Write log file
writeLog: (data: string, filename?: string) =>
ipcRenderer.invoke('api:writeLog', data, filename),
});
2 changes: 1 addition & 1 deletion apps/electron/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "electron-wrapper",
"version": "1.0.0",
"description": "Yerba Electron Application",
"description": "거부기 Electron Application",
"author": {
"name": "Yerba Team",
"email": "[email protected]"
Expand Down
9 changes: 8 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
"format:check": "prettier --check ."
},
"dependencies": {
"@mediapipe/tasks-vision": "^0.10.22-rc.20250304",
"@tailwindcss/vite": "^4.1.14",
"@tanstack/react-query": "^5.0.0",
"api": "*",
"axios": "^1.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^7.9.4",
"react-webcam": "^7.2.0"
"react-webcam": "^7.2.0",
"zustand": "^5.0.8"
},
"devDependencies": {
Expand All @@ -36,5 +37,11 @@
"typescript": "^5.0.0",
"vite": "^5.0.0",
"vite-plugin-svgr": "^4.5.0"
},
"optionalDependencies": {
"@esbuild/win32-x64": "latest",
"@rollup/rollup-win32-x64-msvc": "latest",
"@tailwindcss/oxide-win32-x64-msvc": "latest",
"lightningcss-win32-x64-msvc": "latest"
}
}
Loading