Fix root route parsing to exclude base

This commit is contained in:
Garrett Mills 2020-11-04 20:58:09 -06:00
parent 83b11e267e
commit d1d12663a7
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246
2 changed files with 6 additions and 1 deletions

View File

@ -21,6 +21,10 @@ class FrontendUnit extends Unit {
app.express.use('/app', [ app.express.use('/app', [
this.canon.get('middleware::auth:UserOnly'), this.canon.get('middleware::auth:UserOnly'),
(req, res, next) => { (req, res, next) => {
if ( !req.user ) {
return res.redirect('/auth/login')
}
const allowed_extensions = [ const allowed_extensions = [
'.html', '.js', '.css', '.svg', '.ttf', '.jpg', '.png', '.html', '.js', '.css', '.svg', '.ttf', '.jpg', '.png',
'.jpeg', '.webmanifest', '.json', '.eot', '.svg', '.cur', '.jpeg', '.webmanifest', '.json', '.eot', '.svg', '.cur',

View File

@ -29,7 +29,8 @@ class Router {
constructor() { constructor() {
try { try {
const route = location.href.split(APP_BASE_PATH).filter(Boolean)[0].split(/[#?]/)[0] const route = location.href.split(APP_BASE_PATH).filter(Boolean)[0].split(/[#?]/)[0]
if ( route ) { if ( route && !route.toLowerCase().includes('http://') && !route.toLowerCase().includes('https://') ) {
console.log('resume route', route)
this.navigate(route, {}) this.navigate(route, {})
} }
} catch (e) {} } catch (e) {}