27 lines
781 B
TypeScript
27 lines
781 B
TypeScript
|
import { compile, TemplateDelegate } from "handlebars"
|
||
|
import { readFileSync } from "fs";
|
||
|
import { __ as i__ } from "i18n"
|
||
|
import config from "../config";
|
||
|
|
||
|
let template: TemplateDelegate<any>;
|
||
|
function loadStatic() {
|
||
|
let html = readFileSync("./views/out/authorize/authorize.html").toString();
|
||
|
template = compile(html)
|
||
|
}
|
||
|
|
||
|
export default function GetAuthPage(__: typeof i__, appname: string, scopes: { name: string, description: string, logo: string }[]): string {
|
||
|
if (config.dev) {
|
||
|
loadStatic()
|
||
|
}
|
||
|
|
||
|
return template({
|
||
|
title: __("Authorize %s", appname),
|
||
|
information: __("By clicking on ALLOW, you allow this app to access the requested recources."),
|
||
|
scopes: scopes,
|
||
|
// request: request
|
||
|
}, { helpers: { "i18n": __ } });
|
||
|
}
|
||
|
|
||
|
loadStatic()
|
||
|
|