This commit is contained in:
j3d1 2026-08-21 21:37:12 +02:00
parent 7d9f67a77a
commit 3299c97392
13 changed files with 1407 additions and 327 deletions

View file

@ -24,8 +24,10 @@ import Admin from '@/views/Admin.vue';
import Swatch from '@/views/Swatch.vue';
import Files from '@/views/Files.vue';
import Print from "@/views/Print.vue";
import Scan from "@/views/Scan.vue";
import Workflows from '@/views/Workflows.vue';
import WorkflowDetail from '@/views/WorkflowDetail.vue';
import ShortId from '@/views/ShortId.vue';
import Account from '@/views/settings/Account.vue';
import Password from '@/views/settings/Password.vue';
@ -36,6 +38,14 @@ import Data from '@/views/settings/Data.vue';
import Preferences from '@/views/settings/Preferences.vue';
export function encodeHandleForUrl(handle) {
return handle.replace(/#/g, "+");
}
export function decodeHandleFromUrl(segment) {
return segment.replace(/\+/g, "#");
}
const routes = [{path: '/', component: Dashboard, meta: {requiresAuth: true}}, {
path: '/inventory',
component: Inventory,
@ -58,8 +68,9 @@ const routes = [{path: '/', component: Dashboard, meta: {requiresAuth: true}}, {
}, {
path: '/i/:handle/:id',
redirect: to => {
const {handle, id} = to.params
return handle === store.state.user ? '/inventory/' + id : '/inventory/shared/' + handle + '/' + id
const handle = decodeHandleFromUrl(to.params.handle)
const {id} = to.params
return handle === store.state.user ? '/inventory/' + id : '/inventory/shared/' + encodeHandleForUrl(handle) + '/' + id
}
}, {path: '/inventory/new', component: InventoryNew, meta: {requiresAuth: true}}, {
path: '/friends',
@ -98,6 +109,10 @@ const routes = [{path: '/', component: Dashboard, meta: {requiresAuth: true}}, {
const {kind, ...components} = route.query;
return {prefill: kind ? {kind, components} : null};
}
}, {
path: '/scan',
component: Scan,
meta: {requiresAuth: true},
}, {
path: '/search/:query',
component: Search,
@ -145,6 +160,10 @@ const routes = [{path: '/', component: Dashboard, meta: {requiresAuth: true}}, {
path: '/storage-locations/new',
component: StorageLocationNew,
meta: {requiresAuth: true}
}, {
path: '/:short_id',
component: ShortId,
props: true
}, {path: '/:pathMatch(.*)*', redirect: '/'}]
const router = createRouter({