import { defineComponent, reactive, ref, computed, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrInterpolate, ssrRenderList, ssrRenderStyle, ssrRenderAttr, ssrRenderClass, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderDynamicModel } from 'vue/server-renderer'; import { u as useToast } from './useToast-CS21XT61.mjs'; import { u as useApi } from './useApi-B-E5eLsI.mjs'; import { _ as _export_sfc } from './server.mjs'; import './useLoading-D4zrSa2m.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'pinia'; import 'perfect-debounce'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "systemconfig", __ssrInlineRender: true, setup(__props) { useToast(); useApi(); function mk(id, provider, name, short, tag, color, fields) { return { id, provider, name, short, tag, color, enable: false, is_default: false, fields }; } const CATALOG = reactive([ { id: "storage", label: "对象存储", desc: "固件 / 头像等文件直传(默认阿里云 OSS)", color: "#6366f1", icon: "M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8", multi: true, services: [ mk("storage_aliyun_oss", "aliyun_oss", "阿里云 OSS", "OSS", "Aliyun · 固件/头像上传所用", "#ff6a00", [ { key: "endpoint", label: "Endpoint", value: "", placeholder: "oss-cn-shanghai.aliyuncs.com", mono: true, required: true }, { key: "bucket", label: "Bucket", value: "", placeholder: "yunyan-firmware", mono: true, required: true }, { key: "access_key_id", label: "AccessKey ID", value: "", mono: true, encrypted: true, required: true }, { key: "access_key_secret", label: "AccessKey Secret", value: "", mono: true, encrypted: true, required: true }, { key: "domain", label: "自定义域名 (CDN)", value: "", placeholder: "cdn.yunyan.com", wide: true, hint: "可选,配置后文件下载 URL 走该域名" } ]), mk("storage_tencent_cos", "tencent_cos", "腾讯云 COS", "COS", "Tencent", "#00a4ff", [ { key: "region", label: "Region", value: "", placeholder: "ap-guangzhou", mono: true, required: true }, { key: "appid", label: "AppId", value: "", mono: true, required: true }, { key: "bucket", label: "Bucket", value: "", mono: true, required: true }, { key: "secret_id", label: "SecretId", value: "", mono: true, encrypted: true, required: true }, { key: "secret_key", label: "SecretKey", value: "", mono: true, encrypted: true, required: true }, { key: "domain", label: "自定义域名 (CDN)", value: "", wide: true, hint: "可选" } ]) ] }, { id: "email", label: "邮件服务", desc: "生产通知 / 账号告警发信(支持 SMTP 与 Resend)", color: "#f59e0b", icon: "M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z", multi: false, services: [ mk("email", "auto", "邮件服务", "MAIL", "生产通知 / 账号告警", "#f59e0b", [ { key: "EmailType", label: "邮箱类型", value: "1", type: "select", required: true, options: [ { value: "0", label: "QQ 邮箱 (SMTP)" }, { value: "1", label: "腾讯企业邮箱 (SMTP)" }, { value: "2", label: "Gmail (SMTP)" }, { value: "3", label: "Resend(HTTP API,海外送达率优)" } ] }, { key: "FromEmail", label: "发件人邮箱", value: "", mono: true, required: true, placeholder: "noreply@yourdomain.com", hint: "Resend 须为已在其后台验证域名下的地址" }, { key: "FromName", label: "发件人昵称", value: "", placeholder: "云岩科技" }, { key: "Password", label: "SMTP 授权码 / Resend API Key", value: "", mono: true, encrypted: true, required: true, hint: "SMTP 类型填邮箱授权码;Resend 填 re_ 开头的 API Key" } ]) ] }, { id: "translate", label: "翻译服务", desc: "后台文案多语言同步", color: "#14b8a6", icon: "M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129", multi: true, services: [ mk("translate_volc", "volc", "火山引擎翻译", "火山", "Volcengine MT", "#1664ff", [ { key: "region", label: "Region", value: "cn-beijing", mono: true, required: true }, { key: "access_key", label: "AccessKey", value: "", mono: true, encrypted: true, required: true }, { key: "secret_key", label: "SecretKey", value: "", mono: true, encrypted: true, required: true } ]), mk("translate_aliyun", "aliyun_mt", "阿里云翻译", "阿里", "Aliyun MT", "#ff6a00", [ { key: "region", label: "Region", value: "cn-hangzhou", mono: true, required: true }, { key: "access_key_id", label: "AccessKey ID", value: "", mono: true, encrypted: true, required: true }, { key: "access_key_secret", label: "AccessKey Secret", value: "", mono: true, encrypted: true, required: true } ]), mk("translate_google", "google_mt", "Google 翻译", "G", "Cloud Translation", "#ea4335", [ { key: "project", label: "Project ID", value: "", mono: true, required: true }, { key: "api_key", label: "API Key", value: "", mono: true, encrypted: true, required: true } ]), mk("translate_deepl", "deepl", "DeepL", "DL", "DeepL API", "#0f2b46", [ { key: "auth_key", label: "Auth Key", value: "", mono: true, encrypted: true, required: true } ]) ] } ]); const view = ref("cards"); const editCatId = ref(""); const curProviderId = ref(""); const saving = ref(false); const testing = ref(false); const testTo = ref(""); const curCat = computed(() => CATALOG.find((c) => c.id === editCatId.value) || CATALOG[0]); const curProviders = computed(() => curCat.value.services); const curService = computed(() => { if (!curCat.value.multi) return curCat.value.services[0]; return curCat.value.services.find((s) => s.id === curProviderId.value) || curCat.value.services[0]; }); function catServices(catId) { return CATALOG.find((c) => c.id === catId)?.services || []; } function catEnabled(catId) { return catServices(catId).some((s) => s.enable); } function catDefaultName(catId) { const cat = CATALOG.find((c) => c.id === catId); if (!cat) return ""; if (!cat.multi) { const s = cat.services[0]; return s.enable ? s.name : ""; } const def = cat.services.find((s) => s.is_default && s.enable); return def ? def.name : ""; } return (_ctx, _push, _parent, _attrs) => { _push(`
`); if (view.value === "edit") { _push(``); } else { _push(``); } _push(`

系统配置`); if (view.value === "edit") { _push(` / ${ssrInterpolate(curCat.value.label)}`); } else { _push(``); } _push(`

平台自用服务配置(与「第三方服务配置」分库存储,不下发客户端):对象存储(固件 / 头像直传)、邮件服务(生产通知发信)、翻译服务(后台文案多语言)。

`); if (view.value === "cards") { _push(`
`); ssrRenderList(CATALOG, (cat) => { _push(`
`); if (catEnabled(cat.id)) { _push(`已启用`); } else { _push(`未配置`); } _push(`
${ssrInterpolate(cat.label)}
${ssrInterpolate(cat.desc)}
`); if (catDefaultName(cat.id)) { _push(`当前:${ssrInterpolate(catDefaultName(cat.id))}`); } else { _push(`尚未配置,点击设置`); } _push(`
`); }); _push(`
`); } else if (view.value === "edit") { _push(`
`); if (curCat.value.multi) { _push(`
选择服务商 (勾选设为默认,平台调用走默认项)
`); ssrRenderList(curProviders.value, (p) => { _push(`
`); if (p.enable) { _push(`已配置`); } else { _push(`未配置`); } _push(`
${ssrInterpolate(p.name)}
${ssrInterpolate(p.tag)}
`); }); _push(`
`); } else { _push(``); } if (curService.value) { _push(`

${ssrInterpolate(curService.value.name)}

${ssrInterpolate(curService.value.tag)}

配置项
`); ssrRenderList(curService.value.fields, (f) => { _push(`
`); if (f.type === "select") { _push(``); } else { _push(`
`); if (f.encrypted) { _push(``); } else { _push(``); } _push(`
`); } if (f.hint) { _push(`${ssrInterpolate(f.hint)}`); } else { _push(``); } _push(`
`); }); _push(`
`); if (curCat.value.id === "email") { _push(`
测试发信
`); } else { _push(``); } _push(`
`); } else { _push(``); } _push(`
`); } else { _push(``); } _push(``); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/systemconfig.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; const systemconfig = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6ea4e757"]]); export { systemconfig as default }; //# sourceMappingURL=systemconfig-B2d1IokK.mjs.map