Skip to content

Commit 1147281

Browse files
committed
Merge branch 'feat/mime-converter' into chore/all-my-stuffs
# Conflicts: # components.d.ts # package.json # pnpm-lock.yaml # src/tools/index.ts # vite.config.ts
2 parents 188fc76 + a748499 commit 1147281

File tree

6 files changed

+118
-1
lines changed

6 files changed

+118
-1
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"@types/figlet": "^1.5.8",
102102
"@types/sshpk": "^1.17.4",
103103
"@types/js-beautify": "^1.14.3",
104+
"@types/libmime": "^5.0.3",
104105
"@vicons/material": "^0.12.0",
105106
"@vicons/tabler": "^0.12.0",
106107
"@vueuse/core": "^10.11.1",
@@ -226,6 +227,7 @@
226227
"jsonlint-mod": "^1.7.6",
227228
"jwt-decode": "^3.1.2",
228229
"korean-unpacker": "^1.0.3",
230+
"libmime": "^5.3.4",
229231
"libphonenumber-js": "^1.10.28",
230232
"lodash": "^4.17.21",
231233
"luxon": "^3.5.0",

pnpm-lock.yaml

Lines changed: 35 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import { tool as ocrImage } from './ocr-image';
7373
import { tool as ansibleVaultCryptDecrypt } from './ansible-vault-crypt-decrypt';
7474
import { tool as gzipConverter } from './gzip-converter';
7575
import { tool as htpasswdGenerator } from './htpasswd-generator';
76+
import { tool as mimeConverter } from './mime-converter';
7677
import { tool as safelinkDecoder } from './safelink-decoder';
7778
import { tool as mongoObjectidConverter } from './mongo-objectid-converter';
7879
import { tool as removeExif } from './remove-exif';
@@ -308,6 +309,7 @@ export const toolsByCategory: ToolCategory[] = [
308309
jsonToXml,
309310
gzipConverter,
310311
htmlCleaner,
312+
mimeConverter,
311313
],
312314
},
313315
{

src/tools/mime-converter/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Mail } from '@vicons/tabler';
2+
import { defineTool } from '../tool';
3+
4+
export const tool = defineTool({
5+
name: 'MIME Encoding Converter',
6+
path: '/mime-converter',
7+
description: 'Convert from/to MIME Encoded-Word format (Mail Subject)',
8+
keywords: ['mime', 'converter', 'subject', 'rfc2047', 'rfc1341', 'rfc2045'],
9+
component: () => import('./mime-converter.vue'),
10+
icon: Mail,
11+
createdAt: new Date('2024-03-09'),
12+
});
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<script setup lang="ts">
2+
import libmime from 'libmime';
3+
import TextareaCopyable from '@/components/TextareaCopyable.vue';
4+
import { withDefaultOnError } from '@/utils/defaults';
5+
6+
const encodedInput = ref('');
7+
const decodedOutput = computed(() => withDefaultOnError(() => libmime.decodeWords(encodedInput.value), '# invalid encoded value'));
8+
9+
const rawInput = ref('');
10+
const encodedQOutput = computed(() => withDefaultOnError(() => libmime.encodeWord(rawInput.value, 'Q'), ''));
11+
const encodedBOutput = computed(() => withDefaultOnError(() => libmime.encodeWord(rawInput.value, 'B'), ''));
12+
</script>
13+
14+
<template>
15+
<div style="max-width: 600px;">
16+
<c-card title="Encode string in Encoded-Word format">
17+
<c-input-text
18+
v-model:value="rawInput"
19+
multiline
20+
placeholder="Put your string here..."
21+
rows="5"
22+
label="String to encode"
23+
raw-text
24+
mb-5
25+
/>
26+
27+
<div>
28+
<h3>Quotted Printable encoded string</h3>
29+
<TextareaCopyable
30+
:value="encodedQOutput"
31+
placeholder="The Quotted Printable encoded version of your string will be here"
32+
mb-5
33+
/>
34+
</div>
35+
36+
<div>
37+
<h3>Base64 encoded string</h3>
38+
<TextareaCopyable
39+
:value="encodedBOutput"
40+
placeholder="The Base64 encoded version of your string will be here"
41+
mb-5
42+
/>
43+
</div>
44+
</c-card>
45+
46+
<c-card title="Decode string in Encoded-Word format">
47+
<c-input-text
48+
v-model:value="encodedInput"
49+
multiline
50+
placeholder="Your encoded string..."
51+
rows="5"
52+
label="Encoded string to decode"
53+
mb-5
54+
/>
55+
56+
<div>
57+
<h3>Decoded string</h3>
58+
<TextareaCopyable
59+
v-model:value="decodedOutput"
60+
placeholder="The decoded string will be here"
61+
mb-5
62+
/>
63+
</div>
64+
</c-card>
65+
</div>
66+
</template>

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Icons from 'unplugin-icons/vite';
1212
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
1313
import Components from 'unplugin-vue-components/vite';
1414
import { defineConfig } from 'vite';
15+
import { nodePolyfills } from 'vite-plugin-node-polyfills';
1516
import { VitePWA } from 'vite-plugin-pwa';
1617
import markdown from 'vite-plugin-vue-markdown';
1718
import svgLoader from 'vite-svg-loader';

0 commit comments

Comments
 (0)