adds really basic webfinger
|
@ -0,0 +1,40 @@
|
|||
var appRoot = require('app-root-path');
|
||||
var winston = require('winston');
|
||||
|
||||
// define the custom settings for each transport (file, console)
|
||||
var options = {
|
||||
file: {
|
||||
level: 'info',
|
||||
filename: `${appRoot}/logs/app.log`,
|
||||
handleExceptions: true,
|
||||
json: true,
|
||||
maxsize: 5242880, // 5MB
|
||||
maxFiles: 5,
|
||||
colorize: false,
|
||||
},
|
||||
console: {
|
||||
level: 'debug',
|
||||
handleExceptions: true,
|
||||
json: false,
|
||||
colorize: true,
|
||||
},
|
||||
};
|
||||
|
||||
// instantiate a new Winston Logger with the settings defined above
|
||||
var logger = new winston.Logger({
|
||||
transports: [
|
||||
new winston.transports.File(options.file),
|
||||
new winston.transports.Console(options.console)
|
||||
],
|
||||
exitOnError: false, // do not exit on handled exceptions
|
||||
});
|
||||
|
||||
// create a stream object with a 'write' function that will be used by `morgan`
|
||||
logger.stream = {
|
||||
write: function(message, encoding) {
|
||||
// use the 'info' log level so the output will be picked up by both transports (file and console)
|
||||
logger.info(message);
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = logger;
|
19
server.js
|
@ -136,6 +136,25 @@ app.get('/sitemap.xml', function (_req, res) {
|
|||
})
|
||||
})
|
||||
|
||||
app.get('/.well-known/webfinger', function(req, res) {
|
||||
var resource = req.query.resource
|
||||
if (resource && resource.startsWith('acct:') && resource.endsWith('@cosmic.voyage')) {
|
||||
const regex = /acct:(\w+)@cosmic\.voyage/i
|
||||
const resources = resource.match(regex)
|
||||
if (resources.length) {
|
||||
const user = resources[1].toLowerCase()
|
||||
const path = '/home/' + user + '/.webfinger.json'
|
||||
if (fs.existsSync(path)) {
|
||||
const content = bufferFile(path)
|
||||
res.setHeader('content-type', 'application/jrd+json')
|
||||
res.render('raw', { content: content })
|
||||
}
|
||||
}
|
||||
}
|
||||
res.setHeader('content-type', 'application/jrd+json')
|
||||
res.render('raw', { content: '' })
|
||||
})
|
||||
|
||||
// Any link to a direct static resource will show it
|
||||
app.use(express.static(path.join(__dirname, '/static')))
|
||||
|
||||
|
|
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 6.0 KiB |
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#00a300</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
After Width: | Height: | Size: 797 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 3.4 KiB |
|
@ -0,0 +1,3 @@
|
|||
User-agent: *
|
||||
Disallow: /wp-login.php
|
||||
Disallow: /xmlrpc.php
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "",
|
||||
"short_name": "",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|