MaxMind IP database & region approvals

This commit is contained in:
tim
2024-12-19 20:18:56 -04:00
parent a689766f37
commit 19a8ffbbd4
5 changed files with 56 additions and 41 deletions

View 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>