mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 23:00:19 +03:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5c4e5d026 |
No files matched your search
Vendored
+2
-34
@@ -82,6 +82,7 @@ declare module '@vue/runtime-core' {
|
||||
FormatTransformer: typeof import('./src/components/FormatTransformer.vue')['default']
|
||||
GitMemo: typeof import('./src/tools/git-memo/git-memo.vue')['default']
|
||||
'GitMemo.content': typeof import('./src/tools/git-memo/git-memo.content.md')['default']
|
||||
HarSanitizer: typeof import('./src/tools/har-sanitizer/har-sanitizer.vue')['default']
|
||||
HashText: typeof import('./src/tools/hash-text/hash-text.vue')['default']
|
||||
HmacGenerator: typeof import('./src/tools/hmac-generator/hmac-generator.vue')['default']
|
||||
'Home.page': typeof import('./src/pages/Home.page.vue')['default']
|
||||
@@ -90,28 +91,17 @@ declare module '@vue/runtime-core' {
|
||||
HttpStatusCodes: typeof import('./src/tools/http-status-codes/http-status-codes.vue')['default']
|
||||
IbanValidatorAndParser: typeof import('./src/tools/iban-validator-and-parser/iban-validator-and-parser.vue')['default']
|
||||
'IconMdi:brushVariant': typeof import('~icons/mdi/brush-variant')['default']
|
||||
'IconMdi:contentCopy': typeof import('~icons/mdi/content-copy')['default']
|
||||
'IconMdi:kettleSteamOutline': typeof import('~icons/mdi/kettle-steam-outline')['default']
|
||||
IconMdiArrowDown: typeof import('~icons/mdi/arrow-down')['default']
|
||||
IconMdiArrowRightBottom: typeof import('~icons/mdi/arrow-right-bottom')['default']
|
||||
IconMdiCamera: typeof import('~icons/mdi/camera')['default']
|
||||
IconMdiChevronDown: typeof import('~icons/mdi/chevron-down')['default']
|
||||
IconMdiChevronRight: typeof import('~icons/mdi/chevron-right')['default']
|
||||
IconMdiClose: typeof import('~icons/mdi/close')['default']
|
||||
IconMdiContentCopy: typeof import('~icons/mdi/content-copy')['default']
|
||||
IconMdiDeleteOutline: typeof import('~icons/mdi/delete-outline')['default']
|
||||
IconMdiDownload: typeof import('~icons/mdi/download')['default']
|
||||
IconMdiEye: typeof import('~icons/mdi/eye')['default']
|
||||
IconMdiEyeOff: typeof import('~icons/mdi/eye-off')['default']
|
||||
IconMdiHeart: typeof import('~icons/mdi/heart')['default']
|
||||
IconMdiPause: typeof import('~icons/mdi/pause')['default']
|
||||
IconMdiPlay: typeof import('~icons/mdi/play')['default']
|
||||
IconMdiRecord: typeof import('~icons/mdi/record')['default']
|
||||
IconMdiRefresh: typeof import('~icons/mdi/refresh')['default']
|
||||
IconMdiSearch: typeof import('~icons/mdi/search')['default']
|
||||
IconMdiTranslate: typeof import('~icons/mdi/translate')['default']
|
||||
IconMdiTriangleDown: typeof import('~icons/mdi/triangle-down')['default']
|
||||
IconMdiVideo: typeof import('~icons/mdi/video')['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']
|
||||
@@ -134,47 +124,25 @@ declare module '@vue/runtime-core' {
|
||||
MacAddressLookup: typeof import('./src/tools/mac-address-lookup/mac-address-lookup.vue')['default']
|
||||
MarkdownToHtml: typeof import('./src/tools/markdown-to-html/markdown-to-html.vue')['default']
|
||||
MathEvaluator: typeof import('./src/tools/math-evaluator/math-evaluator.vue')['default']
|
||||
MathFormatsConverter: typeof import('./src/tools/math-formats-converter/math-formats-converter.vue')['default']
|
||||
MenuBar: typeof import('./src/tools/html-wysiwyg-editor/editor/menu-bar.vue')['default']
|
||||
MenuBarItem: typeof import('./src/tools/html-wysiwyg-editor/editor/menu-bar-item.vue')['default']
|
||||
MenuIconItem: typeof import('./src/components/MenuIconItem.vue')['default']
|
||||
MenuLayout: typeof import('./src/components/MenuLayout.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']
|
||||
NAlert: typeof import('naive-ui')['NAlert']
|
||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
NCode: typeof import('naive-ui')['NCode']
|
||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
NDynamicInput: typeof import('naive-ui')['NDynamicInput']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NForm: typeof import('naive-ui')['NForm']
|
||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||
NGi: typeof import('naive-ui')['NGi']
|
||||
NGrid: typeof import('naive-ui')['NGrid']
|
||||
NH1: typeof import('naive-ui')['NH1']
|
||||
NH2: typeof import('naive-ui')['NH2']
|
||||
NH3: typeof import('naive-ui')['NH3']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NImage: typeof import('naive-ui')['NImage']
|
||||
NInputGroup: typeof import('naive-ui')['NInputGroup']
|
||||
NInputGroupLabel: typeof import('naive-ui')['NInputGroupLabel']
|
||||
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']
|
||||
NSlider: typeof import('naive-ui')['NSlider']
|
||||
NSpin: typeof import('naive-ui')['NSpin']
|
||||
NStatistic: typeof import('naive-ui')['NStatistic']
|
||||
NSwitch: typeof import('naive-ui')['NSwitch']
|
||||
NTable: typeof import('naive-ui')['NTable']
|
||||
NTag: typeof import('naive-ui')['NTag']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
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']
|
||||
|
||||
+4
-3
@@ -70,7 +70,7 @@
|
||||
"highlight.js": "^11.7.0",
|
||||
"iarna-toml-esm": "^3.0.5",
|
||||
"ibantools": "^4.3.3",
|
||||
"js-base64": "^3.7.7",
|
||||
"js-base64": "^3.7.6",
|
||||
"json5": "^2.2.3",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"libphonenumber-js": "^1.10.28",
|
||||
@@ -115,7 +115,8 @@
|
||||
"@types/bcryptjs": "^2.4.2",
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/jsdom": "^21.1.0",
|
||||
"@types/har-format": "^1.2.16",
|
||||
"@types/jsdom": "^21.0.0",
|
||||
"@types/lodash": "^4.14.192",
|
||||
"@types/mime-types": "^2.1.1",
|
||||
"@types/netmask": "^2.0.0",
|
||||
@@ -124,7 +125,7 @@
|
||||
"@types/qrcode": "^1.5.0",
|
||||
"@types/ua-parser-js": "^0.7.36",
|
||||
"@types/uuid": "^9.0.0",
|
||||
"@unocss/eslint-config": "^0.57.1",
|
||||
"@unocss/eslint-config": "^0.57.0",
|
||||
"@vitejs/plugin-vue": "^4.3.2",
|
||||
"@vitejs/plugin-vue-jsx": "^3.0.2",
|
||||
"@vue/compiler-sfc": "^3.2.47",
|
||||
|
||||
Generated
+1794
-2078
File diff suppressed because it is too large.
Load diff
Whitespace-only changes.
Whitespace-only changes.
@@ -1,25 +0,0 @@
|
||||
import "./plurimath-opal.js";
|
||||
Opal.require("plurimath");
|
||||
window.Plurimath = class Plurimath {
|
||||
constructor(data, format) {
|
||||
this.data = Opal.Plurimath.Math.$parse(data, format);
|
||||
}
|
||||
toAsciimath() {
|
||||
return this.data.$to_asciimath();
|
||||
}
|
||||
toLatex() {
|
||||
return this.data.$to_latex();
|
||||
}
|
||||
toMathml() {
|
||||
return this.data.$to_mathml();
|
||||
}
|
||||
toHtml() {
|
||||
return this.data.$to_html();
|
||||
}
|
||||
toOmml() {
|
||||
return this.data.$to_omml();
|
||||
}
|
||||
toDisplay(lang) {
|
||||
return this.data.$to_display(lang);
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
(function(e){var t,r,n,a,s,i,o,l;if("undefined"!=typeof globalThis?e=globalThis:"undefined"!=typeof global?e=global:"undefined"!=typeof window&&(e=window),null==e.console&&(e.console={}),"log"in(t="object"==typeof e.console?e.console:{})||(t.log=function(){}),"warn"in t||(t.warn=t.log),void 0!==e.Opal)return t.warn("Opal already loaded. Loading twice can cause troubles, please fix your setup."),e.Opal;var $=e.Opal={};$.global=e,$.config={missing_require_severity:"error",unsupported_features_severity:"warning",experimental_features_severity:"warning",enable_stack_trace:!0};var u=Function.prototype.call,c=Function.prototype.bind,_=Object.hasOwn||u.bind(Object.prototype.hasOwnProperty),p=Object.setPrototypeOf,m=u.bind(Array.prototype.slice),d=u.bind(Array.prototype.splice),f=4;function h(){return f+=2}$.uid=h,$.id=function(e){return e.$$is_number?2*e+1:(null==e.$$id&&y(e,"$$id",h()),e.$$id)};var g=$.gvars={};function b(e,t){if(e||(e=$.Exception||Error),!l||!l.$raise)throw e.$new?e.$new(t):new e(t);arguments.length>2?l.$raise(e.$new.apply(e,m(arguments,1))):l.$raise(e,t)}$.exit=function(e){g.DEBUG&&t.log("Exited with status "+e)},$.exceptions=[],$.pop_exception=function(e){var t=$.exceptions.pop();t===e||(g["!"]=t||r)};var v={value:void 0,enumerable:!1,configurable:!0,writable:!0};function y(e,t,r){"string"==typeof e?e[t]=r:(v.value=r,Object.defineProperty(e,t,v))}$.prop=y,$.defineProperty=$.prop,$.slice=m;var x=$.truthy=function(e){return!(!1===e||r===e||null==e||e instanceof Boolean&&!0!==e.valueOf())};function w(e){var t,r,n;for(t=0,r=$.tracers_for_class.length;t<r;t++)(n=$.tracers_for_class[t]).trace_object=e,n.block.$call(n)}function k(e,t){if(e.$$autoload[t].loaded){if(e.$$autoload[t].loaded&&!e.$$autoload[t].required&&e.$$autoload[t].exception)throw e.$$autoload[t].exception}else{e.$$autoload[t].loaded=!0;try{$.Kernel.$require(e.$$autoload[t].path)}catch(r){throw e.$$autoload[t].exception=r,r}if(e.$$autoload[t].required=!0,null!=e.$$const[t])return e.$$autoload[t].success=!0,e.$$const[t]}}function U(e,t){if(e){if(null!=e.$$const[t])return e.$$const[t];if(e.$$autoload&&e.$$autoload[t])return k(e,t)}}function E(e,t){var r,n,a;if(null!=e)for(r=0,n=(a=P(e)).length;r<n;r++){if(a[r].$$const&&_(a[r].$$const,t))return a[r].$$const[t];if(a[r].$$autoload&&a[r].$$autoload[t])return k(a[r],t)}}function M(e,t){return(e||a).$const_missing(t)}function q(e,t,n){var s=!0;return null!=e&&"::"!==e||(e=a),n.$$is_a_module&&(null!=n.$$name&&n.$$name!==r||(n.$$name=t),null==n.$$base_module&&(n.$$base_module=e)),e.$$const=e.$$const||Object.create(null),(t in e.$$const||"$$autoload"in e&&t in e.$$autoload)&&(s=!1),e.$$const[t]=n,e.$$=e.$$const,$.const_cache_version++,e===a&&($[t]=n),y(e,t,n),s&&e.$const_added&&!e.$const_added.$$pristine&&e.$const_added(t),n}function S(e){return null!=e&&(e.$$bridge?e:!!e.$$super&&S(e.$$super))}function O(e,t,n){var a,s;if(a=(s=S(t))?function(){var e=new(c.apply(s.$$constructor,G(null,arguments)));return p(e,a.$$prototype),e}:function(){},e&&e!==r&&y(a,"displayName","::"+e),y(a,"$$name",e),y(a,"$$constructor",a),y(a,"$$prototype",a.prototype),y(a,"$$const",{}),y(a,"$$is_class",!0),y(a,"$$is_a_module",!0),y(a,"$$super",t),y(a,"$$cvars",{}),y(a,"$$own_included_modules",[]),y(a,"$$own_prepended_modules",[]),y(a,"$$ancestors",[]),y(a,"$$ancestors_cache_version",null),y(a,"$$subclasses",[]),y(a,"$$cloned_from",[]),y(a.$$prototype,"$$class",a),$.Class&&p(a,$.Class.prototype),null!=t){if(p(a.$$prototype,t.$$prototype),!0!==n)if("undefined"!=typeof WeakRef){var i,o,l=[];for(i=0;i<t.$$subclasses.length;i++)void 0!==(o=t.$$subclasses[i]).deref()&&l.push(o);l.push(new WeakRef(a)),t.$$subclasses=l}else t.$$subclasses.push(a);t.$$meta&&$.build_class_singleton_class(a)}return a}function A(e){var t=function(){},r=t;return e&&y(t,"displayName",e+".constructor"),y(r,"$$name",e),y(r,"$$prototype",t.prototype),y(r,"$$const",{}),y(r,"$$is_module",!0),y(r,"$$is_a_module",!0),y(r,"$$cvars",{}),y(r,"$$iclasses",[]),y(r,"$$own_included_modules",[]),y(r,"$$own_prepended_modules",[]),y(r,"$$ancestors",[r]),y(r,"$$ancestors_cache_version",null),y(r,"$$cloned_from",[]),p(r,$.Module.prototype),r}function T(e,t){e.hasOwnProperty("$$meta")?e.$$meta=t:y(e,"$$meta",t),e.$$frozen?e.$$meta.$freeze():p(e,t.$$prototype)}function N(e){return e.hasOwnProperty("$$iclass")&&e.hasOwnProperty("$$root")}function z(e){var t=R(e);return e.$$is_module&&e.$$iclasses.push(t),t}function R(e){var t={},r=e.$$prototype;r.hasOwnProperty("$$dummy")&&(r=r.$$define_methods_on);var n,a=Object.getOwnPropertyNames(r),s=a.length;for(n=0;n<s;n++){var i=a[n];y(t,i,r[i])}return y(t,"$$iclass",!0),y(t,"$$module",e),t}function I(e){var t=e.length,r=e[0];if(y(r,"$$root",!0),1===t)return{first:r,last:r};for(var n=r,a=1;a<t;a++){var s=e[a];p(n,s),n=s}return{first:e[0],last:e[t-1]}}function C(e){if(!e.hasOwnProperty("$$dummy"))return e.hasOwnProperty("$$iclass")?e.$$module:e.hasOwnProperty("$$class")?e.$$class:void 0}function P(e){if(!e)return[];if(e.$$ancestors_cLine truncated
|
||||
//# sourceMappingURL=plurimath-opal.js.map
|
||||
@@ -7,15 +7,8 @@ import sqlHljs from 'highlight.js/lib/languages/sql';
|
||||
import xmlHljs from 'highlight.js/lib/languages/xml';
|
||||
import yamlHljs from 'highlight.js/lib/languages/yaml';
|
||||
import iniHljs from 'highlight.js/lib/languages/ini';
|
||||
import bashHljs from 'highlight.js/lib/languages/bash';
|
||||
import markdownHljs from 'highlight.js/lib/languages/markdown';
|
||||
import jsHljs from 'highlight.js/lib/languages/javascript';
|
||||
import cssHljs from 'highlight.js/lib/languages/css';
|
||||
import goHljs from 'highlight.js/lib/languages/go';
|
||||
import csharpHljs from 'highlight.js/lib/languages/csharp';
|
||||
import { Base64 } from 'js-base64';
|
||||
import { useCopy } from '@/composable/copy';
|
||||
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -24,17 +17,12 @@ const props = withDefaults(
|
||||
language?: string
|
||||
copyPlacement?: 'top-right' | 'bottom-right' | 'outside' | 'none'
|
||||
copyMessage?: string
|
||||
wordWrap?: boolean
|
||||
downloadFileName?: string
|
||||
downloadButtonText?: string
|
||||
}>(),
|
||||
{
|
||||
followHeightOf: null,
|
||||
language: 'txt',
|
||||
copyPlacement: 'top-right',
|
||||
copyMessage: 'Copy to clipboard',
|
||||
downloadFileName: '',
|
||||
downloadButtonText: 'Download',
|
||||
},
|
||||
);
|
||||
hljs.registerLanguage('sql', sqlHljs);
|
||||
@@ -43,25 +31,13 @@ hljs.registerLanguage('html', xmlHljs);
|
||||
hljs.registerLanguage('xml', xmlHljs);
|
||||
hljs.registerLanguage('yaml', yamlHljs);
|
||||
hljs.registerLanguage('toml', iniHljs);
|
||||
hljs.registerLanguage('bash', bashHljs);
|
||||
hljs.registerLanguage('markdown', markdownHljs);
|
||||
hljs.registerLanguage('css', cssHljs);
|
||||
hljs.registerLanguage('javascript', jsHljs);
|
||||
hljs.registerLanguage('go', goHljs);
|
||||
hljs.registerLanguage('csharp', csharpHljs);
|
||||
|
||||
const { value, language, followHeightOf, copyPlacement, copyMessage, downloadFileName, downloadButtonText } = toRefs(props);
|
||||
const { value, language, followHeightOf, copyPlacement, copyMessage } = toRefs(props);
|
||||
const { height } = followHeightOf.value ? useElementSize(followHeightOf) : { height: ref(null) };
|
||||
|
||||
const { copy, isJustCopied } = useCopy({ source: value, createToast: false });
|
||||
const tooltipText = computed(() => isJustCopied.value ? 'Copied!' : copyMessage.value);
|
||||
|
||||
const valueBase64 = computed(() => Base64.encode(value.value));
|
||||
const { download } = useDownloadFileFromBase64(
|
||||
{
|
||||
source: valueBase64,
|
||||
filename: downloadFileName,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -73,16 +49,11 @@ const { download } = useDownloadFileFromBase64(
|
||||
:style="height ? `min-height: ${height - 40 /* card padding */ + 10 /* negative margin compensation */}px` : ''"
|
||||
>
|
||||
<n-config-provider :hljs="hljs">
|
||||
<n-code :code="value" :language="language" :word-wrap="wordWrap" :trim="false" data-test-id="area-content" />
|
||||
<n-code :code="value" :language="language" :trim="false" data-test-id="area-content" />
|
||||
</n-config-provider>
|
||||
</n-scrollbar>
|
||||
<div
|
||||
v-if="value && copyPlacement !== 'none'"
|
||||
absolute right-10px
|
||||
:top-10px="copyPlacement === 'top-right' ? '' : 'no'"
|
||||
:bottom-10px="copyPlacement === 'bottom-right' ? '' : 'no'"
|
||||
>
|
||||
<c-tooltip v-if="value && copyPlacement !== 'outside'" :tooltip="tooltipText" position="left">
|
||||
<div absolute right-10px top-10px>
|
||||
<c-tooltip v-if="value" :tooltip="tooltipText" position="left">
|
||||
<c-button circle important:h-10 important:w-10 @click="copy()">
|
||||
<n-icon size="22" :component="Copy" />
|
||||
</c-button>
|
||||
@@ -94,11 +65,6 @@ const { download } = useDownloadFileFromBase64(
|
||||
{{ tooltipText }}
|
||||
</c-button>
|
||||
</div>
|
||||
<div v-if="downloadFileName !== '' && value !== ''" mt-5 flex justify-center>
|
||||
<c-button secondary @click="download">
|
||||
{{ downloadButtonText }}
|
||||
</c-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -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 });
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
<script setup lang="ts">
|
||||
import { downloadFile } from './lib/downloadFile';
|
||||
import { defaultScrubItems, getHarInfo, sanitize } from './lib/har_sanitize';
|
||||
|
||||
type ScrubState = Record<ScrubType, Record<string, boolean>>;
|
||||
type ScrubType =
|
||||
| 'cookies'
|
||||
| 'headers'
|
||||
| 'queryArgs'
|
||||
| 'postParams'
|
||||
| 'mimeTypes';
|
||||
|
||||
const typeMap: Record<ScrubType, string> = {
|
||||
cookies: 'Cookies',
|
||||
mimeTypes: 'Mime Types',
|
||||
headers: 'Headers',
|
||||
postParams: 'Post Body Params',
|
||||
queryArgs: 'Query String Parameters',
|
||||
};
|
||||
|
||||
const defaulScrubState: ScrubState = {
|
||||
cookies: {},
|
||||
headers: {},
|
||||
queryArgs: {},
|
||||
postParams: {},
|
||||
mimeTypes: {},
|
||||
};
|
||||
const scrubItemsToClean = ref<ScrubState>(defaulScrubState);
|
||||
|
||||
function getScrubableItems(input: string): ScrubState {
|
||||
const rawItems = getHarInfo(input);
|
||||
const output = { ...defaulScrubState };
|
||||
Object.entries(rawItems).forEach(([key, items]: [string, string[]]) => {
|
||||
output[key as ScrubType] = items.reduce(
|
||||
(acc, curr) => {
|
||||
if (!curr) {
|
||||
return acc;
|
||||
}
|
||||
acc[curr] = defaultScrubItems.includes(curr);
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, boolean>,
|
||||
);
|
||||
return null;
|
||||
});
|
||||
return output;
|
||||
}
|
||||
|
||||
function sanitizeHar(input: string, scrubItems: ScrubState) {
|
||||
const words = new Set<string>();
|
||||
Object.entries(scrubItems.cookies).forEach(([key, val]) => {
|
||||
if (val) {
|
||||
words.add(key);
|
||||
}
|
||||
});
|
||||
Object.entries(scrubItems.headers).forEach(([key, val]) => {
|
||||
if (val) {
|
||||
words.add(key);
|
||||
}
|
||||
});
|
||||
Object.entries(scrubItems.queryArgs).forEach(([key, val]) => {
|
||||
if (val) {
|
||||
words.add(key);
|
||||
}
|
||||
});
|
||||
Object.entries(scrubItems.postParams).forEach(([key, val]) => {
|
||||
if (val) {
|
||||
words.add(key);
|
||||
}
|
||||
});
|
||||
|
||||
const mimeTypes = new Set<string>();
|
||||
Object.entries(scrubItems.mimeTypes).forEach(([key, val]) => {
|
||||
if (val) {
|
||||
mimeTypes.add(key);
|
||||
}
|
||||
});
|
||||
return sanitize(input, {
|
||||
scrubWords: [...words],
|
||||
scrubMimetypes: [...mimeTypes],
|
||||
});
|
||||
}
|
||||
|
||||
const file = ref<File | null>(null);
|
||||
|
||||
const error = ref('');
|
||||
|
||||
function readAsTextAsync(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 harContent = ref('');
|
||||
async function onFileUploaded(uploadedFile: File) {
|
||||
file.value = uploadedFile;
|
||||
harContent.value = await readAsTextAsync(uploadedFile);
|
||||
|
||||
error.value = '';
|
||||
try {
|
||||
scrubItemsToClean.value = getScrubableItems(harContent.value);
|
||||
}
|
||||
catch (e: any) {
|
||||
error.value = e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
function processHar() {
|
||||
downloadFile(sanitizeHar(harContent.value, scrubItemsToClean.value), `sanitized-${file.value?.name}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div style="flex: 0 0 100%" mb-3>
|
||||
<div mx-auto max-w-600px>
|
||||
<c-file-upload
|
||||
title="Drag and drop a HAR file here, or click to select a file"
|
||||
accept=".har" @file-upload="onFileUploaded"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<c-alert v-if="error" title="Error">
|
||||
{{ error }}
|
||||
</c-alert>
|
||||
|
||||
<div v-for="(title, key) in typeMap" :key="key" mb-1>
|
||||
<c-card v-if="Object.keys(scrubItemsToClean[key]).length" :title="title">
|
||||
<n-checkbox font-size-5 @update:checked="(allChecked: boolean) => Object.keys(scrubItemsToClean[key]).forEach((name) => scrubItemsToClean[key][name] = allChecked)">
|
||||
All {{ title }}
|
||||
</n-checkbox>
|
||||
<n-space size="large">
|
||||
<n-checkbox v-for="(checked, name) in scrubItemsToClean[key]" :key="name" v-model:checked="scrubItemsToClean[key][name]" style="width: 150px">
|
||||
{{ name }}
|
||||
</n-checkbox>
|
||||
</n-space>
|
||||
</c-card>
|
||||
</div>
|
||||
|
||||
<div v-if="!error" mt-3 flex justify-center>
|
||||
<c-button @click="processHar()">
|
||||
Sanitize and download
|
||||
</c-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ClearFormatting } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'HAR Sanitizer',
|
||||
path: '/har-sanitizer',
|
||||
description: 'HAR Files Sanitizer',
|
||||
keywords: ['har', 'sanitizer'],
|
||||
component: () => import('./har-sanitizer.vue'),
|
||||
icon: ClearFormatting,
|
||||
createdAt: new Date('2024-06-17'),
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
export function downloadFile(harOutput: string, name: string) {
|
||||
const blob = new Blob([harOutput], { type: 'application/json' });
|
||||
|
||||
// Create a URL for the Blob
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
// Create an anchor element to trigger the download
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
// Set file name
|
||||
a.download = name;
|
||||
a.style.display = 'none';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
|
||||
// Clean up by removing the anchor and revoking the URL
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
/* eslint-disable prefer-regex-literals */
|
||||
import type { Cookie, Har, Header, Param, QueryString } from 'har-format';
|
||||
|
||||
export interface PossibleScrubItems {
|
||||
headers: string[]
|
||||
cookies: string[]
|
||||
queryArgs: string[]
|
||||
postParams: string[]
|
||||
mimeTypes: string[]
|
||||
}
|
||||
|
||||
const defaultMimeTypesList = ['application/javascript', 'text/javascript'];
|
||||
|
||||
const defaultWordList = [
|
||||
'Authorization',
|
||||
'SAMLRequest',
|
||||
'SAMLResponse',
|
||||
'access_token',
|
||||
'appID',
|
||||
'assertion',
|
||||
'auth',
|
||||
'authenticity_token',
|
||||
'challenge',
|
||||
'client_id',
|
||||
'client_secret',
|
||||
'code',
|
||||
'code_challenge',
|
||||
'code_verifier',
|
||||
'email',
|
||||
'facetID',
|
||||
'fcParams',
|
||||
'id_token',
|
||||
'password',
|
||||
'refresh_token',
|
||||
'serverData',
|
||||
'shdf',
|
||||
'state',
|
||||
'token',
|
||||
'usg',
|
||||
'vses2',
|
||||
'x-client-data',
|
||||
];
|
||||
|
||||
export const defaultScrubItems = [...defaultMimeTypesList, ...defaultWordList];
|
||||
|
||||
// The default list of regexes that aren't word dependent
|
||||
// Uses double list so it matches format of word regex
|
||||
const defaultRegex = [
|
||||
[
|
||||
// Redact signature on JWTs
|
||||
{
|
||||
regex: new RegExp(
|
||||
'\\b(ey[A-Za-z0-9-_=]+)\\.(ey[A-Za-z0-9-_=]+)\\.[A-Za-z0-9-_.+/=]+\\b',
|
||||
'g',
|
||||
),
|
||||
replacement: '$1.$2.redacted',
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
function buildRegex(word: string) {
|
||||
return [
|
||||
{
|
||||
// [full word]=[capture]
|
||||
regex: new RegExp(
|
||||
`([\\s";,&?]+${word}=)([\\w+-_/=#|.%&:!*()\`~'"]+?)(&|\\\\",|",|"\\s|"}}|;){1}`,
|
||||
'g',
|
||||
),
|
||||
replacement: `$1[${word} redacted]$3`,
|
||||
},
|
||||
// Set up this way in case "value" isn't directly after "name"
|
||||
// {
|
||||
// "name": "[word]",
|
||||
// "something": "not wanted",
|
||||
// "value": "[capture]"
|
||||
// }
|
||||
{
|
||||
regex: new RegExp(
|
||||
`("name": "${word}",[\\s\\w+:"-\\%!*()\`~'.,#]*?"value": ")((?:\\\\"|[^"])*?)(")`,
|
||||
'g',
|
||||
),
|
||||
replacement: `$1[${word} redacted]$3`,
|
||||
},
|
||||
// "name" comes after "value"
|
||||
// {
|
||||
// "value": "[capture]",
|
||||
// "something": "not wanted",
|
||||
// "name": "[word]"
|
||||
// }
|
||||
{
|
||||
regex: new RegExp(
|
||||
`("value": ")([\\w+-_:&+=#$~/()\\\\.\\,*!|%"\\s;]+)("[,\\s}}]+)([\\s\\w+:"-\\\\%!*\`()~'#.]*"name": "${word}")`,
|
||||
'g',
|
||||
),
|
||||
replacement: `$1[${word} redacted]$3$4`,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
function removeContentForMimeTypes(input: string, scrubList: string[]) {
|
||||
const harJSON = JSON.parse(input);
|
||||
|
||||
const entries = harJSON.log.entries;
|
||||
if (!entries) {
|
||||
throw new Error('failed to find entries in HAR file');
|
||||
}
|
||||
|
||||
for (const entry of entries) {
|
||||
const response = entry.response;
|
||||
if (response && scrubList.includes(response.content.mimeType)) {
|
||||
response.content.text = `[${response.content.mimeType} redacted]`;
|
||||
}
|
||||
}
|
||||
|
||||
return JSON.stringify(harJSON, null, 2);
|
||||
}
|
||||
|
||||
export function getHarInfo(input: string): PossibleScrubItems {
|
||||
const output = {
|
||||
headers: new Set<string>(),
|
||||
queryArgs: new Set<string>(),
|
||||
cookies: new Set<string>(),
|
||||
postParams: new Set<string>(),
|
||||
mimeTypes: new Set<string>(),
|
||||
};
|
||||
const harJSON: Har = JSON.parse(input);
|
||||
|
||||
const entries = harJSON.log.entries;
|
||||
if (!entries) {
|
||||
throw new Error('failed to find entries in HAR file');
|
||||
}
|
||||
|
||||
for (const entry of entries) {
|
||||
const response = entry.response;
|
||||
response.headers.map((header: Header) => output.headers.add(header.name));
|
||||
response.cookies.map((cookie: Cookie) => output.cookies.add(cookie.name));
|
||||
output.mimeTypes.add(response.content.mimeType);
|
||||
|
||||
const request = entry.request;
|
||||
request.headers.map((header: Header) => output.headers.add(header.name));
|
||||
request.queryString.map((arg: QueryString) =>
|
||||
output.queryArgs.add(arg.name),
|
||||
);
|
||||
request.cookies.map((cookie: Cookie) => output.cookies.add(cookie.name));
|
||||
if (request.postData) {
|
||||
request.postData.params?.map((param: Param) =>
|
||||
output.postParams.add(param.name),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
headers: [...output.headers].sort((a, b) => a.localeCompare(b)),
|
||||
queryArgs: [...output.queryArgs].sort((a, b) => a.localeCompare(b)),
|
||||
cookies: [...output.cookies].sort((a, b) => a.localeCompare(b)),
|
||||
postParams: [...output.postParams].sort((a, b) => a.localeCompare(b)),
|
||||
mimeTypes: [...output.mimeTypes].sort((a, b) => a.localeCompare(b)),
|
||||
};
|
||||
}
|
||||
|
||||
function getScrubMimeTypes(
|
||||
options?: SanitizeOptions,
|
||||
possibleScrubItems?: PossibleScrubItems,
|
||||
) {
|
||||
if (options?.allMimeTypes && !!possibleScrubItems) {
|
||||
return possibleScrubItems.mimeTypes;
|
||||
}
|
||||
return options?.scrubMimetypes || defaultMimeTypesList;
|
||||
}
|
||||
|
||||
function getScrubWords(
|
||||
options?: SanitizeOptions,
|
||||
possibleScrubItems?: PossibleScrubItems,
|
||||
) {
|
||||
let scrubWords = options?.scrubWords || [];
|
||||
if (options?.allCookies && !!possibleScrubItems) {
|
||||
scrubWords = scrubWords.concat(possibleScrubItems.cookies);
|
||||
}
|
||||
if (options?.allHeaders && !!possibleScrubItems) {
|
||||
scrubWords = scrubWords.concat(possibleScrubItems.headers);
|
||||
}
|
||||
if (options?.allQueryArgs && !!possibleScrubItems) {
|
||||
scrubWords = scrubWords.concat(possibleScrubItems.queryArgs);
|
||||
}
|
||||
if (options?.allPostParams && !!possibleScrubItems) {
|
||||
scrubWords = scrubWords.concat(possibleScrubItems.postParams);
|
||||
}
|
||||
|
||||
return scrubWords || defaultScrubItems;
|
||||
}
|
||||
|
||||
interface SanitizeOptions {
|
||||
scrubWords?: string[]
|
||||
scrubMimetypes?: string[]
|
||||
allCookies?: boolean
|
||||
allHeaders?: boolean
|
||||
allQueryArgs?: boolean
|
||||
allMimeTypes?: boolean
|
||||
allPostParams?: boolean
|
||||
}
|
||||
|
||||
export function sanitize(input: string, options?: SanitizeOptions) {
|
||||
let possibleScrubItems: PossibleScrubItems | undefined;
|
||||
if (
|
||||
options?.allCookies
|
||||
|| options?.allHeaders
|
||||
|| options?.allMimeTypes
|
||||
|| options?.allQueryArgs
|
||||
|| options?.allPostParams
|
||||
) {
|
||||
// we have to parse the HAR to get the full list of things we could scrub
|
||||
possibleScrubItems = getHarInfo(input);
|
||||
}
|
||||
|
||||
// Remove specific mime responses first
|
||||
input = removeContentForMimeTypes(
|
||||
input,
|
||||
getScrubMimeTypes(options, possibleScrubItems),
|
||||
);
|
||||
|
||||
// trim the list of words we are looking for down to the ones actually in the HAR file
|
||||
const wordList = getScrubWords(options, possibleScrubItems).filter(val =>
|
||||
input.includes(val),
|
||||
);
|
||||
|
||||
// build list of regexes needed to actually scrub the file
|
||||
const wordSpecificScrubList = wordList.map(word => buildRegex(word));
|
||||
const allScrubList = defaultRegex.concat(wordSpecificScrubList);
|
||||
|
||||
for (const scrubList of allScrubList) {
|
||||
for (const scrub of scrubList) {
|
||||
input = input.replace(scrub.regex, scrub.replacement);
|
||||
}
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
export type HashMap = Record<string, string[]>;
|
||||
|
||||
export function toHashString(obj: HashMap): string {
|
||||
const params = new URLSearchParams();
|
||||
Object.entries(obj).forEach(([key, stringArr]) => {
|
||||
stringArr.forEach((value) => {
|
||||
params.append(key, value);
|
||||
});
|
||||
});
|
||||
return `#${params.toString()}`;
|
||||
}
|
||||
|
||||
export function getHashMap(hash: string): HashMap {
|
||||
const existingParams = new URLSearchParams(hash.replace('#', ''));
|
||||
return Object.fromEntries(
|
||||
[...existingParams.keys()].map(key => [key, existingParams.getAll(key)]),
|
||||
);
|
||||
}
|
||||
+11
-8
@@ -1,7 +1,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 mathFormatsConverter } from './math-formats-converter';
|
||||
import { tool as emailNormalizer } from './email-normalizer';
|
||||
|
||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||
@@ -13,6 +12,7 @@ import { tool as jsonToXml } from './json-to-xml';
|
||||
import { tool as regexTester } from './regex-tester';
|
||||
import { tool as regexMemo } from './regex-memo';
|
||||
import { tool as markdownToHtml } from './markdown-to-html';
|
||||
import { tool as harSanitizer } from './har-sanitizer';
|
||||
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
||||
import { tool as numeronymGenerator } from './numeronym-generator';
|
||||
import { tool as macAddressGenerator } from './mac-address-generator';
|
||||
@@ -165,16 +165,19 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
},
|
||||
{
|
||||
name: 'Network',
|
||||
components: [ipv4SubnetCalculator, ipv4AddressConverter, ipv4RangeExpander, macAddressLookup, macAddressGenerator, ipv6UlaGenerator],
|
||||
components: [
|
||||
ipv4SubnetCalculator,
|
||||
ipv4AddressConverter,
|
||||
ipv4RangeExpander,
|
||||
macAddressLookup,
|
||||
macAddressGenerator,
|
||||
ipv6UlaGenerator,
|
||||
harSanitizer,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Math',
|
||||
components: [
|
||||
mathEvaluator,
|
||||
etaCalculator,
|
||||
percentageCalculator,
|
||||
mathFormatsConverter,
|
||||
],
|
||||
components: [mathEvaluator, etaCalculator, percentageCalculator],
|
||||
},
|
||||
{
|
||||
name: 'Measurement',
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { EqualNot } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Math Formats Converter',
|
||||
path: '/math-formats-converter',
|
||||
description: 'Convert mathematical expression between formats',
|
||||
keywords: ['math', 'formats', 'converter', 'latex', 'mathml', 'asciimath', 'omml', 'html'],
|
||||
component: () => import('./math-formats-converter.vue'),
|
||||
icon: EqualNot,
|
||||
createdAt: new Date('2024-05-11'),
|
||||
});
|
||||
@@ -1,88 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { useScriptTag } from '@vueuse/core';
|
||||
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||
|
||||
const { load: loadPlurimath } = useScriptTag('/plurimath/index.js', undefined, { type: 'module', manual: true });
|
||||
|
||||
const formats = [
|
||||
{ value: 'asciimath', label: 'AsciiMath' },
|
||||
{ value: 'latex', label: 'Latex' },
|
||||
{ value: 'mathml', label: 'MathML' },
|
||||
{ value: 'html', label: 'Html' },
|
||||
{ value: 'omml', label: 'OOML' },
|
||||
];
|
||||
|
||||
const source = ref('');
|
||||
const sourceFormat = useQueryParamOrStorage({ name: 'src', storageName: 'math-fmts-conv:src', defaultValue: 'latex' });
|
||||
const targetFormat = useQueryParamOrStorage({ name: 'target', storageName: 'math-fmts-conv:target', defaultValue: 'mathml' });
|
||||
const target = computedAsync(async () => {
|
||||
const sourceValue = source.value;
|
||||
const sourceFormatValue = sourceFormat.value;
|
||||
const targetFormatValue = targetFormat.value;
|
||||
if (!sourceValue) {
|
||||
return '';
|
||||
}
|
||||
if (sourceFormatValue === targetFormatValue) {
|
||||
return sourceValue;
|
||||
}
|
||||
await loadPlurimath();
|
||||
return new Promise<string>((resolve, _reject) => {
|
||||
try {
|
||||
const formula = new Plurimath(sourceValue, sourceFormatValue);
|
||||
let result;
|
||||
switch (targetFormatValue) {
|
||||
case 'asciimath':
|
||||
result = formula.toAsciimath();
|
||||
break;
|
||||
case 'latex':
|
||||
result = formula.toLatex();
|
||||
break;
|
||||
case 'mathml':
|
||||
result = formula.toMathml();
|
||||
break;
|
||||
case 'html':
|
||||
result = formula.toHtml();
|
||||
break;
|
||||
case 'omml':
|
||||
result = formula.toOmml();
|
||||
break;
|
||||
default:
|
||||
result = '# unknown format';
|
||||
break;
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
catch (e: any) {
|
||||
resolve(`# error converting formula: ${e.toString()}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text
|
||||
v-model:value="source"
|
||||
multiline
|
||||
placeholder="Put your math expression here..."
|
||||
rows="5"
|
||||
label="Mathematical expression to convert"
|
||||
raw-text
|
||||
mb-5
|
||||
/>
|
||||
<c-select
|
||||
v-model:value="sourceFormat"
|
||||
:options="formats"
|
||||
placeholder="Source format"
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<c-select
|
||||
v-model:value="targetFormat"
|
||||
:options="formats"
|
||||
placeholder="Source format"
|
||||
/>
|
||||
<textarea-copyable v-if="target" :value="target" :language="targetFormat" word-wrap />
|
||||
</div>
|
||||
</template>
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
class Plurimath {
|
||||
constructor(data: string, format: string);
|
||||
toAsciimath(): string;
|
||||
toLatex(): string;
|
||||
toMathml(): string;
|
||||
toHtml(): string;
|
||||
toOmml(): string;
|
||||
toDisplay(lang: string): string;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
Plurimath: Plurimath
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user