4.7.1: Фикс открытия админ-панели
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m11s

This commit is contained in:
poignatov
2026-02-02 19:16:49 +03:00
parent b15e1dd615
commit 89e66d6093
10 changed files with 282 additions and 28 deletions

View File

@@ -23,8 +23,21 @@ server {
proxy_cache_bypass $http_upgrade;
}
# Proxy admin panel to backend (must be before location /)
location ^~ /admin {
proxy_pass http://backend:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
# Proxy other API endpoints to backend
location ~ ^/(playlife-feed|d2dc349a-0d13-49b2-a8f0-1ab094bfba9b|projects|project/priority|project/move|project/delete|project/create|message/post|webhook/|weekly_goals/setup|admin|admin\.html)$ {
location ~ ^/(playlife-feed|d2dc349a-0d13-49b2-a8f0-1ab094bfba9b|projects|project/priority|project/move|project/delete|project/create|message/post|webhook/|weekly_goals/setup)$ {
proxy_pass http://backend:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;

View File

@@ -1,6 +1,6 @@
{
"name": "play-life-web",
"version": "4.7.0",
"version": "4.7.1",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -35,6 +35,38 @@ function Profile({ onNavigate }) {
</div>
</div>
{/* Admin Button */}
{user?.is_admin && (
<div className="mb-6">
<button
onClick={() => {
const adminUrl = window.location.origin + '/admin';
window.open(adminUrl, '_blank', 'noopener,noreferrer');
}}
className="w-full p-4 bg-white rounded-xl shadow-sm hover:shadow-md transition-all text-left border border-gray-100 hover:border-purple-200 group"
>
<div className="flex items-center justify-between">
<span className="text-gray-800 font-medium group-hover:text-purple-600 transition-colors">
Администрирование
</span>
<svg
className="w-5 h-5 text-gray-400 group-hover:text-purple-500 transition-colors"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M9 5l7 7-7 7"
/>
</svg>
</div>
</button>
</div>
)}
{/* Features Section */}
<div className="mb-6">
<h2 className="text-lg font-semibold text-gray-700 mb-4 px-1">Функционал</h2>

View File

@@ -57,6 +57,9 @@ export default defineConfig(({ mode }) => {
// Кэширование статики
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}'],
// Исключаем /admin из навигационного fallback (чтобы Service Worker не перехватывал)
navigateFallbackDenylist: [/^\/admin/],
// Стратегии для API
runtimeCaching: [
{
@@ -138,6 +141,33 @@ export default defineConfig(({ mode }) => {
changeOrigin: true,
secure: false,
},
// Proxy admin panel to backend
'/admin': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false,
},
'/admin.html': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false,
},
// Proxy admin API endpoints
'/message/post': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false,
},
'/weekly_goals/setup': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false,
},
'/daily-report/trigger': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false,
},
}
}
}