mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 02:23:47 +00:00
- Add @kastov/cryptohapp + jsencrypt for encrypted Happ deep links
- Add templateEngine utility to resolve {{SUBSCRIPTION_LINK}},
{{HAPP_CRYPT3_LINK}}, {{HAPP_CRYPT4_LINK}}, {{USERNAME}} templates
- Convert ConnectionModal component into a standalone Connection page
- Add /connection route with ProtectedRoute and lazy loading
- Replace modal invocation in Dashboard and Subscription with
navigate('/connection')
- Add type and svgIconKey optional fields to RemnawaveButton
- Show button type badge and SVG icon in AdminApps BlockCard
- Refactor ThemeTab to use local draft state with Save/Cancel flow
33 lines
883 B
TypeScript
33 lines
883 B
TypeScript
import { createHappCryptoLink } from '@kastov/cryptohapp';
|
|
|
|
const TEMPLATE_RE = /\{\{[A-Z0-9_]+\}\}/;
|
|
|
|
export function hasTemplates(url: string): boolean {
|
|
return TEMPLATE_RE.test(url);
|
|
}
|
|
|
|
interface ResolveContext {
|
|
subscriptionUrl: string;
|
|
username?: string;
|
|
}
|
|
|
|
export function resolveTemplate(template: string, ctx: ResolveContext): string {
|
|
let result = template;
|
|
|
|
result = result.replace(/\{\{SUBSCRIPTION_LINK\}\}/g, ctx.subscriptionUrl);
|
|
|
|
if (ctx.username) {
|
|
result = result.replace(/\{\{USERNAME\}\}/g, ctx.username);
|
|
}
|
|
|
|
result = result.replace(/\{\{HAPP_CRYPT3_LINK\}\}/g, () => {
|
|
return createHappCryptoLink(ctx.subscriptionUrl, 'v3', true) ?? ctx.subscriptionUrl;
|
|
});
|
|
|
|
result = result.replace(/\{\{HAPP_CRYPT4_LINK\}\}/g, () => {
|
|
return createHappCryptoLink(ctx.subscriptionUrl, 'v4', true) ?? ctx.subscriptionUrl;
|
|
});
|
|
|
|
return result;
|
|
}
|