mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 14:50:17 +03:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9bf3fe6c7 | ||
|
|
d2b692269b |
No files matched your search
@@ -286,9 +286,6 @@
|
|||||||
"watchTriggerable": true,
|
"watchTriggerable": true,
|
||||||
"watchWithFilter": true,
|
"watchWithFilter": true,
|
||||||
"whenever": true,
|
"whenever": true,
|
||||||
"toValue": true,
|
"toValue": true
|
||||||
"injectLocal": true,
|
|
||||||
"provideLocal": true,
|
|
||||||
"useClipboardItems": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vendored
-9
@@ -36,7 +36,6 @@ declare global {
|
|||||||
const h: typeof import('vue')['h']
|
const h: typeof import('vue')['h']
|
||||||
const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
|
const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
|
||||||
const inject: typeof import('vue')['inject']
|
const inject: typeof import('vue')['inject']
|
||||||
const injectLocal: typeof import('@vueuse/core')['injectLocal']
|
|
||||||
const isDefined: typeof import('@vueuse/core')['isDefined']
|
const isDefined: typeof import('@vueuse/core')['isDefined']
|
||||||
const isProxy: typeof import('vue')['isProxy']
|
const isProxy: typeof import('vue')['isProxy']
|
||||||
const isReactive: typeof import('vue')['isReactive']
|
const isReactive: typeof import('vue')['isReactive']
|
||||||
@@ -66,7 +65,6 @@ declare global {
|
|||||||
const onUpdated: typeof import('vue')['onUpdated']
|
const onUpdated: typeof import('vue')['onUpdated']
|
||||||
const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
|
const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
|
||||||
const provide: typeof import('vue')['provide']
|
const provide: typeof import('vue')['provide']
|
||||||
const provideLocal: typeof import('@vueuse/core')['provideLocal']
|
|
||||||
const reactify: typeof import('@vueuse/core')['reactify']
|
const reactify: typeof import('@vueuse/core')['reactify']
|
||||||
const reactifyObject: typeof import('@vueuse/core')['reactifyObject']
|
const reactifyObject: typeof import('@vueuse/core')['reactifyObject']
|
||||||
const reactive: typeof import('vue')['reactive']
|
const reactive: typeof import('vue')['reactive']
|
||||||
@@ -130,7 +128,6 @@ declare global {
|
|||||||
const useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation']
|
const useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation']
|
||||||
const useCached: typeof import('@vueuse/core')['useCached']
|
const useCached: typeof import('@vueuse/core')['useCached']
|
||||||
const useClipboard: typeof import('@vueuse/core')['useClipboard']
|
const useClipboard: typeof import('@vueuse/core')['useClipboard']
|
||||||
const useClipboardItems: typeof import('@vueuse/core')['useClipboardItems']
|
|
||||||
const useCloned: typeof import('@vueuse/core')['useCloned']
|
const useCloned: typeof import('@vueuse/core')['useCloned']
|
||||||
const useColorMode: typeof import('@vueuse/core')['useColorMode']
|
const useColorMode: typeof import('@vueuse/core')['useColorMode']
|
||||||
const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']
|
const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']
|
||||||
@@ -329,7 +326,6 @@ declare module 'vue' {
|
|||||||
readonly h: UnwrapRef<typeof import('vue')['h']>
|
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||||
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
|
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
|
||||||
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||||
readonly injectLocal: UnwrapRef<typeof import('@vueuse/core')['injectLocal']>
|
|
||||||
readonly isDefined: UnwrapRef<typeof import('@vueuse/core')['isDefined']>
|
readonly isDefined: UnwrapRef<typeof import('@vueuse/core')['isDefined']>
|
||||||
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||||
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||||
@@ -359,7 +355,6 @@ declare module 'vue' {
|
|||||||
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||||
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
|
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
|
||||||
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||||
readonly provideLocal: UnwrapRef<typeof import('@vueuse/core')['provideLocal']>
|
|
||||||
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
|
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
|
||||||
readonly reactifyObject: UnwrapRef<typeof import('@vueuse/core')['reactifyObject']>
|
readonly reactifyObject: UnwrapRef<typeof import('@vueuse/core')['reactifyObject']>
|
||||||
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||||
@@ -423,7 +418,6 @@ declare module 'vue' {
|
|||||||
readonly useBrowserLocation: UnwrapRef<typeof import('@vueuse/core')['useBrowserLocation']>
|
readonly useBrowserLocation: UnwrapRef<typeof import('@vueuse/core')['useBrowserLocation']>
|
||||||
readonly useCached: UnwrapRef<typeof import('@vueuse/core')['useCached']>
|
readonly useCached: UnwrapRef<typeof import('@vueuse/core')['useCached']>
|
||||||
readonly useClipboard: UnwrapRef<typeof import('@vueuse/core')['useClipboard']>
|
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 useCloned: UnwrapRef<typeof import('@vueuse/core')['useCloned']>
|
||||||
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
|
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
|
||||||
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
|
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
|
||||||
@@ -616,7 +610,6 @@ declare module '@vue/runtime-core' {
|
|||||||
readonly h: UnwrapRef<typeof import('vue')['h']>
|
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||||
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
|
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
|
||||||
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||||
readonly injectLocal: UnwrapRef<typeof import('@vueuse/core')['injectLocal']>
|
|
||||||
readonly isDefined: UnwrapRef<typeof import('@vueuse/core')['isDefined']>
|
readonly isDefined: UnwrapRef<typeof import('@vueuse/core')['isDefined']>
|
||||||
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||||
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||||
@@ -646,7 +639,6 @@ declare module '@vue/runtime-core' {
|
|||||||
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||||
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
|
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
|
||||||
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||||
readonly provideLocal: UnwrapRef<typeof import('@vueuse/core')['provideLocal']>
|
|
||||||
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
|
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
|
||||||
readonly reactifyObject: UnwrapRef<typeof import('@vueuse/core')['reactifyObject']>
|
readonly reactifyObject: UnwrapRef<typeof import('@vueuse/core')['reactifyObject']>
|
||||||
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||||
@@ -710,7 +702,6 @@ declare module '@vue/runtime-core' {
|
|||||||
readonly useBrowserLocation: UnwrapRef<typeof import('@vueuse/core')['useBrowserLocation']>
|
readonly useBrowserLocation: UnwrapRef<typeof import('@vueuse/core')['useBrowserLocation']>
|
||||||
readonly useCached: UnwrapRef<typeof import('@vueuse/core')['useCached']>
|
readonly useCached: UnwrapRef<typeof import('@vueuse/core')['useCached']>
|
||||||
readonly useClipboard: UnwrapRef<typeof import('@vueuse/core')['useClipboard']>
|
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 useCloned: UnwrapRef<typeof import('@vueuse/core')['useCloned']>
|
||||||
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
|
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
|
||||||
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
|
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
|
||||||
|
|||||||
Vendored
+1
-4
@@ -103,6 +103,7 @@ declare module '@vue/runtime-core' {
|
|||||||
IconMdiTriangleDown: typeof import('~icons/mdi/triangle-down')['default']
|
IconMdiTriangleDown: typeof import('~icons/mdi/triangle-down')['default']
|
||||||
InputCopyable: typeof import('./src/components/InputCopyable.vue')['default']
|
InputCopyable: typeof import('./src/components/InputCopyable.vue')['default']
|
||||||
IntegerBaseConverter: typeof import('./src/tools/integer-base-converter/integer-base-converter.vue')['default']
|
IntegerBaseConverter: typeof import('./src/tools/integer-base-converter/integer-base-converter.vue')['default']
|
||||||
|
IpIncludeExclude: typeof import('./src/tools/ip-include-exclude/ip-include-exclude.vue')['default']
|
||||||
Ipv4AddressConverter: typeof import('./src/tools/ipv4-address-converter/ipv4-address-converter.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']
|
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']
|
Ipv4SubnetCalculator: typeof import('./src/tools/ipv4-subnet-calculator/ipv4-subnet-calculator.vue')['default']
|
||||||
@@ -131,19 +132,16 @@ declare module '@vue/runtime-core' {
|
|||||||
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
|
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
|
||||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||||
NCode: typeof import('naive-ui')['NCode']
|
|
||||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||||
NDivider: typeof import('naive-ui')['NDivider']
|
NDivider: typeof import('naive-ui')['NDivider']
|
||||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
|
||||||
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']
|
||||||
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']
|
|
||||||
NSpace: typeof import('naive-ui')['NSpace']
|
NSpace: typeof import('naive-ui')['NSpace']
|
||||||
NTable: typeof import('naive-ui')['NTable']
|
NTable: typeof import('naive-ui')['NTable']
|
||||||
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
||||||
@@ -164,7 +162,6 @@ declare module '@vue/runtime-core' {
|
|||||||
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']
|
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']
|
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']
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
"@vueuse/router": "^10.0.0",
|
"@vueuse/router": "^10.0.0",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"change-case": "^4.1.2",
|
"change-case": "^4.1.2",
|
||||||
|
"cidr-tools": "^11.0.2",
|
||||||
"colord": "^2.9.3",
|
"colord": "^2.9.3",
|
||||||
"composerize-ts": "^0.6.2",
|
"composerize-ts": "^0.6.2",
|
||||||
"country-code-lookup": "^0.1.0",
|
"country-code-lookup": "^0.1.0",
|
||||||
@@ -70,6 +71,7 @@
|
|||||||
"highlight.js": "^11.7.0",
|
"highlight.js": "^11.7.0",
|
||||||
"iarna-toml-esm": "^3.0.5",
|
"iarna-toml-esm": "^3.0.5",
|
||||||
"ibantools": "^4.3.3",
|
"ibantools": "^4.3.3",
|
||||||
|
"ip-matching": "^2.1.2",
|
||||||
"js-base64": "^3.7.6",
|
"js-base64": "^3.7.6",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"jwt-decode": "^3.1.2",
|
"jwt-decode": "^3.1.2",
|
||||||
|
|||||||
Generated
+2420
-2406
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 />
|
<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 v-for="(options, category) in filteredSearchResult" :key="category">
|
||||||
<div ml-3 mt-3 text-sm text-primary font-bold op-60>
|
<div ml-3 mt-3 text-sm font-bold text-primary op-60>
|
||||||
{{ category }}
|
{{ category }}
|
||||||
</div>
|
</div>
|
||||||
<command-palette-option v-for="option in options" :key="option.name" :option="option" :selected="selectedOptionIndex === getOptionIndex(option)" @activated="activateOption" />
|
<command-palette-option v-for="option in options" :key="option.name" :option="option" :selected="selectedOptionIndex === getOptionIndex(option)" @activated="activateOption" />
|
||||||
|
|||||||
+10
-3
@@ -1,8 +1,8 @@
|
|||||||
import { tool as base64FileConverter } from './base64-file-converter';
|
import { tool as base64FileConverter } from './base64-file-converter';
|
||||||
import { tool as base64StringConverter } from './base64-string-converter';
|
import { tool as base64StringConverter } from './base64-string-converter';
|
||||||
import { tool as basicAuthGenerator } from './basic-auth-generator';
|
import { tool as basicAuthGenerator } from './basic-auth-generator';
|
||||||
|
import { tool as ipIncludeExclude } from './ip-include-exclude';
|
||||||
import { tool as emailNormalizer } from './email-normalizer';
|
import { tool as emailNormalizer } from './email-normalizer';
|
||||||
import { tool as sharepointDecoder } from './sharepoint-decoder';
|
|
||||||
|
|
||||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||||
|
|
||||||
@@ -138,7 +138,6 @@ export const toolsByCategory: ToolCategory[] = [
|
|||||||
httpStatusCodes,
|
httpStatusCodes,
|
||||||
jsonDiff,
|
jsonDiff,
|
||||||
safelinkDecoder,
|
safelinkDecoder,
|
||||||
sharepointDecoder,
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -166,7 +165,15 @@ export const toolsByCategory: ToolCategory[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Network',
|
name: 'Network',
|
||||||
components: [ipv4SubnetCalculator, ipv4AddressConverter, ipv4RangeExpander, macAddressLookup, macAddressGenerator, ipv6UlaGenerator],
|
components: [
|
||||||
|
ipv4SubnetCalculator,
|
||||||
|
ipv4AddressConverter,
|
||||||
|
ipv4RangeExpander,
|
||||||
|
ipIncludeExclude,
|
||||||
|
macAddressLookup,
|
||||||
|
macAddressGenerator,
|
||||||
|
ipv6UlaGenerator,
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Math',
|
name: 'Math',
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { UnfoldMoreOutlined } from '@vicons/material';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'IP Subnets Exclude Calculator',
|
||||||
|
path: '/ip-include-exclude',
|
||||||
|
description: 'Substract a disallowed IP Ranges/Mask/CIDR list from an allowed IP Ranges/Mask/CIDR list',
|
||||||
|
keywords: ['ip', 'allowed', 'disallowed', 'include', 'exclude', 'subnet', 'cidr'],
|
||||||
|
component: () => import('./ip-include-exclude.vue'),
|
||||||
|
icon: UnfoldMoreOutlined,
|
||||||
|
createdAt: new Date('2024-08-15'),
|
||||||
|
});
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { substractCIDRs } from './ip-include-exclude.service';
|
||||||
|
|
||||||
|
describe('ip-include-exclude', () => {
|
||||||
|
describe('substractCIDRs', () => {
|
||||||
|
it('should return error on invalid values', () => {
|
||||||
|
expect(substractCIDRs({ allowedRanges: '192.168.0.', disallowedRanges: '' })).to.deep.eq({ // NOSONAR
|
||||||
|
allowedCIDRs: [],
|
||||||
|
allowedSubnets: [],
|
||||||
|
disallowedSubnets: [],
|
||||||
|
error: 'Error: Invalid IP (range/subnetwork)',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should return correct substractions and subnets', () => {
|
||||||
|
expect(substractCIDRs({ allowedRanges: '192.168.3.0/24', disallowedRanges: '' })).to.deep.eq({ // NOSONAR
|
||||||
|
allowedCIDRs: ['192.168.3.0/24'], // NOSONAR
|
||||||
|
allowedSubnets: [{ cidr: '192.168.3.0/24', end: '192.168.3.255', start: '192.168.3.0' }], // NOSONAR
|
||||||
|
disallowedSubnets: [],
|
||||||
|
error: '',
|
||||||
|
});
|
||||||
|
expect(substractCIDRs({ allowedRanges: '192.168.2.0/24', disallowedRanges: '192.168.2.1' })).to.deep.eq({ // NOSONAR
|
||||||
|
allowedCIDRs: ['192.168.2.0/32', // NOSONAR
|
||||||
|
'192.168.2.2/31', // NOSONAR
|
||||||
|
'192.168.2.4/30', // NOSONAR
|
||||||
|
'192.168.2.8/29', // NOSONAR
|
||||||
|
'192.168.2.16/28', // NOSONAR
|
||||||
|
'192.168.2.32/27', // NOSONAR
|
||||||
|
'192.168.2.64/26', // NOSONAR
|
||||||
|
'192.168.2.128/25'], // NOSONAR
|
||||||
|
allowedSubnets: [
|
||||||
|
{ cidr: '192.168.2.0/24', end: '192.168.2.255', start: '192.168.2.0' }, // NOSONAR
|
||||||
|
],
|
||||||
|
disallowedSubnets: [
|
||||||
|
{ cidr: '192.168.2.1/32', end: '192.168.2.1', start: '192.168.2.1' }, // NOSONAR
|
||||||
|
],
|
||||||
|
error: '',
|
||||||
|
});
|
||||||
|
expect(substractCIDRs({ allowedRanges: '192.168.12.0/24', disallowedRanges: '192.168.12.1-192.168.12.10, 192.168.12.34' })).to.deep.eq({ // NOSONAR
|
||||||
|
allowedCIDRs: ['192.168.12.0/32', // NOSONAR
|
||||||
|
'192.168.12.11/32', // NOSONAR
|
||||||
|
'192.168.12.12/30', // NOSONAR
|
||||||
|
'192.168.12.16/28', // NOSONAR
|
||||||
|
'192.168.12.32/31', // NOSONAR
|
||||||
|
'192.168.12.35/32', // NOSONAR
|
||||||
|
'192.168.12.36/30', // NOSONAR
|
||||||
|
'192.168.12.40/29', // NOSONAR
|
||||||
|
'192.168.12.48/28', // NOSONAR
|
||||||
|
'192.168.12.64/26', // NOSONAR
|
||||||
|
'192.168.12.128/25'], // NOSONAR
|
||||||
|
allowedSubnets: [{ cidr: '192.168.12.0/24', end: '192.168.12.255', start: '192.168.12.0' }], // NOSONAR
|
||||||
|
disallowedSubnets: [
|
||||||
|
{ cidr: '192.168.12.1/32', end: '192.168.12.1', start: '192.168.12.1' }, // NOSONAR
|
||||||
|
{ cidr: '192.168.12.2/31', end: '192.168.12.3', start: '192.168.12.2' }, // NOSONAR
|
||||||
|
{ cidr: '192.168.12.4/30', end: '192.168.12.7', start: '192.168.12.4' }, // NOSONAR
|
||||||
|
{ cidr: '192.168.12.8/31', end: '192.168.12.9', start: '192.168.12.8' }, // NOSONAR
|
||||||
|
{ cidr: '192.168.12.10/32', end: '192.168.12.10', start: '192.168.12.10' }, // NOSONAR
|
||||||
|
{ cidr: '192.168.12.34/32', end: '192.168.12.34', start: '192.168.12.34' }, // NOSONAR
|
||||||
|
],
|
||||||
|
error: '',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import type { IPMask } from 'ip-matching';
|
||||||
|
import { getMatch } from 'ip-matching';
|
||||||
|
import { excludeCidr } from 'cidr-tools';
|
||||||
|
|
||||||
|
function convertToCIDR(mask: IPMask) {
|
||||||
|
const subnet = mask.convertToSubnet();
|
||||||
|
if (!subnet) {
|
||||||
|
return { cidr: mask.toString(), start: '', end: '' };
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
cidr: subnet.toString(),
|
||||||
|
start: subnet.getFirst().toString(),
|
||||||
|
end: subnet.getLast().toString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function substractCIDRs(
|
||||||
|
{ allowedRanges, disallowedRanges }:
|
||||||
|
{
|
||||||
|
allowedRanges: string
|
||||||
|
disallowedRanges: string
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const allowedRangesMatchMasks = allowedRanges.split(/\s*[,;|]+\s*/g) // NOSONAR
|
||||||
|
.filter(range => range)
|
||||||
|
.flatMap(range => getMatch(range)?.convertToMasks() || []);
|
||||||
|
const disallowedRangesMatchMasks = disallowedRanges.split(/\s*[,;|]+\s*/g) // NOSONAR
|
||||||
|
.filter(range => range)
|
||||||
|
.flatMap(range => getMatch(range)?.convertToMasks() || []);
|
||||||
|
|
||||||
|
const allowedSubnets = allowedRangesMatchMasks.map(convertToCIDR);
|
||||||
|
const disallowedSubnets = disallowedRangesMatchMasks.map(convertToCIDR);
|
||||||
|
|
||||||
|
return {
|
||||||
|
error: '',
|
||||||
|
allowedSubnets,
|
||||||
|
disallowedSubnets,
|
||||||
|
allowedCIDRs: excludeCidr(allowedSubnets.map(net => net.cidr), disallowedSubnets.map(net => net.cidr)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (e: any) {
|
||||||
|
return {
|
||||||
|
error: e.toString(),
|
||||||
|
allowedSubnets: [],
|
||||||
|
disallowedSubnets: [],
|
||||||
|
allowedCIDRs: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { useStorage } from '@vueuse/core';
|
||||||
|
import { substractCIDRs } from './ip-include-exclude.service';
|
||||||
|
import SpanCopyable from '@/components/SpanCopyable.vue';
|
||||||
|
import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
||||||
|
|
||||||
|
const allowedRanges = useStorage('ip-inc-exc:allow', '192.168.0.1/24'); // NOSONAR
|
||||||
|
const disallowedRanges = useStorage('ip-inc-exc:disallow', '192.168.0.6'); // NOSONAR
|
||||||
|
|
||||||
|
const result = computed(() => substractCIDRs({
|
||||||
|
allowedRanges: allowedRanges.value, disallowedRanges: disallowedRanges.value,
|
||||||
|
}));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="allowedRanges"
|
||||||
|
label="AllowedIPs (IPv4/6 CIDR/Range/Mask/Wildcard)"
|
||||||
|
placeholder="An IPv4/6 CIDR/Range/Mask/Wildcard..."
|
||||||
|
mb-4
|
||||||
|
/>
|
||||||
|
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="disallowedRanges"
|
||||||
|
label="DisallowedIPs (IPv4/6 CIDR/Range/Mask/Wildcard)"
|
||||||
|
placeholder="An IPv4/6 CIDR/Range/Mask/Wildcard..."
|
||||||
|
mb-4
|
||||||
|
/>
|
||||||
|
|
||||||
|
<n-divider />
|
||||||
|
|
||||||
|
<c-alert v-if="result.error">
|
||||||
|
{{ result.error }}
|
||||||
|
</c-alert>
|
||||||
|
|
||||||
|
<div v-if="!result.error">
|
||||||
|
<n-form-item label="Final AllowedIPs:">
|
||||||
|
<TextareaCopyable :value="result.allowedCIDRs.join(', ')" />
|
||||||
|
</n-form-item>
|
||||||
|
|
||||||
|
<n-divider />
|
||||||
|
|
||||||
|
<c-card title="Allowed Subnets">
|
||||||
|
<n-table>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="{ cidr, start, end } in result.allowedSubnets" :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>
|
||||||
|
<c-card title="Disallowed Subnets">
|
||||||
|
<n-table>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="{ cidr, start, end } in result.disallowedSubnets" :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>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
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'),
|
|
||||||
});
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
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');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
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')}`;
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<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>
|
<div flex-1 truncate>
|
||||||
<slot name="displayed-value">
|
<slot name="displayed-value">
|
||||||
<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">
|
<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">
|
||||||
<span v-else-if="selectedOption" lh-normal>
|
<span v-else-if="selectedOption" lh-normal>
|
||||||
{{ selectedOption.label }}
|
{{ selectedOption.label }}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ const headers = computed(() => {
|
|||||||
<template>
|
<template>
|
||||||
<div class="relative overflow-x-auto rounded">
|
<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">
|
<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 text-gray-700 uppercase dark:bg-#333333 dark:text-gray-400" border-b="1px solid dark:transparent #efeff5">
|
<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">
|
||||||
<tr>
|
<tr>
|
||||||
<th v-for="header in headers" :key="header.key" scope="col" class="px-6 py-3 text-xs">
|
<th v-for="header in headers" :key="header.key" scope="col" class="px-6 py-3 text-xs">
|
||||||
{{ header.label }}
|
{{ header.label }}
|
||||||
|
|||||||
Reference in new issue
Block a user