2023-09-23 11:11:28 -04:00
|
|
|
<!-- eslint-disable vue/no-v-html -->
|
2019-05-10 17:12:00 -04:00
|
|
|
<template>
|
|
|
|
<div id="app">
|
2023-09-30 13:40:11 -04:00
|
|
|
<app-navbar />
|
2019-05-10 17:12:00 -04:00
|
|
|
|
2023-09-30 13:40:11 -04:00
|
|
|
<div class="container mt-4">
|
|
|
|
<div
|
|
|
|
v-if="error"
|
|
|
|
class="row justify-content-center"
|
2019-07-14 12:00:47 -04:00
|
|
|
>
|
2023-09-30 13:40:11 -04:00
|
|
|
<div class="col-8">
|
|
|
|
<div
|
|
|
|
class="alert alert-danger"
|
|
|
|
role="alert"
|
2019-07-14 12:00:47 -04:00
|
|
|
v-html="error"
|
|
|
|
/>
|
2023-09-30 13:40:11 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col">
|
|
|
|
<router-view @error="displayError" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row mt-4">
|
|
|
|
<div class="col form-text text-center">
|
|
|
|
{{ $t('text-powered-by') }}
|
|
|
|
<a href="https://github.com/Luzifer/ots"><i class="fab fa-github" /> OTS</a>
|
|
|
|
{{ $root.version }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-05-10 17:12:00 -04:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-09-30 13:40:11 -04:00
|
|
|
import AppNavbar from './components/navbar.vue'
|
2022-08-25 18:41:55 -04:00
|
|
|
|
2019-05-10 17:12:00 -04:00
|
|
|
export default {
|
2023-09-30 13:40:11 -04:00
|
|
|
components: {
|
|
|
|
AppNavbar,
|
|
|
|
},
|
2023-06-14 16:49:21 -04:00
|
|
|
|
2023-09-30 13:40:11 -04:00
|
|
|
created() {
|
|
|
|
this.$root.navigate('/')
|
2019-07-14 12:00:47 -04:00
|
|
|
},
|
|
|
|
|
2023-06-10 14:50:53 -04:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
error: '',
|
|
|
|
}
|
2019-07-14 12:00:47 -04:00
|
|
|
},
|
|
|
|
|
2019-05-10 17:12:00 -04:00
|
|
|
methods: {
|
2023-09-30 13:40:11 -04:00
|
|
|
displayError(error) {
|
|
|
|
this.error = error
|
2023-06-26 17:01:06 -04:00
|
|
|
},
|
|
|
|
|
2019-05-10 17:12:00 -04:00
|
|
|
// hashLoad reacts on a changed window hash an starts the diplaying of the secret
|
|
|
|
hashLoad() {
|
2019-05-12 18:12:11 -04:00
|
|
|
const hash = decodeURIComponent(window.location.hash)
|
2019-05-10 18:31:26 -04:00
|
|
|
if (hash.length === 0) {
|
|
|
|
return
|
|
|
|
}
|
2019-05-10 17:12:00 -04:00
|
|
|
|
|
|
|
const parts = hash.substring(1).split('|')
|
2023-09-30 13:40:11 -04:00
|
|
|
const secretId = parts[0]
|
|
|
|
let securePassword = null
|
|
|
|
|
2019-05-10 18:31:26 -04:00
|
|
|
if (parts.length === 2) {
|
2023-09-30 13:40:11 -04:00
|
|
|
securePassword = parts[1]
|
2019-05-10 17:12:00 -04:00
|
|
|
}
|
|
|
|
|
2023-09-30 13:40:11 -04:00
|
|
|
this.$root.navigate({
|
|
|
|
path: '/secret',
|
|
|
|
query: {
|
|
|
|
secretId,
|
|
|
|
securePassword,
|
|
|
|
},
|
|
|
|
})
|
2019-05-10 17:12:00 -04:00
|
|
|
},
|
2023-06-10 14:50:53 -04:00
|
|
|
},
|
2019-05-10 17:12:00 -04:00
|
|
|
|
2023-06-10 14:50:53 -04:00
|
|
|
// Trigger initialization functions
|
|
|
|
mounted() {
|
|
|
|
window.onhashchange = this.hashLoad
|
|
|
|
this.hashLoad()
|
2019-05-10 17:12:00 -04:00
|
|
|
},
|
2023-06-10 14:24:17 -04:00
|
|
|
|
2023-06-10 14:50:53 -04:00
|
|
|
name: 'App',
|
2019-05-10 17:12:00 -04:00
|
|
|
}
|
|
|
|
</script>
|