This commit is contained in:
Hesabix 2025-03-21 19:05:12 +00:00
parent 4ce9f78fed
commit e85a300703
10 changed files with 28 additions and 41 deletions

2
.gitignore vendored
View file

@ -3,4 +3,4 @@ hesabixArchive/
hesabixBackup/ hesabixBackup/
backup/ backup/
.idea/ .idea/
public_html/webui/* public_html/u/*

View file

@ -11,7 +11,7 @@
/../hesabixBackup/ /../hesabixBackup/
/../backup/ /../backup/
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###
/../public_html/webui/ /../public_html/u/
/../webUI/node_modules/ /../webUI/node_modules/
###> phpunit/phpunit ### ###> phpunit/phpunit ###

View file

@ -4,15 +4,16 @@ namespace App\Controller\Front;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use App\Service\registryMGR; use App\Service\registryMGR;
class UiGeneralController extends AbstractController class UiGeneralController extends AbstractController
{ {
#[Route('/', name: 'general_home')] #[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')] #[Route('/system/getname', name: 'general_get_name')]

View file

@ -3,8 +3,8 @@ DirectoryIndex index.php
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
RewriteEngine On RewriteEngine On
# اگه درخواست با /webui شروع بشه، قوانین بعدی رو اعمال نکن و بذار فایل‌های اونجا مستقیماً لود بشن # اگه درخواست با /u شروع بشه، قوانین بعدی رو اعمال نکن و بذار فایل‌های اونجا مستقیماً لود بشن
RewriteCond %{REQUEST_URI} ^/webui(/|$) [NC] RewriteCond %{REQUEST_URI} ^/u(/|$) [NC]
RewriteRule ^ - [L] RewriteRule ^ - [L]
# اگه فایل یا دایرکتوری فیزیکی وجود داره (مثل فایل‌های استاتیک)، مستقیماً لودش کن # اگه فایل یا دایرکتوری فیزیکی وجود داره (مثل فایل‌های استاتیک)، مستقیماً لودش کن

View file

@ -1,14 +0,0 @@
DirectoryIndex index.html
<IfModule mod_rewrite.c>
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]
</IfModule>

View file

@ -2,7 +2,7 @@ DirectoryIndex index.html
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
RewriteEngine On RewriteEngine On
RewriteBase /webui/ RewriteBase /u/
# اگه درخواست مستقیماً index.html باشه، همون رو لود کن # اگه درخواست مستقیماً index.html باشه، همون رو لود کن
RewriteRule ^index\.html$ - [L] RewriteRule ^index\.html$ - [L]
@ -10,5 +10,5 @@ DirectoryIndex index.html
# اگه فایل یا دایرکتوری فیزیکی وجود نداره، به index.html برو # اگه فایل یا دایرکتوری فیزیکی وجود نداره، به index.html برو
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /webui/index.html [L] RewriteRule ^ /u/index.html [L]
</IfModule> </IfModule>

View file

@ -4,23 +4,23 @@ export const name = "hesabixConfig";
export function getApiUrl() { export function getApiUrl() {
const origin = window.location.origin; // دامنه اصلی مثل http://localhost.com 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 و حذفش به همراه هر چی بعدش هست // پیدا کردن جایگاه u و حذفش به همراه هر چی بعدش هست
const webuiIndex = pathParts.indexOf('webui'); const uIndex = pathParts.indexOf('u');
if (webuiIndex !== -1) { if (uIndex !== -1) {
// فقط مسیر تا قبل از webui رو نگه می‌دارم // فقط مسیر تا قبل از u رو نگه می‌دارم
const basePath = pathParts.slice(0, webuiIndex).join('/'); // app/etc const basePath = pathParts.slice(0, uIndex).join('/'); // app/etc
if (basePath === '') { if (basePath === '') {
return `${origin}`; return `${origin}`;
} }
return `${origin}/${basePath}`; // http://localhost.com/app/etc return `${origin}/${basePath}`; // http://localhost.com/app/etc
} }
// اگه webui توی مسیر نبود، مسیر روت رو برگشت بده // اگه u توی مسیر نبود، مسیر روت رو برگشت بده
return `${origin}`; return `${origin}`;
} }

View file

@ -1,16 +1,16 @@
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router' import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import axios from "axios"; import axios from "axios";
// گرفتن base به‌صورت داینامیک تا بخش /webui // گرفتن base به‌صورت داینامیک تا بخش /u
const getBasePath = () => { const getBasePath = () => {
const fullPath = window.location.pathname; const fullPath = window.location.pathname;
const webuiIndex = fullPath.indexOf('/webui'); const uIndex = fullPath.indexOf('/u');
if (webuiIndex !== -1) { if (uIndex !== -1) {
// از اول مسیر تا آخر /webui رو بگیریم // از اول مسیر تا آخر /u رو بگیریم
return fullPath.substring(0, webuiIndex + '/webui'.length) + '/'; return fullPath.substring(0, uIndex + '/u'.length) + '/';
} }
// اگه /webui توی مسیر نبود (که بعیده)، یه پیش‌فرض بذاریم // اگه /u توی مسیر نبود (که بعیده)، یه پیش‌فرض بذاریم
return '/webui/'; return '/u/';
}; };
const base = getBasePath(); const base = getBasePath();

View file

@ -21,7 +21,7 @@ export default defineConfig({
} }
}, },
build: { build: {
outDir: '../public_html/webui', outDir: '../public_html/u',
chunkSizeWarningLimit: 1600, chunkSizeWarningLimit: 1600,
rollupOptions: { rollupOptions: {
input: { input: {
@ -34,5 +34,5 @@ export default defineConfig({
} }
} }
}, },
base: process.env.VITE_BASE_PATH || '/webui/' // برای سرور فعلی /webui/ base: process.env.VITE_BASE_PATH || '/u/' // برای سرور فعلی /u/
}); });

View file

@ -1,9 +1,9 @@
module.exports = { module.exports = {
globDirectory: '../public_html/webui/', globDirectory: '../public_html/u/',
globPatterns: [ globPatterns: [
'**/*.{html,js,css,scss,eot,ttf,woff,woff2,svg,txt,mjs,png,json,md,jpg,gif,php,ts,rb,less,ico,rar,mp4}' '**/*.{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: [ ignoreURLParametersMatching: [
/^utm_/, /^utm_/,
/^fbclid$/ /^fbclid$/