@ikenxuan/amagi 1.4.7 → 1.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,6 +9,7 @@ export default class BilibiliData {
|
|
|
9
9
|
this.headers = {};
|
|
10
10
|
this.headers.Referer = 'https://api.bilibili.com/';
|
|
11
11
|
this.headers.Cookie = cookie;
|
|
12
|
+
this.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0';
|
|
12
13
|
}
|
|
13
14
|
async GetData(data = {}) {
|
|
14
15
|
let result;
|
package/lib/model/logger.d.ts
CHANGED
package/lib/model/logger.js
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import log from 'loglevel';
|
|
2
|
+
import prefix from 'loglevel-plugin-prefix';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
const colors = {
|
|
5
|
+
TRACE: chalk.magenta,
|
|
6
|
+
DEBUG: chalk.cyan,
|
|
7
|
+
INFO: chalk.blue,
|
|
8
|
+
WARN: chalk.yellow,
|
|
9
|
+
ERROR: chalk.red,
|
|
10
|
+
};
|
|
11
|
+
prefix.reg(log);
|
|
12
|
+
log.enableAll();
|
|
13
|
+
prefix.apply(log, {
|
|
14
|
+
format(level, name, timestamp) {
|
|
15
|
+
const levelKey = level.toUpperCase();
|
|
16
|
+
if (!(levelKey in colors)) {
|
|
17
|
+
throw new Error(`Invalid log level: ${levelKey}`);
|
|
18
|
+
}
|
|
19
|
+
return `${chalk.gray(`[${timestamp}]`)} ${colors[levelKey](level)} ${chalk.green(`${name}:`)}`;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
prefix.apply(log.getLogger('critical'), {
|
|
23
|
+
format(level, name, timestamp) {
|
|
24
|
+
return chalk.red.bold(`[${timestamp}] ${level} ${name}:`);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const logger = log;
|
|
4
28
|
export default logger;
|
package/lib/server/listen.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logger } from '../model/index.js';
|
|
2
2
|
/** 启动监听 */
|
|
3
3
|
export const StartClient = async (client, options) => {
|
|
4
|
-
return client.listen({ port: options.port, host: '
|
|
4
|
+
return client.listen({ port: options.port, host: '::' }, (_err, _address) => {
|
|
5
5
|
if (_err)
|
|
6
6
|
logger.error(_err);
|
|
7
7
|
logger.info(`amagi server listening on http://localhost:${options.port}`);
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikenxuan/amagi",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"homepage": "https://github.com/ikenxuan/amagi",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"dev": "tsx
|
|
9
|
+
"dev": "tsx lib/dev.js",
|
|
10
10
|
"build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json && node src/cp.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"chokidar": "^3.6.0",
|
|
35
35
|
"fastify": "^4.28.1",
|
|
36
36
|
"lodash": "4.17.21",
|
|
37
|
+
"loglevel": "^1.9.1",
|
|
38
|
+
"loglevel-plugin-prefix": "^0.8.4",
|
|
37
39
|
"md5": "^2.3.0",
|
|
38
|
-
"node-fetch": "^3.3.2"
|
|
39
|
-
"pino": "^9.3.2",
|
|
40
|
-
"pino-pretty": "^11.2.2"
|
|
40
|
+
"node-fetch": "^3.3.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/lodash": "latest",
|