msg-viewer

This commit is contained in:
xtremxpert 2025-01-28 09:39:39 -05:00
parent f4550d7723
commit 362fc9b774
10 changed files with 13 additions and 14 deletions

View file

@ -53,7 +53,9 @@
'views/res_config_settings_views.xml',
],
'external_dependencies': {
'python': ['extract-msg'],
'python': [
'extract-msg'
],
},
'installable': True,
'auto_install': False,

View file

@ -45,9 +45,6 @@ async function build() {
entrypoints: ["./lib/index.html"],
outdir: DEST_DIR,
minify: true,
plugins: [
html({ inline: true }),
],
});
console.log("Build succeeded!\n");
} catch(err) {
@ -75,4 +72,4 @@ async function createDestDir(){
} catch(err) {
console.error(`Failed to create destination folder "${DEST_DIR}".`);
}
}
}

BIN
msg_viewer/static/src/lib/msg-viewer-main/bun.lockb Normal file → Executable file

Binary file not shown.

View file

@ -1,7 +1,7 @@
import type { Message } from "../../scripts/msg/types/message";
import { bytesWithUnits } from "../../scripts/utils/file-size-util";
import { createFragmentFromTemplate } from "../../scripts/utils/html-template-util";
import template from "./index.html" with { type: "text" };
const template = await Bun.file("./lib/components/attachment/index.html").text();
export function attachmentsFragment(message: Message): DocumentFragment {
const attachments = message.attachments

View file

@ -1,7 +1,7 @@
import type { DirectoryEntry } from "../../scripts/msg/compound-file/directory/types/directory-entry";
import type { Message } from "../../scripts/msg/types/message";
import { createFragmentFromTemplate } from "../../scripts/utils/html-template-util";
import template from "./index.html" with { type: "text" };
const template = await Bun.file("./lib/components/embedded-msg/index.html").text();
export function embeddedMsgsFragment(message: Message, onClick: (entry: DirectoryEntry) => void): DocumentFragment {
const elements = message.attachments

View file

@ -1,5 +1,5 @@
import { createFragmentFromTemplate } from "../../scripts/utils/html-template-util";
import template from "./index.html" with { type: "text" };
const template = await Bun.file("./lib/components/error/index.html").text();
export function errorFragment(error: string): DocumentFragment {
return createFragmentFromTemplate(template, { error });

View file

@ -4,7 +4,7 @@ import { createFragmentFromTemplate } from "../../scripts/utils/html-template-ut
import { attachmentsFragment } from "../attachment";
import { embeddedMsgsFragment } from "../embedded-msg";
import { recipientsFragments } from "../recipient";
import template from "./index.html" with { type: "text" };
const template = await Bun.file("./lib/components/message/index.html").text();
export function messageFragment(message: Message, renderDir: (dir: DirectoryEntry) => void): DocumentFragment {
const [toRecip, ccRecip] = recipientsFragments(message);

View file

@ -1,6 +1,6 @@
import type { Message, Recipient } from "../../scripts/msg/types/message";
import { createFragmentFromTemplate } from "../../scripts/utils/html-template-util";
import template from "./index.html" with { type: "text" };
const template = await Bun.file("./lib/components/recipient/index.html").text();
export function recipientsFragments(message: Message): DocumentFragment[] {
const toRecipients = toSet(message.content.toRecipients);
@ -45,4 +45,4 @@ function toSet(recipStr: string) {
interface RecipientViewModel {
name: string,
email: string
}
}

View file

@ -1,2 +1,2 @@
@import "./lib/styles/root.css";
@import "./lib/components/styles.css";
@import "./root.css";
@import "../components/styles.css";

View file

@ -5,7 +5,7 @@
"main": "index.js",
"devDependencies": {
"@types/bun": "latest",
"bun-plugin-html": "^2.0.0"
"bun-plugin-html": "^2.2.8"
},
"scripts": {
"clean": "rm -rf build"