lscontests 2.6.3 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -44,8 +44,8 @@ Options:
44
44
  -s, --silent do not print log
45
45
  -o, --oj <ojs...> OJs to display (choices: "at", "cf", "lc", "lg", "nc")
46
46
  -r, --raw print raw contest list
47
- -L, --language <lang> set output language (choices: "en", "zh-CN", "zh-NE",
48
- "zh-TW", default: "zh-CN")
47
+ -L, --language <lang> set output language (choices: "en", "zh-CN", "zh-TW",
48
+ default: "zh-CN")
49
49
  --no-sort do not sort by contests start time, but by OJ order
50
50
  --no-running do not list all running contests
51
51
  --no-upcoming do not list all upcoming contests
@@ -56,43 +56,57 @@ Options:
56
56
  It performs as follows:
57
57
 
58
58
  <!-- block_cli begin -->
59
- (*The following content was automatically generated using [semantic-release](https://github.com/semantic-release/semantic-release) on Sat, 29 Oct 2022 17:43:19 GMT*)
59
+ (*The following content was automatically generated using [semantic-release](https://github.com/semantic-release/semantic-release) on Sun, 24 Sep 2023 06:43:05 GMT*)
60
60
 
61
61
  <details>
62
62
  <summary> <code>> lsct -L en</code> </summary>
63
63
 
64
64
  ```text
65
- There are 2 contests is running on Luogu
65
+ There are 2 contests is running on Luogu,AtCoder
66
66
 
67
67
  OJ: Luogu
68
- Contest name: CSP-J 2022 自测
69
- Rule: IOI
70
- Start time: 10/29/2022, 04:30:00
71
- End time: 11/5/2022, 14:00:00
72
- https://www.luogu.com.cn/contest/90215
68
+ Contest name: [ICPC2021 Macao R] ICPC2021 区域赛澳门站重现赛
69
+ Rule: ICPC
70
+ Start time: 9/24/2023, 05:00:00
71
+ End time: 9/24/2023, 10:00:00
72
+ https://www.luogu.com.cn/contest/134300
73
73
 
74
- OJ: Luogu
75
- Contest name: CSP-S 2022 自测
74
+ OJ: AtCoder
75
+ Contest name: Ⓗ Marubeni Programming Contest 2023 (AtCoder Heuristic Contest 024)
76
+ Rule: AtCoder
77
+ Start time: 9/24/2023, 06:00:00
78
+ End time: 9/24/2023, 10:00:00
79
+ https://atcoder.jp/contests/ahc024
80
+
81
+ There are 4 contests on NowCoder,Codeforces in the next 3 days
82
+
83
+ OJ: NowCoder
84
+ Contest name: 牛客周赛 Round 13
76
85
  Rule: IOI
77
- Start time: 10/29/2022, 10:45:00
78
- End time: 11/5/2022, 14:00:00
79
- https://www.luogu.com.cn/contest/90216
86
+ Start time: 9/24/2023, 11:00:00
87
+ End time: 9/24/2023, 12:30:00
88
+ https://ac.nowcoder.com/acm/contest/65507
80
89
 
81
- There are 2 contests on LeetCode,AtCoder in the next 3 days
90
+ OJ: Codeforces
91
+ Contest name: Educational Codeforces Round 155 (Rated for Div. 2)
92
+ Rule: ICPC
93
+ Start time: 9/24/2023, 14:35:00
94
+ End time: 9/24/2023, 16:35:00
95
+ https://codeforces.com/contests/1879
82
96
 
83
- OJ: LeetCode
84
- Contest name: Weekly Contest 317
85
- Rule: AtCoder
86
- Start time: 10/30/2022, 02:30:00
87
- End time: 10/30/2022, 04:00:00
88
- https://leetcode.com/contest/weekly-contest-317
97
+ OJ: Codeforces
98
+ Contest name: Codeforces Round 899 (Div. 2)
99
+ Rule: Codeforces
100
+ Start time: 9/25/2023, 14:35:00
101
+ End time: 9/25/2023, 16:35:00
102
+ https://codeforces.com/contests/1882
89
103
 
90
- OJ: AtCoder
91
- Contest name: TOYOTA MOTOR CORPORATION Programming Contest 2022(AtCoder Heuristic Contest 015)
92
- Rule: AtCoder
93
- Start time: 10/30/2022, 06:00:00
94
- End time: 10/30/2022, 10:00:00
95
- https://atcoder.jp/contests/ahc015
104
+ OJ: Codeforces
105
+ Contest name: Codeforces Round 900 (Div. 3)
106
+ Rule: ICPC
107
+ Start time: 9/26/2023, 14:35:00
108
+ End time: 9/26/2023, 16:50:00
109
+ https://codeforces.com/contests/1878
96
110
  ```
97
111
 
98
112
  </details>
@@ -101,30 +115,58 @@ https://atcoder.jp/contests/ahc015
101
115
  <summary> <code>> lsct -o at cf -d 7 -L en</code> </summary>
102
116
 
103
117
  ```text
104
- There are no running contests on AtCoder,Codeforces
105
-
106
- There are 3 contests on AtCoder,Codeforces in the next 7 days
118
+ There are 1 contests is running on AtCoder
107
119
 
108
120
  OJ: AtCoder
109
- Contest name: Ⓗ TOYOTA MOTOR CORPORATION Programming Contest 2022(AtCoder Heuristic Contest 015)
121
+ Contest name: Ⓗ Marubeni Programming Contest 2023 (AtCoder Heuristic Contest 024)
110
122
  Rule: AtCoder
111
- Start time: 10/30/2022, 06:00:00
112
- End time: 10/30/2022, 10:00:00
113
- https://atcoder.jp/contests/ahc015
123
+ Start time: 9/24/2023, 06:00:00
124
+ End time: 9/24/2023, 10:00:00
125
+ https://atcoder.jp/contests/ahc024
126
+
127
+ There are 6 contests on Codeforces,AtCoder in the next 7 days
114
128
 
115
129
  OJ: Codeforces
116
- Contest name: Codeforces Round (Div. 2)
130
+ Contest name: Educational Codeforces Round 155 (Rated for Div. 2)
131
+ Rule: ICPC
132
+ Start time: 9/24/2023, 14:35:00
133
+ End time: 9/24/2023, 16:35:00
134
+ https://codeforces.com/contests/1879
135
+
136
+ OJ: Codeforces
137
+ Contest name: Codeforces Round 899 (Div. 2)
117
138
  Rule: Codeforces
118
- Start time: 11/4/2022, 14:35:00
119
- End time: 11/4/2022, 16:35:00
120
- https://codeforces.com/contests/1747
139
+ Start time: 9/25/2023, 14:35:00
140
+ End time: 9/25/2023, 16:35:00
141
+ https://codeforces.com/contests/1882
142
+
143
+ OJ: Codeforces
144
+ Contest name: Codeforces Round 900 (Div. 3)
145
+ Rule: ICPC
146
+ Start time: 9/26/2023, 14:35:00
147
+ End time: 9/26/2023, 16:50:00
148
+ https://codeforces.com/contests/1878
121
149
 
122
150
  OJ: AtCoder
123
- Contest name: Ⓐ AtCoder Beginner Contest 276
151
+ Contest name: Ⓐ AtCoder Beginner Contest 322
124
152
  Rule: AtCoder
125
- Start time: 11/5/2022, 12:00:00
126
- End time: 11/5/2022, 13:40:00
127
- https://atcoder.jp/contests/abc276
153
+ Start time: 9/30/2023, 12:00:00
154
+ End time: 9/30/2023, 13:40:00
155
+ https://atcoder.jp/contests/abc322
156
+
157
+ OJ: Codeforces
158
+ Contest name: Codeforces Round 901 (Div. 1)
159
+ Rule: Codeforces
160
+ Start time: 9/30/2023, 14:35:00
161
+ End time: 9/30/2023, 17:35:00
162
+ https://codeforces.com/contests/1874
163
+
164
+ OJ: Codeforces
165
+ Contest name: Codeforces Round 901 (Div. 2)
166
+ Rule: Codeforces
167
+ Start time: 9/30/2023, 14:35:00
168
+ End time: 9/30/2023, 17:35:00
169
+ https://codeforces.com/contests/1875
128
170
  ```
129
171
 
130
172
  </details>
@@ -134,93 +176,144 @@ https://atcoder.jp/contests/abc276
134
176
 
135
177
  ```json
136
178
  {
137
- "running": [],
179
+ "running": [
180
+ {
181
+ "ojName": "AtCoder",
182
+ "name": "Ⓗ Marubeni Programming Contest 2023 (AtCoder Heuristic Contest 024)",
183
+ "rule": "AtCoder",
184
+ "startTime": "2023-09-24T06:00:00.000Z",
185
+ "endTime": "2023-09-24T10:00:00.000Z",
186
+ "url": "https://atcoder.jp/contests/ahc024"
187
+ }
188
+ ],
138
189
  "upcoming": [
139
190
  {
140
191
  "ojName": "AtCoder",
141
- "name": " TOYOTA MOTOR CORPORATION Programming Contest 2022(AtCoder Heuristic Contest 015)",
192
+ "name": " AtCoder Beginner Contest 322",
193
+ "rule": "AtCoder",
194
+ "startTime": "2023-09-30T12:00:00.000Z",
195
+ "endTime": "2023-09-30T13:40:00.000Z",
196
+ "url": "https://atcoder.jp/contests/abc322"
197
+ },
198
+ {
199
+ "ojName": "AtCoder",
200
+ "name": "Ⓐ UNIQUE VISION Programming Contest 2023 Autumn(AtCoder Beginner Contest 323)",
201
+ "rule": "AtCoder",
202
+ "startTime": "2023-10-07T12:00:00.000Z",
203
+ "endTime": "2023-10-07T13:40:00.000Z",
204
+ "url": "https://atcoder.jp/contests/abc323"
205
+ },
206
+ {
207
+ "ojName": "AtCoder",
208
+ "name": "Ⓐ AtCoder Regular Contest 166",
142
209
  "rule": "AtCoder",
143
- "startTime": "2022-10-30T06:00:00.000Z",
144
- "endTime": "2022-10-30T10:00:00.000Z",
145
- "url": "https://atcoder.jp/contests/ahc015"
210
+ "startTime": "2023-10-08T12:00:00.000Z",
211
+ "endTime": "2023-10-08T14:00:00.000Z",
212
+ "url": "https://atcoder.jp/contests/arc166"
146
213
  },
147
214
  {
148
215
  "ojName": "AtCoder",
149
- "name": " AtCoder Beginner Contest 276",
216
+ "name": " AtCoder Heuristic Contest 025",
150
217
  "rule": "AtCoder",
151
- "startTime": "2022-11-05T12:00:00.000Z",
152
- "endTime": "2022-11-05T13:40:00.000Z",
153
- "url": "https://atcoder.jp/contests/abc276"
218
+ "startTime": "2023-10-14T03:00:00.000Z",
219
+ "endTime": "2023-10-22T10:00:00.000Z",
220
+ "url": "https://atcoder.jp/contests/ahc025"
154
221
  },
155
222
  {
156
223
  "ojName": "AtCoder",
157
- "name": " HACK TO THE FUTURE 2023 qual(AtCoder Heuristic Contest 016)",
224
+ "name": " Japan Registry Services (JPRS) Programming Contest 2023 (AtCoder Beginner Contest 324)",
158
225
  "rule": "AtCoder",
159
- "startTime": "2022-11-11T10:00:00.000Z",
160
- "endTime": "2022-11-20T10:00:00.000Z",
161
- "url": "https://atcoder.jp/contests/ahc016"
226
+ "startTime": "2023-10-14T12:00:00.000Z",
227
+ "endTime": "2023-10-14T13:40:00.000Z",
228
+ "url": "https://atcoder.jp/contests/abc324"
162
229
  },
163
230
  {
164
231
  "ojName": "AtCoder",
165
- "name": "Ⓐ Daiwa Securities Co. Ltd. Programming Contest 2022 Autumn (AtCoder Beginner Contest 277)",
232
+ "name": "Ⓐ AtCoder Regular Contest 167",
166
233
  "rule": "AtCoder",
167
- "startTime": "2022-11-12T12:00:00.000Z",
168
- "endTime": "2022-11-12T13:40:00.000Z",
169
- "url": "https://atcoder.jp/contests/abc277"
234
+ "startTime": "2023-10-15T12:00:00.000Z",
235
+ "endTime": "2023-10-15T14:00:00.000Z",
236
+ "url": "https://atcoder.jp/contests/arc167"
170
237
  },
171
238
  {
172
239
  "ojName": "AtCoder",
173
- "name": "Ⓐ TOYOTA SYSTEMS Programming Contest 2022(AtCoder Beginner Contest 279)",
240
+ "name": "Ⓐ Panasonic Programming Contest 2023(AtCoder Beginner Contest 326)",
174
241
  "rule": "AtCoder",
175
- "startTime": "2022-11-26T12:00:00.000Z",
176
- "endTime": "2022-11-26T13:40:00.000Z",
177
- "url": "https://atcoder.jp/contests/abc279"
242
+ "startTime": "2023-10-28T12:00:00.000Z",
243
+ "endTime": "2023-10-28T13:40:00.000Z",
244
+ "url": "https://atcoder.jp/contests/abc326"
178
245
  },
179
246
  {
180
247
  "ojName": "Codeforces",
181
- "name": "Codeforces Round (Div. 2)",
182
- "rule": "Codeforces",
183
- "startTime": "2022-11-04T14:35:00.000Z",
184
- "endTime": "2022-11-04T16:35:00.000Z",
185
- "url": "https://codeforces.com/contests/1747"
248
+ "name": "Educational Codeforces Round 155 (Rated for Div. 2)",
249
+ "rule": "ICPC",
250
+ "startTime": "2023-09-24T14:35:00.000Z",
251
+ "endTime": "2023-09-24T16:35:00.000Z",
252
+ "url": "https://codeforces.com/contests/1879"
186
253
  },
187
254
  {
188
255
  "ojName": "Codeforces",
189
- "name": "CodeTON Round 3 (Div. 1 + Div. 2, Rated, Prizes!)",
256
+ "name": "Codeforces Round 899 (Div. 2)",
190
257
  "rule": "Codeforces",
191
- "startTime": "2022-11-06T14:35:00.000Z",
192
- "endTime": "2022-11-06T16:35:00.000Z",
193
- "url": "https://codeforces.com/contests/1750"
258
+ "startTime": "2023-09-25T14:35:00.000Z",
259
+ "endTime": "2023-09-25T16:35:00.000Z",
260
+ "url": "https://codeforces.com/contests/1882"
194
261
  },
195
262
  {
196
263
  "ojName": "Codeforces",
197
- "name": "Codeforces Round (Div. 2)",
264
+ "name": "Codeforces Round 900 (Div. 3)",
265
+ "rule": "ICPC",
266
+ "startTime": "2023-09-26T14:35:00.000Z",
267
+ "endTime": "2023-09-26T16:50:00.000Z",
268
+ "url": "https://codeforces.com/contests/1878"
269
+ },
270
+ {
271
+ "ojName": "Codeforces",
272
+ "name": "Codeforces Round 901 (Div. 1)",
198
273
  "rule": "Codeforces",
199
- "startTime": "2022-11-12T14:35:00.000Z",
200
- "endTime": "2022-11-12T16:35:00.000Z",
201
- "url": "https://codeforces.com/contests/1748"
274
+ "startTime": "2023-09-30T14:35:00.000Z",
275
+ "endTime": "2023-09-30T17:35:00.000Z",
276
+ "url": "https://codeforces.com/contests/1874"
202
277
  },
203
278
  {
204
279
  "ojName": "Codeforces",
205
- "name": "45th ICPC World Finals Challenge powered by Huawei - Problem 1",
206
- "startTime": "2022-11-17T00:00:00.000Z",
207
- "endTime": "2022-11-30T23:59:00.000Z",
208
- "url": "https://codeforces.com/contests/1751"
280
+ "name": "Codeforces Round 901 (Div. 2)",
281
+ "rule": "Codeforces",
282
+ "startTime": "2023-09-30T14:35:00.000Z",
283
+ "endTime": "2023-09-30T17:35:00.000Z",
284
+ "url": "https://codeforces.com/contests/1875"
209
285
  },
210
286
  {
211
287
  "ojName": "Codeforces",
212
- "name": "45th ICPC World Finals Challenge powered by Huawei - Problem 2",
213
- "startTime": "2022-11-17T00:00:00.000Z",
214
- "endTime": "2022-11-30T23:59:00.000Z",
215
- "url": "https://codeforces.com/contests/1752"
288
+ "name": "Codeforces Round (Div. 1)",
289
+ "rule": "Codeforces",
290
+ "startTime": "2023-10-08T09:05:00.000Z",
291
+ "endTime": "2023-10-08T11:35:00.000Z",
292
+ "url": "https://codeforces.com/contests/1876"
216
293
  },
217
294
  {
218
295
  "ojName": "Codeforces",
219
296
  "name": "Codeforces Round (Div. 2)",
220
297
  "rule": "Codeforces",
221
- "startTime": "2022-12-27T14:35:00.000Z",
222
- "endTime": "2022-12-27T16:35:00.000Z",
223
- "url": "https://codeforces.com/contests/1731"
298
+ "startTime": "2023-10-08T09:05:00.000Z",
299
+ "endTime": "2023-10-08T11:35:00.000Z",
300
+ "url": "https://codeforces.com/contests/1877"
301
+ },
302
+ {
303
+ "ojName": "Codeforces",
304
+ "name": "Codeforces Round (Div. 3)",
305
+ "rule": "ICPC",
306
+ "startTime": "2023-10-12T14:35:00.000Z",
307
+ "endTime": "2023-10-12T16:50:00.000Z",
308
+ "url": "https://codeforces.com/contests/1881"
309
+ },
310
+ {
311
+ "ojName": "Codeforces",
312
+ "name": "Codeforces Round (Div. 3)",
313
+ "rule": "ICPC",
314
+ "startTime": "2023-10-22T12:05:00.000Z",
315
+ "endTime": "2023-10-22T14:20:00.000Z",
316
+ "url": "https://codeforces.com/contests/1883"
224
317
  }
225
318
  ]
226
319
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * LeDuo: From Luogu OJ
3
3
  */
4
- export declare type rule = "OI" | "IOI" | "ICPC" | "LeDuo" | "Codeforces" | "AtCoder";
4
+ export type rule = "OI" | "IOI" | "ICPC" | "LeDuo" | "Codeforces" | "AtCoder";
5
5
  export interface Contest {
6
6
  ojName: string;
7
7
  name: string;
@@ -1,5 +1,5 @@
1
1
  export declare const langList: string[];
2
- export declare type langDict = {
2
+ export type langDict = {
3
3
  runnning: string;
4
4
  norunning: string;
5
5
  upcoming: string;
@@ -39,7 +39,7 @@ function getLangDict(language) {
39
39
  return __awaiter(this, void 0, void 0, function* () {
40
40
  if (!exports.langList.includes(language))
41
41
  throw new Error(`Illegal language ${language}, the allowed languages are ${exports.langList}`);
42
- return Promise.resolve().then(() => __importStar(require(`./${language}.json`)));
42
+ return Promise.resolve(`${`./${language}.json`}`).then(s => __importStar(require(s)));
43
43
  });
44
44
  }
45
45
  exports.getLangDict = getLangDict;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAiC;AAEpB,QAAA,QAAQ,GAAG,IAAA,gBAAW,EAAC,GAAG,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAgBlJ,SAAsB,WAAW,CAAC,QAAgB;;QAE9C,IAAG,CAAC,gBAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,QAAQ,+BAA+B,gBAAQ,EAAE,CAAC,CAAC;QACxH,yDAAc,KAAK,QAAQ,OAAO,IAAE;IACxC,CAAC;CAAA;AAJD,kCAIC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAiC;AAEpB,QAAA,QAAQ,GAAG,IAAA,gBAAW,EAAC,GAAG,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAgBlJ,SAAsB,WAAW,CAAC,QAAgB;;QAE9C,IAAG,CAAC,gBAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,QAAQ,+BAA+B,gBAAQ,EAAE,CAAC,CAAC;QACxH,0BAAc,KAAK,QAAQ,OAAO,wCAAE;IACxC,CAAC;CAAA;AAJD,kCAIC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const commander_1 = require("commander");
8
+ const package_json_1 = require("../package.json");
9
+ const server_1 = __importDefault(require("./server"));
10
+ const express_1 = __importDefault(require("express"));
11
+ const command = new commander_1.Command()
12
+ .name(Object.keys(package_json_1.bin)[1])
13
+ .version(package_json_1.version)
14
+ .option("-h, --host, <host>", "Host to listen on", "0.0.0.0")
15
+ .option("-p, --port, <port>", "Port to listen on", "8080");
16
+ command.parse();
17
+ const host = command.opts().host;
18
+ let port = command.opts().port;
19
+ port = parseInt(port, 10);
20
+ server_1.default.use(express_1.default.static(`${__dirname}/../public`));
21
+ server_1.default.listen(port, host, () => {
22
+ const logURL = `http://${host === "0.0.0.0" ? "127.0.0.1" : host}:${port}/`;
23
+ console.log(`LSCT server v${package_json_1.version} listening on ${logURL}`);
24
+ });
25
+ //# sourceMappingURL=server-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-cli.js","sourceRoot":"","sources":["../src/server-cli.ts"],"names":[],"mappings":";;;;;;AACA,yCAAoC;AACpC,kDAA+C;AAC/C,sDAA2B;AAC3B,sDAA8B;AAE9B,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE;KACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KACzB,OAAO,CAAC,sBAAO,CAAC;KAChB,MAAM,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,SAAS,CAAC;KAC5D,MAAM,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAC/D,OAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,IAAc,CAAC;AAC3C,IAAI,IAAI,GAAoB,OAAO,CAAC,IAAI,EAAE,CAAC,IAAc,CAAC;AAC1D,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAE1B,gBAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,MAAM,CAAC,GAAG,SAAS,YAAY,CAAC,CAAC,CAAC;AAElD,gBAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;IAExB,MAAM,MAAM,GAAG,UAAU,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,GAAG,CAAC;IAC5E,OAAO,CAAC,GAAG,CAAC,gBAAgB,sBAAO,iBAAiB,MAAM,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC,CAAC"}
package/dist/server.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
2
- export {};
1
+ declare const app: import("express-serve-static-core").Express;
2
+ export = app;
package/dist/server.js CHANGED
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  "use strict";
3
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -12,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
12
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
13
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
14
13
  };
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
14
  const express_1 = __importDefault(require("express"));
17
15
  const _1 = __importDefault(require("."));
18
16
  const oj_1 = require("./lib/oj");
@@ -20,10 +18,8 @@ const locale_1 = require("./locale");
20
18
  const ics_1 = require("ics");
21
19
  const pangu_1 = __importDefault(require("pangu"));
22
20
  const crypto_1 = require("crypto");
23
- const commander_1 = require("commander");
24
- const package_json_1 = require("../package.json");
25
- const fs_1 = require("fs");
26
21
  const await_lock_1 = __importDefault(require("await-lock"));
22
+ const ioredis_1 = __importDefault(require("ioredis"));
27
23
  const app = (0, express_1.default)();
28
24
  const logger = () => {
29
25
  return (req, res, next) => {
@@ -42,13 +38,8 @@ const logger = () => {
42
38
  next();
43
39
  };
44
40
  };
45
- const web = (0, fs_1.readFileSync)(`${__dirname}/server.html`).toString();
46
41
  app.set("trust proxy", true);
47
42
  app.use(logger());
48
- app.get("/", (req, res) => {
49
- res.set("Content-Type", "text/html");
50
- res.send(web);
51
- });
52
43
  app.get("/ics", (req, res) => __awaiter(void 0, void 0, void 0, function* () {
53
44
  const { language, l, ojs, o } = req.query;
54
45
  const lArg = language || l || "zh-CN";
@@ -73,6 +64,29 @@ const contestsCache = {
73
64
  contests: [],
74
65
  lastUpdate: 0
75
66
  };
67
+ let redis = undefined;
68
+ const cacheKey = "lsct:cache";
69
+ function exportContestCache() {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ yield redis.set(cacheKey, JSON.stringify(contestsCache));
72
+ });
73
+ }
74
+ function importContestCache() {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ redis = new ioredis_1.default(process.env.REDIS_URL);
77
+ const payload = yield redis.get(cacheKey);
78
+ if (payload) {
79
+ const obj = JSON.parse(payload);
80
+ contestsCache.lastUpdate = obj.lastUpdate;
81
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
82
+ contestsCache.contests = obj.contests.map((c) => {
83
+ c.startTime = new Date(c.startTime);
84
+ c.endTime = new Date(c.endTime);
85
+ return c;
86
+ });
87
+ }
88
+ });
89
+ }
76
90
  const lock = new await_lock_1.default();
77
91
  function icsPostProcess(value) {
78
92
  return value
@@ -93,12 +107,18 @@ function icsPostProcess(value) {
93
107
  function checkCache() {
94
108
  return __awaiter(this, void 0, void 0, function* () {
95
109
  yield lock.acquireAsync();
110
+ if (process.env.VERCEL) {
111
+ yield importContestCache();
112
+ }
96
113
  try {
97
114
  if (contestsCache.lastUpdate < Date.now() - 1000 * 60 * 5) {
98
115
  const c = yield new _1.default({ days: -1 }).getContests();
99
116
  contestsCache.contests = c.running.concat(...c.upcoming);
100
117
  contestsCache.contests = contestsCache.contests.filter(c => c.endTime.getTime() - c.startTime.getTime() < 1000 * 60 * 60 * 24 * 2); // ignore too long contests
101
118
  contestsCache.lastUpdate = Date.now();
119
+ if (process.env.VERCEL) {
120
+ yield exportContestCache();
121
+ }
102
122
  }
103
123
  }
104
124
  finally {
@@ -141,17 +161,5 @@ function getIcs(lang, ojs) {
141
161
  return icsPostProcess(value);
142
162
  });
143
163
  }
144
- const command = new commander_1.Command()
145
- .name(Object.keys(package_json_1.bin)[1])
146
- .version(package_json_1.version)
147
- .option("-h, --host, <host>", "Host to listen on", "0.0.0.0")
148
- .option("-p, --port, <port>", "Port to listen on", "8080");
149
- command.parse();
150
- const host = command.opts().host;
151
- let port = command.opts().port;
152
- port = parseInt(port, 10);
153
- app.listen(port, host, () => {
154
- const logURL = `http://${host === "0.0.0.0" ? "127.0.0.1" : host}:${port}/`;
155
- console.log(`LSCT server v${package_json_1.version} listening on ${logURL}`);
156
- });
164
+ module.exports = app;
157
165
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,sDAA8B;AAC9B,yCAAwC;AACxC,iCAAiC;AACjC,qCAAuC;AACvC,6BAA6E;AAC7E,kDAA0B;AAC1B,mCAAoC;AACpC,yCAAoC;AACpC,kDAA+C;AAC/C,2BAAkC;AAClC,4DAAmC;AAEnC,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;AAEtB,MAAM,MAAM,GAAG,GAAG,EAAE;IAEhB,OAAO,CAAC,GAAoB,EAAE,GAAqB,EAAE,IAA0B,EAAE,EAAE;QAE/E,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAC/B,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YAElB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG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,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACjD,MAAM,GAAG,GAAoB;gBACzB,KAAK,EAAE,IAAA,6BAAuB,EAAC,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC;gBAC9D,eAAe,EAAE,OAAO;gBACxB,GAAG,EAAE,IAAA,6BAAuB,EAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC;gBAC1D,aAAa,EAAE,OAAO;gBACtB,OAAO,EAAE,MAAM;gBACf,SAAS,EAAE,yBAAyB;gBACpC,KAAK,EAAE,CAAC,CAAC,IAAI;gBACb,QAAQ,EAAE,CAAC,CAAC,MAAM;gBAClB,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;gBACpB,GAAG,EAAE,GAAG,IAAA,mBAAU,GAAE,OAAO;gBAC3B,WAAW;aACd,CAAC;YACF,OAAO,GAAG,CAAC;QACf,CAAC,CAAC,CAAC;QACH,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAA,kBAAY,EAAC,MAAM,CAAC,CAAC;QAC9C,IAAG,KAAK;YAAE,MAAM,KAAK,CAAC;QACtB,IAAG,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACnD,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CAAA;AAED,iBAAS,GAAG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lscontests",
3
- "version": "2.6.3",
3
+ "version": "2.7.0",
4
4
  "description": "A tool to get information about the contests on each OJ",
5
5
  "keywords": [
6
6
  "cli",
@@ -18,51 +18,54 @@
18
18
  "main": "./dist/index.js",
19
19
  "bin": {
20
20
  "lsct": "./dist/cli.js",
21
- "lsct-s": "./dist/server.js"
21
+ "lsct-s": "./dist/server-cli.js"
22
22
  },
23
23
  "files": [
24
- "dist"
24
+ "dist",
25
+ "public"
25
26
  ],
26
27
  "scripts": {
27
- "prebuild": "rimraf ./dist/*",
28
- "postbuild": "cpy --flat src/server.html dist",
28
+ "prebuild": "rimraf ./dist",
29
29
  "build": "tsc -p src",
30
30
  "clean": "rimraf ./dist ./docs ./node_modules",
31
31
  "docs": "typedoc",
32
32
  "lint": "eslint . && markdownlint .",
33
33
  "lint:fix": "eslint . --fix && markdownlint . --fix",
34
34
  "start": "tsx src/cli.ts",
35
- "start-s": "tsx src/server.ts"
35
+ "start-s": "tsx src/server.ts",
36
+ "vercel-dev": "vercel dev"
36
37
  },
37
38
  "dependencies": {
38
39
  "await-lock": "^2.2.2",
39
- "axios": "^1.1.3",
40
- "axios-retry": "^3.2.5",
41
- "cheerio": "^1.0.0-rc.11",
42
- "commander": "^9.3.0",
43
- "express": "^4.18.1",
44
- "html-entities": "^2.3.3",
45
- "ics": "^2.35.0",
40
+ "axios": "^1.5.0",
41
+ "axios-retry": "^3.8.0",
42
+ "cheerio": "^1.0.0-rc.12",
43
+ "commander": "^11.0.0",
44
+ "express": "^4.18.2",
45
+ "html-entities": "^2.4.0",
46
+ "ics": "^3.5.0",
47
+ "ioredis": "^5.3.2",
46
48
  "lodash": "^4.17.21",
47
49
  "pangu": "^4.0.7",
48
- "winston": "^3.7.2"
50
+ "winston": "^3.10.0"
49
51
  },
50
52
  "devDependencies": {
51
- "@types/express": "^4.17.13",
52
- "@types/lodash": "^4.14.182",
53
- "@types/node": "^18.0.0",
53
+ "@types/express": "^4.17.17",
54
+ "@types/lodash": "^4.14.199",
55
+ "@types/node": "^20.6.3",
54
56
  "@types/pangu": "^4.0.0",
55
- "@typescript-eslint/eslint-plugin": "^5.27.1",
56
- "@typescript-eslint/parser": "^5.27.1",
57
- "cpy-cli": "^4.1.0",
57
+ "@typescript-eslint/eslint-plugin": "^6.7.2",
58
+ "@typescript-eslint/parser": "^6.7.2",
59
+ "@vercel/ncc": "^0.38.0",
60
+ "cpy-cli": "^5.0.0",
58
61
  "cz-conventional-changelog": "3.3.0",
59
- "eslint": "^8.17.0",
60
- "markdownlint-cli": "^0.32.0",
61
- "rimraf": "^3.0.2",
62
- "tsx": "^3.4.2",
63
- "typedoc": "^0.23.16",
64
- "typedoc-plugin-extras": "^2.2.3",
65
- "typescript": "^4.7.3"
62
+ "eslint": "^8.50.0",
63
+ "markdownlint-cli": "^0.37.0",
64
+ "rimraf": "^5.0.1",
65
+ "tsx": "^3.12.10",
66
+ "typedoc": "^0.25.1",
67
+ "typedoc-plugin-extras": "^3.0.0",
68
+ "typescript": "^5.2.2"
66
69
  },
67
70
  "config": {
68
71
  "commitizen": {
@@ -70,11 +70,6 @@
70
70
  checked/>
71
71
  <label class="form-check-label" for="zhCN">zh-CN</label>
72
72
  </div>
73
- <div class="form-check">
74
- <input class="form-check-input" type="radio" name="lang"
75
- id="zhNE"/>
76
- <label class="form-check-label" for="zhNE">zh-NE</label>
77
- </div>
78
73
  <div class="form-check">
79
74
  <input class="form-check-input" type="radio" name="lang"
80
75
  id="zhTW"/>
@@ -97,14 +92,10 @@
97
92
  </div>
98
93
  </div>
99
94
  </main>
100
- <script src="https://cdnjs.loli.net/ajax/libs/mdb-ui-kit/4.1.0/mdb.min.js" crossorigin="anonymous"
101
- referrerpolicy="no-referrer"
95
+ <script src="https://cdnjs.loli.net/ajax/libs/mdb-ui-kit/6.4.1/mdb.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"
102
96
  ></script>
103
- <script src="https://cdnjs.loli.net/ajax/libs/jquery/3.6.0/jquery.min.js" crossorigin="anonymous"
104
- referrerpolicy="no-referrer"></script>
105
- <script src="https://cdnjs.loli.net/ajax/libs/clipboard.js/2.0.10/clipboard.min.js"
106
- crossorigin="anonymous"
107
- referrerpolicy="no-referrer"></script>
97
+ <script src="https://cdnjs.loli.net/ajax/libs/jquery/3.7.1/jquery.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
98
+ <script src="https://cdnjs.loli.net/ajax/libs/clipboard.js/2.0.11/clipboard.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
108
99
  <script>
109
100
  function updateURL()
110
101
  {
@@ -130,7 +121,9 @@
130
121
  if(lc) ojs.push("lc");
131
122
  if(lg) ojs.push("lg");
132
123
  if(nc) ojs.push("nc");
133
- args.append("o", ojs.join(","));
124
+ if(ojs.length > 0) {
125
+ args.append("o", ojs.join(","));
126
+ }
134
127
  }
135
128
 
136
129
  //process lang
@@ -171,7 +164,6 @@
171
164
  {
172
165
  copy.tooltip("hide");
173
166
  }, 1000);
174
- fetch(url);
175
167
  }
176
168
  });
177
169
  }
@@ -1,13 +0,0 @@
1
- {
2
- "runnning": "搁 ${oj} 上有 ${contestCount} 场比赛正偷摸干着呢",
3
- "norunning": "这前搁 ${oj} 上属实是没比赛打",
4
- "upcoming": "之后 ${days} 天搁 ${oj} 上拢共 ${contestCount} 场比赛",
5
- "upcoming_all": "往后搁 ${oj} 上有 ${contestCount} 场比赛",
6
- "noupcoming": "没成想往后 ${days} 天搁 ${oj} 上没比赛打啊",
7
- "noupcoming_all": "将来搁 ${oj} 上没比赛",
8
- "ojName": "搁哪",
9
- "name": "叫啥",
10
- "rule": "咋个整法",
11
- "startTime": "啥前开始",
12
- "endTime": "多前完事"
13
- }