mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 23:09:29 -07:00
Allow overruling of XMPP vCard fetch server
This commit is contained in:
parent
4b01f9c99f
commit
d7384d8109
7 changed files with 39 additions and 6 deletions
10
index.js
10
index.js
|
@ -33,6 +33,8 @@ const fs = require('fs');
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = 3000;
|
const port = 3000;
|
||||||
const env = {};
|
const env = {};
|
||||||
|
const { stringReplace } = require('string-replace-middleware');
|
||||||
|
require('dotenv').config();
|
||||||
|
|
||||||
md.use(require("markdown-it-anchor"));
|
md.use(require("markdown-it-anchor"));
|
||||||
md.use(require("markdown-it-table-of-contents"), { "includeLevel": [2, 3], "listType": "ol" });
|
md.use(require("markdown-it-table-of-contents"), { "includeLevel": [2, 3], "listType": "ol" });
|
||||||
|
@ -41,6 +43,12 @@ md.use(require('markdown-it-title'));
|
||||||
app.set('view engine', 'pug');
|
app.set('view engine', 'pug');
|
||||||
app.use('/favicon.svg', express.static('favicon.svg'));
|
app.use('/favicon.svg', express.static('favicon.svg'));
|
||||||
|
|
||||||
|
app.use(stringReplace({
|
||||||
|
PLACEHOLDER__XMPP_VCARD_SERVER_DOMAIN: process.env.XMPP_VCARD_SERVER_DOMAIN ? process.env.XMPP_VCARD_SERVER_DOMAIN : 'xmpp-vcard.keyoxide.org'
|
||||||
|
}, {
|
||||||
|
contentTypeFilterRegexp: /application\/javascript/,
|
||||||
|
}));
|
||||||
|
|
||||||
app.use('/', require('./routes/main'));
|
app.use('/', require('./routes/main'));
|
||||||
app.use('/static', require('./routes/static'));
|
app.use('/static', require('./routes/static'));
|
||||||
app.use('/server', require('./routes/server'));
|
app.use('/server', require('./routes/server'));
|
||||||
|
@ -51,5 +59,5 @@ app.use('/util', require('./routes/util'));
|
||||||
app.use('/', require('./routes/profile'));
|
app.use('/', require('./routes/profile'));
|
||||||
|
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log(`Example app listening at http://localhost:${port}`);
|
console.log(`Example app listening at http://localhost:${port}`);
|
||||||
});
|
});
|
||||||
|
|
21
package-lock.json
generated
21
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "keyoxide-web",
|
"name": "keyoxide-web",
|
||||||
"version": "1.0.0",
|
"version": "2.0.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -227,6 +227,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||||
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
|
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
|
||||||
},
|
},
|
||||||
|
"escape-string-regexp": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="
|
||||||
|
},
|
||||||
"etag": {
|
"etag": {
|
||||||
"version": "1.8.1",
|
"version": "1.8.1",
|
||||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||||
|
@ -312,6 +317,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
|
||||||
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg=="
|
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg=="
|
||||||
},
|
},
|
||||||
|
"hijackresponse": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/hijackresponse/-/hijackresponse-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ilL2k2/k9NXk4QCx7dz7pV+ZRL8aOX9ZiaVD+5nql1fF5WdKNhXbPh4shyfICpgHoHiD4FKZ1jLgNKYDYhy0Yw=="
|
||||||
|
},
|
||||||
"http-errors": {
|
"http-errors": {
|
||||||
"version": "1.7.2",
|
"version": "1.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
|
||||||
|
@ -1315,6 +1325,15 @@
|
||||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
|
||||||
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
|
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
|
||||||
},
|
},
|
||||||
|
"string-replace-middleware": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-replace-middleware/-/string-replace-middleware-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-AZBPVPJ0A3DhBleAGjA8qAoL0hEKxb7C5QUYr9VnzCO+COEqI6tyGDe2a+A3odJc5uRDT/CPKdbH8oe5laCv/g==",
|
||||||
|
"requires": {
|
||||||
|
"escape-string-regexp": "^4.0.0",
|
||||||
|
"hijackresponse": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"to-fast-properties": {
|
"to-fast-properties": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
"markdown-it-table-of-contents": "^0.4.4",
|
"markdown-it-table-of-contents": "^0.4.4",
|
||||||
"markdown-it-title": "^3.0.0",
|
"markdown-it-title": "^3.0.0",
|
||||||
"openpgp": "^4.10.7",
|
"openpgp": "^4.10.7",
|
||||||
"pug": "^3.0.0"
|
"pug": "^3.0.0",
|
||||||
|
"string-replace-middleware": "^1.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"license-check-and-add": "^3.0.4"
|
"license-check-and-add": "^3.0.4"
|
||||||
|
|
|
@ -437,7 +437,7 @@ async function verifyProof(url, fingerprint) {
|
||||||
output.type = "xmpp";
|
output.type = "xmpp";
|
||||||
match = url.match(/xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/);
|
match = url.match(/xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/);
|
||||||
output.display = `${match[1]}@${match[2]}`;
|
output.display = `${match[1]}@${match[2]}`;
|
||||||
output.proofUrl = `https://xmpp-vcard.keyoxide.org/api/vcard/${output.display}/DESC`;
|
output.proofUrl = `https://PLACEHOLDER__XMPP_VCARD_SERVER_DOMAIN/api/vcard/${output.display}/DESC`;
|
||||||
output.qr = url;
|
output.qr = url;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
# Domain for XMPP vCard fetch server
|
||||||
|
# Code for the server can be found here https://codeberg.org/keyoxide/node-xmpp-vcard
|
||||||
|
# Defaults to: "xmpp-vcard.keyoxide.org"
|
||||||
|
#XMPP_VCARD_SERVER_DOMAIN=
|
||||||
|
|
||||||
# Twitter API bearer code
|
# Twitter API bearer code
|
||||||
# Documentation: https://developer.twitter.com/en/docs/basics/authentication/oauth-2-0
|
# Documentation: https://developer.twitter.com/en/docs/basics/authentication/oauth-2-0
|
||||||
# Expected format: "XXXXXXXXXXXXXXXXXXXXX"
|
# Expected format: "XXXXXXXXXXXXXXXXXXXXX"
|
||||||
|
|
|
@ -22,4 +22,4 @@ main.container.container--profile
|
||||||
| .
|
| .
|
||||||
|
|
||||||
script(src='/static/openpgp.min.js')
|
script(src='/static/openpgp.min.js')
|
||||||
script(type='text/javascript' src='/static/scripts.js' charset='utf-8')
|
script(type='application/javascript' src='/static/scripts.js' charset='utf-8')
|
||||||
|
|
|
@ -30,4 +30,4 @@ main.container
|
||||||
|
|
||||||
script(src='/static/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='application/javascript' src='/static/scripts.js' charset='utf-8')
|
||||||
|
|
Loading…
Reference in a new issue