mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 23:00:19 +03:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
071cd4c366 | ||
|
|
cb5b462e11 | ||
|
|
9eac9cb2a9 | ||
|
|
23f82d956a | ||
|
|
d3b32cc14e |
No files matched your search
@@ -15,7 +15,7 @@ jobs:
|
|||||||
- run: corepack enable
|
- run: corepack enable
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 20
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 20
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Get Playwright version
|
- name: Get Playwright version
|
||||||
|
|||||||
Vendored
+4
@@ -11,6 +11,7 @@ declare module '@vue/runtime-core' {
|
|||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
'404.page': typeof import('./src/pages/404.page.vue')['default']
|
'404.page': typeof import('./src/pages/404.page.vue')['default']
|
||||||
About: typeof import('./src/pages/About.vue')['default']
|
About: typeof import('./src/pages/About.vue')['default']
|
||||||
|
AirCodes: typeof import('./src/tools/air-codes/air-codes.vue')['default']
|
||||||
App: typeof import('./src/App.vue')['default']
|
App: typeof import('./src/App.vue')['default']
|
||||||
AsciiTextDrawer: typeof import('./src/tools/ascii-text-drawer/ascii-text-drawer.vue')['default']
|
AsciiTextDrawer: typeof import('./src/tools/ascii-text-drawer/ascii-text-drawer.vue')['default']
|
||||||
'Base.layout': typeof import('./src/layouts/base.layout.vue')['default']
|
'Base.layout': typeof import('./src/layouts/base.layout.vue')['default']
|
||||||
@@ -138,12 +139,14 @@ declare module '@vue/runtime-core' {
|
|||||||
NH1: typeof import('naive-ui')['NH1']
|
NH1: typeof import('naive-ui')['NH1']
|
||||||
NH3: typeof import('naive-ui')['NH3']
|
NH3: typeof import('naive-ui')['NH3']
|
||||||
NIcon: typeof import('naive-ui')['NIcon']
|
NIcon: typeof import('naive-ui')['NIcon']
|
||||||
|
NInput: typeof import('naive-ui')['NInput']
|
||||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||||
NLabel: typeof import('naive-ui')['NLabel']
|
NLabel: typeof import('naive-ui')['NLabel']
|
||||||
NLayout: typeof import('naive-ui')['NLayout']
|
NLayout: typeof import('naive-ui')['NLayout']
|
||||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||||
NMenu: typeof import('naive-ui')['NMenu']
|
NMenu: typeof import('naive-ui')['NMenu']
|
||||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||||
|
NSpace: typeof import('naive-ui')['NSpace']
|
||||||
NSpin: typeof import('naive-ui')['NSpin']
|
NSpin: typeof import('naive-ui')['NSpin']
|
||||||
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
||||||
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
|
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
|
||||||
@@ -159,6 +162,7 @@ declare module '@vue/runtime-core' {
|
|||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
RsaKeyPairGenerator: typeof import('./src/tools/rsa-key-pair-generator/rsa-key-pair-generator.vue')['default']
|
RsaKeyPairGenerator: typeof import('./src/tools/rsa-key-pair-generator/rsa-key-pair-generator.vue')['default']
|
||||||
|
SafelinkDecoder: typeof import('./src/tools/safelink-decoder/safelink-decoder.vue')['default']
|
||||||
SlugifyString: typeof import('./src/tools/slugify-string/slugify-string.vue')['default']
|
SlugifyString: typeof import('./src/tools/slugify-string/slugify-string.vue')['default']
|
||||||
SpanCopyable: typeof import('./src/components/SpanCopyable.vue')['default']
|
SpanCopyable: typeof import('./src/components/SpanCopyable.vue')['default']
|
||||||
SqlPrettify: typeof import('./src/tools/sql-prettify/sql-prettify.vue')['default']
|
SqlPrettify: typeof import('./src/tools/sql-prettify/sql-prettify.vue')['default']
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
"@vueuse/core": "^10.3.0",
|
"@vueuse/core": "^10.3.0",
|
||||||
"@vueuse/head": "^1.0.0",
|
"@vueuse/head": "^1.0.0",
|
||||||
"@vueuse/router": "^10.0.0",
|
"@vueuse/router": "^10.0.0",
|
||||||
|
"aircodes": "^1.3.16",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"change-case": "^4.1.2",
|
"change-case": "^4.1.2",
|
||||||
"colord": "^2.9.3",
|
"colord": "^2.9.3",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const useWebServer = process.env.NO_WEB_SERVER !== 'true';
|
|||||||
*/
|
*/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
testDir: './src',
|
testDir: './src',
|
||||||
testMatch: /.*\.e2e\.(spec\.)?ts/,
|
testMatch: /\.e2e\.(spec\.)?ts$/,
|
||||||
/* Run tests in files in parallel */
|
/* Run tests in files in parallel */
|
||||||
fullyParallel: true,
|
fullyParallel: true,
|
||||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||||
@@ -57,7 +57,7 @@ export default defineConfig({
|
|||||||
&& {
|
&& {
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run preview',
|
command: 'npm run preview',
|
||||||
url: 'http://127.0.0.1:5050',
|
url: 'http://localhost:5050',
|
||||||
reuseExistingServer: !isCI,
|
reuseExistingServer: !isCI,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+14
-6
@@ -41,6 +41,9 @@ dependencies:
|
|||||||
'@vueuse/router':
|
'@vueuse/router':
|
||||||
specifier: ^10.0.0
|
specifier: ^10.0.0
|
||||||
version: 10.0.0(vue-router@4.1.6)(vue@3.3.4)
|
version: 10.0.0(vue-router@4.1.6)(vue@3.3.4)
|
||||||
|
aircodes:
|
||||||
|
specifier: ^1.3.16
|
||||||
|
version: 1.3.16
|
||||||
bcryptjs:
|
bcryptjs:
|
||||||
specifier: ^2.4.3
|
specifier: ^2.4.3
|
||||||
version: 2.4.3
|
version: 2.4.3
|
||||||
@@ -3351,7 +3354,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@unhead/dom': 0.5.1
|
'@unhead/dom': 0.5.1
|
||||||
'@unhead/schema': 0.5.1
|
'@unhead/schema': 0.5.1
|
||||||
'@vueuse/shared': 10.7.2(vue@3.3.4)
|
'@vueuse/shared': 10.9.0(vue@3.3.4)
|
||||||
unhead: 0.5.1
|
unhead: 0.5.1
|
||||||
vue: 3.3.4
|
vue: 3.3.4
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
@@ -3993,10 +3996,10 @@ packages:
|
|||||||
- vue
|
- vue
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@vueuse/shared@10.7.2(vue@3.3.4):
|
/@vueuse/shared@10.9.0(vue@3.3.4):
|
||||||
resolution: {integrity: sha512-qFbXoxS44pi2FkgFjPvF4h7c9oMDutpyBdcJdMYIMg9XyXli2meFMuaKn+UMgsClo//Th6+beeCgqweT/79BVA==}
|
resolution: {integrity: sha512-Uud2IWncmAfJvRaFYzv5OHDli+FbOzxiVEQdLCKQKLyhz94PIyFC3CHcH7EDMwIn8NPtD06+PNbC/PiO0LGLtw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
vue-demi: 0.14.6(vue@3.3.4)
|
vue-demi: 0.14.7(vue@3.3.4)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@vue/composition-api'
|
- '@vue/composition-api'
|
||||||
- vue
|
- vue
|
||||||
@@ -4051,6 +4054,10 @@ packages:
|
|||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/aircodes@1.3.16:
|
||||||
|
resolution: {integrity: sha512-ysPgP4iifjazWJfnfkywqpJMS+wVGzd9Z1t9oEeMjjbktavlxaJsFgmLl2OLdZru44sefc9/cCRUeeB7xKjxxQ==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/ajv@6.12.6:
|
/ajv@6.12.6:
|
||||||
resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
|
resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -9151,8 +9158,8 @@ packages:
|
|||||||
vue: 3.3.4
|
vue: 3.3.4
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/vue-demi@0.14.6(vue@3.3.4):
|
/vue-demi@0.14.7(vue@3.3.4):
|
||||||
resolution: {integrity: sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==}
|
resolution: {integrity: sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
@@ -9442,6 +9449,7 @@ packages:
|
|||||||
|
|
||||||
/workbox-google-analytics@7.0.0:
|
/workbox-google-analytics@7.0.0:
|
||||||
resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==}
|
resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==}
|
||||||
|
deprecated: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained
|
||||||
dependencies:
|
dependencies:
|
||||||
workbox-background-sync: 7.0.0
|
workbox-background-sync: 7.0.0
|
||||||
workbox-core: 7.0.0
|
workbox-core: 7.0.0
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { findAirline, findAirport } from 'aircodes';
|
||||||
|
import SpanCopyable from '@/components/SpanCopyable.vue';
|
||||||
|
|
||||||
|
const airlineQuery = ref('');
|
||||||
|
const airportQuery = ref('');
|
||||||
|
const resultAirline = computed(() => airlineQuery.value === '' ? [] : findAirline(airlineQuery.value));
|
||||||
|
const resultAirport = computed(() => airportQuery.value === '' ? [] : findAirport(airportQuery.value));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<c-card title="Airline search" mb-1>
|
||||||
|
<n-space>
|
||||||
|
<n-form-item label="Airline query">
|
||||||
|
<n-input v-model:value="airlineQuery" />
|
||||||
|
</n-form-item>
|
||||||
|
</n-space>
|
||||||
|
|
||||||
|
<n-divider />
|
||||||
|
|
||||||
|
<div v-for="airline in resultAirline" :key="airline.iata">
|
||||||
|
<n-form-item label="IATA">
|
||||||
|
<SpanCopyable :value="airline.iata" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="ICAO">
|
||||||
|
<SpanCopyable :value="airline.icao" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="Name">
|
||||||
|
<SpanCopyable :value="airline.name" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="Logo">
|
||||||
|
<img width="100" :alt="airline.name" :src="airline.logo">
|
||||||
|
</n-form-item>
|
||||||
|
</div>
|
||||||
|
</c-card>
|
||||||
|
|
||||||
|
<c-card title="Airport search">
|
||||||
|
<n-space>
|
||||||
|
<n-form-item label="Airport query">
|
||||||
|
<n-input v-model:value="airportQuery" />
|
||||||
|
</n-form-item>
|
||||||
|
</n-space>
|
||||||
|
|
||||||
|
<n-divider />
|
||||||
|
|
||||||
|
<div v-for="airport in resultAirport" :key="airport.iata">
|
||||||
|
<n-form-item label="IATA">
|
||||||
|
<SpanCopyable :value="airport.iata" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="ICAO">
|
||||||
|
<SpanCopyable :value="airport.icao" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="Name">
|
||||||
|
<SpanCopyable :value="airport.name" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="City">
|
||||||
|
<SpanCopyable :value="airport.city" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="State">
|
||||||
|
<SpanCopyable :value="airport.state" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="Country">
|
||||||
|
<SpanCopyable :value="airport.country" />
|
||||||
|
</n-form-item>
|
||||||
|
</div>
|
||||||
|
</c-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { Plane } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'Air Codes',
|
||||||
|
path: '/air-codes',
|
||||||
|
description: 'Get Airport and Airline info from name, ICAO code or IATA code',
|
||||||
|
keywords: ['airport', 'airline', 'air', 'plane', 'icao', 'iata'],
|
||||||
|
component: () => import('./air-codes.vue'),
|
||||||
|
icon: Plane,
|
||||||
|
createdAt: new Date('2024-04-20'),
|
||||||
|
});
|
||||||
@@ -28,7 +28,7 @@ const compareMatch = computed(() => compareSync(compareString.value, compareHash
|
|||||||
mb-2
|
mb-2
|
||||||
/>
|
/>
|
||||||
<n-form-item label="Salt count: " label-placement="left" label-width="120">
|
<n-form-item label="Salt count: " label-placement="left" label-width="120">
|
||||||
<n-input-number v-model:value="saltCount" placeholder="Salt rounds..." :max="10" :min="0" w-full />
|
<n-input-number v-model:value="saltCount" placeholder="Salt rounds..." :max="100" :min="0" w-full />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
||||||
<c-input-text :value="hashed" readonly text-center />
|
<c-input-text :value="hashed" readonly text-center />
|
||||||
|
|||||||
+8
-2
@@ -5,7 +5,7 @@ import { tool as basicAuthGenerator } from './basic-auth-generator';
|
|||||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||||
|
|
||||||
import { tool as textToUnicode } from './text-to-unicode';
|
import { tool as textToUnicode } from './text-to-unicode';
|
||||||
|
import { tool as safelinkDecoder } from './safelink-decoder';
|
||||||
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
||||||
import { tool as numeronymGenerator } from './numeronym-generator';
|
import { tool as numeronymGenerator } from './numeronym-generator';
|
||||||
import { tool as macAddressGenerator } from './mac-address-generator';
|
import { tool as macAddressGenerator } from './mac-address-generator';
|
||||||
@@ -14,6 +14,7 @@ import { tool as ulidGenerator } from './ulid-generator';
|
|||||||
import { tool as ibanValidatorAndParser } from './iban-validator-and-parser';
|
import { tool as ibanValidatorAndParser } from './iban-validator-and-parser';
|
||||||
import { tool as stringObfuscator } from './string-obfuscator';
|
import { tool as stringObfuscator } from './string-obfuscator';
|
||||||
import { tool as textDiff } from './text-diff';
|
import { tool as textDiff } from './text-diff';
|
||||||
|
import { tool as airCodes } from './air-codes';
|
||||||
import { tool as emojiPicker } from './emoji-picker';
|
import { tool as emojiPicker } from './emoji-picker';
|
||||||
import { tool as passwordStrengthAnalyser } from './password-strength-analyser';
|
import { tool as passwordStrengthAnalyser } from './password-strength-analyser';
|
||||||
import { tool as yamlToToml } from './yaml-to-toml';
|
import { tool as yamlToToml } from './yaml-to-toml';
|
||||||
@@ -127,6 +128,7 @@ export const toolsByCategory: ToolCategory[] = [
|
|||||||
userAgentParser,
|
userAgentParser,
|
||||||
httpStatusCodes,
|
httpStatusCodes,
|
||||||
jsonDiff,
|
jsonDiff,
|
||||||
|
safelinkDecoder,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -175,7 +177,11 @@ export const toolsByCategory: ToolCategory[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Data',
|
name: 'Data',
|
||||||
components: [phoneParserAndFormatter, ibanValidatorAndParser],
|
components: [
|
||||||
|
phoneParserAndFormatter,
|
||||||
|
ibanValidatorAndParser,
|
||||||
|
airCodes,
|
||||||
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ describe('integer-base-converter', () => {
|
|||||||
expect(convertBase({ value: '10100101', fromBase: 2, toBase: 16 })).toEqual('a5');
|
expect(convertBase({ value: '10100101', fromBase: 2, toBase: 16 })).toEqual('a5');
|
||||||
expect(convertBase({ value: '192654', fromBase: 10, toBase: 8 })).toEqual('570216');
|
expect(convertBase({ value: '192654', fromBase: 10, toBase: 8 })).toEqual('570216');
|
||||||
expect(convertBase({ value: 'zz', fromBase: 64, toBase: 10 })).toEqual('2275');
|
expect(convertBase({ value: 'zz', fromBase: 64, toBase: 10 })).toEqual('2275');
|
||||||
|
expect(convertBase({ value: '42540766411283223938465490632011909384', fromBase: 10, toBase: 10 })).toEqual('42540766411283223938465490632011909384');
|
||||||
|
expect(convertBase({ value: '42540766411283223938465490632011909384', fromBase: 10, toBase: 16 })).toEqual('20010db8000085a300000000ac1f8908');
|
||||||
|
expect(convertBase({ value: '20010db8000085a300000000ac1f8908', fromBase: 16, toBase: 10 })).toEqual('42540766411283223938465490632011909384');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ export function convertBase({ value, fromBase, toBase }: { value: string; fromBa
|
|||||||
let decValue = value
|
let decValue = value
|
||||||
.split('')
|
.split('')
|
||||||
.reverse()
|
.reverse()
|
||||||
.reduce((carry: number, digit: string, index: number) => {
|
.reduce((carry: bigint, digit: string, index: number) => {
|
||||||
if (!fromRange.includes(digit)) {
|
if (!fromRange.includes(digit)) {
|
||||||
throw new Error(`Invalid digit "${digit}" for base ${fromBase}.`);
|
throw new Error(`Invalid digit "${digit}" for base ${fromBase}.`);
|
||||||
}
|
}
|
||||||
return (carry += fromRange.indexOf(digit) * fromBase ** index);
|
return (carry += BigInt(fromRange.indexOf(digit)) * BigInt(fromBase) ** BigInt(index));
|
||||||
}, 0);
|
}, 0n);
|
||||||
let newValue = '';
|
let newValue = '';
|
||||||
while (decValue > 0) {
|
while (decValue > 0) {
|
||||||
newValue = toRange[decValue % toBase] + newValue;
|
newValue = toRange[Number(decValue % BigInt(toBase))] + newValue;
|
||||||
decValue = (decValue - (decValue % toBase)) / toBase;
|
decValue = (decValue - (decValue % BigInt(toBase))) / BigInt(toBase);
|
||||||
}
|
}
|
||||||
return newValue || '0';
|
return newValue || '0';
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { Mailbox } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'Outlook Safelink decoder',
|
||||||
|
path: '/safelink-decoder',
|
||||||
|
description: 'Decode Outlook SafeLink links',
|
||||||
|
keywords: ['outlook', 'safelink', 'decoder'],
|
||||||
|
component: () => import('./safelink-decoder.vue'),
|
||||||
|
icon: Mailbox,
|
||||||
|
createdAt: new Date('2024-03-11'),
|
||||||
|
});
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { decodeSafeLinksURL } from './safelink-decoder.service';
|
||||||
|
|
||||||
|
describe('safelink-decoder', () => {
|
||||||
|
describe('decodeSafeLinksURL', () => {
|
||||||
|
describe('decode outlook safelink urls', () => {
|
||||||
|
it('should decode basic safelink urls', () => {
|
||||||
|
expect(decodeSafeLinksURL('https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dsafelink%26rlz%3D1&data=05%7C02%7C%7C1ed07253975b46da1d1508dc3443752a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638442711583216725%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=%2BQY0HBnnxfI7pzZoxzlhZdDvYu80LwQB0zUUjrffVnk%3D&reserved=0'))
|
||||||
|
.toBe('https://www.google.com/search?q=safelink&rlz=1');
|
||||||
|
});
|
||||||
|
it('should decode encoded safelink urls', () => {
|
||||||
|
expect(decodeSafeLinksURL('https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dsafelink%26rlz%3D1&data=05%7C02%7C%7C1ed07253975b46da1d1508dc3443752a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638442711583216725%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=%2BQY0HBnnxfI7pzZoxzlhZdDvYu80LwQB0zUUjrffVnk%3D&reserved=0'))
|
||||||
|
.toBe('https://www.google.com/search?q=safelink&rlz=1');
|
||||||
|
});
|
||||||
|
it('throw on not outlook safelink urls', () => {
|
||||||
|
expect(() => decodeSafeLinksURL('https://google.com'))
|
||||||
|
.toThrow('Invalid SafeLinks URL provided');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
export function decodeSafeLinksURL(safeLinksUrl: string) {
|
||||||
|
if (!safeLinksUrl.match(/\.safelinks\.protection\.outlook\.com/)) {
|
||||||
|
throw new Error('Invalid SafeLinks URL provided');
|
||||||
|
}
|
||||||
|
|
||||||
|
return new URL(safeLinksUrl).searchParams.get('url');
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { decodeSafeLinksURL } from './safelink-decoder.service';
|
||||||
|
import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
||||||
|
|
||||||
|
const inputSafeLinkUrl = ref('');
|
||||||
|
const outputDecodedUrl = computed(() => {
|
||||||
|
try {
|
||||||
|
return decodeSafeLinksURL(inputSafeLinkUrl.value);
|
||||||
|
}
|
||||||
|
catch (e: any) {
|
||||||
|
return e.toString();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="inputSafeLinkUrl"
|
||||||
|
raw-text
|
||||||
|
placeholder="Your input Outlook SafeLink Url..."
|
||||||
|
autofocus
|
||||||
|
label="Your input Outlook SafeLink Url:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<n-divider />
|
||||||
|
|
||||||
|
<n-form-item label="Output decoded URL:">
|
||||||
|
<TextareaCopyable :value="outputDecodedUrl" :word-wrap="true" />
|
||||||
|
</n-form-item>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -23,7 +23,7 @@ const decodeInput = ref('Hello%20world%20%3A)');
|
|||||||
const decodeOutput = computed(() => withDefaultOnError(() => decodeURIComponent(decodeInput.value), ''));
|
const decodeOutput = computed(() => withDefaultOnError(() => decodeURIComponent(decodeInput.value), ''));
|
||||||
|
|
||||||
const decodeValidation = useValidation({
|
const decodeValidation = useValidation({
|
||||||
source: encodeInput,
|
source: decodeInput,
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
validator: value => isNotThrowing(() => decodeURIComponent(value)),
|
validator: value => isNotThrowing(() => decodeURIComponent(value)),
|
||||||
|
|||||||
Reference in new issue
Block a user