2019-03-23 17:01:49 +00:00
|
|
|
<template>
|
2019-04-04 10:45:34 +00:00
|
|
|
<div id="app" class="flex flex-column items-center">
|
|
|
|
<div id="logo" class="w-100 flex justify-center items-end">
|
2019-04-04 18:26:43 +00:00
|
|
|
<a href="/" class="logo-titla f1 lh-title tracked">BIT4SAT</a>
|
2019-04-04 10:45:34 +00:00
|
|
|
</div>
|
2019-04-04 18:26:43 +00:00
|
|
|
<div class="main h-100 w-100 flex mt4 items-start justify-center">
|
2019-04-04 10:45:34 +00:00
|
|
|
<router-view />
|
|
|
|
</div>
|
2019-03-23 17:01:49 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script charset="utf-8">
|
2019-04-04 18:26:43 +00:00
|
|
|
import GetWorker from './workerInterface.js';
|
|
|
|
const Worker = GetWorker('main');
|
2019-04-07 10:30:43 +00:00
|
|
|
import { mapState, mapGetters } from 'vuex'
|
|
|
|
|
|
|
|
const dlUrlRegex = /d\/(\w+)\/?/
|
2019-04-09 07:20:46 +00:00
|
|
|
const adminUrlRegex = /r\/(\w+)\/?/
|
2019-04-04 18:26:43 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
|
|
mounted(){
|
|
|
|
|
|
|
|
this.worker = Worker
|
|
|
|
|
|
|
|
// listen and route
|
|
|
|
this.worker.listenTo('upload-invoice', (e) => {
|
|
|
|
console.log("received invoice ", e.data)
|
|
|
|
this.$store.commit('setInvoice', e.data.invoice)
|
2019-04-07 10:30:43 +00:00
|
|
|
this.$store.commit('setUpStatus', e.data.status)
|
2019-04-04 18:26:43 +00:00
|
|
|
|
|
|
|
// if we are not on upload route go there
|
|
|
|
if ( this.$router.currentRoute.name !== 'upload' ) {
|
|
|
|
this.$router.push({name: 'upload', params: { uploadId: e.data.upload_id }})
|
|
|
|
}
|
|
|
|
})
|
2019-04-07 10:30:43 +00:00
|
|
|
|
|
|
|
// On load if the url is a download url route to download path
|
|
|
|
let loc = window.location
|
|
|
|
if (loc.pathname.match(dlUrlRegex)) {
|
|
|
|
let dlId = dlUrlRegex.exec(loc.pathname)[1]
|
|
|
|
history.replaceState("", `download ${dlId}`, '/' )
|
|
|
|
this.$router.replace({
|
|
|
|
name: 'download',
|
|
|
|
replace: true,
|
|
|
|
params: {dlId}
|
|
|
|
})
|
|
|
|
}
|
2019-04-09 07:20:46 +00:00
|
|
|
if (loc.pathname.match(adminUrlRegex)) {
|
|
|
|
let adminToken = adminUrlRegex.exec(loc.pathname)[1]
|
|
|
|
history.replaceState("", `admin`, '/' )
|
|
|
|
this.$router.replace({
|
|
|
|
name: 'admin',
|
|
|
|
replace: true,
|
|
|
|
params: {adminToken}
|
|
|
|
})
|
|
|
|
}
|
2019-04-07 10:30:43 +00:00
|
|
|
|
|
|
|
},
|
2019-04-04 18:26:43 +00:00
|
|
|
}
|
2019-04-04 10:45:34 +00:00
|
|
|
</script>
|
2019-04-02 13:53:00 +00:00
|
|
|
|
2019-04-04 10:45:34 +00:00
|
|
|
<style>
|
|
|
|
#app {
|
|
|
|
height: 100vh;
|
|
|
|
}
|
2019-04-02 13:53:00 +00:00
|
|
|
|
2019-04-04 10:45:34 +00:00
|
|
|
#logo {
|
2019-04-04 18:26:43 +00:00
|
|
|
height: 25%;
|
|
|
|
}
|
|
|
|
|
|
|
|
#logo a {
|
2019-04-04 10:45:34 +00:00
|
|
|
color: #FF725C;
|
|
|
|
font-style: italic;
|
|
|
|
font-weight: bolder;
|
|
|
|
text-shadow: 2px 3px #444, -2px -2px #444;
|
2019-04-04 18:26:43 +00:00
|
|
|
text-decoration: none;
|
2019-03-23 17:01:49 +00:00
|
|
|
}
|
2019-04-02 13:53:00 +00:00
|
|
|
|
|
|
|
</style>
|