fix: Gitea Traefik routing and connection pool optimization
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled
- Remove middleware reference from Gitea Traefik labels (caused routing issues) - Optimize Gitea connection pool settings (MAX_IDLE_CONNS=30, authentication_timeout=180s) - Add explicit service reference in Traefik labels - Fix intermittent 504 timeouts by improving PostgreSQL connection handling Fixes Gitea unreachability via git.michaelschiemer.de
This commit is contained in:
78
resources/js/modules/router/RouteMiddleware.js
Normal file
78
resources/js/modules/router/RouteMiddleware.js
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Route Middleware
|
||||
*
|
||||
* Provides route-level middleware for cross-cutting concerns.
|
||||
*/
|
||||
|
||||
import { Logger } from '../../core/logger.js';
|
||||
|
||||
/**
|
||||
* RouteMiddleware - Route middleware
|
||||
*/
|
||||
export class RouteMiddleware {
|
||||
constructor(name, middlewareFn) {
|
||||
this.name = name;
|
||||
this.middlewareFn = middlewareFn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new RouteMiddleware
|
||||
*/
|
||||
static create(name, middlewareFn) {
|
||||
return new RouteMiddleware(name, middlewareFn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute middleware
|
||||
*/
|
||||
async execute(to, from, next, context = {}) {
|
||||
try {
|
||||
await this.middlewareFn(to, from, next, context);
|
||||
} catch (error) {
|
||||
Logger.error(`[RouteMiddleware] Middleware "${this.name}" error:`, error);
|
||||
next(false); // Block navigation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Built-in middleware
|
||||
*/
|
||||
export const BuiltInMiddleware = {
|
||||
/**
|
||||
* Analytics middleware
|
||||
*/
|
||||
analytics: RouteMiddleware.create('analytics', async (to, from, next) => {
|
||||
// Track page view
|
||||
if (typeof window !== 'undefined' && window.analytics) {
|
||||
window.analytics.track('page_view', {
|
||||
path: to.path,
|
||||
title: to.title
|
||||
});
|
||||
}
|
||||
next();
|
||||
}),
|
||||
|
||||
/**
|
||||
* Loading middleware
|
||||
*/
|
||||
loading: RouteMiddleware.create('loading', async (to, from, next) => {
|
||||
// Show loading indicator
|
||||
document.body.classList.add('route-loading');
|
||||
next();
|
||||
|
||||
// Hide loading indicator after navigation
|
||||
setTimeout(() => {
|
||||
document.body.classList.remove('route-loading');
|
||||
}, 100);
|
||||
}),
|
||||
|
||||
/**
|
||||
* Scroll to top middleware
|
||||
*/
|
||||
scrollToTop: RouteMiddleware.create('scroll-to-top', async (to, from, next) => {
|
||||
next();
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user