mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-13 17:36:54 -04:00
parent
08d977b8cd
commit
76425c94b7
10 changed files with 6572 additions and 8118 deletions
12
src/tools/my-ip/index.ts
Normal file
12
src/tools/my-ip/index.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { World } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'My IP Address',
|
||||
path: '/my-ip',
|
||||
description: 'Get your client IP Address (IPv4/6) using https://getjsonip.com/',
|
||||
keywords: ['my', 'client', 'ip'],
|
||||
component: () => import('./my-ip.vue'),
|
||||
icon: World,
|
||||
createdAt: new Date('2025-01-01'),
|
||||
});
|
40
src/tools/my-ip/my-ip.vue
Normal file
40
src/tools/my-ip/my-ip.vue
Normal file
|
@ -0,0 +1,40 @@
|
|||
<script setup lang="ts">
|
||||
import { computedRefreshableAsync } from '@/composable/computedRefreshable';
|
||||
import { useCopy } from '@/composable/copy';
|
||||
|
||||
const [clientIP, refreshClientIP] = computedRefreshableAsync(async () => {
|
||||
try {
|
||||
return (await (await fetch('https://jsonip.com', { mode: 'cors' })).json()).ip?.toString();
|
||||
}
|
||||
catch (e: any) {
|
||||
return e.toString();
|
||||
}
|
||||
});
|
||||
|
||||
const { copy } = useCopy({ source: clientIP, text: 'Client IP copied to the clipboard' });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<c-card title="Your IPv4/6 address">
|
||||
<div class="ip">
|
||||
{{ clientIP }}
|
||||
</div>
|
||||
<div flex justify-center gap-3>
|
||||
<c-button @click="copy()">
|
||||
Copy
|
||||
</c-button>
|
||||
<c-button @click="refreshClientIP">
|
||||
Refresh
|
||||
</c-button>
|
||||
</div>
|
||||
</c-card>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.ip {
|
||||
text-align: center;
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
margin: 10px 0 25px;
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue