Skip to content

Commit ef6dbe1

Browse files
committedJul 14, 2023
feat: show ip address
1 parent 84c6990 commit ef6dbe1

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed
 

‎components/AppFooter.vue

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<template>
2+
<div class="w-100 inset-x-0 mx-auto p-2 text-center fixed bottom-10">
3+
<p class="text-gray-400 text-sm">
4+
Current IP: {{ data?.ip }} ({{ data?.province }} {{ data?.city }} {{ data?.distinct }} {{ data?.isp }})
5+
</p>
6+
</div>
7+
</template>
8+
9+
<script setup lang="ts">
10+
import type { LocationInfo } from '@/types'
11+
12+
const { data } = useFetch<LocationInfo>('https://forge.speedtest.cn/api/location/info')
13+
</script>

‎pages/index.vue

+1
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,6 @@ function onDeleteKey(row: KeyData) {
147147
</template>
148148
</ClientOnly>
149149
</section>
150+
<AppFooter />
150151
</div>
151152
</template>

‎types/index.ts

+8
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,12 @@ export type KeyData = {
77
expiryDate: string
88
hasGPT4: boolean
99
hasPayment: boolean
10+
}
11+
12+
export type LocationInfo = {
13+
ip: string
14+
province: string
15+
city: string
16+
distinct: string
17+
isp: string
1018
}

0 commit comments

Comments
 (0)
Please sign in to comment.