Skip to content

Commit

Permalink
[#170] Add button to burn secrets immediately
Browse files Browse the repository at this point in the history
Signed-off-by: Knut Ahlers <[email protected]>
  • Loading branch information
Luzifer committed Sep 22, 2024
1 parent 73209fc commit 04a435c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ reference:
text-powered-by: Powered by
text-pre-reveal-hint: To reveal the secret click this button but be aware doing so will destroy the secret. You can only view it once!
text-pre-url: 'Your secret was created and stored using this URL:'
text-secret-burned: The secret was successfully destroyed.
text-secret-create-disabled: The creation of new secrets is disabled in this instance.
title-explanation: This is how it works&hellip;
title-new-secret: Create a new secret
title-reading-secret: Reading your secret&hellip;
title-secret-create-disabled: Secret creation disabled…
title-secret-created: Secret created!
tooltip-burn-secret: Burn Secret now!
tooltip-copy-to-clipboard: Copy to Clipboard
tooltip-download-as-file: Download as File
translations:
Expand Down
28 changes: 27 additions & 1 deletion src/components/display-url.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
class="card-header bg-success-subtle"
v-html="$t('title-secret-created')"
/>
<div class="card-body">
<div
v-if="!burned"
class="card-body"
>
<p v-html="$t('text-pre-url')" />
<div class="input-group mb-3">
<input
Expand All @@ -21,13 +24,26 @@
:title="$t('tooltip-copy-to-clipboard')"
/>
<app-qr-button :qr-content="secretUrl" />
<button
class="btn btn-danger"
:title="$t('tooltip-burn-secret')"
@click="burnSecret"
>
<i class="fas fa-fire fa-fw" />
</button>
</div>
<p v-html="$t('text-burn-hint')" />
<p v-if="expiresAt">
{{ $t('text-burn-time') }}
<strong>{{ expiresAt.toLocaleString() }}</strong>
</p>
</div>
<div
v-else
class="card-body"
>
{{ $t('text-secret-burned') }}
</div>
</div>
</template>
<script>
Expand All @@ -50,10 +66,20 @@ export default {
data() {
return {
burned: false,
popover: null,
}
},
methods: {
burnSecret() {
return fetch(`api/get/${this.secretId}`)
.then(() => {
this.burned = true
})
},
},
mounted() {
// Give the interface a moment to transistion and focus
window.setTimeout(() => this.$refs.secretUrl.focus(), 100)
Expand Down
2 changes: 1 addition & 1 deletion src/langs/langs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 04a435c

Please sign in to comment.