diff --git a/config/winston.js b/config/winston.js new file mode 100644 index 0000000..efa946e --- /dev/null +++ b/config/winston.js @@ -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; diff --git a/server.js b/server.js index 3abcb59..baf4a1d 100644 --- a/server.js +++ b/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'))) diff --git a/static/android-chrome-192x192.png b/static/android-chrome-192x192.png new file mode 100644 index 0000000..ce86fc7 Binary files /dev/null and b/static/android-chrome-192x192.png differ diff --git a/static/android-chrome-512x512.png b/static/android-chrome-512x512.png new file mode 100644 index 0000000..0176576 Binary files /dev/null and b/static/android-chrome-512x512.png differ diff --git a/static/apple-touch-icon.png b/static/apple-touch-icon.png new file mode 100644 index 0000000..98321b5 Binary files /dev/null and b/static/apple-touch-icon.png differ diff --git a/static/browserconfig.xml b/static/browserconfig.xml new file mode 100644 index 0000000..eeb397f --- /dev/null +++ b/static/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #00a300 + + + diff --git a/static/favicon-16x16.png b/static/favicon-16x16.png new file mode 100644 index 0000000..590126e Binary files /dev/null and b/static/favicon-16x16.png differ diff --git a/static/favicon-32x32.png b/static/favicon-32x32.png new file mode 100644 index 0000000..3d1a979 Binary files /dev/null and b/static/favicon-32x32.png differ diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..50a7ce5 Binary files /dev/null and b/static/favicon.ico differ diff --git a/static/mstile-144x144.png b/static/mstile-144x144.png new file mode 100644 index 0000000..5fe1d23 Binary files /dev/null and b/static/mstile-144x144.png differ diff --git a/static/mstile-150x150.png b/static/mstile-150x150.png new file mode 100644 index 0000000..1313c46 Binary files /dev/null and b/static/mstile-150x150.png differ diff --git a/static/mstile-310x150.png b/static/mstile-310x150.png new file mode 100644 index 0000000..0cecb63 Binary files /dev/null and b/static/mstile-310x150.png differ diff --git a/static/mstile-310x310.png b/static/mstile-310x310.png new file mode 100644 index 0000000..2b27b2c Binary files /dev/null and b/static/mstile-310x310.png differ diff --git a/static/mstile-70x70.png b/static/mstile-70x70.png new file mode 100644 index 0000000..236146b Binary files /dev/null and b/static/mstile-70x70.png differ diff --git a/static/robots.txt b/static/robots.txt new file mode 100644 index 0000000..87ce5a8 --- /dev/null +++ b/static/robots.txt @@ -0,0 +1,3 @@ +User-agent: * +Disallow: /wp-login.php +Disallow: /xmlrpc.php diff --git a/static/site.webmanifest b/static/site.webmanifest new file mode 100644 index 0000000..b20abb7 --- /dev/null +++ b/static/site.webmanifest @@ -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" +}