mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-23 22:31:10 +03:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46e2648ea5 |
No files matched your search
Vendored
+1
-5
@@ -130,12 +130,10 @@ 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']
|
||||
NButton: typeof import('naive-ui')['NButton']
|
||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
NCode: typeof import('naive-ui')['NCode']
|
||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDataTable: typeof import('naive-ui')['NDataTable']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||
@@ -148,11 +146,8 @@ declare module '@vue/runtime-core' {
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NTable: typeof import('naive-ui')['NTable']
|
||||
NTabPane: typeof import('naive-ui')['NTabPane']
|
||||
NTabs: typeof import('naive-ui')['NTabs']
|
||||
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']
|
||||
ParquetsReader: typeof import('./src/tools/parquets-reader/parquets-reader.vue')['default']
|
||||
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
|
||||
PdfSignatureChecker: typeof import('./src/tools/pdf-signature-checker/pdf-signature-checker.vue')['default']
|
||||
PdfSignatureDetails: typeof import('./src/tools/pdf-signature-checker/components/pdf-signature-details.vue')['default']
|
||||
@@ -169,6 +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']
|
||||
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']
|
||||
|
||||
@@ -68,8 +68,6 @@
|
||||
"figue": "^1.2.0",
|
||||
"fuse.js": "^6.6.2",
|
||||
"highlight.js": "^11.7.0",
|
||||
"hyparquet": "^1.9.0",
|
||||
"hyparquet-compressors": "^1.0.0",
|
||||
"iarna-toml-esm": "^3.0.5",
|
||||
"ibantools": "^4.3.3",
|
||||
"js-base64": "^3.7.6",
|
||||
|
||||
Generated
+538
-507
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -2,7 +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 parquetsReader } from './parquets-reader';
|
||||
import { tool as sharepointDecoder } from './sharepoint-decoder';
|
||||
|
||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||
|
||||
@@ -138,6 +138,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
httpStatusCodes,
|
||||
jsonDiff,
|
||||
safelinkDecoder,
|
||||
sharepointDecoder,
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -161,7 +162,6 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
emailNormalizer,
|
||||
regexTester,
|
||||
regexMemo,
|
||||
parquetsReader,
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { Parking } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Parquet files Reader',
|
||||
path: '/parquets-reader',
|
||||
description: 'Read parquet file as JSON object arrays',
|
||||
keywords: ['parquet', 'reader'],
|
||||
component: () => import('./parquets-reader.vue'),
|
||||
icon: Parking,
|
||||
createdAt: new Date('2025-02-09'),
|
||||
});
|
||||
@@ -1,76 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
// import { Buffer } from 'node:buffer';
|
||||
import { parquetReadObjects } from 'hyparquet';
|
||||
import { compressors } from 'hyparquet-compressors';
|
||||
import type { DataTableInst } from 'naive-ui';
|
||||
|
||||
const fileInput = ref() as Ref<File | null>;
|
||||
|
||||
const error = ref('');
|
||||
|
||||
const results = computedAsync(async () => {
|
||||
const file = fileInput.value;
|
||||
error.value = '';
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return await parquetReadObjects({ file: await file.arrayBuffer(), compressors });
|
||||
}
|
||||
catch (e: any) {
|
||||
error.value = e.toString();
|
||||
return [];
|
||||
}
|
||||
});
|
||||
const resultsJson = computed(() => JSON.stringify(results.value || [], (_, v) => typeof v === 'bigint' ? v.toString() : v, 2));
|
||||
|
||||
const columns = computed(() => Object.keys((results.value || [])[0] || {})
|
||||
.map(h => ({ key: h.replace(/\./g, '\\.'), title: h })));
|
||||
|
||||
function onUpload(file: File) {
|
||||
if (file) {
|
||||
fileInput.value = file;
|
||||
}
|
||||
}
|
||||
|
||||
const tableRef = ref<DataTableInst>();
|
||||
function downloadCsv() {
|
||||
tableRef.value?.downloadCsv({ fileName: fileInput.value?.name || 'data' });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div style="max-width: 600px;">
|
||||
<c-card title="Input" mb-2>
|
||||
<c-file-upload
|
||||
title="Drag and drop Parquet file here, or click to select a file"
|
||||
@file-upload="onUpload"
|
||||
/>
|
||||
</c-card>
|
||||
|
||||
<c-alert v-if="error">
|
||||
{{ error }}
|
||||
</c-alert>
|
||||
|
||||
<n-tabs v-if="!error" type="line" animated>
|
||||
<n-tab-pane name="jsonData" tab="JSON Content">
|
||||
<textarea-copyable :value="resultsJson" language="json" :download-file-name="`${fileInput?.name}.json`" />
|
||||
</n-tab-pane>
|
||||
<n-tab-pane v-if="columns.length" name="tabData" tab="Table View">
|
||||
<div mb-1 flex justify-center>
|
||||
<n-button @click="downloadCsv">
|
||||
Export as CSV
|
||||
</n-button>
|
||||
</div>
|
||||
<n-data-table
|
||||
ref="tableRef"
|
||||
size="small"
|
||||
:columns="columns"
|
||||
|
||||
:data="results" bordered striped
|
||||
pagination
|
||||
/>
|
||||
</n-tab-pane>
|
||||
</n-tabs>
|
||||
</div>
|
||||
</template>
|
||||
@@ -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