diff --git a/web/src/elements/Markdown.ts b/web/src/elements/Markdown.ts
index c95d302ef..40561a59f 100644
--- a/web/src/elements/Markdown.ts
+++ b/web/src/elements/Markdown.ts
@@ -6,10 +6,16 @@ import AKGlobal from "../authentik.css";
import PFContent from "@patternfly/patternfly/components/Content/content.css";
import PFList from "@patternfly/patternfly/components/List/list.css";
+export interface MarkdownDocument {
+ html: string;
+ metadata: { [key: string]: string };
+ filename: string;
+}
+
@customElement("ak-markdown")
export class Markdown extends LitElement {
- @property()
- md?: string;
+ @property({ attribute: false })
+ md?: MarkdownDocument;
static get styles(): CSSResult[] {
return [PFList, PFContent, AKGlobal];
@@ -19,7 +25,8 @@ export class Markdown extends LitElement {
if (!this.md) {
return html``;
}
- const finalHTML = this.md.replace("
", ``);
- return html`${unsafeHTML(finalHTML)}`;
+ const finalHTML = this.md?.html.replace("", "");
+ return html`${this.md?.metadata.title ? html`${this.md.metadata.title}
` : html``}
+ ${unsafeHTML(finalHTML)}`;
}
}
diff --git a/web/src/global.d.ts b/web/src/global.d.ts
index 203b51ec2..b7b3dfdf8 100644
--- a/web/src/global.d.ts
+++ b/web/src/global.d.ts
@@ -1,7 +1,7 @@
declare module "*.css";
declare module "*.md" {
const html: string;
- const metadata: object;
+ const metadata: { [key: string]: string };
const filename: string;
}
diff --git a/web/src/pages/providers/proxy/ProxyProviderViewPage.ts b/web/src/pages/providers/proxy/ProxyProviderViewPage.ts
index 03a655c15..b8909bb43 100644
--- a/web/src/pages/providers/proxy/ProxyProviderViewPage.ts
+++ b/web/src/pages/providers/proxy/ProxyProviderViewPage.ts
@@ -28,6 +28,7 @@ import { EVENT_REFRESH } from "../../../constants";
import "../../../elements/CodeMirror";
import { PFColor } from "../../../elements/Label";
import "../../../elements/Markdown";
+import { MarkdownDocument } from "../../../elements/Markdown";
import "../../../elements/Tabs";
import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/SpinnerButton";
@@ -90,20 +91,19 @@ export class ProxyProviderViewPage extends LitElement {
});
}
- renderConfigTemplate(tmpl: string): string {
+ renderConfigTemplate(markdown: MarkdownDocument): MarkdownDocument {
// See website/docs/providers/proxy/forward_auth.mdx
- let final = "";
if (this.provider?.mode === ProxyMode.ForwardSingle) {
- final = tmpl
+ markdown.html = markdown.html
.replaceAll("authentik.company", window.location.hostname)
.replaceAll("outpost.company", window.location.hostname)
.replaceAll("app.company", this.provider?.externalHost || "");
} else if (this.provider?.mode == ProxyMode.ForwardDomain) {
- final = tmpl
+ markdown.html = markdown.html
.replaceAll("authentik.company", window.location.hostname)
.replaceAll("outpost.company", this.provider?.externalHost || "");
}
- return final;
+ return markdown;
}
render(): TemplateResult {
@@ -251,7 +251,7 @@ export class ProxyProviderViewPage extends LitElement {
class="pf-c-page__main-section pf-m-light pf-m-no-padding-mobile"
>