feat: implement process management service and base application UI structure

This commit is contained in:
Ümit Tunç
2026-03-29 00:43:11 +03:00
parent a6887106da
commit bf99a4fb49
5 changed files with 55 additions and 7 deletions
+3 -2
View File
@@ -1,8 +1,9 @@
location /{{HOST}}/ {
location ^~ /{{HOST}}/ {
alias "{{PATH}}/";
index index.php index.html;
autoindex on;
# Try the literal URI, then directory, then fallback to index.php
# Try the literal URI, then directory (checks for index), then fallback to root index.php
try_files $uri $uri/ /{{HOST}}/index.php?$query_string;
# PHP handling nested INSIDE the alias location to maintain context
+1 -1
View File
@@ -1 +1 @@
38592
43936
+23
View File
@@ -29,6 +29,29 @@ function findExecutable(dir: string, name: string): string | null {
export function registerIpcHandlers(): void {
// Service management
ipcMain.handle('services:reload', async (_event, serviceName: string) => {
if (serviceName !== 'nginx') return { success: false, message: 'Yalnızca Nginx için reload desteklenmektedir.' }
try {
// Re-generate config
const binDir = path.join(configService.getBasePath(), 'bin')
const nginxDir = path.join(binDir, 'nginx')
const nginxVersions = fs.readdirSync(nginxDir).filter(f => fs.statSync(path.join(nginxDir, f)).isDirectory())
const activeVersion = nginxVersions[0] // Simplify: use first installed
if (!activeVersion) throw new Error('Nginx sürümü bulunamadı.')
const nginxPrefix = path.join(nginxDir, activeVersion)
const binPath = path.join(nginxPrefix, 'nginx.exe')
const configPath = path.join(configService.getBasePath(), 'generated_configs', 'nginx.conf')
// For reload, we need the same prefix and config
const success = await processManager.runOnce(binPath, ['-p', nginxPrefix, '-c', configPath, '-s', 'reload'], 'nginx')
return { success, message: success ? 'Nginx yapılandırması yeniden yüklendi.' : 'Nginx reload hatası (Nginx çalışmıyor olabilir).' }
} catch (error: any) {
return { success: false, message: `Reload hatası: ${error.message}` }
}
})
ipcMain.handle('services:start', async (_event, serviceName: string) => {
try {
const settings = configService.getSettings()
+10 -1
View File
@@ -110,11 +110,20 @@ export class ProcessManager {
try {
this.addLog(name, `Starting service with: ${binPath} ${args.join(' ')}`)
const serviceEnv = { ...process.env }
const binDirPath = path.dirname(binPath)
if (serviceEnv.PATH) {
serviceEnv.PATH = `${binDirPath}${path.delimiter}${serviceEnv.PATH}`
} else {
serviceEnv.PATH = binDirPath
}
const child = spawn(binPath, args, {
shell: shell,
windowsHide: true,
stdio: ['ignore', 'pipe', 'pipe'],
cwd: path.dirname(binPath)
cwd: binDirPath,
env: serviceEnv
})
console.log(`[PROCESS] Started ${name} with PID ${child.pid}`)
+18 -3
View File
@@ -765,9 +765,24 @@ function App(): JSX.Element {
<Typography variant="h6" sx={{ fontWeight: 'bold' }}>Nginx</Typography>
<Typography variant="body2" color="text.secondary" sx={{ mb: 2 }}>Port: {settings.nginxPort}</Typography>
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<IconButton onClick={() => handleOpenLogs('nginx')} size="small" sx={{ bgcolor: 'rgba(255,255,255,0.05)' }}>
<TerminalIcon fontSize="small" />
</IconButton>
<Box sx={{ display: 'flex', gap: 1 }}>
<IconButton onClick={() => handleOpenLogs('nginx')} title="Hata Logları" size="small" sx={{ bgcolor: 'rgba(255,255,255,0.05)' }}>
<TerminalIcon fontSize="small" />
</IconButton>
<IconButton
onClick={() => {
window.api.invoke('services:reload', 'nginx').then((res: any) => {
setNotification({ open: true, message: res.message, severity: res.success ? 'success' : 'error' })
})
}}
title="Yapılandırmayı Yeniden Yükle"
size="small"
disabled={status.nginx !== 'running'}
sx={{ bgcolor: 'rgba(255,255,255,0.05)', '&:hover': { color: 'primary.main' } }}
>
<RefreshIcon fontSize="small" />
</IconButton>
</Box>
<Switch
checked={status.nginx === 'running' || status.nginx === 'starting'}
onChange={() => handleToggleService('nginx')}