WIP(external-link): hacky attempt number one

This commit is contained in:
SabreCat 2023-03-10 13:33:51 -06:00
parent 3f3e0e2ae8
commit a210ab57b0
2 changed files with 9 additions and 0 deletions

View file

@ -8,6 +8,8 @@ export default function markdown (el, { value, oldValue }) {
} else {
el.innerHTML = '';
}
// This is a hack, but it's one idea for how we might do things
el.innerHTML = el.innerHTML.replace('href="h', 'href="/external?link=h');
el.classList.add('markdown');
}

View file

@ -377,6 +377,8 @@ const router = new VueRouter({
],
},
{ name: 'externalLink', path: '/external' },
// Only used to handle some redirects
// See router.beforeEach
{ path: '/redirect/:redirect', name: 'redirect' },
@ -393,6 +395,11 @@ router.beforeEach(async (to, from, next) => {
if (to.name === 'redirect') return handleRedirect(to, from, next);
if (to.name === 'externalLink') {
setTimeout(() => router.app.$emit('bv::show::modal', 'external-link-modal'), 500);
return null;
}
if (!isUserLoggedIn && routeRequiresLogin) {
// Redirect to the login page unless the user is trying to reach the
// root of the website, in which case show the home page.