From d15b10a012b95fdbfeaff688accab8ca97b27649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Mon, 30 Mar 2026 09:13:55 +0300 Subject: [PATCH] feat: implement backend configuration service and initialize main application UI components --- config/nginx.conf.template | 2 +- port_mappings.json | 2 +- settings.json | 7 +++++-- src/main/ipc/index.ts | 1 + src/main/services/ConfigService.ts | 1 + src/renderer/src/App.tsx | 21 +++++++++++++++++++++ 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/config/nginx.conf.template b/config/nginx.conf.template index 36dbe65..76521d5 100644 --- a/config/nginx.conf.template +++ b/config/nginx.conf.template @@ -11,7 +11,7 @@ http { keepalive_timeout 65; server { - listen {{PORT}}; + listen {{LISTEN_ADDRESS}}:{{PORT}}; server_name localhost; root "{{ROOT}}"; index index.php index.html index.htm; diff --git a/port_mappings.json b/port_mappings.json index 4cfc888..7896836 100644 --- a/port_mappings.json +++ b/port_mappings.json @@ -11,5 +11,5 @@ "4.4.9": 9009, "3.0.x (latest)": 9010 }, - "mysql": {} + "mariadb": {} } \ No newline at end of file diff --git a/settings.json b/settings.json index 9206455..6ac90a0 100644 --- a/settings.json +++ b/settings.json @@ -1,7 +1,10 @@ { "nginxPort": "80", "phpPort": "9001", + "mariaDbPort": "3306", + "mariaDbPorts": {}, + "allowRemoteAccess": true, + "language": "tr", "mysqlPort": "3306", - "mysqlPorts": {}, - "language": "tr" + "mysqlPorts": {} } \ No newline at end of file diff --git a/src/main/ipc/index.ts b/src/main/ipc/index.ts index 873fc38..cb4690f 100644 --- a/src/main/ipc/index.ts +++ b/src/main/ipc/index.ts @@ -91,6 +91,7 @@ async function rebuildNginxConfig(forceProjects: boolean = false): Promise<{ bin const configPath = await configService.generateConfig('nginx.conf.template', 'nginx.conf', { PORT: settings.nginxPort, + LISTEN_ADDRESS: settings.allowRemoteAccess ? '0.0.0.0' : '127.0.0.1', PHP_PORT: settings.phpPort, ROOT: rootPath, LOG_DIR: logDir.replace(/\\/g, '/'), diff --git a/src/main/services/ConfigService.ts b/src/main/services/ConfigService.ts index 5b3565a..066cbb1 100644 --- a/src/main/services/ConfigService.ts +++ b/src/main/services/ConfigService.ts @@ -11,6 +11,7 @@ export class ConfigService { phpPort: '9001', mariaDbPort: '3306', mariaDbPorts: {} as Record, + allowRemoteAccess: false, language: 'tr' } diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 172d3df..c270703 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -19,6 +19,7 @@ import { Paper, Chip, Switch, + FormControlLabel, Button, Snackbar, Alert, @@ -92,6 +93,7 @@ interface AppSettings { phpPort: string mariaDbPort: string mariaDbPorts?: Record + allowRemoteAccess: boolean language: string } @@ -116,6 +118,7 @@ function App(): JSX.Element { nginxPort: '80', phpPort: '9001', mariaDbPort: '3306', + allowRemoteAccess: false, language: 'tr' }) const [notification, setNotification] = useState<{ open: boolean, message: string, severity: 'success' | 'error' }>({ @@ -878,6 +881,24 @@ function App(): JSX.Element { helperText="Varsayılan: 3306" /> + + { + const newSettings = { ...settings, allowRemoteAccess: e.target.checked } + setSettings(newSettings) + }} + /> + } + label="Dış Erişime İzin Ver (0.0.0.0)" + /> + + {settings.allowRemoteAccess + ? "Sunucu yerel ağdaki diğer cihazlardan erişilebilir." + : "Sunucu sadece bu bilgisayardan (127.0.0.1) erişilebilir."} +