Acual support of Therms of services
This commit is contained in:
@ -5,7 +5,7 @@ import { downloadAndUnzip } from "./tools/downloadAndUnzip";
|
||||
import { join as pathJoin } from "path";
|
||||
|
||||
export const builtinThemesUrl =
|
||||
"https://github.com/garronej/keycloakify/releases/download/v0.0.1/keycloak_11.0.3_builtin_themes.zip";
|
||||
"https://github.com/garronej/keycloakify/releases/download/v0.0.1/keycloak_11.0.3_builtin_themes_with_light_mods.zip";
|
||||
|
||||
if (require.main === module) {
|
||||
|
||||
|
@ -5,27 +5,27 @@ import { objectKeys } from "evt/tools/typeSafety/objectKeys";
|
||||
|
||||
export const evtTermsUpdated = Evt.asNonPostable(Evt.create<void>());
|
||||
|
||||
objectKeys(kcMessages).forEach(kcLanguage =>
|
||||
Object.defineProperty(
|
||||
kcMessages[kcLanguage],
|
||||
"termsText",
|
||||
(() => {
|
||||
(["termsText", "doAccept", "doDecline", "termsTitle"] as const).forEach(key =>
|
||||
objectKeys(kcMessages).forEach(kcLanguage =>
|
||||
Object.defineProperty(
|
||||
kcMessages[kcLanguage],
|
||||
key,
|
||||
(() => {
|
||||
|
||||
let value = kcMessages[kcLanguage].termsText;
|
||||
let value = key === "termsText" ? "⏳" : kcMessages[kcLanguage][key];
|
||||
|
||||
return {
|
||||
"enumerable": true,
|
||||
"get": () => value,
|
||||
"set": (newValue: string) => {
|
||||
|
||||
Evt.asPostable(evtTermsUpdated).post();
|
||||
|
||||
value = newValue;
|
||||
}
|
||||
};
|
||||
return {
|
||||
"enumerable": true,
|
||||
"get": () => value,
|
||||
"set": (newValue: string) => {
|
||||
value = newValue;
|
||||
Evt.asPostable(evtTermsUpdated).post();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
})()
|
||||
})()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -4,8 +4,8 @@ import { useKcLanguageTag } from "./useKcLanguageTag";
|
||||
import { kcMessages, evtTermsUpdated } from "./kcMessages/login";
|
||||
import type { ReactNode } from "react";
|
||||
import { useEvt } from "evt/hooks";
|
||||
//@ts-ignore
|
||||
import * as markdown from "markdown";
|
||||
//NOTE for later: https://github.com/remarkjs/react-markdown/blob/236182ecf30bd89c1e5a7652acaf8d0bf81e6170/src/renderers.js#L7-L35
|
||||
import ReactMarkdown from "react-markdown";
|
||||
|
||||
export type MessageKey = keyof typeof kcMessages["en"];
|
||||
|
||||
@ -40,15 +40,10 @@ export function useKcMessage() {
|
||||
|
||||
const msg = useCallback<(...args: Parameters<typeof msgStr>) => ReactNode>(
|
||||
(key, ...args) =>
|
||||
<span
|
||||
className={key}
|
||||
dangerouslySetInnerHTML={{
|
||||
"__html":
|
||||
markdown.toHTML(msgStr(key, ...args))
|
||||
}}
|
||||
/>
|
||||
,
|
||||
[kcLanguageTag, trigger]
|
||||
<ReactMarkdown allowDangerousHtml renderers={key === "termsText" ? undefined : { "paragraph": "span" }}>
|
||||
{msgStr(key, ...args)}
|
||||
</ReactMarkdown>,
|
||||
[msgStr]
|
||||
);
|
||||
|
||||
return { msg, msgStr };
|
||||
|
@ -199,7 +199,7 @@ export const kcLoginVerifyEmailContext: KcContext.LoginVerifyEmail = {
|
||||
"pageId": "login-verify-email.ftl"
|
||||
};
|
||||
|
||||
export const kcTermContext: KcContext.Terms = {
|
||||
export const kcTermsContext: KcContext.Terms = {
|
||||
...kcCommonContext,
|
||||
"pageId": "terms.ftl"
|
||||
};
|
||||
|
Reference in New Issue
Block a user