fedifeed/lib/errorPage.js
Sam Therapy 73a0ccf871
Redo app from the ground up
Make it an ES module, TODO: Typescript
Make the themes explicitly mastodon

Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-02-06 13:14:18 -06:00

36 lines
No EOL
1,015 B
JavaScript

import { compile } from 'ejs';
import { readFileSync } from 'fs';
var template = compile(readFileSync('./lib/template.ejs', 'utf8'));
export default function(code,message,displayOptions){
var msg;
var displayOptions = displayOptions || {};
if (code == 500 && !message){
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://git.froth.zone/Sam/fedifeed/issues">please open an issue on Gitea</a>, or message sam@froth.zone</p>'
}else{
msg = message||'';
}
var options = {
opts:{
header:true,
theme:displayOptions.theme||null,
size:displayOptions.size||null
},
meta:{
title:code.toString(),
description:msg,
link:'#'
// avatar:'',
// headerImage:''
},
items:[],
nextPageLink:null,
isIndex:true
}
return template(options);
}