mirror of
https://github.com/sharevb/it-tools.git
synced 2026-12-01 17:32:54 +03:00
* chore: upgrade toolchain to Vite 8, Vue 3.5, Vitest 4, TypeScript 6 and pnpm 11; adopt oxlint/oxfmt - vite 4 -> 8.1.3 (rolldown-based: build.rollupOptions -> rolldownOptions, drop optimizeDeps.esbuildOptions), @vitejs/plugin-vue 4 -> 6, plugin-vue-jsx 3 -> 5 - vue 3.3 -> 3.5.39, vue-tsc 1.8 -> 3.3.6, vitest 0.34 -> 4.1.9, jsdom 22 -> 29 - typescript 5.2 -> 6.0.3 with moduleResolution=bundler (baseUrl/node10 are hard errors in TS 6, removed in TS 7); TS 7 RC not adoptable: its native tsc lacks the JS compiler API vue-tsc needs (vuejs/language-tools#5381) - unocss 0.57 -> 66 (presetUno -> presetWind3), unplugin-* to current majors (unplugin-vue-components dtsTsx disabled: emits invalid declarations for dotted component names) - @vueuse/head 1.0.0 -> 1.3.1 (1.0.0 silently stopped applying page titles under Vue 3.5) - replace ESLint (@antfu config) + Prettier with oxlint + oxfmt; configs mirror the previous style rules. Existing files are intentionally NOT mass-reformatted (oxfmt has no brace-style/operator-position options to match the old @antfu style) — only files with real changes are formatted - pnpm 9 -> 11.10.0: settings move to pnpm-workspace.yaml, fresh lockfile passing supply-chain policies, explicit allowBuilds decisions, blockExoticSubdeps off (xlsx CDN override patches vulnerable npm 0.18.5) - isolated-vm (17 MB) and onnxruntime-node (208 MB) stubbed via overrides: native-only transitives already aliased to an empty module for the bundle - elliptic overridden to npm ^6.6.1 (github fork tarball of webcrypto-liner-shim unreachable from the build environment) - CI: node 22 -> 24, all actions pinned to latest patch releases, automatic Vercel workflows disabled (fork deploys via Vercel Git integration), vercel.json: git.deploymentEnabled removed, buildCommand skips no-op vue-tsc - Dockerfile: node:24-alpine, pnpm@11, ship pnpm-workspace.yaml and stubs Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6deEDJXFzgDzPiYPAcsv1 * fix: resolve type, lint and runtime issues from the toolchain upgrade vue-tsc 3 checks templates far more strictly than 1.8 and TS 5.7+ made Uint8Array generic over its backing buffer. Widen shared component props (InputCopyable, c-table, c-input-text, UnitsConverter), convert values at call sites, fix invalid local .d.ts declarations, and repair issues the new tooling exposed: - WireGuard generator: pre-shared-keys checkbox used v-model:value which never binds on a standalone n-checkbox (now v-model:checked) - mask-closable="false" string attrs became real boolean bindings in countdown/cron-alarm/time-alarm - v-model casts (x as any) fail to compile under plugin-vue 6 + rolldown; replaced with :value/@update:value split bindings - invalid '::ffff::' IPv6 literal in ipv6registry.json, exposed by stricter parsing in cidr-tools 11.3 (IPv4-mapped range never matched) - fanger pinned to 0.3.1 (0.3.2 published without dist/) - countries-and-timezones namespace imports, Vitest 4 snapshot format, invalid ul-inside-p HTML in dead-pixel, test assertion outside it() block vue-tsc clean; oxlint clean; vitest 665/665; vite build + PWA OK; Playwright e2e 100/100; all 457 tool routes render without errors Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6deEDJXFzgDzPiYPAcsv1 * chore: drop whole-tree oxfmt from precommit instructions The tree deliberately keeps its existing @antfu-era formatting; running 'pnpm fmt' (oxfmt over all of src) would reformat ~800 untouched files. Format only the files you change, or run 'pnpm fmt' in a dedicated PR. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6deEDJXFzgDzPiYPAcsv1 * fix: escape backslashes before dots in parquet column keys CodeQL flagged incomplete string escaping (js/incomplete-sanitization): escaping '.' to '\.' without first escaping existing backslashes makes column names containing backslashes ambiguous in naive-ui's nested-key syntax. Escape backslashes first. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6deEDJXFzgDzPiYPAcsv1 * test: allow 30s for initial mermaid render in e2e mermaid is a large lazy-loaded chunk; webkit on cold CI runners exceeds Playwright's default 5s expect timeout even across retries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6deEDJXFzgDzPiYPAcsv1 * refactor: replace 'as any' input type casts with proper typings Copilot review on the upstream PR flagged the casts. c-input-text renders any non-password type as a text input, so widen its type union to include 'url' instead of casting; for naive-ui's NInput use the documented input-props to set the native input's type=number. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6deEDJXFzgDzPiYPAcsv1 (cherry picked from commit 906820336b271aa6d96ecb11efa03219bf869475) * fix: reconcile lockfile with upstream sync; repair date-picker typing in Docker Label Generator - fold upstream's new CodeMirror/picomatch dependencies into the pnpm 11 lockfile; add @lezer/highlight to optimizeDeps (kept from upstream) - dockerfile-label-generator: n-date-picker emits a number timestamp, not a Date — calling toISOString() on it would throw at runtime the moment a date was picked. Type as number and convert via new Date() - drop stray tsconfig.vite-config.tsbuildinfo build artifact; ignore *.tsbuildinfo vue-tsc clean; oxlint clean; vitest 665/665; vite build OK Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6deEDJXFzgDzPiYPAcsv1 * chore: keep upstream Vercel CLI deployment setup The fork-specific Vercel changes (Git-integration deploys, disabled CLI workflows, build:vercel command) are excluded from the upstream contribution; upstream deploys via its own Vercel CLI workflows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6deEDJXFzgDzPiYPAcsv1 (cherry picked from commit ed182ec55648358556343e60e1667129acdbb966) * fix: escape backslashes in Docker label values; raise global e2e expect timeout - dockerfile-label-generator escaped quotes without escaping existing backslashes first (CodeQL js/incomplete-sanitization, same class as the parquets-reader fix): a value ending in a backslash would break the generated LABEL quoting - playwright: 15s global expect timeout — first paint of heavy lazy chunks exceeds the 5s default on slow CI browsers (webkit), which intermittently failed title assertions across retries Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6deEDJXFzgDzPiYPAcsv1 (cherry picked from commit 5b3822e10113a49bc519661a5b01ad62660d56a9) * Update .gitignore to include specific file types * Add stats.html to .gitignore * Delete tsconfig.vite-config.tsbuildinfo * Delete stats.html --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: sharevb <sharevb@gmail.com>
204 lines
6.9 KiB
Vue
204 lines
6.9 KiB
Vue
<script setup lang="ts">
|
|
import { useI18n } from 'vue-i18n';
|
|
import PostalMime from 'postal-mime';
|
|
|
|
const { t } = useI18n();
|
|
|
|
const inputType = ref<'file' | 'content'>('file');
|
|
const emailContent = ref('');
|
|
const fileInput = ref() as Ref<File | null>;
|
|
const error = ref('');
|
|
|
|
const parsedEmail = computedAsync(async () => {
|
|
const emailContentValue = emailContent.value;
|
|
const file = fileInput.value;
|
|
error.value = '';
|
|
try {
|
|
if (inputType.value === 'file' && file) {
|
|
return await PostalMime.parse(await file.arrayBuffer());
|
|
} else if (inputType.value === 'content' && emailContentValue) {
|
|
return await PostalMime.parse(emailContentValue);
|
|
} else {
|
|
return null;
|
|
}
|
|
} catch (e: any) {
|
|
error.value = e.toString();
|
|
return null;
|
|
}
|
|
});
|
|
|
|
function downloadFile(data: ArrayBuffer | Uint8Array | string, fileName: string, fileType: string) {
|
|
const blob = new Blob([data as BlobPart], { type: fileType || 'application/octet-stream' });
|
|
const downloadUrl = URL.createObjectURL(blob);
|
|
const a = document.createElement('a');
|
|
a.href = downloadUrl;
|
|
a.download = fileName;
|
|
document.body.appendChild(a);
|
|
a.click();
|
|
URL.revokeObjectURL(downloadUrl);
|
|
}
|
|
|
|
function onUpload(file: File) {
|
|
if (file) {
|
|
fileInput.value = file;
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<c-card :title="t('tools.email-parser.texts.title-input')" mb-2>
|
|
<n-radio-group v-model:value="inputType" name="radiogroup" mb-2 flex justify-center>
|
|
<n-space>
|
|
<n-radio value="file" :label="t('tools.email-parser.texts.label-file')" />
|
|
<n-radio value="content" :label="t('tools.email-parser.texts.label-content')" />
|
|
</n-space>
|
|
</n-radio-group>
|
|
|
|
<c-file-upload
|
|
v-if="inputType === 'file'"
|
|
:title="t('tools.email-parser.texts.title-drag-and-drop-eml-file-here-or-click-to-select-a-file')"
|
|
@file-upload="onUpload"
|
|
/>
|
|
|
|
<c-input-text
|
|
v-if="inputType === 'content'"
|
|
v-model:value="emailContent"
|
|
:label="t('tools.email-parser.texts.label-email-content')"
|
|
multiline
|
|
:placeholder="t('tools.email-parser.texts.placeholder-put-your-eml-email-content-here')"
|
|
rows="15"
|
|
mb-2
|
|
/>
|
|
</c-card>
|
|
|
|
<c-alert v-if="error">
|
|
{{ error }}
|
|
</c-alert>
|
|
|
|
<c-card v-if="!error && parsedEmail" :title="t('tools.email-parser.texts.title-output')">
|
|
<input-copyable
|
|
v-if="fileInput?.name"
|
|
:label="t('tools.email-parser.texts.label-file-name')"
|
|
:value="fileInput?.name"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.date"
|
|
:label="t('tools.email-parser.texts.label-date')"
|
|
:value="parsedEmail.date"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.from?.name"
|
|
:label="t('tools.email-parser.texts.label-from-name')"
|
|
:value="parsedEmail.from?.name"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.from"
|
|
:label="t('tools.email-parser.texts.label-from-address')"
|
|
:value="parsedEmail.from?.address || String(parsedEmail.from)"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.to"
|
|
:label="t('tools.email-parser.texts.label-to')"
|
|
:value="JSON.stringify(parsedEmail.to)"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.cc"
|
|
:label="t('tools.email-parser.texts.label-cc')"
|
|
:value="JSON.stringify(parsedEmail.cc)"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.bcc"
|
|
:label="t('tools.email-parser.texts.label-bcc')"
|
|
:value="JSON.stringify(parsedEmail.bcc)"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.replyTo"
|
|
:label="t('tools.email-parser.texts.label-reply-to')"
|
|
:value="JSON.stringify(parsedEmail.replyTo)"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.subject"
|
|
:label="t('tools.email-parser.texts.label-subject')"
|
|
:value="parsedEmail.subject"
|
|
/>
|
|
<c-card v-if="parsedEmail.text" :title="t('tools.email-parser.texts.title-plain-content')" mb-2>
|
|
<details>
|
|
<summary>{{ t('tools.email-parser.texts.tag-see-content') }}</summary>
|
|
<textarea-copyable :value="parsedEmail.text" word-wrap download-file-name="body.txt" />
|
|
</details>
|
|
</c-card>
|
|
<c-card v-if="parsedEmail.html" :title="t('tools.email-parser.texts.title-html-content')" mb-2>
|
|
<details>
|
|
<summary>{{ t('tools.email-parser.texts.tag-see-content') }}</summary>
|
|
<textarea-copyable :value="parsedEmail.html" word-wrap download-file-name="body.htm" />
|
|
</details>
|
|
</c-card>
|
|
<c-card v-if="parsedEmail?.attachments?.length" :title="t('tools.email-parser.texts.title-attachments')" mb-2>
|
|
<n-table>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">
|
|
{{ t('tools.email-parser.texts.tag-attachment') }}
|
|
</th>
|
|
<th scope="col" />
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(h, index) in parsedEmail.attachments || []" :key="index">
|
|
<td>
|
|
{{ `${h.filename || h.contentId || 'noname'} (${h.mimeType}) / ${h.disposition}` }}
|
|
</td>
|
|
<td>
|
|
<c-button @click="downloadFile(h.content, h.filename || h.contentId || 'noname', h.mimeType)">
|
|
{{ t('tools.email-parser.texts.tag-download') }}
|
|
</c-button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</n-table>
|
|
</c-card>
|
|
|
|
<input-copyable
|
|
v-if="parsedEmail.messageId"
|
|
:label="t('tools.email-parser.texts.label-message-id')"
|
|
:value="parsedEmail.messageId"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.inReplyTo"
|
|
:label="t('tools.email-parser.texts.label-in-reply-to')"
|
|
:value="parsedEmail.inReplyTo"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.references"
|
|
:label="t('tools.email-parser.texts.label-references')"
|
|
:value="parsedEmail.references"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.deliveredTo"
|
|
:label="t('tools.email-parser.texts.label-delivered-to')"
|
|
:value="parsedEmail.deliveredTo"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.returnPath"
|
|
:label="t('tools.email-parser.texts.label-return-path')"
|
|
:value="parsedEmail.returnPath"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.sender?.name"
|
|
:label="t('tools.email-parser.texts.label-sender-name')"
|
|
:value="parsedEmail.sender?.name"
|
|
/>
|
|
<input-copyable
|
|
v-if="parsedEmail.sender"
|
|
:label="t('tools.email-parser.texts.label-sender-address')"
|
|
:value="parsedEmail.sender?.address || String(parsedEmail.sender)"
|
|
/>
|
|
|
|
<c-card :title="t('tools.email-parser.texts.title-all-headers')" mt-2>
|
|
<input-copyable v-for="(h, index) in parsedEmail.headers || []" :key="index" :label="h.key" :value="h.value" />
|
|
</c-card>
|
|
</c-card>
|
|
</div>
|
|
</template>
|