import { ApiStrGenerate } from "./util/viewApi";
// const ApiStrGenerate ={}
// 定义一些常量名
const CONSTANT = {
PAGE: 1,
// PAGE_SIZE: 8,
TOTAL: 0,
DEFALUT_SITE_CONFIG: JSON.stringify({ "logo": "", "pagesize": "8", "slogan": "A Message Way Hosted Site", "title": "Message Nest" }),
LOG_TASK_ID: "T-IM1GBswSRY",
STORE_TOKEN_NAME: '__message_nest_token__',
STORE_CUSTOM_NAME: '__message_nest_custom_site__',
NO_AUTH_URL: [
'/auth',
],
WAYS_DATA: [
{
type: 'Email',
label: '邮箱',
inputs: [
{ subLabel: 'smtp服务地址', value: '', col: 'server', desc: "smtp@xyz.com" },
{ subLabel: 'smtp服务端口', value: '', col: 'port', desc: "port" },
{ subLabel: '邮箱账号', value: '', col: 'account', desc: "邮箱账号" },
{ subLabel: '邮箱密码', value: '', col: 'passwd', desc: "邮箱密码" },
{ subLabel: '渠道名', value: '', col: 'name', desc: "想要设置的渠道名字" },
],
taskInsRadios: [
{ subLabel: 'text', content: 'text' },
{ subLabel: 'html', content: 'html' },
],
taskInsInputs: [
{ value: '', col: 'to_account', desc: "目的邮箱账号(发给谁)" },
// { value: '', col: 'title', desc: "邮箱标题" },
],
},
{
type: 'Dtalk',
label: '钉钉',
inputs: [
{ subLabel: 'access_token', value: '', col: 'access_token', desc: "钉钉webhook中的access_token" },
{ subLabel: '加签', value: '', col: 'secret', desc: "加签的签名,SEC开头" },
{ subLabel: '渠道名', value: '', col: 'name', desc: "想要设置的渠道名字" },
],
tips: {
text: "输入框说明", desc: "钉钉支持加签和关键字过滤,如果是配置了关键字过滤,只需要消息里面包含了关键字,就会发送"
},
taskInsRadios: [
{ subLabel: 'text', content: 'text' },
{ subLabel: 'markdown', content: 'markdown' },
],
taskInsInputs: [
],
},
{
type: 'QyWeiXin',
label: '企业微信',
inputs: [
{ subLabel: 'token', value: '', col: 'access_token', desc: "企业微信webhook中的token" },
{ subLabel: '渠道名', value: '', col: 'name', desc: "想要设置的渠道名字" },
],
tips: {
},
taskInsRadios: [
{ subLabel: 'text', content: 'text' },
{ subLabel: 'markdown', content: 'markdown' },
],
taskInsInputs: [
],
},
{
type: 'Custom',
label: '自定义推送',
inputs: [
{ subLabel: 'webhook地址', value: '', col: 'webhook', desc: "自定义webhook地址" },
{ subLabel: '请求体', value: '', col: 'body', desc: "text内容请使用 TEXT 进行占位\n例如:{\"message\": \"TEXT\", \"foo\": \"bar\"}", isTextArea: true },
{ subLabel: '渠道名', value: '', col: 'name', desc: "想要设置的渠道名字" },
],
tips: {
text: "自定义webhook说明", desc: "自定义webhook暂时只支持text,消息将解析TEXT占位标识进行替换,暂时只支持POST方式"
},
taskInsRadios: [
{ subLabel: 'text', content: 'text' },
],
taskInsInputs: [
],
},
{
type: 'WeChatOFAccount',
label: '微信测试公众号模板',
inputs: [
{ subLabel: 'appID', value: '', col: 'appID', desc: "公众号appid" },
{ subLabel: 'appsecret', value: '', col: 'appsecret', desc: "公众号appsecret" },
{ subLabel: '模板id', value: '', col: 'tempid', desc: "模板消息id" },
{ subLabel: '渠道名', value: '', col: 'name', desc: "想要设置的渠道名字" },
],
tips: {
text: "公众号消息说明", desc: "微信测试公众号模板消息发送,token使用内存缓存,
秘钥请访问 https://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index"
},
taskInsRadios: [
{ subLabel: 'text', content: 'text' },
],
taskInsInputs: [
{ value: '', col: 'to_account', desc: "要发送的OpenId(登录微信公众号后台查看)" },
],
},
{
type: 'MessageNest',
label: '自托管消息',
inputs: [
{ subLabel: '渠道名', value: '', col: 'name', desc: "想要设置的渠道名字" },
],
tips: {
text: "自托管消息说明", desc: "站点本身会作为消息接收站点,接收、展示推送过来的消息。"
},
taskInsRadios: [
{ subLabel: 'text', content: 'text' },
],
taskInsInputs: [
],
},
],
API_VIEW_DATA: [
{ label: "curl", class: "language-shell line-numbers", code: "", func: ApiStrGenerate.getCurlString },
{ label: "python", class: "language-python line-numbers", code: "", func: ApiStrGenerate.getPythonString },
{ label: "go", class: "language-go line-numbers", code: "", func: ApiStrGenerate.getGolangString },
{ label: "java", class: "language-java line-numbers", code: "", func: ApiStrGenerate.getJaveString },
{ label: "rust", class: "language-rust line-numbers", code: "", func: ApiStrGenerate.getRustString },
{ label: "php", class: "language-php line-numbers", code: "", func: ApiStrGenerate.getPHPString },
{ label: "node", class: "language-javascript line-numbers", code: "", func: ApiStrGenerate.getNodeString },
],
}
// 转换渠道map
CONSTANT.WAYS_DATA_MAP = {};
CONSTANT.WAYS_DATA.forEach(element => {
CONSTANT.WAYS_DATA_MAP[element.type] = element
});
export { CONSTANT }