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
88 lines
2.1 KiB
JavaScript
88 lines
2.1 KiB
JavaScript
/**
|
|
* Router Enhancement Module
|
|
*
|
|
* Provides enhanced routing with guards, middleware, lazy loading, and analytics.
|
|
*
|
|
* Usage:
|
|
* - Add data-module="router" to enable enhanced router
|
|
* - Or import and use directly: import { Router } from './modules/router/index.js'
|
|
*
|
|
* Features:
|
|
* - Route guards (auth, permissions)
|
|
* - Route middleware
|
|
* - Lazy route loading
|
|
* - Route analytics
|
|
* - Integration with LiveComponents
|
|
*/
|
|
|
|
import { Logger } from '../../core/logger.js';
|
|
import { Router } from './Router.js';
|
|
import { RouteGuard, BuiltInGuards } from './RouteGuard.js';
|
|
import { RouteMiddleware, BuiltInMiddleware } from './RouteMiddleware.js';
|
|
|
|
const RouterModule = {
|
|
name: 'router',
|
|
router: null,
|
|
|
|
init(config = {}, state = null) {
|
|
Logger.info('[RouterModule] Module initialized');
|
|
|
|
// Create router
|
|
this.router = Router.create(config);
|
|
|
|
// Expose globally for easy access
|
|
if (typeof window !== 'undefined') {
|
|
window.Router = this.router;
|
|
}
|
|
|
|
return this;
|
|
},
|
|
|
|
/**
|
|
* Get router instance
|
|
*/
|
|
getRouter() {
|
|
return this.router || Router.create();
|
|
},
|
|
|
|
/**
|
|
* Register routes
|
|
*/
|
|
routes(routesConfig) {
|
|
const router = this.getRouter();
|
|
router.routes(routesConfig);
|
|
return this;
|
|
},
|
|
|
|
/**
|
|
* Navigate to route
|
|
*/
|
|
async navigate(path, options = {}) {
|
|
const router = this.getRouter();
|
|
return await router.navigate(path, options);
|
|
},
|
|
|
|
destroy() {
|
|
if (this.router) {
|
|
this.router.destroy();
|
|
this.router = null;
|
|
}
|
|
|
|
if (typeof window !== 'undefined' && window.Router) {
|
|
delete window.Router;
|
|
}
|
|
|
|
Logger.info('[RouterModule] Module destroyed');
|
|
}
|
|
};
|
|
|
|
// Export for direct usage
|
|
export { Router, RouteGuard, RouteMiddleware, BuiltInGuards, BuiltInMiddleware };
|
|
|
|
// Export as default for module system
|
|
export default RouterModule;
|
|
|
|
// Export init function for module system
|
|
export const init = RouterModule.init.bind(RouterModule);
|
|
|