mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-23 14:21:04 +03:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46e2648ea5 |
No files matched your search
@@ -286,6 +286,9 @@
|
||||
"watchTriggerable": true,
|
||||
"watchWithFilter": true,
|
||||
"whenever": true,
|
||||
"toValue": true
|
||||
"toValue": true,
|
||||
"injectLocal": true,
|
||||
"provideLocal": true,
|
||||
"useClipboardItems": true
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -36,6 +36,7 @@ declare global {
|
||||
const h: typeof import('vue')['h']
|
||||
const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
|
||||
const inject: typeof import('vue')['inject']
|
||||
const injectLocal: typeof import('@vueuse/core')['injectLocal']
|
||||
const isDefined: typeof import('@vueuse/core')['isDefined']
|
||||
const isProxy: typeof import('vue')['isProxy']
|
||||
const isReactive: typeof import('vue')['isReactive']
|
||||
@@ -65,6 +66,7 @@ declare global {
|
||||
const onUpdated: typeof import('vue')['onUpdated']
|
||||
const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
|
||||
const provide: typeof import('vue')['provide']
|
||||
const provideLocal: typeof import('@vueuse/core')['provideLocal']
|
||||
const reactify: typeof import('@vueuse/core')['reactify']
|
||||
const reactifyObject: typeof import('@vueuse/core')['reactifyObject']
|
||||
const reactive: typeof import('vue')['reactive']
|
||||
@@ -128,6 +130,7 @@ declare global {
|
||||
const useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation']
|
||||
const useCached: typeof import('@vueuse/core')['useCached']
|
||||
const useClipboard: typeof import('@vueuse/core')['useClipboard']
|
||||
const useClipboardItems: typeof import('@vueuse/core')['useClipboardItems']
|
||||
const useCloned: typeof import('@vueuse/core')['useCloned']
|
||||
const useColorMode: typeof import('@vueuse/core')['useColorMode']
|
||||
const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']
|
||||
@@ -326,6 +329,7 @@ declare module 'vue' {
|
||||
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
|
||||
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||
readonly injectLocal: UnwrapRef<typeof import('@vueuse/core')['injectLocal']>
|
||||
readonly isDefined: UnwrapRef<typeof import('@vueuse/core')['isDefined']>
|
||||
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||
@@ -355,6 +359,7 @@ declare module 'vue' {
|
||||
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
|
||||
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||
readonly provideLocal: UnwrapRef<typeof import('@vueuse/core')['provideLocal']>
|
||||
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
|
||||
readonly reactifyObject: UnwrapRef<typeof import('@vueuse/core')['reactifyObject']>
|
||||
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||
@@ -418,6 +423,7 @@ declare module 'vue' {
|
||||
readonly useBrowserLocation: UnwrapRef<typeof import('@vueuse/core')['useBrowserLocation']>
|
||||
readonly useCached: UnwrapRef<typeof import('@vueuse/core')['useCached']>
|
||||
readonly useClipboard: UnwrapRef<typeof import('@vueuse/core')['useClipboard']>
|
||||
readonly useClipboardItems: UnwrapRef<typeof import('@vueuse/core')['useClipboardItems']>
|
||||
readonly useCloned: UnwrapRef<typeof import('@vueuse/core')['useCloned']>
|
||||
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
|
||||
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
|
||||
@@ -610,6 +616,7 @@ declare module '@vue/runtime-core' {
|
||||
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
|
||||
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||
readonly injectLocal: UnwrapRef<typeof import('@vueuse/core')['injectLocal']>
|
||||
readonly isDefined: UnwrapRef<typeof import('@vueuse/core')['isDefined']>
|
||||
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||
@@ -639,6 +646,7 @@ declare module '@vue/runtime-core' {
|
||||
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
|
||||
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||
readonly provideLocal: UnwrapRef<typeof import('@vueuse/core')['provideLocal']>
|
||||
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
|
||||
readonly reactifyObject: UnwrapRef<typeof import('@vueuse/core')['reactifyObject']>
|
||||
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||
@@ -702,6 +710,7 @@ declare module '@vue/runtime-core' {
|
||||
readonly useBrowserLocation: UnwrapRef<typeof import('@vueuse/core')['useBrowserLocation']>
|
||||
readonly useCached: UnwrapRef<typeof import('@vueuse/core')['useCached']>
|
||||
readonly useClipboard: UnwrapRef<typeof import('@vueuse/core')['useClipboard']>
|
||||
readonly useClipboardItems: UnwrapRef<typeof import('@vueuse/core')['useClipboardItems']>
|
||||
readonly useCloned: UnwrapRef<typeof import('@vueuse/core')['useCloned']>
|
||||
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
|
||||
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
|
||||
|
||||
Vendored
+6
-3
@@ -37,7 +37,6 @@ declare module '@vue/runtime-core' {
|
||||
'CFileUpload.demo': typeof import('./src/ui/c-file-upload/c-file-upload.demo.vue')['default']
|
||||
ChmodCalculator: typeof import('./src/tools/chmod-calculator/chmod-calculator.vue')['default']
|
||||
Chronometer: typeof import('./src/tools/chronometer/chronometer.vue')['default']
|
||||
CidrInCidr: typeof import('./src/tools/cidr-in-cidr/cidr-in-cidr.vue')['default']
|
||||
CInputText: typeof import('./src/ui/c-input-text/c-input-text.vue')['default']
|
||||
'CInputText.demo': typeof import('./src/ui/c-input-text/c-input-text.demo.vue')['default']
|
||||
CKeyValueList: typeof import('./src/ui/c-key-value-list/c-key-value-list.vue')['default']
|
||||
@@ -104,7 +103,6 @@ declare module '@vue/runtime-core' {
|
||||
IconMdiTriangleDown: typeof import('~icons/mdi/triangle-down')['default']
|
||||
InputCopyable: typeof import('./src/components/InputCopyable.vue')['default']
|
||||
IntegerBaseConverter: typeof import('./src/tools/integer-base-converter/integer-base-converter.vue')['default']
|
||||
IpInRange: typeof import('./src/tools/cidr-in-cidr/cidr-in-cidr.vue')['default']
|
||||
Ipv4AddressConverter: typeof import('./src/tools/ipv4-address-converter/ipv4-address-converter.vue')['default']
|
||||
Ipv4RangeExpander: typeof import('./src/tools/ipv4-range-expander/ipv4-range-expander.vue')['default']
|
||||
Ipv4SubnetCalculator: typeof import('./src/tools/ipv4-subnet-calculator/ipv4-subnet-calculator.vue')['default']
|
||||
@@ -132,16 +130,21 @@ declare module '@vue/runtime-core' {
|
||||
MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default']
|
||||
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
|
||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
NCode: typeof import('naive-ui')['NCode']
|
||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||
NH1: typeof import('naive-ui')['NH1']
|
||||
NH3: typeof import('naive-ui')['NH3']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NLayout: typeof import('naive-ui')['NLayout']
|
||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NTable: typeof import('naive-ui')['NTable']
|
||||
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']
|
||||
@@ -161,7 +164,7 @@ declare module '@vue/runtime-core' {
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
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']
|
||||
SafelinkDecoder: typeof import('./src/tools/safelink-decoder/safelink-decoder.vue')['default']
|
||||
SharepointDecoder: typeof import('./src/tools/sharepoint-decoder/sharepoint-decoder.vue')['default']
|
||||
SlugifyString: typeof import('./src/tools/slugify-string/slugify-string.vue')['default']
|
||||
SpanCopyable: typeof import('./src/components/SpanCopyable.vue')['default']
|
||||
SqlPrettify: typeof import('./src/tools/sql-prettify/sql-prettify.vue')['default']
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
"highlight.js": "^11.7.0",
|
||||
"iarna-toml-esm": "^3.0.5",
|
||||
"ibantools": "^4.3.3",
|
||||
"ip-matching": "^2.1.2",
|
||||
"js-base64": "^3.7.6",
|
||||
"json5": "^2.2.3",
|
||||
"jwt-decode": "^3.1.2",
|
||||
|
||||
Generated
+2507
-2561
File diff suppressed because it is too large.
Load diff
@@ -128,7 +128,7 @@ function activateOption(option: PaletteOption) {
|
||||
<c-input-text ref="inputRef" v-model:value="searchPrompt" raw-text placeholder="Type to search a tool or a command..." autofocus clearable />
|
||||
|
||||
<div v-for="(options, category) in filteredSearchResult" :key="category">
|
||||
<div ml-3 mt-3 text-sm font-bold text-primary op-60>
|
||||
<div ml-3 mt-3 text-sm text-primary font-bold op-60>
|
||||
{{ category }}
|
||||
</div>
|
||||
<command-palette-option v-for="option in options" :key="option.name" :option="option" :selected="selectedOptionIndex === getOptionIndex(option)" @activated="activateOption" />
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { cidrInCidr } from './cidr-in-cidr.service';
|
||||
|
||||
describe('cidr-in-cidr', () => {
|
||||
describe('cidrInCidr', () => {
|
||||
it('should return correct inclusion', () => {
|
||||
expect(cidrInCidr({ baseRange: '192.168.0.0/16', ipOrRangeToTest: '192.168.0.1' }).isIncluded).toBe(true); // NOSONAR
|
||||
expect(cidrInCidr({ baseRange: '192.168.1.0/24', ipOrRangeToTest: '192.168.0.10' }).isIncluded).toBe(false); // NOSONAR
|
||||
expect(cidrInCidr({ baseRange: '192.168.1.*', ipOrRangeToTest: '192.168.0.10' }).isIncluded).toBe(false); // NOSONAR
|
||||
|
||||
expect(cidrInCidr({ baseRange: '192.168.0.0/24', ipOrRangeToTest: '192.168.0.0/28' }).isIncluded).toBe(true); // NOSONAR
|
||||
expect(cidrInCidr({ baseRange: '192.168.20.0/24', ipOrRangeToTest: '192.168.1.0/28' }).isIncluded).toBe(false); // NOSONAR
|
||||
expect(cidrInCidr({ baseRange: '192.168.20.*', ipOrRangeToTest: '192.168.1.0/28' }).isIncluded).toBe(false); // NOSONAR
|
||||
expect(cidrInCidr({ baseRange: '192.168.0.*', ipOrRangeToTest: '192.168.0.0/28' }).isIncluded).toBe(true); // NOSONAR
|
||||
|
||||
expect(cidrInCidr({ baseRange: '192.168.20.1-192.168.20.15', ipOrRangeToTest: '192.168.20.12' }).isIncluded).toBe(true); // NOSONAR
|
||||
expect(cidrInCidr({ baseRange: '192.168.20.1-192.168.20.15', ipOrRangeToTest: '192.168.20.20' }).isIncluded).toBe(false); // NOSONAR
|
||||
|
||||
expect(cidrInCidr({ baseRange: '192.168.20.1-192.168.20.15', ipOrRangeToTest: '192.168.20.9-192.168.20.12' }).isIncluded).toBe(true); // NOSONAR
|
||||
expect(cidrInCidr({ baseRange: '192.168.20.1-192.168.20.15', ipOrRangeToTest: '192.168.20.9-192.168.20.20' }).isIncluded).toBe(false); // NOSONAR
|
||||
|
||||
expect(cidrInCidr({ baseRange: '192.168.20.0-192.168.20.255', ipOrRangeToTest: '192.168.20.0/28' }).isIncluded).toBe(true); // NOSONAR
|
||||
expect(cidrInCidr({ baseRange: '192.168.20.0-192.168.20.255', ipOrRangeToTest: '192.168.1.0/28' }).isIncluded).toBe(false); // NOSONAR
|
||||
expect(cidrInCidr({ baseRange: '192.168.0.0-192.168.1.255', ipOrRangeToTest: '192.168.1.0/28' }).isIncluded).toBe(true); // NOSONAR
|
||||
});
|
||||
it('should return correct subnet', () => {
|
||||
expect(cidrInCidr({ baseRange: '192.168.0.0/16', ipOrRangeToTest: '192.168.0.1' }).baseSubnets).to.deep.eq([ // NOSONAR
|
||||
{
|
||||
cidr: '192.168.0.0/16', // NOSONAR
|
||||
end: '192.168.255.255', // NOSONAR
|
||||
start: '192.168.0.0', // NOSONAR
|
||||
},
|
||||
]);
|
||||
expect(cidrInCidr({ baseRange: '192.168.20.1-192.168.20.3', ipOrRangeToTest: '192.168.1.0/28' }).baseSubnets).to.deep.eq([ // NOSONAR
|
||||
{
|
||||
cidr: '192.168.20.1/32', // NOSONAR
|
||||
end: '192.168.20.1', // NOSONAR
|
||||
start: '192.168.20.1', // NOSONAR
|
||||
},
|
||||
{
|
||||
cidr: '192.168.20.2/31', // NOSONAR
|
||||
end: '192.168.20.3', // NOSONAR
|
||||
start: '192.168.20.2', // NOSONAR
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,28 +0,0 @@
|
||||
import { getMatch } from 'ip-matching';
|
||||
|
||||
export function cidrInCidr(
|
||||
{ baseRange, ipOrRangeToTest }:
|
||||
{
|
||||
baseRange: string
|
||||
ipOrRangeToTest: string
|
||||
}) {
|
||||
const baseMatchMasks = getMatch(baseRange)?.convertToMasks() || [];
|
||||
const ipOrRangeToTestMatchMasks = getMatch(ipOrRangeToTest)?.convertToMasks() || [];
|
||||
|
||||
const baseSubnets = baseMatchMasks.map((mask) => {
|
||||
const subnet = mask.convertToSubnet();
|
||||
if (!subnet) {
|
||||
return { cidr: '', start: '', end: '' };
|
||||
}
|
||||
return {
|
||||
cidr: subnet.toString(),
|
||||
start: subnet.getFirst().toString(),
|
||||
end: subnet.getLast().toString(),
|
||||
};
|
||||
}).filter(subnet => subnet.cidr !== '');
|
||||
|
||||
return {
|
||||
baseSubnets,
|
||||
isIncluded: baseMatchMasks.some(baseMask => ipOrRangeToTestMatchMasks.every(ipOrRangeMask => ipOrRangeMask.isSubsetOf(baseMask))),
|
||||
};
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { useStorage } from '@vueuse/core';
|
||||
import { Check as CheckIcon, LetterX as CrossIcon } from '@vicons/tabler';
|
||||
import { getMatch } from 'ip-matching';
|
||||
import { cidrInCidr } from './cidr-in-cidr.service';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
import { isNotThrowing } from '@/utils/boolean';
|
||||
import SpanCopyable from '@/components/SpanCopyable.vue';
|
||||
|
||||
const baseRange = useStorage('cidr-in-cidr:range', '192.168.0.1/24'); // NOSONAR
|
||||
const ipOrRangeToTest = useStorage('cidr-in-cidr:ip', '192.168.0.1'); // NOSONAR
|
||||
|
||||
const matchResult = computed(() => withDefaultOnError(
|
||||
() => cidrInCidr({ baseRange: baseRange.value, ipOrRangeToTest: ipOrRangeToTest.value }),
|
||||
{ baseSubnets: [], isIncluded: false }));
|
||||
|
||||
const rangeValidationRules = [
|
||||
{
|
||||
message: 'We cannot parse this CIDR/IP Range/Mask/Wildcard, check the format',
|
||||
validator: (value: string) => isNotThrowing(() => getMatch(value)) && getMatch(value),
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text
|
||||
v-model:value="baseRange"
|
||||
label="An IPv4/6 CIDR/Range/Mask/Wildcard (base network)"
|
||||
placeholder="The ipv4/6 CIDR..."
|
||||
:validation-rules="rangeValidationRules"
|
||||
mb-4
|
||||
/>
|
||||
|
||||
<c-input-text
|
||||
v-model:value="ipOrRangeToTest"
|
||||
label="An IPv4/6 CIDR/Range/Mask/Wildcard (to test for inclusion)"
|
||||
placeholder="The An IPv4/6 CIDR/Range/Mask/Wildcard..."
|
||||
:validation-rules="rangeValidationRules"
|
||||
mb-4
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<div flex justify-center>
|
||||
<span v-if="matchResult.isIncluded">
|
||||
<n-icon color="green">
|
||||
<CheckIcon />
|
||||
</n-icon>
|
||||
Included
|
||||
</span>
|
||||
<span v-else>
|
||||
<n-icon color="red">
|
||||
<CrossIcon />
|
||||
</n-icon>
|
||||
Not included
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<c-card title="Subnets">
|
||||
<n-table>
|
||||
<tbody>
|
||||
<tr v-for="{ cidr, start, end } in matchResult.baseSubnets" :key="cidr">
|
||||
<td font-bold>
|
||||
<SpanCopyable :value="cidr" />
|
||||
</td>
|
||||
<td>
|
||||
<SpanCopyable :value="start" />
|
||||
</td>
|
||||
<td>
|
||||
<SpanCopyable :value="end" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</n-table>
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,13 +0,0 @@
|
||||
import { UnfoldMoreOutlined } from '@vicons/material';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'IPv4-6/IPRange/CIDR in IPRange/CIDR/IPMask',
|
||||
path: '/cidr-in-cidr',
|
||||
description: 'Given a CIDR/IP Range/Wildcard IP/IP Mask, tell if a given IPv4-6/Range/CIDR/Wildcard IP/IP Mask is in subnet range',
|
||||
keywords: ['ip', 'cidr', 'range', 'mask', 'wildcard', 'ipv4', 'ipv6', 'subnet', 'include', 'inclusion'],
|
||||
component: () => import('./cidr-in-cidr.vue'),
|
||||
redirectFrom: ['/ip-in-range'],
|
||||
icon: UnfoldMoreOutlined,
|
||||
createdAt: new Date('2025-01-12'),
|
||||
});
|
||||
+3
-10
@@ -2,6 +2,7 @@ import { tool as base64FileConverter } from './base64-file-converter';
|
||||
import { tool as base64StringConverter } from './base64-string-converter';
|
||||
import { tool as basicAuthGenerator } from './basic-auth-generator';
|
||||
import { tool as emailNormalizer } from './email-normalizer';
|
||||
import { tool as sharepointDecoder } from './sharepoint-decoder';
|
||||
|
||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||
|
||||
@@ -86,7 +87,6 @@ import { tool as urlParser } from './url-parser';
|
||||
import { tool as uuidGenerator } from './uuid-generator';
|
||||
import { tool as macAddressLookup } from './mac-address-lookup';
|
||||
import { tool as xmlFormatter } from './xml-formatter';
|
||||
import { tool as cidrInCidr } from './cidr-in-cidr';
|
||||
import { tool as yamlViewer } from './yaml-viewer';
|
||||
|
||||
export const toolsByCategory: ToolCategory[] = [
|
||||
@@ -138,6 +138,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
httpStatusCodes,
|
||||
jsonDiff,
|
||||
safelinkDecoder,
|
||||
sharepointDecoder,
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -165,15 +166,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
},
|
||||
{
|
||||
name: 'Network',
|
||||
components: [
|
||||
ipv4SubnetCalculator,
|
||||
ipv4AddressConverter,
|
||||
cidrInCidr,
|
||||
ipv4RangeExpander,
|
||||
macAddressLookup,
|
||||
macAddressGenerator,
|
||||
ipv6UlaGenerator,
|
||||
],
|
||||
components: [ipv4SubnetCalculator, ipv4AddressConverter, ipv4RangeExpander, macAddressLookup, macAddressGenerator, ipv6UlaGenerator],
|
||||
},
|
||||
{
|
||||
name: 'Math',
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Mailbox } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Sharepoint Share Url Decoder',
|
||||
path: '/sharepoint-decoder',
|
||||
description: 'Decode sharepoint.com share urls to "normal" Sharepoint Url',
|
||||
keywords: ['sharepoint', 'url', 'decoder'],
|
||||
component: () => import('./sharepoint-decoder.vue'),
|
||||
icon: Mailbox,
|
||||
createdAt: new Date('2025-02-09'),
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { decodeSharePointsURL } from './sharepoint-decoder.service';
|
||||
|
||||
describe('sharepoint-decoder', () => {
|
||||
describe('decodeSharePointsURL', () => {
|
||||
describe('decode outlook sharepoint urls', () => {
|
||||
it('should decode basic sharepoint urls', () => {
|
||||
expect(decodeSharePointsURL('https://my-site.sharepoint.com/sites/SBL-AssuranceofLearning/AoL%20Reviews/Forms/AllItems.aspx?FolderCTID=0x0120004A7E52B45BF74940ABEB3A8AA69FF829&id=%2Fsites%2FSBL%2DAssuranceofLearning%2FAoL%20Reviews%2FAnalytics%2FSQL%2EDefinitions%2Fcourse%5Funit%5Fsets%2Esql&viewid=d65c252e%2Db796%2D4457%2D88dd%2D2a8095006fb9&parent=%2Fsites%2FSBL%2DAssuranceofLearning%2FAoL%20Reviews%2FAnalytics%2FSQL%2EDefinitions'))
|
||||
.toBe('https://my-site.sharepoint.com/sites/SBL-AssuranceofLearning/AoL Reviews/Analytics/SQL.Definitions/course_unit_sets.sql');
|
||||
});
|
||||
|
||||
it('throw on not outlook sharepoint urls', () => {
|
||||
expect(() => decodeSharePointsURL('https://google.com'))
|
||||
.toThrow('Invalid SharePoint URL provided');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
export function decodeSharePointsURL(sharePointsUrl: string) {
|
||||
if (!sharePointsUrl.match(/\.sharepoint\.com/)) {
|
||||
throw new Error('Invalid SharePoint URL provided');
|
||||
}
|
||||
|
||||
const url = new URL(sharePointsUrl);
|
||||
return `${url.protocol}//${url.hostname}${url.searchParams.get('id')}`;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<script setup lang="ts">
|
||||
import { decodeSharePointsURL } from './sharepoint-decoder.service';
|
||||
import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
||||
|
||||
const inputSharePointUrl = ref('');
|
||||
const outputDecodedUrl = computed(() => {
|
||||
try {
|
||||
return decodeSharePointsURL(inputSharePointUrl.value);
|
||||
}
|
||||
catch (e: any) {
|
||||
return e.toString();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text
|
||||
v-model:value="inputSharePointUrl"
|
||||
raw-text
|
||||
placeholder="Your input SharePoint Url..."
|
||||
autofocus
|
||||
label="Your input SharePoint Url:"
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<n-form-item label="Output decoded URL:">
|
||||
<TextareaCopyable :value="outputDecodedUrl" :word-wrap="true" />
|
||||
</n-form-item>
|
||||
</div>
|
||||
</template>
|
||||
@@ -151,7 +151,7 @@ function onSearchInput() {
|
||||
>
|
||||
<div flex-1 truncate>
|
||||
<slot name="displayed-value">
|
||||
<input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" placeholder="Search..." class="search-input" w-full lh-normal color-current @input="onSearchInput">
|
||||
<input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" placeholder="Search..." class="search-input" w-full color-current lh-normal @input="onSearchInput">
|
||||
<span v-else-if="selectedOption" lh-normal>
|
||||
{{ selectedOption.label }}
|
||||
</span>
|
||||
|
||||
@@ -39,7 +39,7 @@ const headers = computed(() => {
|
||||
<template>
|
||||
<div class="relative overflow-x-auto rounded">
|
||||
<table class="w-full border-collapse text-left text-sm text-gray-500 dark:text-gray-400" role="table" :aria-label="description">
|
||||
<thead v-if="!hideHeaders" class="bg-#ffffff uppercase text-gray-700 dark:bg-#333333 dark:text-gray-400" border-b="1px solid dark:transparent #efeff5">
|
||||
<thead v-if="!hideHeaders" class="bg-#ffffff text-gray-700 uppercase dark:bg-#333333 dark:text-gray-400" border-b="1px solid dark:transparent #efeff5">
|
||||
<tr>
|
||||
<th v-for="header in headers" :key="header.key" scope="col" class="px-6 py-3 text-xs">
|
||||
{{ header.label }}
|
||||
|
||||
Reference in new issue
Block a user