2022-11-30 05:51:52 +09:00
|
|
|
<script setup lang="ts">
|
2022-12-05 04:56:33 +09:00
|
|
|
import { hasProtocol, parseURL } from 'ufo'
|
2022-11-30 05:51:52 +09:00
|
|
|
|
|
|
|
definePageMeta({
|
|
|
|
middleware: async (to) => {
|
2022-12-05 04:56:33 +09:00
|
|
|
const permalink = Array.isArray(to.params.permalink)
|
|
|
|
? to.params.permalink.join('/')
|
|
|
|
: to.params.permalink
|
2022-11-30 05:51:52 +09:00
|
|
|
|
2022-12-05 04:56:33 +09:00
|
|
|
if (hasProtocol(permalink)) {
|
|
|
|
const { host, pathname } = parseURL(permalink)
|
2022-12-02 07:59:08 +09:00
|
|
|
|
2022-12-05 04:56:33 +09:00
|
|
|
if (host) {
|
|
|
|
await loginTo({ server: host })
|
2022-11-30 22:31:33 +09:00
|
|
|
return pathname
|
|
|
|
}
|
2022-11-30 05:51:52 +09:00
|
|
|
}
|
|
|
|
|
2022-12-05 04:56:33 +09:00
|
|
|
// We've reached a page that doesn't exist
|
|
|
|
return false
|
2022-11-30 05:51:52 +09:00
|
|
|
},
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div />
|
|
|
|
</template>
|