diff --git a/lib/client/index.js b/lib/client/index.js index 2365806..57d1af4 100644 --- a/lib/client/index.js +++ b/lib/client/index.js @@ -1,8 +1,31 @@ +window.__ModuleLoader__.load({id:"dsh-mail-sender",factory:require=>{var module={exports:{}};var exports=module.exports;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}); +"use strict"; var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name2 in all) __defProp(target, name2, { get: all[name2], enumerable: true }); }; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/client/index.ts +var index_exports = {}; +__export(index_exports, { + apply: () => apply, + inject: () => inject, + name: () => name +}); +module.exports = __toCommonJS(index_exports); // node_modules/zod/v4/classic/external.js var external_exports = {}; @@ -19972,10 +19995,10 @@ function createApi(ctx) { } // src/client/MailGatewaySection.tsx -import { useEffect, useState } from "react"; +var import_react = require("react"); // src/client/StatusCard.tsx -import { jsx, jsxs } from "react/jsx-runtime"; +var import_jsx_runtime = require("react/jsx-runtime"); var card = { border: "1px solid var(--dsh-border, #e5e7eb)", borderRadius: 8, @@ -20004,20 +20027,20 @@ function summary(status) { } function StatusCard({ status, allowedCount, test }) { const state = summary(status); - return /* @__PURE__ */ jsxs("div", { style: card, children: [ - /* @__PURE__ */ jsx("div", { style: { color: state.color, fontWeight: 600 }, children: state.text }), - status?.phase === "idle" || status?.phase === "polling" ? /* @__PURE__ */ jsxs("div", { style: { color: "#6b7280" }, children: [ + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: card, children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { color: state.color, fontWeight: 600 }, children: state.text }), + status?.phase === "idle" || status?.phase === "polling" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { color: "#6b7280" }, children: [ "\u6536\u4FE1\u7B56\u7565\uFF1A", allowedCount > 0 ? `\u4EC5\u63A5\u6536\u767D\u540D\u5355\u5185 ${allowedCount} \u4E2A\u5730\u5740\u7684\u90AE\u4EF6\u3002` : "\u767D\u540D\u5355\u4E3A\u7A7A\uFF0C\u4E0D\u4F1A\u63A5\u6536\u4EFB\u4F55\u90AE\u4EF6\u3002", status.since ? ` \u8FDE\u63A5\u5EFA\u7ACB\u4E8E ${new Date(status.since).toLocaleString()}\u3002` : "" ] }) : null, - allowedCount === 0 && status?.phase !== "idle" && status?.phase !== "polling" ? /* @__PURE__ */ jsx("div", { style: { color: "#b45309" }, children: "\u767D\u540D\u5355\u4E3A\u7A7A\uFF1A\u4E0D\u4F1A\u63A5\u6536\u4EFB\u4F55\u90AE\u4EF6\u3002" }) : null, - test ? /* @__PURE__ */ jsx("div", { style: { color: test.ok ? "#047857" : "#b91c1c" }, children: test.ok ? test.supportsIdle ? "\u6D4B\u8BD5\u8FDE\u63A5\u6210\u529F\uFF1A\u670D\u52A1\u5668\u652F\u6301 IDLE\u3002" : "\u6D4B\u8BD5\u8FDE\u63A5\u6210\u529F\uFF1A\u670D\u52A1\u5668\u4E0D\u652F\u6301 IDLE\uFF0C\u5C06\u4F7F\u7528\u8F6E\u8BE2\u3002" : `\u6D4B\u8BD5\u8FDE\u63A5\u5931\u8D25\uFF1A${test.error ?? "\u672A\u77E5\u539F\u56E0"}` }) : null + allowedCount === 0 && status?.phase !== "idle" && status?.phase !== "polling" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { color: "#b45309" }, children: "\u767D\u540D\u5355\u4E3A\u7A7A\uFF1A\u4E0D\u4F1A\u63A5\u6536\u4EFB\u4F55\u90AE\u4EF6\u3002" }) : null, + test ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { color: test.ok ? "#047857" : "#b91c1c" }, children: test.ok ? test.supportsIdle ? "\u6D4B\u8BD5\u8FDE\u63A5\u6210\u529F\uFF1A\u670D\u52A1\u5668\u652F\u6301 IDLE\u3002" : "\u6D4B\u8BD5\u8FDE\u63A5\u6210\u529F\uFF1A\u670D\u52A1\u5668\u4E0D\u652F\u6301 IDLE\uFF0C\u5C06\u4F7F\u7528\u8F6E\u8BE2\u3002" : `\u6D4B\u8BD5\u8FDE\u63A5\u5931\u8D25\uFF1A${test.error ?? "\u672A\u77E5\u539F\u56E0"}` }) : null ] }); } // src/client/MailGatewaySection.tsx -import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime"; +var import_jsx_runtime2 = require("react/jsx-runtime"); var table = { width: "100%", borderCollapse: "collapse", @@ -20058,14 +20081,14 @@ var muted = { color: "#6b7280", fontSize: 12 }; var section = { display: "grid", gap: 16, maxWidth: 760 }; var row = { display: "flex", gap: 8, alignItems: "center" }; function MailGatewaySection({ api }) { - const [snapshot, setSnapshot] = useState(); - const [mailbox, setMailbox] = useState(); - const [password, setPassword] = useState(""); - const [allowed, setAllowed] = useState([]); - const [entry, setEntry] = useState(""); - const [test, setTest] = useState(); - const [busy, setBusy] = useState(null); - const [notice, setNotice] = useState(); + const [snapshot, setSnapshot] = (0, import_react.useState)(); + const [mailbox, setMailbox] = (0, import_react.useState)(); + const [password, setPassword] = (0, import_react.useState)(""); + const [allowed, setAllowed] = (0, import_react.useState)([]); + const [entry, setEntry] = (0, import_react.useState)(""); + const [test, setTest] = (0, import_react.useState)(); + const [busy, setBusy] = (0, import_react.useState)(null); + const [notice, setNotice] = (0, import_react.useState)(); const applySnapshot = (next, resetMailbox) => { setSnapshot(next); setAllowed([...next.allowedAddresses]); @@ -20074,7 +20097,7 @@ function MailGatewaySection({ api }) { setPassword(""); } }; - useEffect(() => { + (0, import_react.useEffect)(() => { let alive = true; void api.get().then((result) => { if (!alive) return; @@ -20153,65 +20176,65 @@ function MailGatewaySection({ api }) { const boolField = (key) => (event) => { setField(key, event.target.checked); }; - return /* @__PURE__ */ jsxs2("div", { style: section, children: [ - /* @__PURE__ */ jsx2(StatusCard, { status: snapshot?.status, allowedCount: allowed.length, test }), - /* @__PURE__ */ jsxs2("div", { children: [ - /* @__PURE__ */ jsx2("h3", { style: { margin: "0 0 8px", fontSize: 15 }, children: "\u90AE\u7BB1\u7ED1\u5B9A" }), - /* @__PURE__ */ jsxs2("table", { style: table, children: [ - /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("th", { style: { ...cell, ...muted, width: 140 }, children: "\u5B57\u6BB5" }), - /* @__PURE__ */ jsx2("th", { style: { ...cell, ...muted }, children: "\u503C" }), - /* @__PURE__ */ jsx2("th", { style: { ...cell, ...muted, width: 240 }, children: "\u8BF4\u660E" }) + return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: section, children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StatusCard, { status: snapshot?.status, allowedCount: allowed.length, test }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { style: { margin: "0 0 8px", fontSize: 15 }, children: "\u90AE\u7BB1\u7ED1\u5B9A" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { style: table, children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { style: { ...cell, ...muted, width: 140 }, children: "\u5B57\u6BB5" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { style: { ...cell, ...muted }, children: "\u503C" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { style: { ...cell, ...muted, width: 240 }, children: "\u8BF4\u660E" }) ] }) }), - /* @__PURE__ */ jsxs2("tbody", { children: [ - /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("td", { style: cell, children: "\u90AE\u7BB1\u5730\u5740" }), - /* @__PURE__ */ jsx2("td", { style: cell, children: /* @__PURE__ */ jsx2("input", { style: input2, value: mailbox?.email ?? "", onChange: textField("email") }) }), - /* @__PURE__ */ jsx2("td", { style: { ...cell, ...muted }, children: "\u63A5\u6536\u90AE\u4EF6\u4E0E\u56DE\u4FE1\u4F7F\u7528\u7684\u5730\u5740\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tbody", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: "\u90AE\u7BB1\u5730\u5740" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { style: input2, value: mailbox?.email ?? "", onChange: textField("email") }) }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, ...muted }, children: "\u63A5\u6536\u90AE\u4EF6\u4E0E\u56DE\u4FE1\u4F7F\u7528\u7684\u5730\u5740\u3002" }) ] }), - /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("td", { style: cell, children: "\u663E\u793A\u540D" }), - /* @__PURE__ */ jsx2("td", { style: cell, children: /* @__PURE__ */ jsx2("input", { style: input2, value: mailbox?.displayName ?? "", onChange: textField("displayName") }) }), - /* @__PURE__ */ jsx2("td", { style: { ...cell, ...muted }, children: "\u56DE\u4FE1\u65F6\u7684\u53D1\u4EF6\u4EBA\u540D\u79F0\uFF0C\u53EF\u7559\u7A7A\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: "\u663E\u793A\u540D" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { style: input2, value: mailbox?.displayName ?? "", onChange: textField("displayName") }) }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, ...muted }, children: "\u56DE\u4FE1\u65F6\u7684\u53D1\u4EF6\u4EBA\u540D\u79F0\uFF0C\u53EF\u7559\u7A7A\u3002" }) ] }), - /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("td", { style: cell, children: "IMAP \u4E3B\u673A" }), - /* @__PURE__ */ jsx2("td", { style: cell, children: /* @__PURE__ */ jsx2("input", { style: input2, value: mailbox?.imapHost ?? "", onChange: textField("imapHost") }) }), - /* @__PURE__ */ jsx2("td", { style: { ...cell, ...muted }, children: "\u6807\u51C6 IMAP \u670D\u52A1\u5668\u5730\u5740\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: "IMAP \u4E3B\u673A" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { style: input2, value: mailbox?.imapHost ?? "", onChange: textField("imapHost") }) }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, ...muted }, children: "\u6807\u51C6 IMAP \u670D\u52A1\u5668\u5730\u5740\u3002" }) ] }), - /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("td", { style: cell, children: "IMAP \u7AEF\u53E3" }), - /* @__PURE__ */ jsx2("td", { style: cell, children: /* @__PURE__ */ jsx2("input", { style: input2, value: mailbox?.imapPort ?? 993, onChange: numberField("imapPort") }) }), - /* @__PURE__ */ jsx2("td", { style: { ...cell, ...muted }, children: "SSL \u4E00\u822C\u4E3A 993\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: "IMAP \u7AEF\u53E3" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { style: input2, value: mailbox?.imapPort ?? 993, onChange: numberField("imapPort") }) }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, ...muted }, children: "SSL \u4E00\u822C\u4E3A 993\u3002" }) ] }), - /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("td", { style: cell, children: "IMAP TLS" }), - /* @__PURE__ */ jsx2("td", { style: cell, children: /* @__PURE__ */ jsx2("input", { type: "checkbox", checked: mailbox?.imapSecure ?? true, onChange: boolField("imapSecure") }) }), - /* @__PURE__ */ jsx2("td", { style: { ...cell, ...muted }, children: "\u52FE\u9009\u8868\u793A\u4F7F\u7528 SSL/TLS\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: "IMAP TLS" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { type: "checkbox", checked: mailbox?.imapSecure ?? true, onChange: boolField("imapSecure") }) }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, ...muted }, children: "\u52FE\u9009\u8868\u793A\u4F7F\u7528 SSL/TLS\u3002" }) ] }), - /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("td", { style: cell, children: "SMTP \u4E3B\u673A" }), - /* @__PURE__ */ jsx2("td", { style: cell, children: /* @__PURE__ */ jsx2("input", { style: input2, value: mailbox?.smtpHost ?? "", onChange: textField("smtpHost") }) }), - /* @__PURE__ */ jsx2("td", { style: { ...cell, ...muted }, children: "\u6807\u51C6 SMTP \u670D\u52A1\u5668\u5730\u5740\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: "SMTP \u4E3B\u673A" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { style: input2, value: mailbox?.smtpHost ?? "", onChange: textField("smtpHost") }) }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, ...muted }, children: "\u6807\u51C6 SMTP \u670D\u52A1\u5668\u5730\u5740\u3002" }) ] }), - /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("td", { style: cell, children: "SMTP \u7AEF\u53E3" }), - /* @__PURE__ */ jsx2("td", { style: cell, children: /* @__PURE__ */ jsx2("input", { style: input2, value: mailbox?.smtpPort ?? 465, onChange: numberField("smtpPort") }) }), - /* @__PURE__ */ jsx2("td", { style: { ...cell, ...muted }, children: "SSL \u4E00\u822C\u4E3A 465\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: "SMTP \u7AEF\u53E3" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { style: input2, value: mailbox?.smtpPort ?? 465, onChange: numberField("smtpPort") }) }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, ...muted }, children: "SSL \u4E00\u822C\u4E3A 465\u3002" }) ] }), - /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("td", { style: cell, children: "SMTP TLS" }), - /* @__PURE__ */ jsx2("td", { style: cell, children: /* @__PURE__ */ jsx2("input", { type: "checkbox", checked: mailbox?.smtpSecure ?? true, onChange: boolField("smtpSecure") }) }), - /* @__PURE__ */ jsx2("td", { style: { ...cell, ...muted }, children: "\u52FE\u9009\u8868\u793A\u4F7F\u7528 SSL/TLS\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: "SMTP TLS" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { type: "checkbox", checked: mailbox?.smtpSecure ?? true, onChange: boolField("smtpSecure") }) }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, ...muted }, children: "\u52FE\u9009\u8868\u793A\u4F7F\u7528 SSL/TLS\u3002" }) ] }), - /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("td", { style: cell, children: "\u767B\u5F55\u7528\u6237\u540D" }), - /* @__PURE__ */ jsx2("td", { style: cell, children: /* @__PURE__ */ jsx2("input", { style: input2, value: mailbox?.username ?? "", onChange: textField("username") }) }), - /* @__PURE__ */ jsx2("td", { style: { ...cell, ...muted }, children: "\u7559\u7A7A\u65F6\u4F7F\u7528\u90AE\u7BB1\u5730\u5740\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: "\u767B\u5F55\u7528\u6237\u540D" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { style: input2, value: mailbox?.username ?? "", onChange: textField("username") }) }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, ...muted }, children: "\u7559\u7A7A\u65F6\u4F7F\u7528\u90AE\u7BB1\u5730\u5740\u3002" }) ] }), - /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("td", { style: cell, children: "\u5BC6\u7801" }), - /* @__PURE__ */ jsx2("td", { style: cell, children: /* @__PURE__ */ jsx2( + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: "\u5BC6\u7801" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "input", { style: input2, @@ -20221,20 +20244,20 @@ function MailGatewaySection({ api }) { onChange: (event) => setPassword(event.target.value) } ) }), - /* @__PURE__ */ jsx2("td", { style: { ...cell, ...muted }, children: "\u4FDD\u5B58\u540E\u53EA\u663E\u793A\u201C\u5DF2\u8BBE\u7F6E\u201D\uFF0C\u4E0D\u4F1A\u56DE\u663E\u660E\u6587\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, ...muted }, children: "\u4FDD\u5B58\u540E\u53EA\u663E\u793A\u201C\u5DF2\u8BBE\u7F6E\u201D\uFF0C\u4E0D\u4F1A\u56DE\u663E\u660E\u6587\u3002" }) ] }) ] }) ] }), - /* @__PURE__ */ jsxs2("div", { style: { ...row, marginTop: 10 }, children: [ - /* @__PURE__ */ jsx2("button", { style: primary, disabled: busy !== null, onClick: () => void saveMailbox(), children: busy === "mailbox" ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58\u90AE\u7BB1\u7ED1\u5B9A" }), - /* @__PURE__ */ jsx2("button", { style: button, disabled: busy !== null, onClick: () => void testConnection(), children: busy === "test" ? "\u6D4B\u8BD5\u4E2D\u2026" : "\u6D4B\u8BD5\u8FDE\u63A5" }), - /* @__PURE__ */ jsx2("span", { style: muted, children: "\u4FDD\u5B58\u90AE\u7BB1\u7ED1\u5B9A\u65F6\u4F1A\u6309\u65B0\u914D\u7F6E\u91CD\u5EFA\u8FDE\u63A5\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { ...row, marginTop: 10 }, children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { style: primary, disabled: busy !== null, onClick: () => void saveMailbox(), children: busy === "mailbox" ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58\u90AE\u7BB1\u7ED1\u5B9A" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { style: button, disabled: busy !== null, onClick: () => void testConnection(), children: busy === "test" ? "\u6D4B\u8BD5\u4E2D\u2026" : "\u6D4B\u8BD5\u8FDE\u63A5" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: muted, children: "\u4FDD\u5B58\u90AE\u7BB1\u7ED1\u5B9A\u65F6\u4F1A\u6309\u65B0\u914D\u7F6E\u91CD\u5EFA\u8FDE\u63A5\u3002" }) ] }) ] }), - /* @__PURE__ */ jsxs2("div", { children: [ - /* @__PURE__ */ jsx2("h3", { style: { margin: "0 0 8px", fontSize: 15 }, children: "\u767D\u540D\u5355" }), - /* @__PURE__ */ jsxs2("div", { style: { ...row, marginBottom: 8 }, children: [ - /* @__PURE__ */ jsx2( + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { style: { margin: "0 0 8px", fontSize: 15 }, children: "\u767D\u540D\u5355" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { ...row, marginBottom: 8 }, children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "input", { style: { ...input2, maxWidth: 320 }, @@ -20244,18 +20267,18 @@ function MailGatewaySection({ api }) { onKeyDown: onEntryKey } ), - /* @__PURE__ */ jsx2("button", { style: button, onClick: addAddress, children: "\u6DFB\u52A0" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { style: button, onClick: addAddress, children: "\u6DFB\u52A0" }) ] }), - /* @__PURE__ */ jsx2("table", { style: table, children: /* @__PURE__ */ jsx2("tbody", { children: allowed.length === 0 ? /* @__PURE__ */ jsx2("tr", { children: /* @__PURE__ */ jsx2("td", { style: { ...cell, ...muted }, children: "\u6682\u65E0\u5730\u5740\uFF0C\u767D\u540D\u5355\u4E3A\u7A7A\u65F6\u4E0D\u4F1A\u63A5\u6536\u4EFB\u4F55\u90AE\u4EF6\u3002" }) }) : allowed.map((address) => /* @__PURE__ */ jsxs2("tr", { children: [ - /* @__PURE__ */ jsx2("td", { style: cell, children: address }), - /* @__PURE__ */ jsx2("td", { style: { ...cell, width: 80, textAlign: "right" }, children: /* @__PURE__ */ jsx2("button", { style: button, onClick: () => removeAddress(address), children: "\u5220\u9664" }) }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("table", { style: table, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tbody", { children: allowed.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, ...muted }, children: "\u6682\u65E0\u5730\u5740\uFF0C\u767D\u540D\u5355\u4E3A\u7A7A\u65F6\u4E0D\u4F1A\u63A5\u6536\u4EFB\u4F55\u90AE\u4EF6\u3002" }) }) : allowed.map((address) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cell, children: address }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: { ...cell, width: 80, textAlign: "right" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { style: button, onClick: () => removeAddress(address), children: "\u5220\u9664" }) }) ] }, address)) }) }), - /* @__PURE__ */ jsxs2("div", { style: { ...row, marginTop: 10 }, children: [ - /* @__PURE__ */ jsx2("button", { style: primary, disabled: busy !== null, onClick: () => void saveWhitelist(), children: busy === "whitelist" ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58\u767D\u540D\u5355" }), - /* @__PURE__ */ jsx2("span", { style: muted, children: "\u540C\u4E00\u4EFD\u767D\u540D\u5355\u540C\u65F6\u6821\u9A8C\u5165\u7AD9\u53D1\u4EF6\u5730\u5740\u4E0E\u51FA\u7AD9\u56DE\u590D\u5730\u5740\u3002" }) + /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { ...row, marginTop: 10 }, children: [ + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { style: primary, disabled: busy !== null, onClick: () => void saveWhitelist(), children: busy === "whitelist" ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58\u767D\u540D\u5355" }), + /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: muted, children: "\u540C\u4E00\u4EFD\u767D\u540D\u5355\u540C\u65F6\u6821\u9A8C\u5165\u7AD9\u53D1\u4EF6\u5730\u5740\u4E0E\u51FA\u7AD9\u56DE\u590D\u5730\u5740\u3002" }) ] }) ] }), - notice ? /* @__PURE__ */ jsx2("div", { style: { color: notice.kind === "ok" ? "#047857" : "#b91c1c", fontSize: 13 }, children: notice.text }) : null + notice ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { color: notice.kind === "ok" ? "#047857" : "#b91c1c", fontSize: 13 }, children: notice.text }) : null ] }); } @@ -20280,8 +20303,4 @@ async function apply(ctx) { ); return disposeRemote; } -export { - apply, - inject, - name -}; +Object.defineProperty(module.exports,Symbol.toStringTag,{value:"Module"});return module.exports}}); diff --git a/package.json b/package.json index b9321b6..c680d77 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "dsh": ">=0.2.2-rc.2" }, "scripts": { - "build": "tsc && esbuild src/client/index.ts --bundle --format=esm --platform=browser --jsx=automatic --external:react --external:react/jsx-runtime --external:react-dom --external:@deepseek-ai/cordis --outfile=lib/client/index.js" + "build": "tsc && node scripts/build-client.mjs" }, "dependencies": { "imapflow": "^1.0.171", diff --git a/scripts/build-client.mjs b/scripts/build-client.mjs new file mode 100644 index 0000000..b36dad0 --- /dev/null +++ b/scripts/build-client.mjs @@ -0,0 +1,19 @@ +import { build } from 'esbuild' + +const id = 'dsh-mail-sender' + +await build({ + entryPoints: ['src/client/index.ts'], + outfile: 'lib/client/index.js', + bundle: true, + format: 'cjs', + platform: 'browser', + jsx: 'automatic', + external: ['react', 'react/jsx-runtime', 'react-dom', '@deepseek-ai/cordis'], + banner: { + js: `window.__ModuleLoader__.load({id:${JSON.stringify(id)},factory:require=>{var module={exports:{}};var exports=module.exports;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});`, + }, + footer: { + js: 'Object.defineProperty(module.exports,Symbol.toStringTag,{value:"Module"});return module.exports}});', + }, +})