forked from anime-vsub/app
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3b6917
commit 04c52a2
Showing
9 changed files
with
146 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,41 @@ | ||
<template> | ||
<div | ||
class="h-full w-full flex items-center text-white text-center q-pa-md flex flex-center q-pa-md"> | ||
<component :is="componentErrors[typeError ?? 'unknown'] ?? componentErrors.unknown" :no-image="noImage" | ||
:retry="() => emit('click:retry')" /> | ||
class="h-full w-full flex items-center text-white text-center q-pa-md flex flex-center q-pa-md" | ||
> | ||
<component | ||
:is="componentErrors[typeError ?? 'unknown'] ?? componentErrors.unknown" | ||
:no-image="noImage" | ||
:retry="() => emit('click:retry')" | ||
/> | ||
</div> | ||
</template> | ||
<script lang="ts" setup> | ||
import ErrorCloudflare from "./errors/cloudflare.vue" | ||
import ErrorUnknown from "./errors/unknown.vue" | ||
import { computed } from "vue" | ||
const props = defineProps < { | ||
noImage ? : boolean | ||
error ? : Error | ||
} > () | ||
const emit = defineEmits < { | ||
(name: "click:retry"): void | ||
} > () | ||
import ErrorCloudflare from "./errors/cloudflare.vue" | ||
import ErrorUnknown from "./errors/unknown.vue" | ||
const componentErrors = { | ||
cloudflare: ErrorCloudflare, | ||
unknown: ErrorUnknown | ||
} | ||
const props = defineProps<{ | ||
noImage?: boolean | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
error?: any | ||
}>() | ||
const emit = defineEmits<{ | ||
(name: "click:retry"): void | ||
}>() | ||
const componentErrors = { | ||
cloudflare: ErrorCloudflare, | ||
unknown: ErrorUnknown, | ||
} | ||
const typeError = computed(() => { | ||
if (!props.error) return null | ||
const typeError = computed(() => { | ||
if (!props.error) return null | ||
if (props.error.data?.includes("<title>Just a moment...</title>")) | ||
return "cloudflare" | ||
if (props.error.data?.includes("<title>Just a moment...</title>")) | ||
return "cloudflare" | ||
return null | ||
}) | ||
return null | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,107 @@ | ||
<template> | ||
<div> | ||
|
||
<transition-group v-if="!noImage" name="q-transition--fade" tag="div" class="flex items-center justify-center"> | ||
<Icon v-if="rand === 0" icon="vscode-icons:file-type-aurelia" width="84" height="84" /> | ||
|
||
<Icon v-else-if="rand === 1" icon="vscode-icons:file-type-playwright" width="84" height="84" /> | ||
<transition-group | ||
v-if="!noImage" | ||
name="q-transition--fade" | ||
tag="div" | ||
class="flex items-center justify-center" | ||
> | ||
<Icon | ||
v-if="rand === 0" | ||
icon="vscode-icons:file-type-aurelia" | ||
width="84" | ||
height="84" | ||
/> | ||
|
||
<Icon | ||
v-else-if="rand === 1" | ||
icon="vscode-icons:file-type-playwright" | ||
width="84" | ||
height="84" | ||
/> | ||
|
||
<Icon v-else icon="vscode-icons:file-type-ovpn" width="84" height="84" /> | ||
</transition-group> | ||
|
||
|
||
<div class="text-h4 mt-4"> | ||
IP của bạn tới từ quốc gia chưa được hỗ trợ | ||
{{ t("ip-cua-ban-toi-tu-quoc-gia-chua-duoc-ho-tro") }} | ||
</div> | ||
|
||
<div class="text-h6 text-weight-regular mt-4"> | ||
<p class="opacity-40"> | ||
Hiện tại AnimeVsub chỉ hỗ trợ các địa chỉ IP tới từ Việt Nam. Nếu bạn | ||
đang không ở Việt Nam hãy sử dụng các dịch vụ VPN để có được địa chỉ IP | ||
từ Việt Nam | ||
{{ t("msg-caption-country-not-support") }} | ||
</p> | ||
|
||
<p class="mt-3 text-gray-400 text-weight-medium"> | ||
Bạn có thể sử dụng <a | ||
{{ t("ban-co-the-su-dung") }} | ||
<a | ||
href="https://chrome.google.com/webstore/detail/urban-vpn-proxy/eppiocemhmnlbhjplcgkofciiegomcon" | ||
target="_blank" class="text-blue">Urban VPN</a> | ||
là một VPN miễn phí | ||
target="_blank" | ||
class="text-blue" | ||
>Urban VPN</a | ||
>{{ t("la-mot-vpn-mien-phi") }} | ||
</p> | ||
|
||
<div v-if="myip"> | ||
<span class="text-weight-medium text-gray-500">IP của bạn: </span> | ||
{{ myip.ip }} ({{ myip.country }} <img :src="`https://flagsapi.com/${myip.cc.toUpperCase()}/flat/64.png`" :ratio="1" class="inline h-7" />) | ||
<span class="text-weight-medium text-gray-500" | ||
>{{ t("ip-cua-ban") }} | ||
</span> | ||
{{ myip.ip }} ({{ myip.country }} | ||
<img | ||
:src="`https://flagsapi.com/${myip.cc.toUpperCase()}/flat/64.png`" | ||
:ratio="1" | ||
class="inline h-7" | ||
/>) | ||
</div> | ||
</div> | ||
|
||
<q-btn class="q-mt-md" no-caps outline rounded @click="retry" style="color: #00be06">{{ t("thu-lai") }}</q-btn> | ||
<q-btn | ||
class="q-mt-md" | ||
no-caps | ||
outline | ||
rounded | ||
@click="retry" | ||
style="color: #00be06" | ||
>{{ t("thu-lai") }}</q-btn | ||
> | ||
</div> | ||
|
||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { | ||
useIntervalFn, computedAsync | ||
} from "@vueuse/core" | ||
import { Icon } from "@iconify/vue" | ||
import { useI18n } from "vue-i18n" | ||
import { ref } from "vue" | ||
import { Icon } from "@iconify/vue" | ||
import { computedAsync, useIntervalFn } from "@vueuse/core" | ||
import { get } from "src/logic/http" | ||
import { ref } from "vue" | ||
import { useI18n } from "vue-i18n" | ||
defineProps < { | ||
noImage?: boolean | ||
retry: () => void | ||
} > () | ||
const {t}= useI18n() | ||
const rand = ref(Math.round(Math.random() * 2)) | ||
useIntervalFn(() => { | ||
rand.value = Math.round(Math.random() * 3) | ||
}, 3_000) | ||
const myip = computedAsync<{ | ||
ip: string | ||
country: string | ||
cc: string | ||
} | null>(() => { | ||
return fetch("https://api.myip.com/").then(res => { | ||
defineProps<{ | ||
noImage?: boolean | ||
retry: () => void | ||
}>() | ||
const { t } = useI18n() | ||
const rand = ref(Math.round(Math.random() * 2)) | ||
useIntervalFn(() => { | ||
rand.value = Math.round(Math.random() * 3) | ||
}, 3_000) | ||
const myip = computedAsync<{ | ||
ip: string | ||
country: string | ||
cc: string | ||
} | null>(() => { | ||
return fetch("https://api.myip.com/") | ||
.then((res) => { | ||
if (res.ok) return res.json() | ||
return null | ||
}) | ||
.catch(() => { | ||
return get({ | ||
url: "https://api.myip.com/", | ||
responseType: "json", | ||
}).then(res=>res.data) | ||
}).then((res) => JSON.parse(res.data)) | ||
}) | ||
}, null) | ||
}, null) | ||
</script> | ||
|
||
<style> | ||
</style> | ||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
<template> | ||
<div> | ||
<img v-if="!noImage" src="~assets/ic_22_cry.png" width="240" class="mx-auto" /> | ||
<img | ||
v-if="!noImage" | ||
src="~assets/ic_22_cry.png" | ||
width="240" | ||
class="mx-auto" | ||
/> | ||
<div style="font-size: 30vh">Error</div> | ||
|
||
<div class="text-h2" style="opacity: 0.4">{{ t("da-xay-ra-loi") }}</div> | ||
|
||
<q-btn no-caps outline rounded @click="retry" style="color: #00be06">{{ t("thu-lai") }}</q-btn> | ||
<q-btn no-caps outline rounded @click="retry" style="color: #00be06">{{ | ||
t("thu-lai") | ||
}}</q-btn> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
defineProps < { | ||
import { useI18n } from "vue-i18n" | ||
defineProps<{ | ||
noImage?: boolean | ||
retry: () => void | ||
}>() | ||
noImage ? : boolean | ||
retry: () => void | ||
} > () | ||
import { | ||
useI18n | ||
} from "vue-i18n" | ||
const t = useI18n() | ||
const { t } = useI18n() | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
</style> | ||
<style lang="scss" scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.