Skip to content

Commit 8519694

Browse files
committed
Merge branch 'feat/url-cleaner' into chore/all-my-stuffs
# Conflicts: # package.json # pnpm-lock.yaml # src/tools/index.ts
2 parents 7b487a6 + 3f7151b commit 8519694

File tree

5 files changed

+67
-1
lines changed

5 files changed

+67
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@
296296
"svg-to-url": "^4.0.0",
297297
"tesseract.js": "^5.0.4",
298298
"sshpk": "^1.18.0",
299+
"tidy-url": "^1.15.1",
299300
"ua-parser-js": "^1.0.35",
300301
"ulid": "^2.3.0",
301302
"unicode-emoji-json": "^0.4.0",

pnpm-lock.yaml

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ import { tool as pgpEncryption } from './pgp-encryption';
132132
import { tool as pgpKeygen } from './pgp-keygen';
133133
import { tool as portNumbers } from './port-numbers';
134134
import { tool as rsaEncryption } from './rsa-encryption';
135+
import { tool as urlCleaner } from './url-cleaner';
135136
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
136137
import { tool as numeronymGenerator } from './numeronym-generator';
137138
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -336,6 +337,7 @@ export const toolsByCategory: ToolCategory[] = [
336337
urlEncoder,
337338
htmlEntities,
338339
urlParser,
340+
urlCleaner,
339341
deviceInformation,
340342
basicAuthGenerator,
341343
htpasswdGenerator,

src/tools/url-cleaner/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { ClearAll } from '@vicons/tabler';
2+
import { defineTool } from '../tool';
3+
4+
export const tool = defineTool({
5+
name: 'Url Cleaner',
6+
path: '/url-cleaner',
7+
description: 'Clean Ads tracker, UTM, Facebook and other ads provider parameters from an URL',
8+
keywords: ['url', 'cleaner', 'utm', 'fbclip'],
9+
component: () => import('./url-cleaner.vue'),
10+
icon: ClearAll,
11+
createdAt: new Date('2024-03-13'),
12+
});

src/tools/url-cleaner/url-cleaner.vue

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<script setup lang="ts">
2+
import { TidyURL } from 'tidy-url';
3+
import { Check as CheckIcon, LetterX as CrossIcon } from '@vicons/tabler';
4+
import TextareaCopyable from '@/components/TextareaCopyable.vue';
5+
import { withDefaultOnError } from '@/utils/defaults';
6+
7+
const inputUrl = ref('');
8+
const cleanedUrl = computed(() => withDefaultOnError(() => TidyURL.clean(inputUrl.value), undefined));
9+
const isClean = computed(() => withDefaultOnError(() => TidyURL.clean(inputUrl.value)?.url === inputUrl.value, false));
10+
</script>
11+
12+
<template>
13+
<c-card title="Clean url">
14+
<c-input-text
15+
v-model:value="inputUrl"
16+
placeholder="Put your url here..."
17+
label="Url to clean"
18+
/>
19+
20+
<n-divider />
21+
22+
<div v-if="inputUrl">
23+
<n-p v-if="isClean" text-center>
24+
<n-icon color="green">
25+
<CheckIcon />
26+
</n-icon>
27+
Is clean
28+
</n-p>
29+
<n-p v-if="!isClean" text-center>
30+
<n-icon color="red">
31+
<CrossIcon />
32+
</n-icon>
33+
Was not clean
34+
</n-p>
35+
<TextareaCopyable
36+
label="Cleaned url"
37+
:value="cleanedUrl?.url || ''"
38+
placeholder="The cleaned url will be here"
39+
mb-5
40+
mt-5
41+
/>
42+
</div>
43+
</c-card>
44+
</template>

0 commit comments

Comments
 (0)