-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy patharguments-builder-full.config.ts
More file actions
342 lines (315 loc) · 13.4 KB
/
arguments-builder-full.config.ts
File metadata and controls
342 lines (315 loc) · 13.4 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
import { defineConfig } from "@iringo/arguments-builder";
type Arg = {
key: string;
type: "string" | "number" | "boolean" | "array";
boxJsType?: "number" | "boolean" | "text" | "slider" | "textarea" | "radios" | "checkboxes" | "colorpicker" | "selects" | "modalSelects" | undefined;
name?: string | undefined;
description?: string | undefined;
// biome-ignore lint/suspicious/noExplicitAny: Copy from upstream `@iringo/arguments-builder`
defaultValue?: any;
options?:
| {
key: string;
label?: string | undefined;
}[]
| undefined;
placeholder?: string | undefined;
exclude?: ("surge" | "loon" | "boxjs" | "dts")[] | undefined;
};
export const output = {
surge: {
path: "./dist/iRingo.WeatherKit.sgmodule",
transformEgern: {
enable: true,
path: "./dist/iRingo.WeatherKit.yaml",
},
},
loon: {
path: "./dist/iRingo.WeatherKit.plugin",
},
customItems: [
{
path: "./dist/iRingo.WeatherKit.snippet",
template: "./template/quantumultx.handlebars",
},
{
path: "./dist/iRingo.WeatherKit.stoverride",
template: "./template/stash.handlebars",
},
],
dts: {
isExported: true,
path: "./src/types.d.ts",
},
boxjsSettings: {
path: "./template/boxjs.settings.json",
scope: "@iRingo.WeatherKit.Settings",
},
};
const dataSets: Arg[] = [
{
key: "DataSets",
name: "[数据集]",
defaultValue: ["airQuality", "currentWeather", "forecastDaily", "forecastHourly", "forecastNextHour", "locationInfo", "news", "historicalComparisons", "weatherAlerts", "weatherChanges"],
type: "array",
description: "选中的数据集会被包含在请求中。",
options: [
{ key: "airQuality", label: "空气质量" },
{ key: "currentWeather", label: "当前天气" },
{ key: "forecastDaily", label: "每日预报" },
{ key: "forecastHourly", label: "每小时预报" },
{ key: "forecastNextHour", label: "未来一小时降水强度" },
{ key: "locationInfo", label: "位置信息" },
{ key: "news", label: "新闻" },
{ key: "historicalComparisons", label: "历史对比" },
{ key: "weatherAlerts", label: "天气预警" },
{ key: "weatherChanges", label: "天气变化" },
],
},
];
const weatherReplace: Arg = {
key: "Weather.Replace",
name: "[天气] 替换范围",
defaultValue: ["CN"],
type: "array",
description: "正则表达式,只替换指定地区的天气。",
};
const weatherProvider: Arg = {
key: "Weather.Provider",
name: "[天气] 数据源",
defaultValue: "ColorfulClouds",
type: "string",
options: [
{ key: "WeatherKit", label: "WeatherKit(不替换)" },
{ key: "ColorfulClouds", label: "彩云天气" },
{ key: "QWeather", label: "和风天气" },
],
description: "使用选定的数据源替换天气数据。",
};
export const weather = [weatherProvider];
const weatherFull = [weatherReplace, weatherProvider];
const nextHourProvider: Arg = {
key: "NextHour.Provider",
name: "[未来一小时降水强度] 数据源",
defaultValue: "ColorfulClouds",
type: "string",
options: [
{ key: "WeatherKit", label: "WeatherKit(不添加)" },
{ key: "ColorfulClouds", label: "彩云天气" },
{ key: "QWeather", label: "和风天气" },
],
description: "使用选定的数据源填充未来一小时降水强度的数据。",
};
export const nextHour = [nextHourProvider];
const nextHourFull = [nextHourProvider];
const airQualityCurrentPollutantsProvider: Arg = {
key: "AirQuality.Current.Pollutants.Provider",
name: "[今日污染物] 数据源",
defaultValue: "ColorfulClouds",
type: "string",
options: [
{ key: "ColorfulClouds", label: "彩云天气" },
{ key: "QWeather", label: "和风天气" },
],
description: "使用选定的数据源填补污染物数据。",
};
const airQualityCurrentPollutantsUnitsReplace: Arg = {
key: "AirQuality.Current.Pollutants.Units.Replace",
name: "[今日污染物 - 单位转换] 替换目标",
defaultValue: [],
type: "array",
options: [
{ key: "EPA_NowCast", label: "美国AQI(EPA_NowCast)" },
{ key: "EU.EAQI", label: "欧盟EAQI(EU.EAQI)" },
{ key: "HJ6332012", label: "中国AQI(HJ6332012)" },
{ key: "UBA", label: "德国LQI(UBA)" },
],
description: "转换污染物的单位,方便与空气质量标准比对。单位转换会产生小数,有略微精度损失,且小数部分可能会被省略。",
};
const airQualityCurrentPollutantsUnitsMode: Arg = {
key: "AirQuality.Current.Pollutants.Units.Mode",
name: "[今日污染物 - 单位转换] 模式",
defaultValue: "Scale",
type: "string",
options: [
{ key: "Scale", label: "与空气质量标准的要求相同" },
{ key: "ugm3", label: "除非标准要求,都转为µg/m³" },
{ key: "EU_ppb", label: "除非标准要求,都转为欧盟ppb" },
{ key: "US_ppb", label: "除非标准要求,都转为美标ppb" },
{ key: "Force_ugm3", label: "µg/m³" },
{ key: "Force_EU_ppb", label: "欧盟ppb" },
{ key: "Force_US_ppb", label: "美标ppb" },
],
description: "污染物单位的转换目标。",
};
const airQualityCurrentIndexReplace: Arg = {
key: "AirQuality.Current.Index.Replace",
name: "[今日空气指数] 替换目标",
defaultValue: ["HJ6332012"],
type: "array",
options: [
{ key: "HJ6332012", label: "中国AQI(HJ6332012)" },
{ key: "IE.AQIH", label: "爱尔兰AQIH(IE.AQIH)" },
{ key: "AT.AQI", label: "奥地利AQI(AT.AQI)" },
{ key: "BE.BelAQI", label: "比利时BelAQI(BE.BelAQI)" },
{ key: "UBA", label: "德国LQI(UBA)" },
{ key: "FR.ATMO", label: "法国IQA(FR.ATMO)" },
{ key: "KR.CAI", label: "韩国CAI(KR.CAI)" },
{ key: "CA.AQHI", label: "加拿大AQHI(CA.AQHI)" },
{ key: "CZ.AQI", label: "捷克AQI(CZ.AQI)" },
{ key: "NL.LKI", label: "荷兰LKI(NL.LKI)" },
{ key: "EPA_NowCast", label: "美国AQI(EPA_NowCast)" },
{ key: "ICARS", label: "墨西哥ICARS(ICARS)" },
{ key: "EU.EAQI", label: "欧盟EAQI(EU.EAQI)" },
{ key: "CH.KBI", label: "瑞士KBI(CH.KBI)" },
{ key: "ES.MITECO", label: "西班牙ICA(ES.MITECO)" },
{ key: "SG.NEA", label: "新加坡PSI(SG.NEA)" },
{ key: "NAQI", label: "印度NAQI(NAQI)" },
{ key: "DAQI", label: "英国DAQI(DAQI)" },
],
description: "替换指定标准的空气质量指数。",
};
const airQualityCurrentIndexProvider: Arg = {
key: "AirQuality.Current.Index.Provider",
name: "[今日空气指数] 数据源",
defaultValue: "Calculate",
type: "string",
options: [
{ key: "Calculate", label: "iRingo内置算法" },
{ key: "ColorfulCloudsUS", label: "彩云天气(美标,18年9月版)" },
{ key: "ColorfulCloudsCN", label: "彩云天气(国标,12年2月版)" },
{ key: "QWeather", label: "和风天气(国标,12年2月版)" },
],
description: "使用选定的数据源填补和替换空气质量指数。",
};
const airQualityCurrentIndexForceCNPrimaryPollutants: Arg = {
key: "AirQuality.Current.Index.ForceCNPrimaryPollutants",
name: "[今日空气指数] 强制主要污染物",
defaultValue: true,
type: "boolean",
description: "忽略国标(HJ 633—2012)的AQI > 50规定,始终将IAQI最大的空气污染物作为主要污染物。",
};
const airQualityCurrentFull = [airQualityCurrentPollutantsProvider, airQualityCurrentPollutantsUnitsReplace, airQualityCurrentPollutantsUnitsMode, airQualityCurrentIndexReplace, airQualityCurrentIndexProvider, airQualityCurrentIndexForceCNPrimaryPollutants];
const airQualityComparisonReplace: Arg = {
key: "AirQuality.Comparison.ReplaceWhenCurrentChange",
name: "[空气质量 - 对比昨日] 变化时替换",
defaultValue: false,
type: "boolean",
description: "即使已有对比昨日数据,当今日空气质量指数发生变化时,替换对比昨日数据。",
};
const airQualityComparisonYesterdayPollutantsProvider: Arg = {
key: "AirQuality.Comparison.Yesterday.PollutantsProvider",
name: "[昨日污染物] 数据源",
defaultValue: "QWeather",
type: "string",
options: [{ key: "QWeather", label: "和风天气" }],
description: "为iRingo内置算法提供污染物数据,计算出昨日的空气质量指数。",
};
const airQualityComparisonYesterdayIndexProvider: Arg = {
key: "AirQuality.Comparison.Yesterday.IndexProvider",
name: "[昨日空气指数] 数据源",
defaultValue: "ColorfulCloudsUS",
type: "string",
options: [
{ key: "Calculate", label: "iRingo内置算法" },
{ key: "ColorfulCloudsUS", label: "彩云天气(美标,18年9月版)" },
{ key: "ColorfulCloudsCN", label: "彩云天气(国标,12年2月版)" },
{ key: "QWeather", label: "和风天气(国标,12年2月版)" },
],
description: "用来和今日空气质量指数对比的数据。",
};
const airQualityComparisonFull = [airQualityComparisonReplace, airQualityComparisonYesterdayPollutantsProvider, airQualityComparisonYesterdayIndexProvider];
const airQualityFull = [...airQualityCurrentFull, ...airQualityComparisonFull];
const calculateAlgorithm: Arg = {
key: "AirQuality.Calculate.Algorithm",
name: "[iRingo内置算法] 算法",
defaultValue: "EU_EAQI",
type: "string",
options: [
{ key: "None", label: "不转换" },
{ key: "UBA", label: "德国LQI(FB001846)" },
{ key: "EU_EAQI", label: "欧盟EAQI(ETC HE Report 2024/17)" },
{ key: "WAQI_InstantCast_US", label: "美标InstantCast(EPA-454/B-24-002)" },
{ key: "WAQI_InstantCast_CN", label: "国标InstantCast(HJ 633—2012)" },
{ key: "WAQI_InstantCast_CN_25_DRAFT", label: "国标InstantCast(HJ 633 2025年草案)" },
],
description: "使用内置算法,通过污染物数据本地计算空气指数。InstantCast源自于WAQI,美标版本使用了WAQI的臭氧标准。",
};
const calculateAllowOverRange: Arg = {
key: "AirQuality.Calculate.AllowOverRange",
name: "[iRingo内置算法] 允许指数超标",
defaultValue: true,
type: "boolean",
description: "允许美标和国标的指数超过500。超过500时,指示颜色的小圆点会消失。",
};
export const calculate = [calculateAlgorithm];
const calculateFull = [calculateAlgorithm, calculateAllowOverRange];
export const api: Arg[] = [
{
key: "API.ColorfulClouds.Token",
name: "[API] 彩云天气令牌",
defaultValue: "",
type: "string",
placeholder: "123456789123456789abcdefghijklmnopqrstuv",
description: "彩云天气 API 令牌",
},
{
key: "API.QWeather.Host",
name: "[API] 和风天气主机",
defaultValue: "devapi.qweather.com",
type: "string",
placeholder: "devapi.qweather.com",
description: "和风天气 API 使用的主机名",
},
{
key: "API.QWeather.Token",
name: "[API] 和风天气令牌",
defaultValue: "",
type: "string",
placeholder: "123456789123456789abcdefghijklmnopqrstuv",
description: "和风天气 API 令牌",
},
{
key: "API.WAQI.Token",
name: "[API] WAQI 令牌",
defaultValue: "",
type: "string",
placeholder: "123456789123456789abcdefghijklmnopqrstuv",
description: "WAQI API 令牌,填写此字段将自动使用WAQI高级API",
},
];
export const storage: Arg[] = [
{
key: "Storage",
name: "[储存] 配置类型",
defaultValue: "Argument",
type: "string",
options: [
{ key: "Argument", label: "优先使用插件选项与模块参数等,由 $argument 传入的配置,$argument 不包含的设置项由 PersistentStore (BoxJs) 提供" },
{ key: "PersistentStore", label: "只使用来自 BoxJs 等,由 $persistentStore 提供的配置" },
{ key: "database", label: "只使用由作者的 database.mjs 文件提供的默认配置,其他任何自定义配置不再起作用" },
],
description: "选择要使用的配置类型。未设置此选项或不通过此选项的旧版本的配置顺序依旧是 $persistentStore (BoxJs) > $argument > database。",
},
];
export const logLevel: Arg[] = [
{
key: "LogLevel",
name: "[调试] 日志等级",
type: "string",
defaultValue: "WARN",
description: "选择脚本日志的输出等级,低于所选等级的日志将全部输出。",
options: [
{ key: "OFF", label: "关闭" },
{ key: "ERROR", label: "❌ 错误" },
{ key: "WARN", label: "⚠️ 警告" },
{ key: "INFO", label: "ℹ️ 信息" },
{ key: "DEBUG", label: "🅱️ 调试" },
{ key: "ALL", label: "全部" },
],
},
];
export default defineConfig({
output,
args: [...dataSets, ...weatherFull, ...nextHourFull, ...airQualityFull, ...calculateFull, ...api, ...storage, ...logLevel],
});