diff --git a/package.json b/package.json index e2b210f..dfb5249 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "cli": "ts-node src/cli.ts", "setup": "sh install/setup.sh", "migrate": "ts-node src/migrate.ts", - "invite": "ts-node src/cli.ts --invite" + "invite": "ts-node src/cli.ts --invite", + "make-templates": "cp node_modules/nunjucks/browser/nunjucks-slim.js site &&nunjucks-precompile -i [\"\\.html$\",\"\\.njk$\"] templates > site/templates.js" }, "repository": { "type": "git", diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000..b7a72bd --- /dev/null +++ b/site/index.html @@ -0,0 +1,37 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/http.ts b/src/http.ts index 8eb06dc..1576883 100644 --- a/src/http.ts +++ b/src/http.ts @@ -56,11 +56,12 @@ async function init(){ } app.disable('x-powered-by'); //site handlers - await initSite(config['satyr']['registration']); + //await initSite(config['satyr']['registration']); //api handlers await initAPI(); //static files if nothing else matches first app.use(express.static(config['http']['directory'])); + await initFE(); //404 Handler app.use(function (req, res, next) { if(tryDecode(req.cookies.Authorization)) { @@ -73,6 +74,12 @@ async function init(){ server.listen(config['http']['port']); } +async function initFE(){ + app.get('*', (req, res) => { + res.sendFile(process.cwd()+'/'+config['http']['directory']+'/index.html'); + }); +} + async function newNick(socket, skip?: boolean, i?: number) { if(socket.handshake.headers['cookie'] && !skip){ let c = await parseCookie(socket.handshake.headers['cookie']);