2022-02-06 20:46:27 +00:00
import { compile } from "ejs" ;
import { readFileSync } from "fs" ;
2022-02-07 00:46:21 +00:00
let template = compile ( readFileSync ( "./lib/template.ejs" , "utf8" ) ) ;
2019-08-02 15:57:13 +00:00
2022-05-11 18:35:34 +00:00
export default function ( code , message , displayOptions ) {
let msg ;
// const displayOptions = displayOptions || {};
2019-08-02 15:57:13 +00:00
2022-08-02 23:54:55 +00:00
if ( code === 500 && ! message ) {
2022-05-11 18:35:34 +00:00
msg =
2022-05-12 12:03:15 +00:00
"<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>" ;
2022-05-11 18:35:34 +00:00
} else {
msg = message || "" ;
}
2019-08-02 15:57:13 +00:00
2022-05-11 18:35:34 +00:00
let 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 ,
} ;
2019-08-02 15:57:13 +00:00
2022-05-11 18:35:34 +00:00
return template ( options ) ;
}