mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 06:40:20 +03:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23256695c3 | ||
|
|
69e660bf04 |
No files matched your search
Vendored
+5
-5
@@ -83,7 +83,6 @@ declare module '@vue/runtime-core' {
|
||||
GitMemo: typeof import('./src/tools/git-memo/git-memo.vue')['default']
|
||||
'GitMemo.content': typeof import('./src/tools/git-memo/git-memo.content.md')['default']
|
||||
HashText: typeof import('./src/tools/hash-text/hash-text.vue')['default']
|
||||
HexFileConverter: typeof import('./src/tools/hex-file-converter/hex-file-converter.vue')['default']
|
||||
HmacGenerator: typeof import('./src/tools/hmac-generator/hmac-generator.vue')['default']
|
||||
'Home.page': typeof import('./src/pages/Home.page.vue')['default']
|
||||
HtmlEntities: typeof import('./src/tools/html-entities/html-entities.vue')['default']
|
||||
@@ -136,16 +135,16 @@ declare module '@vue/runtime-core' {
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||
NGi: typeof import('naive-ui')['NGi']
|
||||
NGrid: typeof import('naive-ui')['NGrid']
|
||||
NH1: typeof import('naive-ui')['NH1']
|
||||
NH3: typeof import('naive-ui')['NH3']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NLayout: typeof import('naive-ui')['NLayout']
|
||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NRadio: typeof import('naive-ui')['NRadio']
|
||||
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NTable: typeof import('naive-ui')['NTable']
|
||||
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']
|
||||
@@ -167,6 +166,7 @@ declare module '@vue/runtime-core' {
|
||||
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']
|
||||
StacktracePrettier: typeof import('./src/tools/stacktrace-prettier/stacktrace-prettier.vue')['default']
|
||||
StringObfuscator: typeof import('./src/tools/string-obfuscator/string-obfuscator.vue')['default']
|
||||
SvgPlaceholderGenerator: typeof import('./src/tools/svg-placeholder-generator/svg-placeholder-generator.vue')['default']
|
||||
TemperatureConverter: typeof import('./src/tools/temperature-converter/temperature-converter.vue')['default']
|
||||
|
||||
+5
-1
@@ -58,6 +58,7 @@
|
||||
"cronstrue": "^2.26.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"date-fns": "^2.29.3",
|
||||
"dom-to-image-more": "^3.4.5",
|
||||
"dompurify": "^3.0.6",
|
||||
"email-normalizer": "^1.0.0",
|
||||
"emojilib": "^3.0.10",
|
||||
@@ -67,8 +68,10 @@
|
||||
"highlight.js": "^11.7.0",
|
||||
"iarna-toml-esm": "^3.0.5",
|
||||
"ibantools": "^4.3.3",
|
||||
"javastack.js": "^1.0.2",
|
||||
"js-base64": "^3.7.6",
|
||||
"json5": "^2.2.3",
|
||||
"jsstack.js": "^2.0.0",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"libphonenumber-js": "^1.10.28",
|
||||
"lodash": "^4.17.21",
|
||||
@@ -79,11 +82,13 @@
|
||||
"monaco-editor": "^0.43.0",
|
||||
"naive-ui": "^2.35.0",
|
||||
"netmask": "^2.0.2",
|
||||
"netstack.js": "^2.0.0",
|
||||
"node-forge": "^1.3.1",
|
||||
"oui-data": "^1.0.10",
|
||||
"pdf-signature-reader": "^1.4.2",
|
||||
"pinia": "^2.0.34",
|
||||
"plausible-tracker": "^0.3.8",
|
||||
"pythonstack.js": "^1.0.2",
|
||||
"qrcode": "^1.5.1",
|
||||
"randexp": "^0.5.3",
|
||||
"sql-formatter": "^13.0.0",
|
||||
@@ -139,7 +144,6 @@
|
||||
"unplugin-icons": "^0.17.0",
|
||||
"unplugin-vue-components": "^0.25.0",
|
||||
"vite": "^4.4.9",
|
||||
"vite-plugin-node-polyfills": "^0.22.0",
|
||||
"vite-plugin-pwa": "^0.16.0",
|
||||
"vite-plugin-vue-markdown": "^0.23.5",
|
||||
"vite-svg-loader": "^4.0.0",
|
||||
|
||||
Generated
+654
-641
File diff suppressed because it is too large.
Load diff
@@ -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 });
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { Buffer } from 'node:buffer';
|
||||
import type { Ref } from 'vue';
|
||||
import { useCopy } from '@/composable/copy';
|
||||
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
|
||||
|
||||
const fileName = ref('');
|
||||
const fileExtension = ref('');
|
||||
const hexInput = ref('');
|
||||
const base64Input = computed(() => {
|
||||
const hexString = hexInput.value?.replace(/^(?:0x|&H|\\x)/gi, '').replace(/[^\da-f]/gi, '');
|
||||
try {
|
||||
return `data:application/octet-stream;base64,${Buffer.from(hexString, 'hex').toString('base64')}`;
|
||||
}
|
||||
catch {
|
||||
return '';
|
||||
}
|
||||
});
|
||||
const { download } = useDownloadFileFromBase64(
|
||||
{
|
||||
source: base64Input,
|
||||
filename: fileName,
|
||||
extension: fileExtension,
|
||||
});
|
||||
|
||||
function downloadFile() {
|
||||
try {
|
||||
download();
|
||||
}
|
||||
catch (_) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
function buf2hex(buffer: ArrayBuffer, separator: string): string {
|
||||
return [...new Uint8Array(buffer)]
|
||||
.map(x => x.toString(16).padStart(2, '0'))
|
||||
.join(separator);
|
||||
}
|
||||
|
||||
async function ReadFileAsHex(file: File, separator: string = ' '): Promise<string> {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
resolve(buf2hex(reader.result as ArrayBuffer, separator));
|
||||
};
|
||||
reader.onerror = () => reject(reader.error?.toString());
|
||||
reader.readAsArrayBuffer(file);
|
||||
});
|
||||
}
|
||||
|
||||
const separator = useStorage('hex-converter:sep', ' ');
|
||||
const fileInput = ref() as Ref<File>;
|
||||
const prefix = useStorage('hex-converter:prefix', '');
|
||||
const fileHex = computedAsync(async () => {
|
||||
const file = fileInput.value;
|
||||
const sep = separator.value;
|
||||
const pref = prefix.value;
|
||||
|
||||
return pref + await ReadFileAsHex(file, sep);
|
||||
});
|
||||
const { copy: copyFileHex } = useCopy({ source: fileHex, text: 'Hex string copied to the clipboard' });
|
||||
|
||||
function onUpload(file: File) {
|
||||
if (file) {
|
||||
fileInput.value = file;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<c-card title="HEX to file">
|
||||
<n-grid cols="3" x-gap="12">
|
||||
<n-gi span="2">
|
||||
<c-input-text
|
||||
v-model:value="fileName"
|
||||
label="File Name"
|
||||
placeholder="Download filename"
|
||||
mb-2
|
||||
/>
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<c-input-text
|
||||
v-model:value="fileExtension"
|
||||
label="Extension"
|
||||
placeholder="Extension"
|
||||
/>
|
||||
</n-gi>
|
||||
</n-grid>
|
||||
|
||||
<n-form-item label="Content in Hex">
|
||||
<c-input-text
|
||||
v-model:value="hexInput"
|
||||
multiline
|
||||
placeholder="Put your Hex file string here..."
|
||||
rows="5"
|
||||
/>
|
||||
</n-form-item>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<div flex justify-center>
|
||||
<c-button :disabled="hexInput === ''" @click="downloadFile()">
|
||||
Download file
|
||||
</c-button>
|
||||
</div>
|
||||
</c-card>
|
||||
|
||||
<c-card title="File to HEX">
|
||||
<c-file-upload
|
||||
title="Drag and drop a file here, or click to select a file"
|
||||
mb-2
|
||||
@file-upload="onUpload"
|
||||
/>
|
||||
|
||||
<c-input-text
|
||||
v-model:value="separator"
|
||||
label="Separator"
|
||||
label-position="left"
|
||||
placeholder="Separator"
|
||||
mb-2
|
||||
/>
|
||||
|
||||
<c-input-text
|
||||
v-model:value="prefix"
|
||||
label="Prefix"
|
||||
label-position="left"
|
||||
placeholder="Enter a prefix (ie, 0x, &H or empty)"
|
||||
mb-2
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<n-form-item label="File in Hex">
|
||||
<c-input-text
|
||||
:value="fileHex"
|
||||
multiline readonly
|
||||
placeholder="File in hex will be here"
|
||||
rows="5" mb-2
|
||||
/>
|
||||
</n-form-item>
|
||||
|
||||
<div flex justify-center>
|
||||
<c-button @click="copyFileHex()">
|
||||
Copy
|
||||
</c-button>
|
||||
</div>
|
||||
</c-card>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
::v-deep(.n-upload-trigger) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -1,12 +0,0 @@
|
||||
import { FileDigit } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'HEX File Converter',
|
||||
path: '/hex-file-converter',
|
||||
description: 'Convert between file and hexadecimal representation',
|
||||
keywords: ['hex', 'file', 'converter'],
|
||||
component: () => import('./hex-file-converter.vue'),
|
||||
icon: FileDigit,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
+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 hexFileConverter } from './hex-file-converter';
|
||||
import { tool as stacktracePrettier } from './stacktrace-prettier';
|
||||
|
||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||
|
||||
@@ -102,7 +102,6 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
romanNumeralConverter,
|
||||
base64StringConverter,
|
||||
base64FileConverter,
|
||||
hexFileConverter,
|
||||
colorConverter,
|
||||
caseConverter,
|
||||
textToNatoAlphabet,
|
||||
@@ -162,6 +161,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
emailNormalizer,
|
||||
regexTester,
|
||||
regexMemo,
|
||||
stacktracePrettier,
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
declare module "dom-to-image-more" {
|
||||
export function toPng(el: HTMLElement | undefined, options?: { bgcolor: string }) : Promise<string>;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Stack } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Stacktrace prettier',
|
||||
path: '/stacktrace-prettier',
|
||||
description: 'Highlight .Net and JS stacktraces',
|
||||
keywords: ['stacktrace', 'prettier', 'highlighter'],
|
||||
component: () => import('./stacktrace-prettier.vue'),
|
||||
icon: Stack,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
declare module "javastack.js" {
|
||||
export default function javastack(selector: string, options: { prettyprint: boolean }) : void;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
declare module "jsstack.js" {
|
||||
export default function jsstack(selector: string) : void;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
declare module "netstack.js" {
|
||||
export default class netstack {
|
||||
constructor(el: HTMLElement | undefined, options: { prettyprint: boolean })
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
declare module "pythonstack.js" {
|
||||
export default function pythonstack(selector: string, options: { prettyprint: boolean }) : void;
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
<script setup lang="ts">
|
||||
import JSStack from 'jsstack.js';
|
||||
import JavaStack from 'javastack.js';
|
||||
import PythonStack from 'pythonstack.js';
|
||||
import NetStack from 'netstack.js';
|
||||
import domtoimage from 'dom-to-image-more';
|
||||
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||
import { useStyleStore } from '@/stores/style.store';
|
||||
import { useCopy } from '@/composable/copy';
|
||||
|
||||
const styleStore = useStyleStore();
|
||||
|
||||
const stackType = useQueryParamOrStorage<'net' | 'js' | 'java' | 'python'>({ name: 'type', storageName: 'stackfmt:type', defaultValue: 'net' });
|
||||
const stackTrace = ref('');
|
||||
const formatedStackTrace = ref<HTMLElement>();
|
||||
|
||||
const stackTraceText = ref('');
|
||||
watchEffect(() => {
|
||||
if (!formatedStackTrace.value) {
|
||||
return;
|
||||
}
|
||||
let cleanedStackTrace;
|
||||
try {
|
||||
cleanedStackTrace = JSON.parse(stackTrace.value);
|
||||
}
|
||||
catch (_) {
|
||||
cleanedStackTrace = stackTrace.value.replace(/(\\r)?\\n/g, '\n').replace(/(?:^['"])|(?:['"]$)/, '');
|
||||
};
|
||||
try {
|
||||
if (stackType.value === 'js') {
|
||||
formatedStackTrace.value.textContent = cleanedStackTrace;
|
||||
JSStack('.stacktrace');
|
||||
}
|
||||
else if (stackType.value === 'java') {
|
||||
formatedStackTrace.value.textContent = cleanedStackTrace;
|
||||
JavaStack('.stacktrace', { prettyprint: true });
|
||||
}
|
||||
else if (stackType.value === 'python') {
|
||||
formatedStackTrace.value.textContent = cleanedStackTrace;
|
||||
PythonStack('.stacktrace', { prettyprint: true });
|
||||
}
|
||||
else if (stackType.value === 'net') {
|
||||
formatedStackTrace.value.innerText = cleanedStackTrace;
|
||||
const _ = new NetStack(formatedStackTrace.value, { prettyprint: true });
|
||||
}
|
||||
stackTraceText.value = formatedStackTrace.value.innerText;
|
||||
}
|
||||
catch {}
|
||||
});
|
||||
|
||||
const stackTraceMarkdown = computed(() => {
|
||||
let lang;
|
||||
if (stackType.value === 'net') {
|
||||
lang = 'csharp';
|
||||
}
|
||||
else if (stackType.value === 'js') {
|
||||
lang = 'javascript';
|
||||
}
|
||||
else if (stackType.value === 'java') {
|
||||
lang = 'java';
|
||||
}
|
||||
else if (stackType.value === 'python') {
|
||||
lang = 'python';
|
||||
}
|
||||
return `\`\`\`${lang}\n${formatedStackTrace.value?.innerText}\n\`\`\``;
|
||||
});
|
||||
|
||||
const { copy: copyText } = useCopy({ source: stackTraceText, text: 'Formatted stacktrace copied to the clipboard' });
|
||||
const { copy: copyMarkdown } = useCopy({ source: stackTraceMarkdown, text: 'Markdown Formatted stacktrace copied to the clipboard' });
|
||||
|
||||
async function downloadAsPNG() {
|
||||
const dataUrl = await domtoimage.toPng(formatedStackTrace.value, { bgcolor: styleStore.isDarkTheme ? '#333' : '#fff' });
|
||||
const link = document.createElement('a');
|
||||
link.download = 'stacktrace.png';
|
||||
link.href = dataUrl;
|
||||
link.click();
|
||||
}
|
||||
|
||||
const wrap = ref(true);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div max-w-600px>
|
||||
<n-radio-group v-model:value="stackType" name="radiogroup" mb-2 flex justify-center>
|
||||
<n-space>
|
||||
<n-radio
|
||||
value="net"
|
||||
label=".Net"
|
||||
/>
|
||||
<n-radio
|
||||
value="js"
|
||||
label="Javascript"
|
||||
/>
|
||||
<n-radio
|
||||
value="python"
|
||||
label="Python"
|
||||
/>
|
||||
<n-radio
|
||||
value="java"
|
||||
label="Java"
|
||||
/>
|
||||
</n-space>
|
||||
</n-radio-group>
|
||||
|
||||
<div mb-2 flex justify-center>
|
||||
<n-checkbox v-model:checked="wrap">
|
||||
Wrap lines?
|
||||
</n-checkbox>
|
||||
</div>
|
||||
<c-input-text
|
||||
v-model:value="stackTrace"
|
||||
label="Stacktrace"
|
||||
placeholder="Paste your stacktrace here.."
|
||||
multiline
|
||||
rows="5"
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<pre ref="formatedStackTrace" class="stacktrace" :style="{ padding: '20px', whiteSpace: wrap ? 'pre-wrap' : 'pre', overflowX: 'auto', wordBreak: 'break-all' }" />
|
||||
|
||||
<div v-if="stackTraceText" flex justify-center gap-1>
|
||||
<c-button @click="copyText()">
|
||||
Copy Formatted (Text)
|
||||
</c-button>
|
||||
<c-button @click="copyMarkdown()">
|
||||
Copy Formatted (Markdown)
|
||||
</c-button>
|
||||
<c-button @click="downloadAsPNG()">
|
||||
Download as PNG
|
||||
</c-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
::v-deep(.stacktrace) {
|
||||
pre, code {background-color:#333 !important; color: #fff !important;}
|
||||
.st-type {color: #0a8472; font-weight: bolder;}
|
||||
.st-method {color: #70c9ba; font-weight: bolder;}
|
||||
.st-frame-params {color: #ffffff; font-weight: normal;}
|
||||
.st-param-type {color: #0a8472;}
|
||||
.st-param-name {color: #ffffff;}
|
||||
.st-file {color:#f8b068;}
|
||||
.st-line {color:#ff4f68;}
|
||||
.st-methodName {color: #70c9ba;font-weight: bolder;}
|
||||
.st-column {color: #f8b068;}
|
||||
.st-lineNumber {color: #ff4f68;}
|
||||
.st-fileName {color: #85dbff;}
|
||||
.st-intro {color: #0044dd;}
|
||||
.st-exception {color: #e40000;}
|
||||
}
|
||||
</style>
|
||||
@@ -15,7 +15,6 @@ import { VitePWA } from 'vite-plugin-pwa';
|
||||
import markdown from 'vite-plugin-vue-markdown';
|
||||
import svgLoader from 'vite-svg-loader';
|
||||
import { configDefaults } from 'vitest/config';
|
||||
import { nodePolyfills } from 'vite-plugin-node-polyfills'
|
||||
|
||||
const baseUrl = process.env.BASE_URL ?? '/';
|
||||
|
||||
@@ -98,7 +97,6 @@ export default defineConfig({
|
||||
resolvers: [NaiveUiResolver(), IconsResolver({ prefix: 'icon' })],
|
||||
}),
|
||||
Unocss(),
|
||||
nodePolyfills(),
|
||||
],
|
||||
base: baseUrl,
|
||||
resolve: {
|
||||
|
||||
Reference in new issue
Block a user