From e85a300703779c13524da274affde869aca2df76 Mon Sep 17 00:00:00 2001 From: Babak Alizadeh Date: Fri, 21 Mar 2025 19:05:12 +0000 Subject: [PATCH] bug fix --- .gitignore | 2 +- hesabixCore/.gitignore | 2 +- .../src/Controller/Front/UiGeneralController.php | 5 +++-- public_html/.htaccess | 4 ++-- public_html/webui/.htaccess | 14 -------------- webUI/public/.htaccess | 4 ++-- webUI/src/hesabixConfig.js | 16 ++++++++-------- webUI/src/router/index.ts | 14 +++++++------- webUI/vite.config.ts | 4 ++-- webUI/workbox-config.js | 4 ++-- 10 files changed, 28 insertions(+), 41 deletions(-) delete mode 100644 public_html/webui/.htaccess diff --git a/.gitignore b/.gitignore index b9ba060..d316c39 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ hesabixArchive/ hesabixBackup/ backup/ .idea/ -public_html/webui/* +public_html/u/* diff --git a/hesabixCore/.gitignore b/hesabixCore/.gitignore index 5caec0b..3175926 100644 --- a/hesabixCore/.gitignore +++ b/hesabixCore/.gitignore @@ -11,7 +11,7 @@ /../hesabixBackup/ /../backup/ ###< symfony/framework-bundle ### -/../public_html/webui/ +/../public_html/u/ /../webUI/node_modules/ ###> phpunit/phpunit ### diff --git a/hesabixCore/src/Controller/Front/UiGeneralController.php b/hesabixCore/src/Controller/Front/UiGeneralController.php index 6d9465c..8f5eb0f 100644 --- a/hesabixCore/src/Controller/Front/UiGeneralController.php +++ b/hesabixCore/src/Controller/Front/UiGeneralController.php @@ -4,15 +4,16 @@ namespace App\Controller\Front; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use App\Service\registryMGR; class UiGeneralController extends AbstractController { #[Route('/', name: 'general_home')] - public function general_home(): JsonResponse + public function general_home(): Response { - return $this->json(['message' => 'System is running ...']); + return $this->redirect('/u'); } #[Route('/system/getname', name: 'general_get_name')] diff --git a/public_html/.htaccess b/public_html/.htaccess index e662d13..7407c8c 100644 --- a/public_html/.htaccess +++ b/public_html/.htaccess @@ -3,8 +3,8 @@ DirectoryIndex index.php RewriteEngine On - # اگه درخواست با /webui شروع بشه، قوانین بعدی رو اعمال نکن و بذار فایل‌های اونجا مستقیماً لود بشن - RewriteCond %{REQUEST_URI} ^/webui(/|$) [NC] + # اگه درخواست با /u شروع بشه، قوانین بعدی رو اعمال نکن و بذار فایل‌های اونجا مستقیماً لود بشن + RewriteCond %{REQUEST_URI} ^/u(/|$) [NC] RewriteRule ^ - [L] # اگه فایل یا دایرکتوری فیزیکی وجود داره (مثل فایل‌های استاتیک)، مستقیماً لودش کن diff --git a/public_html/webui/.htaccess b/public_html/webui/.htaccess deleted file mode 100644 index c934f98..0000000 --- a/public_html/webui/.htaccess +++ /dev/null @@ -1,14 +0,0 @@ -DirectoryIndex index.html - - - RewriteEngine On - RewriteBase /webui/ - - # اگه درخواست مستقیماً index.html باشه، همون رو لود کن - RewriteRule ^index\.html$ - [L] - - # اگه فایل یا دایرکتوری فیزیکی وجود نداره، به index.html برو - RewriteCond %{REQUEST_FILENAME} !-f - RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^ /webui/index.html [L] - \ No newline at end of file diff --git a/webUI/public/.htaccess b/webUI/public/.htaccess index c934f98..edc796e 100644 --- a/webUI/public/.htaccess +++ b/webUI/public/.htaccess @@ -2,7 +2,7 @@ DirectoryIndex index.html RewriteEngine On - RewriteBase /webui/ + RewriteBase /u/ # اگه درخواست مستقیماً index.html باشه، همون رو لود کن RewriteRule ^index\.html$ - [L] @@ -10,5 +10,5 @@ DirectoryIndex index.html # اگه فایل یا دایرکتوری فیزیکی وجود نداره، به index.html برو RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^ /webui/index.html [L] + RewriteRule ^ /u/index.html [L] \ No newline at end of file diff --git a/webUI/src/hesabixConfig.js b/webUI/src/hesabixConfig.js index 82be4ee..86511f2 100644 --- a/webUI/src/hesabixConfig.js +++ b/webUI/src/hesabixConfig.js @@ -4,23 +4,23 @@ export const name = "hesabixConfig"; export function getApiUrl() { const origin = window.location.origin; // دامنه اصلی مثل http://localhost.com - const path = window.location.pathname; // مسیر فعلی مثل /app/etc/webui + const path = window.location.pathname; // مسیر فعلی مثل /app/etc/u // مسیر رو به آرایه تبدیل می‌کنم تا بتونم پوشه‌ها رو جدا کنم - const pathParts = path.split('/').filter(part => part !== ''); // ['app', 'etc', 'webui'] + const pathParts = path.split('/').filter(part => part !== ''); // ['app', 'etc', 'u'] - // پیدا کردن جایگاه webui و حذفش به همراه هر چی بعدش هست - const webuiIndex = pathParts.indexOf('webui'); - if (webuiIndex !== -1) { - // فقط مسیر تا قبل از webui رو نگه می‌دارم - const basePath = pathParts.slice(0, webuiIndex).join('/'); // app/etc + // پیدا کردن جایگاه u و حذفش به همراه هر چی بعدش هست + const uIndex = pathParts.indexOf('u'); + if (uIndex !== -1) { + // فقط مسیر تا قبل از u رو نگه می‌دارم + const basePath = pathParts.slice(0, uIndex).join('/'); // app/etc if (basePath === '') { return `${origin}`; } return `${origin}/${basePath}`; // http://localhost.com/app/etc } - // اگه webui توی مسیر نبود، مسیر روت رو برگشت بده + // اگه u توی مسیر نبود، مسیر روت رو برگشت بده return `${origin}`; } diff --git a/webUI/src/router/index.ts b/webUI/src/router/index.ts index d650689..a6da6d1 100644 --- a/webUI/src/router/index.ts +++ b/webUI/src/router/index.ts @@ -1,16 +1,16 @@ import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router' import axios from "axios"; -// گرفتن base به‌صورت داینامیک تا بخش /webui +// گرفتن base به‌صورت داینامیک تا بخش /u const getBasePath = () => { const fullPath = window.location.pathname; - const webuiIndex = fullPath.indexOf('/webui'); - if (webuiIndex !== -1) { - // از اول مسیر تا آخر /webui رو بگیریم - return fullPath.substring(0, webuiIndex + '/webui'.length) + '/'; + const uIndex = fullPath.indexOf('/u'); + if (uIndex !== -1) { + // از اول مسیر تا آخر /u رو بگیریم + return fullPath.substring(0, uIndex + '/u'.length) + '/'; } - // اگه /webui توی مسیر نبود (که بعیده)، یه پیش‌فرض بذاریم - return '/webui/'; + // اگه /u توی مسیر نبود (که بعیده)، یه پیش‌فرض بذاریم + return '/u/'; }; const base = getBasePath(); diff --git a/webUI/vite.config.ts b/webUI/vite.config.ts index 9310202..cf81ea4 100644 --- a/webUI/vite.config.ts +++ b/webUI/vite.config.ts @@ -21,7 +21,7 @@ export default defineConfig({ } }, build: { - outDir: '../public_html/webui', + outDir: '../public_html/u', chunkSizeWarningLimit: 1600, rollupOptions: { input: { @@ -34,5 +34,5 @@ export default defineConfig({ } } }, - base: process.env.VITE_BASE_PATH || '/webui/' // برای سرور فعلی /webui/ + base: process.env.VITE_BASE_PATH || '/u/' // برای سرور فعلی /u/ }); \ No newline at end of file diff --git a/webUI/workbox-config.js b/webUI/workbox-config.js index 1a790a5..0a48120 100644 --- a/webUI/workbox-config.js +++ b/webUI/workbox-config.js @@ -1,9 +1,9 @@ module.exports = { - globDirectory: '../public_html/webui/', + globDirectory: '../public_html/u/', globPatterns: [ '**/*.{html,js,css,scss,eot,ttf,woff,woff2,svg,txt,mjs,png,json,md,jpg,gif,php,ts,rb,less,ico,rar,mp4}' ], - swDest: '../public_html/webui/sw.js', + swDest: '../public_html/u/sw.js', ignoreURLParametersMatching: [ /^utm_/, /^fbclid$/