Compare commits

..
13 changed files with 421 additions and 838 deletions

No files matched your search

+8 -5
View File
@@ -108,6 +108,7 @@ declare module '@vue/runtime-core' {
Ipv4SubnetCalculator: typeof import('./src/tools/ipv4-subnet-calculator/ipv4-subnet-calculator.vue')['default']
Ipv6UlaGenerator: typeof import('./src/tools/ipv6-ula-generator/ipv6-ula-generator.vue')['default']
JsonDiff: typeof import('./src/tools/json-diff/json-diff.vue')['default']
JsonEditor: typeof import('./src/tools/json-editor/json-editor.vue')['default']
JsonMinify: typeof import('./src/tools/json-minify/json-minify.vue')['default']
JsonToCsv: typeof import('./src/tools/json-to-csv/json-to-csv.vue')['default']
JsonToToml: typeof import('./src/tools/json-to-toml/json-to-toml.vue')['default']
@@ -135,16 +136,19 @@ declare module '@vue/runtime-core' {
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDivider: typeof import('naive-ui')['NDivider']
NEllipsis: typeof import('naive-ui')['NEllipsis']
NForm: typeof import('naive-ui')['NForm']
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
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']
NRadio: typeof import('naive-ui')['NRadio']
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
NSpace: typeof import('naive-ui')['NSpace']
NTable: typeof import('naive-ui')['NTable']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSlider: typeof import('naive-ui')['NSlider']
NSpin: typeof import('naive-ui')['NSpin']
NSwitch: typeof import('naive-ui')['NSwitch']
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']
@@ -166,7 +170,6 @@ 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']
+2 -5
View File
@@ -58,7 +58,6 @@
"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",
@@ -68,10 +67,9 @@
"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",
"json-editor-vue": "^0.16.0",
"json5": "^2.2.3",
"jsstack.js": "^2.0.0",
"jwt-decode": "^3.1.2",
"libphonenumber-js": "^1.10.28",
"lodash": "^4.17.21",
@@ -82,13 +80,11 @@
"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",
@@ -97,6 +93,7 @@
"unicode-emoji-json": "^0.4.0",
"unplugin-auto-import": "^0.16.4",
"uuid": "^9.0.0",
"vanilla-jsoneditor": "^0.23.8",
"vue": "^3.3.4",
"vue-i18n": "^9.9.1",
"vue-router": "^4.1.6",
+343 -644
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -1,8 +1,8 @@
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 jsonEditor } from './json-editor';
import { tool as emailNormalizer } from './email-normalizer';
import { tool as stacktracePrettier } from './stacktrace-prettier';
import { tool as asciiTextDrawer } from './ascii-text-drawer';
@@ -158,10 +158,10 @@ export const toolsByCategory: ToolCategory[] = [
dockerRunToDockerComposeConverter,
xmlFormatter,
yamlViewer,
jsonEditor,
emailNormalizer,
regexTester,
regexMemo,
stacktracePrettier,
],
},
{
+12
View File
@@ -0,0 +1,12 @@
import { Braces } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'JSON Editor',
path: '/json-editor',
description: 'Edit JSON content',
keywords: ['json', 'editor'],
component: () => import('./json-editor.vue'),
icon: Braces,
createdAt: new Date('2024-05-11'),
});
+54
View File
@@ -0,0 +1,54 @@
<script setup lang="ts">
import JsonEditorVue from 'json-editor-vue';
import { type AfterSelection, type InsideSelection, type JSONEditorSelection, type KeySelection, type MultiSelection, type ValueSelection, isAfterSelection, isInsideSelection, isKeySelection, isMultiSelection, isValueSelection, stringifyJSONPath } from 'vanilla-jsoneditor';
import 'vanilla-jsoneditor/themes/jse-theme-dark.css';
import { useStyleStore } from '@/stores/style.store';
const styleStore = useStyleStore();
const jsonText = ref('{ "a": { "array": [1, 2, 3] } }');
const jsonPath = ref('');
function updateJsonPath(selection: JSONEditorSelection) {
if (isAfterSelection (selection)) {
jsonPath.value = `$.${stringifyJSONPath((selection as AfterSelection).path)}`;
}
else if (isInsideSelection (selection)) {
jsonPath.value = `$.${stringifyJSONPath((selection as InsideSelection).path)}`;
}
else if (isKeySelection (selection)) {
jsonPath.value = `$.${stringifyJSONPath((selection as KeySelection).path)}`;
}
else if (isValueSelection (selection)) {
jsonPath.value = `$.${stringifyJSONPath((selection as ValueSelection).path)}`;
}
else if (isMultiSelection (selection)) {
jsonPath.value = `$.${stringifyJSONPath((selection as MultiSelection).focusPath)}`;
}
else {
jsonPath.value = 'No available in this mode';
}
}
</script>
<template>
<div>
<JsonEditorVue
v-model="jsonText"
mode="text"
:class="styleStore.isDarkTheme ? 'jse-theme-dark' : ''"
:on-select="updateJsonPath"
mb-2
/>
<n-form-item label="Current Selected Node JSONPath:">
<textarea-copyable :value="jsonPath" />
</n-form-item>
<n-divider />
<n-form-item label="Your edited JSON:">
<textarea-copyable :value="jsonText" language="json" />
</n-form-item>
</div>
</template>
-3
View File
@@ -1,3 +0,0 @@
declare module "dom-to-image-more" {
export function toPng(el: HTMLElement | undefined, options?: { bgcolor: string }) : Promise<string>;
}
-12
View File
@@ -1,12 +0,0 @@
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'),
});
-3
View File
@@ -1,3 +0,0 @@
declare module "javastack.js" {
export default function javastack(selector: string, options: { prettyprint: boolean }) : void;
}
-3
View File
@@ -1,3 +0,0 @@
declare module "jsstack.js" {
export default function jsstack(selector: string) : void;
}
-5
View File
@@ -1,5 +0,0 @@
declare module "netstack.js" {
export default class netstack {
constructor(el: HTMLElement | undefined, options: { prettyprint: boolean })
}
}
-3
View File
@@ -1,3 +0,0 @@
declare module "pythonstack.js" {
export default function pythonstack(selector: string, options: { prettyprint: boolean }) : void;
}
@@ -1,153 +0,0 @@
<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>