Redirect to login page if not logged in
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Cadence Ember 2020-10-21 20:34:09 +13:00
parent 988dd1050b
commit 184c876fb9
Signed by: cadence
GPG key ID: BC1C2C61CF521B17
3 changed files with 18 additions and 8 deletions

View file

@ -9,6 +9,11 @@ module.exports = [
source: "/assets/fonts/whitney-400.woff",
target: "/static/whitney-400.woff",
},
{
type: "js",
source: "/js/main.js",
target: "/static/main.js",
},
{
type: "js",
source: "/js/basic.js",
@ -127,6 +132,6 @@ module.exports = [
{
type: "pug",
source: "/login.pug",
target: "/login.html",
target: "/login/index.html",
},
];

View file

@ -33,18 +33,14 @@ doctype html
html
head
meta(charset="utf-8")
title Carbon
// var static = !{JSON.stringify([...static.entries()].reduce((a, c) => (a[c[0]] = getRelative(c[1]), a), {}))}
script
| var staticFiles = new Map(
!= JSON.stringify([...static.keys()].map(k => [k, getStatic(k)]))
| )
link(rel="stylesheet" type="text/css" href=getStatic("/sass/main.sass"))
script(type="module" src=getStatic("/js/groups.js"))
script(type="module" src=getStatic("/js/chat-input.js"))
script(type="module" src=getStatic("/js/room-picker.js"))
script(type="module" src=getStatic("/js/sync/sync.js"))
script(type="module" src=getStatic("/js/chat.js"))
title Carbon
script(type="module" src=getStatic("/js/main.js"))
body
main.main
.c-groups
@ -56,4 +52,4 @@ html
.c-chat__messages#c-chat-messages
.c-chat__inner#c-chat
.c-chat-input
textarea(placeholder="Send a message..." autocomplete="off").c-chat-input__textarea#c-chat-textarea
textarea(placeholder="Send a message..." autocomplete="off").c-chat-input__textarea#c-chat-textarea

9
src/js/main.js Normal file
View file

@ -0,0 +1,9 @@
import $to_relative "/js/groups.js"
import $to_relative "/js/chat-input.js"
import $to_relative "/js/room-picker.js"
import $to_relative "/js/sync/sync.js"
import $to_relative "/js/chat.js"
if (!localStorage.getItem("access_token")) {
location.assign("./login")
}