mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-27 07:58:54 +03:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5df0b8c7f | ||
|
|
ed77345767 | ||
|
|
adb0249f29 | ||
|
|
e9ac8f5a79 | ||
|
|
722de30113 | ||
|
|
2da74fa121 |
No files matched your search
Vendored
+2
-5
@@ -11,6 +11,7 @@ declare module '@vue/runtime-core' {
|
||||
export interface GlobalComponents {
|
||||
'404.page': typeof import('./src/pages/404.page.vue')['default']
|
||||
About: typeof import('./src/pages/About.vue')['default']
|
||||
AiPromptSplitter: typeof import('./src/tools/ai-prompt-splitter/ai-prompt-splitter.vue')['default']
|
||||
App: typeof import('./src/App.vue')['default']
|
||||
AsciiTextDrawer: typeof import('./src/tools/ascii-text-drawer/ascii-text-drawer.vue')['default']
|
||||
'Base.layout': typeof import('./src/layouts/base.layout.vue')['default']
|
||||
@@ -101,7 +102,6 @@ declare module '@vue/runtime-core' {
|
||||
IconMdiSearch: typeof import('~icons/mdi/search')['default']
|
||||
IconMdiTranslate: typeof import('~icons/mdi/translate')['default']
|
||||
IconMdiTriangleDown: typeof import('~icons/mdi/triangle-down')['default']
|
||||
ImageConverter: typeof import('./src/tools/image-converter/image-converter.vue')['default']
|
||||
InputCopyable: typeof import('./src/components/InputCopyable.vue')['default']
|
||||
IntegerBaseConverter: typeof import('./src/tools/integer-base-converter/integer-base-converter.vue')['default']
|
||||
Ipv4AddressConverter: typeof import('./src/tools/ipv4-address-converter/ipv4-address-converter.vue')['default']
|
||||
@@ -140,14 +140,11 @@ declare module '@vue/runtime-core' {
|
||||
NH1: typeof import('naive-ui')['NH1']
|
||||
NH3: typeof import('naive-ui')['NH3']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||
NLayout: typeof import('naive-ui')['NLayout']
|
||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NProgress: typeof import('naive-ui')['NProgress']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSpin: typeof import('naive-ui')['NSpin']
|
||||
NSwitch: typeof import('naive-ui')['NSwitch']
|
||||
NTag: typeof import('naive-ui')['NTag']
|
||||
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']
|
||||
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
|
||||
|
||||
+1
-4
@@ -54,6 +54,7 @@
|
||||
"@vueuse/router": "^10.0.0",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"change-case": "^4.1.2",
|
||||
"chatgpt-prompt-splitter": "^1.0.5",
|
||||
"colord": "^2.9.3",
|
||||
"composerize-ts": "^0.6.2",
|
||||
"country-code-lookup": "^0.1.0",
|
||||
@@ -70,7 +71,6 @@
|
||||
"highlight.js": "^11.7.0",
|
||||
"iarna-toml-esm": "^3.0.5",
|
||||
"ibantools": "^4.3.3",
|
||||
"image-in-browser": "^3.2.0",
|
||||
"js-base64": "^3.7.6",
|
||||
"json5": "^2.2.3",
|
||||
"jwt-decode": "^3.1.2",
|
||||
@@ -90,9 +90,7 @@
|
||||
"plausible-tracker": "^0.3.8",
|
||||
"qrcode": "^1.5.1",
|
||||
"randexp": "^0.5.3",
|
||||
"roboto-base64": "^0.1.2",
|
||||
"sql-formatter": "^13.0.0",
|
||||
"svg2png-wasm": "^1.4.1",
|
||||
"ua-parser-js": "^1.0.35",
|
||||
"ulid": "^2.3.0",
|
||||
"unicode-emoji-json": "^0.4.0",
|
||||
@@ -103,7 +101,6 @@
|
||||
"vue-router": "^4.1.6",
|
||||
"vue-shadow-dom": "^4.2.0",
|
||||
"vue-tsc": "^1.8.1",
|
||||
"webp-converter-browser": "^1.0.4",
|
||||
"vuedraggable": "^4.1.0",
|
||||
"xml-formatter": "^3.3.2",
|
||||
"xml-js": "^1.6.11",
|
||||
|
||||
Generated
+1927
-2366
File diff suppressed because it is too large.
Load diff
Binary file not shown.
@@ -1,7 +1,6 @@
|
||||
import { extension as getExtensionFromMimeType, extension as getMimeTypeFromExtension } from 'mime-types';
|
||||
import type { MaybeRef, Ref } from 'vue';
|
||||
import type { Ref } from 'vue';
|
||||
import _ from 'lodash';
|
||||
import { get } from '@vueuse/core';
|
||||
|
||||
export {
|
||||
getMimeTypeFromBase64,
|
||||
@@ -76,11 +75,21 @@ function downloadFromBase64({ sourceValue, filename, extension, fileMimeType }:
|
||||
}
|
||||
|
||||
function useDownloadFileFromBase64(
|
||||
{ source, filename, extension }:
|
||||
{ source: MaybeRef<string>; filename?: MaybeRef<string>; extension?: MaybeRef<string> }) {
|
||||
{ source, filename, extension, fileMimeType }:
|
||||
{ source: Ref<string>; filename?: string; extension?: string; fileMimeType?: string }) {
|
||||
return {
|
||||
download() {
|
||||
downloadFromBase64({ sourceValue: get(source), filename: get(filename), extension: get(extension) });
|
||||
downloadFromBase64({ sourceValue: source.value, filename, extension, fileMimeType });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function useDownloadFileFromBase64Refs(
|
||||
{ source, filename, extension }:
|
||||
{ source: Ref<string>; filename?: Ref<string>; extension?: Ref<string> }) {
|
||||
return {
|
||||
download() {
|
||||
downloadFromBase64({ sourceValue: source.value, filename: filename?.value, extension: extension?.value });
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -107,13 +116,3 @@ function previewImageFromBase64(base64String: string): HTMLImageElement {
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
function useDownloadFileFromBase64Refs(
|
||||
{ source, filename, extension }:
|
||||
{ source: Ref<string>; filename?: Ref<string>; extension?: Ref<string> }) {
|
||||
return {
|
||||
download() {
|
||||
downloadFromBase64({ sourceValue: source.value, filename: filename?.value, extension: extension?.value });
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -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" />
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<script setup lang="ts">
|
||||
import promptSplitter from 'chatgpt-prompt-splitter';
|
||||
import { useValidation } from '@/composable/validation';
|
||||
|
||||
const prompt = ref('');
|
||||
const splitLength = ref(1024);
|
||||
|
||||
const splittedPrompts = computed(() => {
|
||||
try {
|
||||
return promptSplitter({
|
||||
prompt: prompt.value,
|
||||
splitLength: splitLength.value,
|
||||
newLine: true,
|
||||
});
|
||||
}
|
||||
catch (e: any) {
|
||||
return [e.toString()];
|
||||
}
|
||||
});
|
||||
|
||||
const promptValidation = useValidation({
|
||||
source: prompt,
|
||||
rules: [
|
||||
{
|
||||
validator: v => v !== '',
|
||||
message: 'Prompt must not be empty',
|
||||
},
|
||||
],
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div style="max-width: 600px;">
|
||||
<c-card title="Prompt and options" mb-2>
|
||||
<c-input-text
|
||||
v-model:value="prompt"
|
||||
label="Full Prompt"
|
||||
multiline
|
||||
placeholder="Put your full prompt here..."
|
||||
rows="10"
|
||||
:validation="promptValidation"
|
||||
mb-2
|
||||
/>
|
||||
<n-form-item label="Character length for each chunk">
|
||||
<n-input-number v-model:value="splitLength" :min="1" />
|
||||
</n-form-item>
|
||||
</c-card>
|
||||
|
||||
<c-card title="Divided prompts">
|
||||
<div v-for="(splittedPrompt, index) in splittedPrompts" :key="index">
|
||||
<TextareaCopyable :value="splittedPrompt" />
|
||||
</div>
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,7 @@
|
||||
declare module "chatgpt-prompt-splitter" {
|
||||
export default function promptSplitter(options: {
|
||||
prompt: string
|
||||
splitLength: number
|
||||
newLine: boolean
|
||||
}): Array<string>;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Prompt } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'AI Prompt Splitter',
|
||||
path: '/ai-prompt-splitter',
|
||||
description: 'Split a long document to multiple chat (ie ChatGPT) prompts',
|
||||
keywords: ['ai', 'chatgpt', 'gpt', 'prompt', 'splitter'],
|
||||
component: () => import('./ai-prompt-splitter.vue'),
|
||||
icon: Prompt,
|
||||
createdAt: new Date('2024-07-14'),
|
||||
});
|
||||
@@ -1,181 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { Base64 } from 'js-base64';
|
||||
import type { MemoryImage } from 'image-in-browser';
|
||||
import { decodeImage, encodeBmp, encodeGif, encodeIco, encodeJpg, encodePng, encodePvr, encodeTga, encodeTiff } from 'image-in-browser';
|
||||
import { arrayBufferToWebP } from 'webp-converter-browser';
|
||||
import { createSvg2png, initialize } from 'svg2png-wasm';
|
||||
import { normal as robotoBase64 } from 'roboto-base64';
|
||||
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
|
||||
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||
|
||||
function readAsText(file: File) {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.readAsText(file);
|
||||
reader.onload = () => resolve(reader.result?.toString() ?? '');
|
||||
reader.onerror = error => reject(error);
|
||||
});
|
||||
}
|
||||
|
||||
const status = ref<'idle' | 'done' | 'error' | 'processing'>('idle');
|
||||
const file = ref<File | null>(null);
|
||||
|
||||
const svgScale = ref(2);
|
||||
const base64OutputFile = ref('');
|
||||
const fileName = ref('');
|
||||
const fileExtension = ref('');
|
||||
const { download } = useDownloadFileFromBase64(
|
||||
{
|
||||
source: base64OutputFile,
|
||||
filename: fileName,
|
||||
extension: fileExtension,
|
||||
});
|
||||
|
||||
const outputQuality = useQueryParamOrStorage({ name: 'qual', storageName: 'imgconv:q', defaultValue: 0.95 });
|
||||
const outputFormats = {
|
||||
png: {
|
||||
mime: 'image/png',
|
||||
save: (image: MemoryImage) => encodePng({ image }),
|
||||
},
|
||||
jpg: {
|
||||
mime: 'image/jpeg',
|
||||
save: (image: MemoryImage) => encodeJpg({ image, quality: outputQuality.value }),
|
||||
},
|
||||
bmp: {
|
||||
mime: 'image/bmp',
|
||||
save: (image: MemoryImage) => encodeBmp({ image }),
|
||||
},
|
||||
gif: {
|
||||
mime: 'image/gif',
|
||||
save: (image: MemoryImage) => encodeGif({ image }),
|
||||
},
|
||||
ico: {
|
||||
mime: 'image/x-icon',
|
||||
save: (image: MemoryImage) => encodeIco({ image }),
|
||||
},
|
||||
tga: {
|
||||
mime: 'image/tga',
|
||||
save: (image: MemoryImage) => encodeTga({ image }),
|
||||
},
|
||||
pvr: {
|
||||
mime: 'image/pvr',
|
||||
save: (image: MemoryImage) => encodePvr({ image }),
|
||||
},
|
||||
tif: {
|
||||
mime: 'image/tif',
|
||||
save: (image: MemoryImage) => encodeTiff({ image }),
|
||||
},
|
||||
webp: {
|
||||
mime: 'image/webp',
|
||||
save: () => null,
|
||||
},
|
||||
};
|
||||
|
||||
const outputFormat = useQueryParamOrStorage({ name: 'fmt', storageName: 'imgconv:fmt', defaultValue: 'png' });
|
||||
const outputFormatHasQuality = computed(() => {
|
||||
return outputFormat.value === 'jpg';
|
||||
});
|
||||
|
||||
const svgWasmLoaded = ref(false);
|
||||
|
||||
async function onFilesUploaded(uploadedFiles: File[]) {
|
||||
for (const file of uploadedFiles) {
|
||||
await onFileUploaded(file);
|
||||
}
|
||||
}
|
||||
async function onFileUploaded(uploadedFile: File) {
|
||||
const outputFormatValue = outputFormat.value;
|
||||
file.value = uploadedFile;
|
||||
let fileBuffer = new Uint8Array(await uploadedFile.arrayBuffer());
|
||||
|
||||
fileName.value = uploadedFile.name.replace(/\.\w+$/, '');
|
||||
status.value = 'processing';
|
||||
try {
|
||||
if (outputFormatValue === 'webp') {
|
||||
const encodedImage = await arrayBufferToWebP(fileBuffer);
|
||||
fileExtension.value = 'webp';
|
||||
base64OutputFile.value = `data:image/webp;base64,${Base64.fromUint8Array(new Uint8Array(await encodedImage.arrayBuffer()))}`;
|
||||
}
|
||||
else {
|
||||
if (uploadedFile.type === 'image/svg+xml') {
|
||||
if (!svgWasmLoaded.value) {
|
||||
await initialize(fetch('/svg2png_wasm_bg.wasm'));
|
||||
svgWasmLoaded.value = true;
|
||||
}
|
||||
const svg2png = createSvg2png({
|
||||
fonts: [Base64.toUint8Array(robotoBase64)],
|
||||
});
|
||||
fileBuffer = await svg2png(await readAsText(uploadedFile), { scale: svgScale.value });
|
||||
svg2png.dispose();
|
||||
}
|
||||
const decodedImage = decodeImage({
|
||||
data: fileBuffer,
|
||||
});
|
||||
|
||||
if (decodedImage == null) {
|
||||
throw new Error('Invalid Image file!');
|
||||
};
|
||||
|
||||
const outConfig = outputFormats[outputFormatValue as (keyof typeof outputFormats)];
|
||||
const encodedImage = outConfig.save(decodedImage);
|
||||
fileExtension.value = outputFormatValue;
|
||||
base64OutputFile.value = `data:${outConfig.mime};base64,${Base64.fromUint8Array(encodedImage!)}`;
|
||||
}
|
||||
status.value = 'done';
|
||||
|
||||
download();
|
||||
}
|
||||
catch (e) {
|
||||
status.value = 'error';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<h4>First, select output options:</h4>
|
||||
|
||||
<c-select
|
||||
v-model:value="outputFormat"
|
||||
label="Output format:"
|
||||
label-position="left"
|
||||
:options="Object.keys(outputFormats)"
|
||||
placeholder="Select output format"
|
||||
mb-2
|
||||
/>
|
||||
|
||||
<div mb-2 flex justify-center>
|
||||
<n-form-item v-if="outputFormatHasQuality" label="Output quality:" label-placement="left">
|
||||
<n-input-number v-model:value="outputQuality" :max="100" :min="0" w-full />
|
||||
</n-form-item>
|
||||
<n-form-item label="SVG scaling:" label-placement="left">
|
||||
<n-input-number v-model:value="svgScale" :min="0" />
|
||||
</n-form-item>
|
||||
</div>
|
||||
|
||||
<h4>Then, drag and drop your images below and they will be converted and downloaded immediately:</h4>
|
||||
|
||||
<div style="flex: 0 0 100%" mb-2>
|
||||
<div mx-auto max-w-600px>
|
||||
<c-file-upload
|
||||
title="Drag and drop images files here, or click to select some files"
|
||||
accept="image/*"
|
||||
paste-image
|
||||
multiple
|
||||
@file-upload="onFileUploaded"
|
||||
@files-upload="onFilesUploaded"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div mt-3 flex justify-center>
|
||||
<c-alert v-if="status === 'error'" type="error">
|
||||
An error occured processing {{ fileName }}
|
||||
</c-alert>
|
||||
<n-spin
|
||||
v-if="status === 'processing'"
|
||||
size="small"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,12 +0,0 @@
|
||||
import { PictureInPicture } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Image Formats Converter',
|
||||
path: '/image-converter',
|
||||
description: 'Convert images from one format to another',
|
||||
keywords: ['image', 'bmp', 'gif', 'ico', 'jpg', 'png', 'tga', 'pvr', 'tiff', 'pnm', 'pbm', 'pgm', 'ppm', 'psd', 'webp', 'converter'],
|
||||
component: () => import('./image-converter.vue'),
|
||||
icon: PictureInPicture,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
declare module 'roboto-base64' {
|
||||
export const normal: string;
|
||||
}
|
||||
+3
-8
@@ -2,7 +2,6 @@ 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 imageConverter } from './image-converter';
|
||||
|
||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||
|
||||
@@ -10,6 +9,7 @@ import { tool as textToUnicode } from './text-to-unicode';
|
||||
import { tool as safelinkDecoder } from './safelink-decoder';
|
||||
import { tool as xmlToJson } from './xml-to-json';
|
||||
import { tool as jsonToXml } from './json-to-xml';
|
||||
import { tool as aiPromptSplitter } from './ai-prompt-splitter';
|
||||
import { tool as regexTester } from './regex-tester';
|
||||
import { tool as regexMemo } from './regex-memo';
|
||||
import { tool as markdownToHtml } from './markdown-to-html';
|
||||
@@ -142,13 +142,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
},
|
||||
{
|
||||
name: 'Images and videos',
|
||||
components: [
|
||||
qrCodeGenerator,
|
||||
wifiQrCodeGenerator,
|
||||
svgPlaceholderGenerator,
|
||||
cameraRecorder,
|
||||
imageConverter,
|
||||
],
|
||||
components: [qrCodeGenerator, wifiQrCodeGenerator, svgPlaceholderGenerator, cameraRecorder],
|
||||
},
|
||||
{
|
||||
name: 'Development',
|
||||
@@ -190,6 +184,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
stringObfuscator,
|
||||
textDiff,
|
||||
numeronymGenerator,
|
||||
aiPromptSplitter,
|
||||
asciiTextDrawer,
|
||||
],
|
||||
},
|
||||
|
||||
@@ -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