Improve static link handling

This commit is contained in:
Yarmo Mackenbach 2020-08-14 15:42:33 +02:00
parent 0fb575f369
commit 7251c97c54
4 changed files with 6 additions and 4 deletions

View file

@ -39,11 +39,10 @@ md.use(require("markdown-it-table-of-contents"), { "includeLevel": [2, 3], "list
md.use(require('markdown-it-title')); md.use(require('markdown-it-title'));
app.set('view engine', 'pug'); app.set('view engine', 'pug');
app.use('/static', express.static('static'));
app.use('/favicon.svg', express.static('favicon.svg')); app.use('/favicon.svg', express.static('favicon.svg'));
app.use('/', require('./routes/main')); 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('/server', require('./routes/server'));
app.use('/encrypt', require('./routes/encrypt')); app.use('/encrypt', require('./routes/encrypt'));
app.use('/verify', require('./routes/verify')); app.use('/verify', require('./routes/verify'));

View file

@ -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 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 <https://www.gnu.org/licenses/>. more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>.
*/ */
const express = require('express');
const router = require('express').Router(); const router = require('express').Router();
router.get('/openpgp.min.js', function(req, res) { router.get('/openpgp.min.js', function(req, res) {
res.sendFile(`node_modules/openpgp/dist/openpgp.min.js`, { root: `${__dirname}/../` }) res.sendFile(`node_modules/openpgp/dist/openpgp.min.js`, { root: `${__dirname}/../` })
}); });
router.use('/', express.static('static'));
module.exports = router; module.exports = router;

View file

@ -21,5 +21,5 @@ main.container.container--profile
a(href='/') Keyoxide 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') script(type='text/javascript' src='/static/scripts.js' charset='utf-8')

View file

@ -28,6 +28,6 @@ main.container
a(href='https://fosstodon.org/@keyoxide') Mastodon a(href='https://fosstodon.org/@keyoxide') Mastodon
p &copy; 2020 Keyoxide contributors p &copy; 2020 Keyoxide contributors
script(src='/dep/openpgp.min.js') script(src='/static/openpgp.min.js')
script(src='/static/qrcode.min.js') script(src='/static/qrcode.min.js')
script(type='text/javascript' src='/static/scripts.js' charset='utf-8') script(type='text/javascript' src='/static/scripts.js' charset='utf-8')