-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguoba.support.js
More file actions
131 lines (130 loc) · 4.28 KB
/
guoba.support.js
File metadata and controls
131 lines (130 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import { cfg } from "#GamePush.components"
import { gameIds, getGameName } from "#GamePush.model"
export function supportGuoba() {
return {
pluginInfo: {
name: "GamePush-Plugin",
title: "游戏推送",
description: "自动监控游戏版本更新并推送通知,支持Yunzai和Karin",
author: "@rainbowwarmth",
link: "https://gitcode.com/rainbowwarmth/GamePush-Plugin.git",
isV3: true,
showInMenu: true,
icon: "mdi:gamepad-square-outline",
iconColor: "#FF5722"
},
configInfo: {
schemas: [
...gameIds
.map((gameId) => {
const gameName = getGameName(gameId)
return [
{
label: `${gameName}`,
component: "SOFT_GROUP_BEGIN"
},
{
label: `${gameName}配置`,
component: "Divider"
},
{
field: `${gameId}.enable`,
label: "启用推送",
component: "Switch",
value: true,
componentProps: {
defaultChecked: true
}
},
{
field: `${gameId}.log`,
label: "启用日志",
component: "Switch",
value: false,
componentProps: {
defaultChecked: false
}
},
{
field: `${gameId}.cron`,
label: "检查频率",
bottomHelpMessage: "版本检查的时间表达式",
component: "EasyCron",
value: "0 0/5 * * * *",
componentProps: {
placeholder: "默认: 0 0/5 * * * * (每5分钟检查一次)"
}
},
{
field: `${gameId}.pushGroups`,
label: "推送配置",
bottomHelpMessage: "机器人ID和群组配置",
component: "GSubForm",
componentProps: {
multiple: true,
schemas: [
{
field: "botId",
label: "机器人ID",
component: "Input",
required: true,
componentProps: {
placeholder: "请输入机器人账号ID"
}
},
{
field: "Group",
helpMessage: "检测到UP更新后推送的群列表",
label: "推送群",
componentProps: {
placeholder: "点击选择要推送的群"
},
component: "GSelectGroup"
}
]
}
},
{
field: `${gameId}.pushChangeType`,
label: "消息类型",
bottomHelpMessage: "1. 图片类型消息推送 2. 文字类型消息推送",
component: "RadioGroup",
componentProps: {
options: [
{ label: "图片消息", value: "1" },
{ label: "文字消息", value: "2" }
],
placeholder: "请选择消息推送类型"
}
},
{
field: `${gameId}.html`,
label: "html模板",
bottomHelpMessage: "1. 默认模板 2. 简约模板",
component: "RadioGroup",
componentProps: {
options: [
{ label: "默认html", value: "default" },
{ label: "简约", value: "Simple" }
],
placeholder: "请选择渲染的html模板"
}
}
]
})
.flat()
],
getConfigData() {
return cfg.getFrontendConfig()
},
setConfigData(data, { Result }) {
const saveResult = cfg.saveFromFrontend(data, { Result })
if (saveResult.success) {
return Result.ok({}, saveResult.message)
} else {
return Result.error(saveResult.message)
}
}
}
}
}