mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 23:38:56 +00:00
42 lines
1.9 KiB
HTML
42 lines
1.9 KiB
HTML
{{- /*
|
|
Encrypted content renderer.
|
|
- Encrypts content payload and renders decryptor UI.
|
|
- Supports full-page mode and partial mode with isolated target container.
|
|
@param {String} .Password encryption password
|
|
@param {String} .Content content to encrypt and render
|
|
@param {String} [.Message] custom input placeholder message
|
|
@param {Boolean} [.IsPartial] whether current render is partial mode
|
|
@param {Object} [.Page] current page context (required when IsPartial is true)
|
|
*/ -}}
|
|
|
|
{{- if .Password -}}
|
|
{{- /* Content Encryption */ -}}
|
|
{{- $content := dict "Content" .Content "Password" .Password | partial "function/content-encryption.html" -}}
|
|
|
|
{{- /* Generating fixit-encryptor DOM */ -}}
|
|
{{- $message := .Message | default (T "single.encryptedMessage") -}}
|
|
{{- $loading := resources.Get "images/loading.svg" | minify -}}
|
|
{{- $id := "fixit-decryptor-input" -}}
|
|
{{- if .IsPartial -}}
|
|
{{- $id = dict "Page" .Page | partial "function/id.html" -}}
|
|
{{- end -}}
|
|
<fixit-encryptor>
|
|
<div class="fixit-decryptor-container">
|
|
<img class="fixit-decryptor-loading" src="{{ $loading.RelPermalink }}" alt="decryptor loading" width="48" height="48" />
|
|
<label for="{{ $id }}" title="{{ T `single.password` }}">
|
|
<input type="password" id="{{ $id }}" class="fixit-decryptor-input" placeholder="🔑 {{ $message }}" />
|
|
</label>
|
|
<button class="fixit-decryptor-btn">
|
|
{{- dict "Class" "fa-solid fa-unlock" | partial "plugin/icon.html" }}{{ T "single.enterBtn" -}}
|
|
</button>
|
|
{{- if not .IsPartial -}}
|
|
<button class="fixit-encryptor-btn">
|
|
{{- dict "Class" "fa-solid fa-lock" | partial "plugin/icon.html" }}{{ T "single.encryptyAgain" -}}
|
|
</button>
|
|
{{- end -}}
|
|
</div>
|
|
{{- if .IsPartial }}<div class="decryptor-content"></div>{{ end -}}
|
|
<cipher-text data-password="{{ xxhash .Password }}">{{ $content }}</cipher-text>
|
|
</fixit-encryptor>
|
|
{{- end -}}
|