fishpi 0.0.4 → 0.0.8
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.
- package/lib/src/article.d.ts +60 -0
- package/lib/src/article.js +254 -0
- package/lib/src/breezemoon.d.ts +20 -0
- package/lib/src/breezemoon.js +114 -0
- package/lib/src/chat.d.ts +66 -0
- package/lib/src/chat.js +315 -0
- package/lib/src/chatroom.d.ts +80 -0
- package/lib/src/chatroom.js +460 -0
- package/lib/src/comment.d.ts +31 -0
- package/lib/src/comment.js +207 -0
- package/lib/src/emoji.d.ts +197 -0
- package/lib/src/emoji.js +308 -0
- package/lib/src/index.d.ts +64 -0
- package/lib/src/index.js +257 -0
- package/lib/src/notice.d.ts +31 -0
- package/lib/src/notice.js +157 -0
- package/lib/src/typing.d.ts +1901 -0
- package/lib/src/typing.js +411 -0
- package/lib/src/user.d.ts +35 -0
- package/lib/src/user.js +243 -0
- package/lib/src/utils.d.ts +7 -0
- package/lib/src/utils.js +132 -0
- package/package.json +2 -2
package/lib/src/utils.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
31
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
32
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
33
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
|
+
function step(op) {
|
|
35
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
36
|
+
while (_) try {
|
|
37
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
38
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
39
|
+
switch (op[0]) {
|
|
40
|
+
case 0: case 1: t = op; break;
|
|
41
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
42
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
43
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
44
|
+
default:
|
|
45
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
46
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
47
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
48
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
49
|
+
if (t[2]) _.ops.pop();
|
|
50
|
+
_.trys.pop(); continue;
|
|
51
|
+
}
|
|
52
|
+
op = body.call(thisArg, _);
|
|
53
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
54
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
58
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
59
|
+
};
|
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
+
exports.isBrowse = exports.analyzeMetalAttr = exports.toMetal = exports.domain = exports.request = void 0;
|
|
62
|
+
var axios_1 = __importDefault(require("axios"));
|
|
63
|
+
var https = __importStar(require("https"));
|
|
64
|
+
var domain = 'fishpi.cn/';
|
|
65
|
+
exports.domain = domain;
|
|
66
|
+
function request(opt) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
+
var url, _a, method, _b, headers, data, options, rsp, err_1;
|
|
69
|
+
return __generator(this, function (_c) {
|
|
70
|
+
switch (_c.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
url = opt.url, _a = opt.method, method = _a === void 0 ? 'get' : _a, _b = opt.headers, headers = _b === void 0 ? {} : _b, data = opt.data;
|
|
73
|
+
if (!isBrowse) {
|
|
74
|
+
headers['User-Agent'] = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36";
|
|
75
|
+
headers['Referer'] = "https://".concat(domain);
|
|
76
|
+
}
|
|
77
|
+
options = {
|
|
78
|
+
method: method,
|
|
79
|
+
headers: headers,
|
|
80
|
+
httpsAgent: new https.Agent({
|
|
81
|
+
keepAlive: true,
|
|
82
|
+
rejectUnauthorized: false,
|
|
83
|
+
}),
|
|
84
|
+
data: data
|
|
85
|
+
};
|
|
86
|
+
_c.label = 1;
|
|
87
|
+
case 1:
|
|
88
|
+
_c.trys.push([1, 3, , 4]);
|
|
89
|
+
return [4 /*yield*/, (0, axios_1.default)("https://".concat(domain).concat(url), options)];
|
|
90
|
+
case 2:
|
|
91
|
+
rsp = _c.sent();
|
|
92
|
+
return [2 /*return*/, rsp];
|
|
93
|
+
case 3:
|
|
94
|
+
err_1 = _c.sent();
|
|
95
|
+
if (err_1.response.status === 401) {
|
|
96
|
+
return [2 /*return*/, err_1.response];
|
|
97
|
+
}
|
|
98
|
+
throw (err_1);
|
|
99
|
+
case 4: return [2 /*return*/];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
exports.request = request;
|
|
105
|
+
function analyzeMetalAttr(m) {
|
|
106
|
+
if (!m)
|
|
107
|
+
return m;
|
|
108
|
+
if (typeof m.attr != 'string')
|
|
109
|
+
return m;
|
|
110
|
+
var attr = m.attr.split('&');
|
|
111
|
+
m.attr = {};
|
|
112
|
+
attr.forEach(function (a) { return m.attr[a.split('=')[0]] = a.split('=')[1]; });
|
|
113
|
+
m.url = "https://fishpi.cn/gen?txt=".concat(m.description, "&").concat(m.attr.url);
|
|
114
|
+
m.icon = "https://fishpi.cn/gen?txt=&".concat(m.attr.url);
|
|
115
|
+
return m;
|
|
116
|
+
}
|
|
117
|
+
exports.analyzeMetalAttr = analyzeMetalAttr;
|
|
118
|
+
function toMetal(sysMetal) {
|
|
119
|
+
try {
|
|
120
|
+
var metal = JSON.parse(sysMetal);
|
|
121
|
+
metal.list.forEach(function (m, i, list) {
|
|
122
|
+
list[i] = analyzeMetalAttr(m);
|
|
123
|
+
});
|
|
124
|
+
return metal.list;
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.toMetal = toMetal;
|
|
131
|
+
var isBrowse = typeof window !== 'undefined';
|
|
132
|
+
exports.isBrowse = isBrowse;
|
package/package.json
CHANGED