MaxMind IP database & region approvals
This commit is contained in:
38
src/components/ApproveRegion.vue
Normal file
38
src/components/ApproveRegion.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<slot v-if="s.regionApproved"/>
|
||||
<v-card v-if="s.regionApproved===null" title="Loading..." prepend-icon="mdi-clock-outline"
|
||||
text="If loading takes more than a second, please refresh your browser or contact support@dexorder.trade"/>
|
||||
<v-card v-if="s.regionApproved===false" title="Restricted" prepend-icon="mdi-alert"
|
||||
text="Dexorder is not available in your region."/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {useStore} from "@/store/store";
|
||||
import {socket} from "@/socket.js";
|
||||
import {useRoute} from "vue-router";
|
||||
|
||||
const s = useStore()
|
||||
|
||||
let timer = null
|
||||
|
||||
const bypass = useRoute().query.approval
|
||||
|
||||
function tryApproval() {
|
||||
console.log('approval query', bypass)
|
||||
if (timer!==null) {
|
||||
clearTimeout(timer)
|
||||
timer = null
|
||||
}
|
||||
if (s.regionApproved===null) {
|
||||
socket.emit('approveRegion', bypass)
|
||||
timer = setTimeout(tryApproval, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
tryApproval()
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
@@ -1,35 +0,0 @@
|
||||
<template>
|
||||
<slot v-if="s.allowed"/>
|
||||
<v-card v-if="!s.allowed" rounded="0" title="Dexorder Private Beta">
|
||||
<v-card-item><v-text-field v-model="password" label="Beta Password" class="maxw"/></v-card-item>
|
||||
<v-card-text>
|
||||
Follow our social media for public release updates!
|
||||
</v-card-text>
|
||||
<v-card-item><social/></v-card-item>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {useStore} from "@/store/store";
|
||||
import Social from "@/components/Social.vue";
|
||||
import {ref, watchEffect} from "vue";
|
||||
import {hashMessage} from "ethers";
|
||||
|
||||
const s = useStore()
|
||||
|
||||
const password = ref(null)
|
||||
const passHash = '0x3e6e96bd824dd0a5e5361853719ef051e939b91f3fc6fd0f685b4c414c7ba89e'
|
||||
|
||||
watchEffect(()=>{
|
||||
if (!password.value) return
|
||||
const canonical = password.value.replace(/[^a-zA-Z]/g, '').toLowerCase();
|
||||
const hash = hashMessage(canonical);
|
||||
if (hash===passHash)
|
||||
s.allowed = true
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<beta-signin>
|
||||
<approve-region>
|
||||
<slot v-if="status===Status.OK" v-bind="$props"/>
|
||||
<v-card v-if="status!==Status.OK" rounded="0">
|
||||
<v-card-title>
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
</v-card>
|
||||
<terms-of-service v-if="status===Status.OK"/>
|
||||
</beta-signin>
|
||||
</approve-region>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -43,7 +43,7 @@ import {computed, ref} from "vue";
|
||||
import {addNetwork, connectWallet, switchChain} from "@/blockchain/wallet.js";
|
||||
import Btn from "@/components/Btn.vue";
|
||||
import Logo from "@/components/Logo.vue";
|
||||
import BetaSignin from "@/components/BetaSignin.vue";
|
||||
import ApproveRegion from "@/components/ApproveRegion.vue";
|
||||
import TermsOfService from "@/components/TermsOfService.vue";
|
||||
|
||||
const s = useStore()
|
||||
|
||||
Reference in New Issue
Block a user