- Updated incoming webhook API endpoint to use `/api/webhook/post/<name>` for better namespace management. - Added a new WebHooks page in the admin UI for managing webhook endpoints. - Introduced a ConfigSection component to streamline the rendering and saving of configuration fields. - Enhanced Settings.vue to reference the new WebHooks page and updated the configuration structure. - Implemented a new webhook API in the frontend to handle listing, adding, modifying, and removing webhook endpoints. - Improved the sidebar to include a link to the WebHooks page. - Added functionality to generate tokens for new webhook endpoints and manage notification channels.
67 lines
1.8 KiB
JavaScript
67 lines
1.8 KiB
JavaScript
import { createRouter, createWebHistory } from 'vue-router';
|
|
import { isLoggedIn } from '../utils/auth.js';
|
|
|
|
const routes = [
|
|
{
|
|
path: '/login',
|
|
name: 'Login',
|
|
component: () => import('../views/Login.vue'),
|
|
meta: { public: true }
|
|
},
|
|
{
|
|
path: '/',
|
|
component: () => import('../views/Layout.vue'),
|
|
redirect: { name: 'Overview' },
|
|
children: [
|
|
{
|
|
path: 'overview',
|
|
name: 'Overview',
|
|
component: () => import('../views/Overview.vue'),
|
|
meta: { title: 'Nodes' }
|
|
},
|
|
{
|
|
path: 'trusted',
|
|
name: 'Trusted',
|
|
component: () => import('../views/Trusted.vue'),
|
|
meta: { title: 'Bot trust' }
|
|
},
|
|
{
|
|
path: 'settings',
|
|
name: 'Settings',
|
|
component: () => import('../views/Settings.vue'),
|
|
meta: { title: 'Settings' }
|
|
},
|
|
{
|
|
path: 'webhooks',
|
|
name: 'WebHooks',
|
|
component: () => import('../views/WebHooks.vue'),
|
|
meta: { title: 'WebHooks' }
|
|
},
|
|
{
|
|
path: 'logs',
|
|
name: 'Logs',
|
|
component: () => import('../views/Logs.vue'),
|
|
meta: { title: 'Logs' }
|
|
}
|
|
]
|
|
},
|
|
{ path: '/:pathMatch(.*)*', redirect: '/' }
|
|
];
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes
|
|
});
|
|
|
|
router.beforeEach((to) => {
|
|
if (!to.meta.public && !isLoggedIn()) {
|
|
return { name: 'Login', query: { redirect: to.fullPath } };
|
|
}
|
|
if (to.name === 'Login' && isLoggedIn()) {
|
|
return { name: 'Overview' };
|
|
}
|
|
return true;
|
|
});
|
|
|
|
export default router;
|