From 7251c97c54e7f7ebb685c60c30831befd6f06d0a Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Fri, 14 Aug 2020 15:42:33 +0200 Subject: [PATCH] Improve static link handling --- index.js | 3 +-- routes/{dep.js => static.js} | 3 +++ views/profile.pug | 2 +- views/template.base.pug | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) rename routes/{dep.js => static.js} (95%) diff --git a/index.js b/index.js index 1af2f62..e5e29b9 100644 --- a/index.js +++ b/index.js @@ -39,11 +39,10 @@ md.use(require("markdown-it-table-of-contents"), { "includeLevel": [2, 3], "list md.use(require('markdown-it-title')); app.set('view engine', 'pug'); -app.use('/static', express.static('static')); app.use('/favicon.svg', express.static('favicon.svg')); app.use('/', require('./routes/main')); -app.use('/dep', require('./routes/dep')); +app.use('/static', require('./routes/static')); app.use('/server', require('./routes/server')); app.use('/encrypt', require('./routes/encrypt')); app.use('/verify', require('./routes/verify')); diff --git a/routes/dep.js b/routes/static.js similarity index 95% rename from routes/dep.js rename to routes/static.js index 2724284..5facb8f 100644 --- a/routes/dep.js +++ b/routes/static.js @@ -27,10 +27,13 @@ You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . */ +const express = require('express'); const router = require('express').Router(); router.get('/openpgp.min.js', function(req, res) { res.sendFile(`node_modules/openpgp/dist/openpgp.min.js`, { root: `${__dirname}/../` }) }); +router.use('/', express.static('static')); + module.exports = router; diff --git a/views/profile.pug b/views/profile.pug index ab70a5c..ca42316 100644 --- a/views/profile.pug +++ b/views/profile.pug @@ -21,5 +21,5 @@ main.container.container--profile a(href='/') Keyoxide | . -script(src='/dep/openpgp.min.js') +script(src='/static/openpgp.min.js') script(type='text/javascript' src='/static/scripts.js' charset='utf-8') diff --git a/views/template.base.pug b/views/template.base.pug index 5fba115..c6d2ec9 100644 --- a/views/template.base.pug +++ b/views/template.base.pug @@ -28,6 +28,6 @@ main.container a(href='https://fosstodon.org/@keyoxide') Mastodon p © 2020 Keyoxide contributors -script(src='/dep/openpgp.min.js') +script(src='/static/openpgp.min.js') script(src='/static/qrcode.min.js') script(type='text/javascript' src='/static/scripts.js' charset='utf-8')