Add public map with JWT admin login and protect admin APIs.

Keep map reads open; gate admin UI/nav and object mutations behind env-based admin credentials, and default parser batch limit to 10.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-16 23:04:21 +03:00
co-authored by Cursor
parent 52185aeaa8
commit 8ab606747f
23 changed files with 564 additions and 41 deletions
+54 -7
View File
@@ -1,10 +1,12 @@
import { createRouter, createWebHistory } from "vue-router";
import { getToken } from "../auth";
import AppLayout from "../layouts/AppLayout.vue";
import AnalyticsView from "../views/AnalyticsView.vue";
import ChannelsView from "../views/ChannelsView.vue";
import ConsumersView from "../views/ConsumersView.vue";
import EventsView from "../views/EventsView.vue";
import LoginView from "../views/LoginView.vue";
import MapViewPage from "../views/MapViewPage.vue";
import ParserProfilesView from "../views/ParserProfilesView.vue";
import ParsersView from "../views/ParsersView.vue";
@@ -12,20 +14,65 @@ import ParsersView from "../views/ParsersView.vue";
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: "/login",
name: "login",
component: LoginView,
meta: { public: true },
},
{
path: "/",
component: AppLayout,
children: [
{ path: "", name: "map", component: MapViewPage },
{ path: "channels", name: "channels", component: ChannelsView },
{ path: "parser-profiles", name: "parser-profiles", component: ParserProfilesView },
{ path: "parsers", name: "parsers", component: ParsersView },
{ path: "events", name: "events", component: EventsView },
{ path: "analytics", name: "analytics", component: AnalyticsView },
{ path: "consumers", name: "consumers", component: ConsumersView },
{ path: "", name: "map", component: MapViewPage, meta: { public: true } },
{
path: "channels",
name: "channels",
component: ChannelsView,
meta: { requiresAuth: true },
},
{
path: "parser-profiles",
name: "parser-profiles",
component: ParserProfilesView,
meta: { requiresAuth: true },
},
{
path: "parsers",
name: "parsers",
component: ParsersView,
meta: { requiresAuth: true },
},
{
path: "events",
name: "events",
component: EventsView,
meta: { requiresAuth: true },
},
{
path: "analytics",
name: "analytics",
component: AnalyticsView,
meta: { requiresAuth: true },
},
{
path: "consumers",
name: "consumers",
component: ConsumersView,
meta: { requiresAuth: true },
},
],
},
],
});
router.beforeEach((to) => {
if (!to.meta.requiresAuth) return true;
if (getToken()) return true;
return {
name: "login",
query: { next: to.fullPath },
};
});
export default router;