mastofeed-iframe-embed/lib/errorPage.js

36 lines
1022 B
JavaScript
Raw Normal View History

2019-08-02 17:57:13 +02:00
var ejs = require('ejs');
var fs = require('fs');
var template = ejs.compile(fs.readFileSync('./lib/template.ejs', 'utf8'));
2019-08-02 19:24:31 +02:00
module.exports = function(code,message,displayOptions){
2019-08-02 17:57:13 +02:00
var msg;
2019-08-02 19:24:31 +02:00
var displayOptions = displayOptions || {};
2019-08-02 17:57:13 +02:00
if (code == 500 && !message){
2019-08-02 19:24:31 +02:00
msg = '<p>Sorry, we are having trouble fetching posts for this user. Please try again later.</p><br><p>If the issue persists, <a href="https://github.com/fenwick67/mastofeed/issues">please open an issue on GitHub</a>, or message fenwick67@octodon.social</p>'
2019-08-02 17:57:13 +02:00
}else{
2019-08-02 19:24:31 +02:00
msg = message||'';
2019-08-02 17:57:13 +02:00
}
var options = {
opts:{
2019-08-02 19:24:31 +02:00
header:true,
theme:displayOptions.theme||null,
size:displayOptions.size||null
2019-08-02 17:57:13 +02:00
},
meta:{
title:code.toString(),
description:msg,
link:'#'
2019-08-02 19:24:31 +02:00
// avatar:'',
// headerImage:''
2019-08-02 17:57:13 +02:00
},
items:[],
nextPageLink:null,
isIndex:true
}
return template(options);
}