mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-29 16:40:29 +03:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
489b3a6eeb | ||
|
|
3eaaddea9a | ||
|
|
bbcb36a87d | ||
|
|
dadd8fd528 | ||
|
|
31e280c6eb |
No files matched your search
Vendored
-9
@@ -72,7 +72,6 @@ declare module '@vue/runtime-core' {
|
|||||||
DockerRunToDockerComposeConverter: typeof import('./src/tools/docker-run-to-docker-compose-converter/docker-run-to-docker-compose-converter.vue')['default']
|
DockerRunToDockerComposeConverter: typeof import('./src/tools/docker-run-to-docker-compose-converter/docker-run-to-docker-compose-converter.vue')['default']
|
||||||
DynamicValues: typeof import('./src/tools/benchmark-builder/dynamic-values.vue')['default']
|
DynamicValues: typeof import('./src/tools/benchmark-builder/dynamic-values.vue')['default']
|
||||||
Editor: typeof import('./src/tools/html-wysiwyg-editor/editor/editor.vue')['default']
|
Editor: typeof import('./src/tools/html-wysiwyg-editor/editor/editor.vue')['default']
|
||||||
EmailNormalizer: typeof import('./src/tools/email-normalizer/email-normalizer.vue')['default']
|
|
||||||
EmojiCard: typeof import('./src/tools/emoji-picker/emoji-card.vue')['default']
|
EmojiCard: typeof import('./src/tools/emoji-picker/emoji-card.vue')['default']
|
||||||
EmojiGrid: typeof import('./src/tools/emoji-picker/emoji-grid.vue')['default']
|
EmojiGrid: typeof import('./src/tools/emoji-picker/emoji-grid.vue')['default']
|
||||||
EmojiPicker: typeof import('./src/tools/emoji-picker/emoji-picker.vue')['default']
|
EmojiPicker: typeof import('./src/tools/emoji-picker/emoji-picker.vue')['default']
|
||||||
@@ -128,26 +127,18 @@ declare module '@vue/runtime-core' {
|
|||||||
MenuLayout: typeof import('./src/components/MenuLayout.vue')['default']
|
MenuLayout: typeof import('./src/components/MenuLayout.vue')['default']
|
||||||
MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default']
|
MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default']
|
||||||
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
|
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
|
||||||
MongoObjectidConverter: typeof import('./src/tools/mongo-objectid-converter/mongo-objectid-converter.vue')['default']
|
|
||||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||||
NCode: typeof import('naive-ui')['NCode']
|
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']
|
||||||
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
|
||||||
NDivider: typeof import('naive-ui')['NDivider']
|
|
||||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||||
NForm: typeof import('naive-ui')['NForm']
|
|
||||||
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']
|
||||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
|
||||||
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']
|
||||||
NSlider: typeof import('naive-ui')['NSlider']
|
|
||||||
NSwitch: typeof import('naive-ui')['NSwitch']
|
|
||||||
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']
|
||||||
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
|
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
|
||||||
|
|||||||
@@ -57,7 +57,6 @@
|
|||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"date-fns": "^2.29.3",
|
"date-fns": "^2.29.3",
|
||||||
"dompurify": "^3.0.6",
|
"dompurify": "^3.0.6",
|
||||||
"email-normalizer": "^1.0.0",
|
|
||||||
"emojilib": "^3.0.10",
|
"emojilib": "^3.0.10",
|
||||||
"figlet": "^1.7.0",
|
"figlet": "^1.7.0",
|
||||||
"figue": "^1.2.0",
|
"figue": "^1.2.0",
|
||||||
|
|||||||
Generated
-15
@@ -71,9 +71,6 @@ dependencies:
|
|||||||
dompurify:
|
dompurify:
|
||||||
specifier: ^3.0.6
|
specifier: ^3.0.6
|
||||||
version: 3.0.6
|
version: 3.0.6
|
||||||
email-normalizer:
|
|
||||||
specifier: ^1.0.0
|
|
||||||
version: 1.0.0
|
|
||||||
emojilib:
|
emojilib:
|
||||||
specifier: ^3.0.10
|
specifier: ^3.0.10
|
||||||
version: 3.0.10
|
version: 3.0.10
|
||||||
@@ -4979,12 +4976,6 @@ packages:
|
|||||||
/electron-to-chromium@1.4.572:
|
/electron-to-chromium@1.4.572:
|
||||||
resolution: {integrity: sha512-RlFobl4D3ieetbnR+2EpxdzFl9h0RAJkPK3pfiwMug2nhBin2ZCsGIAJWdpNniLz43sgXam/CgipOmvTA+rUiA==}
|
resolution: {integrity: sha512-RlFobl4D3ieetbnR+2EpxdzFl9h0RAJkPK3pfiwMug2nhBin2ZCsGIAJWdpNniLz43sgXam/CgipOmvTA+rUiA==}
|
||||||
|
|
||||||
/email-normalizer@1.0.0:
|
|
||||||
resolution: {integrity: sha512-wZYuuMtL4kUOmg/TPtCrf9hAZjbFq+FcjWA85Z5nr2lGllRnWJPxCJw3gy4Cx+adMoyVw4VJfGGvt/OHgIW+qg==}
|
|
||||||
dependencies:
|
|
||||||
typescript: 5.5.4
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/emitter-component@1.1.1:
|
/emitter-component@1.1.1:
|
||||||
resolution: {integrity: sha512-G+mpdiAySMuB7kesVRLuyvYRqDmshB7ReKEVuyBPkzQlmiDiLrt7hHHIy4Aff552bgknVN7B2/d3lzhGO5dvpQ==}
|
resolution: {integrity: sha512-G+mpdiAySMuB7kesVRLuyvYRqDmshB7ReKEVuyBPkzQlmiDiLrt7hHHIy4Aff552bgknVN7B2/d3lzhGO5dvpQ==}
|
||||||
dev: false
|
dev: false
|
||||||
@@ -8613,12 +8604,6 @@ packages:
|
|||||||
engines: {node: '>=14.17'}
|
engines: {node: '>=14.17'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
/typescript@5.5.4:
|
|
||||||
resolution: {integrity: sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==}
|
|
||||||
engines: {node: '>=14.17'}
|
|
||||||
hasBin: true
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/ua-parser-js@1.0.35:
|
/ua-parser-js@1.0.35:
|
||||||
resolution: {integrity: sha512-fKnGuqmTBnIE+/KXSzCn4db8RTigUzw1AN0DmdU6hJovUTbYJKyqj+8Mt1c4VfRDnOVJnENmfYkIPZ946UrSAA==}
|
resolution: {integrity: sha512-fKnGuqmTBnIE+/KXSzCn4db8RTigUzw1AN0DmdU6hJovUTbYJKyqj+8Mt1c4VfRDnOVJnENmfYkIPZ946UrSAA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { normalizeEmail } from 'email-normalizer';
|
|
||||||
import { withDefaultOnError } from '@/utils/defaults';
|
|
||||||
import { useCopy } from '@/composable/copy';
|
|
||||||
|
|
||||||
const emails = ref('');
|
|
||||||
const normalizedEmails = computed(() => {
|
|
||||||
if (!emails.value) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return emails.value
|
|
||||||
.split('\n')
|
|
||||||
.map((email) => {
|
|
||||||
return withDefaultOnError(() => normalizeEmail({ email }), `Unable to parse email: ${email}`);
|
|
||||||
})
|
|
||||||
.join('\n');
|
|
||||||
});
|
|
||||||
|
|
||||||
const { copy } = useCopy({ source: normalizedEmails, text: 'Normalized emails copied to the clipboard', createToast: true });
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<div class="mb-2">
|
|
||||||
Raw emails to normalize:
|
|
||||||
</div>
|
|
||||||
<c-input-text
|
|
||||||
v-model:value="emails"
|
|
||||||
placeholder="Put your emails here (one per line)..."
|
|
||||||
rows="3"
|
|
||||||
multiline
|
|
||||||
autocomplete="off"
|
|
||||||
autocorrect="off"
|
|
||||||
autocapitalize="off"
|
|
||||||
spellcheck="false"
|
|
||||||
autofocus
|
|
||||||
monospace
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div class="mb-2 mt-4">
|
|
||||||
Normalized emails:
|
|
||||||
</div>
|
|
||||||
<c-input-text
|
|
||||||
:value="normalizedEmails"
|
|
||||||
placeholder="Normalized emails will appear here..."
|
|
||||||
rows="3"
|
|
||||||
autocomplete="off"
|
|
||||||
autocorrect="off"
|
|
||||||
autocapitalize="off"
|
|
||||||
spellcheck="false"
|
|
||||||
multiline
|
|
||||||
readonly
|
|
||||||
monospace
|
|
||||||
/>
|
|
||||||
<div class="mt-4 flex justify-center gap-2">
|
|
||||||
<c-button @click="emails = ''">
|
|
||||||
Clear emails
|
|
||||||
</c-button>
|
|
||||||
<c-button :disabled="!normalizedEmails" @click="copy()">
|
|
||||||
Copy normalized emails
|
|
||||||
</c-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
import { Mail } from '@vicons/tabler';
|
|
||||||
import { defineTool } from '../tool';
|
|
||||||
|
|
||||||
export const tool = defineTool({
|
|
||||||
name: 'Email normalizer',
|
|
||||||
path: '/email-normalizer',
|
|
||||||
description: 'Normalize email addresses to a standard format for easier comparison. Useful for deduplication and data cleaning.',
|
|
||||||
keywords: ['email', 'normalizer'],
|
|
||||||
component: () => import('./email-normalizer.vue'),
|
|
||||||
icon: Mail,
|
|
||||||
createdAt: new Date('2024-08-15'),
|
|
||||||
});
|
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
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 emailNormalizer } from './email-normalizer';
|
|
||||||
|
|
||||||
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 safelinkDecoder } from './safelink-decoder';
|
||||||
import { tool as mongoObjectidConverter } from './mongo-objectid-converter';
|
|
||||||
import { tool as xmlToJson } from './xml-to-json';
|
import { tool as xmlToJson } from './xml-to-json';
|
||||||
import { tool as jsonToXml } from './json-to-xml';
|
import { tool as jsonToXml } from './json-to-xml';
|
||||||
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
||||||
@@ -154,8 +152,6 @@ export const toolsByCategory: ToolCategory[] = [
|
|||||||
dockerRunToDockerComposeConverter,
|
dockerRunToDockerComposeConverter,
|
||||||
xmlFormatter,
|
xmlFormatter,
|
||||||
yamlViewer,
|
yamlViewer,
|
||||||
emailNormalizer,
|
|
||||||
mongoObjectidConverter,
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
import { Database } from '@vicons/tabler';
|
|
||||||
import { defineTool } from '../tool';
|
|
||||||
|
|
||||||
export const tool = defineTool({
|
|
||||||
name: 'MongoDB ObjectId Converter',
|
|
||||||
path: '/mongo-objectid-converter',
|
|
||||||
description: 'Convert between MongoDB ObjectId and internal timestamp',
|
|
||||||
keywords: ['mongo', 'objectid', 'converter', 'timestamp'],
|
|
||||||
component: () => import('./mongo-objectid-converter.vue'),
|
|
||||||
icon: Database,
|
|
||||||
createdAt: new Date('2024-08-15'),
|
|
||||||
});
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import { describe, expect, it } from 'vitest';
|
|
||||||
import { dateFromObjectId, generateMongoFilter, objectIdFromDate, objectIdSyntaxFromDate } from './mongo-objectid-converter.service';
|
|
||||||
|
|
||||||
describe('mongo-objectid-converter', () => {
|
|
||||||
describe('objectIdFromDate', () => {
|
|
||||||
it('convert a Date to ObjectId', () => {
|
|
||||||
expect(objectIdFromDate(new Date(Date.UTC(2024, 0, 1)))).to.eql('659200800000000000000000');
|
|
||||||
expect(objectIdFromDate(new Date(Date.UTC(2024, 0, 1, 12, 12, 12)))).to.eql('6592ac1c0000000000000000');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('objectIdSyntaxFromDate', () => {
|
|
||||||
it('convert a Date to ObjectId', () => {
|
|
||||||
expect(objectIdSyntaxFromDate(new Date(Date.UTC(2024, 0, 1)))).to.eql('ObjectId("659200800000000000000000")');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('dateFromObjectId', () => {
|
|
||||||
it('convert an ObjectId to Date', () => {
|
|
||||||
expect(dateFromObjectId('659200800000000000000000')).to.eql(new Date(Date.UTC(2024, 0, 1)));
|
|
||||||
expect(dateFromObjectId('6592ac1c0000000000000000')).to.eql(new Date(Date.UTC(2024, 0, 1, 12, 12, 12)));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('generateMongoFilter', () => {
|
|
||||||
it('convert a date to mongo query', () => {
|
|
||||||
expect(generateMongoFilter({
|
|
||||||
date: new Date(Date.UTC(2024, 0, 1, 12, 12, 12)),
|
|
||||||
tableName: 'comments',
|
|
||||||
})).to.eql('db.comments.find({_id: {$gt: ObjectId("6592ac1c0000000000000000")}})');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
export function objectIdFromDate(date: Date) {
|
|
||||||
return `${Math.floor(date.getTime() / 1000).toString(16)}0000000000000000`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function objectIdSyntaxFromDate(date: Date) {
|
|
||||||
return `ObjectId("${objectIdFromDate(date)}")`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function generateMongoFilter(
|
|
||||||
{
|
|
||||||
tableName, date, operator = 'gt',
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
tableName: string
|
|
||||||
date: Date
|
|
||||||
operator?: 'gt' | 'lt'
|
|
||||||
}) {
|
|
||||||
return `db.${tableName}.find({_id: {$${operator}: ObjectId("${objectIdFromDate(date)}")}})`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function dateFromObjectId(objectId: string) {
|
|
||||||
return new Date(Number.parseInt(objectId.substring(0, 8), 16) * 1000);
|
|
||||||
};
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { dateFromObjectId, generateMongoFilter, objectIdFromDate, objectIdSyntaxFromDate } from './mongo-objectid-converter.service';
|
|
||||||
import { withDefaultOnError } from '@/utils/defaults';
|
|
||||||
|
|
||||||
const currentTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
||||||
|
|
||||||
const objectIdInput = ref(objectIdFromDate(new Date()));
|
|
||||||
const dateOutput = computed(() =>
|
|
||||||
withDefaultOnError(() => dateFromObjectId(objectIdInput.value), 'Invalid ObjectId'),
|
|
||||||
);
|
|
||||||
|
|
||||||
const dateInput = ref(Date.now());
|
|
||||||
const dateValue = computed(() => new Date(dateInput.value));
|
|
||||||
const tableName = ref('tbl');
|
|
||||||
const objectIdOutput = computed(() =>
|
|
||||||
withDefaultOnError(() => objectIdFromDate(dateValue.value), 'Invalid Date'),
|
|
||||||
);
|
|
||||||
const objectIdSyntaxOutput = computed(() =>
|
|
||||||
withDefaultOnError(() => objectIdSyntaxFromDate(dateValue.value), 'Invalid Date'),
|
|
||||||
);
|
|
||||||
const objectIdQueryOutput = computed(() =>
|
|
||||||
withDefaultOnError(() => generateMongoFilter({ date: dateValue.value, tableName: tableName.value }), 'Invalid Date'),
|
|
||||||
);
|
|
||||||
const objectIdUTCDate = computed(() =>
|
|
||||||
dateValue.value.toISOString(),
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<c-card :title="`ObjectId to Date (${currentTimeZone})`">
|
|
||||||
<c-input-text
|
|
||||||
v-model:value="objectIdInput"
|
|
||||||
placeholder="Put your ObjectId here..."
|
|
||||||
label="ObjectId to encode"
|
|
||||||
raw-text
|
|
||||||
mb-5
|
|
||||||
/>
|
|
||||||
|
|
||||||
<n-divider />
|
|
||||||
|
|
||||||
<textarea-copyable
|
|
||||||
:value="dateOutput instanceof Date ? dateOutput.toLocaleString(undefined, { timeZoneName: 'short' }) : dateOutput"
|
|
||||||
/>
|
|
||||||
<textarea-copyable
|
|
||||||
:value="dateOutput instanceof Date ? dateOutput.toISOString() : dateOutput"
|
|
||||||
/>
|
|
||||||
</c-card>
|
|
||||||
|
|
||||||
<c-card :title="`Date to ObjectId (${currentTimeZone})`">
|
|
||||||
<n-form-item label="Date and time" label-placement="left" mb-2 flex-1>
|
|
||||||
<n-date-picker v-model:value="dateInput" type="datetime" />
|
|
||||||
</n-form-item>
|
|
||||||
|
|
||||||
<c-input-text
|
|
||||||
v-model:value="tableName"
|
|
||||||
placeholder="Put your Table Name here..."
|
|
||||||
label="Table Name"
|
|
||||||
label-position="left"
|
|
||||||
raw-text
|
|
||||||
mb-5
|
|
||||||
/>
|
|
||||||
|
|
||||||
<textarea-copyable :value="objectIdUTCDate" />
|
|
||||||
<textarea-copyable :value="objectIdOutput" />
|
|
||||||
<textarea-copyable :value="objectIdSyntaxOutput" />
|
|
||||||
<textarea-copyable :value="objectIdQueryOutput" />
|
|
||||||
</c-card>
|
|
||||||
</template>
|
|
||||||
Reference in new issue
Block a user