mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-25 23:24:09 +03:00
feat(new tool): SharePoint Url Decoder
Decode sharepoint.com share urls Fix #1482
This commit is contained in:
1 parent
4f9503333e
commit
8d1d069cd2
6 files changed
+74
No files matched your search
Vendored
+2
@@ -248,6 +248,7 @@ declare module '@vue/runtime-core' {
|
|||||||
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']
|
NCode: typeof import('naive-ui')['NCode']
|
||||||
|
NCode: typeof import('naive-ui')['NCode']
|
||||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||||
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
||||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||||
@@ -262,6 +263,7 @@ declare module '@vue/runtime-core' {
|
|||||||
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']
|
||||||
|
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||||
NSpace: typeof import('naive-ui')['NSpace']
|
NSpace: typeof import('naive-ui')['NSpace']
|
||||||
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
||||||
OcrImage: typeof import('./src/tools/ocr-image/ocr-image.vue')['default']
|
OcrImage: typeof import('./src/tools/ocr-image/ocr-image.vue')['default']
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { tool as floatingPointNumberConverter } from './floating-point-number-co
|
|||||||
import { tool as snowflakeIdExtractor } from './snowflake-id-extractor';
|
import { tool as snowflakeIdExtractor } from './snowflake-id-extractor';
|
||||||
import { tool as qrContactInfoGenerator } from './qr-contact-info-generator';
|
import { tool as qrContactInfoGenerator } from './qr-contact-info-generator';
|
||||||
import { tool as emailNormalizer } from './email-normalizer';
|
import { tool as emailNormalizer } from './email-normalizer';
|
||||||
|
import { tool as sharepointDecoder } from './sharepoint-decoder';
|
||||||
import { tool as jwtGenerator } from './jwt-generator';
|
import { tool as jwtGenerator } from './jwt-generator';
|
||||||
import { tool as gptTokenEstimator } from './gpt-token-estimator';
|
import { tool as gptTokenEstimator } from './gpt-token-estimator';
|
||||||
import { tool as myIp } from './my-ip';
|
import { tool as myIp } from './my-ip';
|
||||||
@@ -372,6 +373,7 @@ export const toolsByCategory: ToolCategory[] = [
|
|||||||
jsonDiff,
|
jsonDiff,
|
||||||
softwareLicenceCompatibility,
|
softwareLicenceCompatibility,
|
||||||
safelinkDecoder,
|
safelinkDecoder,
|
||||||
|
sharepointDecoder,
|
||||||
micTester,
|
micTester,
|
||||||
snowflakeIdExtractor,
|
snowflakeIdExtractor,
|
||||||
apiTester,
|
apiTester,
|
||||||
|
|||||||
@@ -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>
|
||||||
Reference in new issue
Block a user