@maiyunnet/kebab 5.0.0 → 5.0.2
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/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/db/conn.js +2 -2
- package/lib/db/pool.js +1 -1
- package/lib/sql.js +3 -0
- package/package.json +1 -1
- package/sys/child.js +5 -4
- package/sys/mod.js +2 -2
- package/www/example/data/test.zip +0 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '5.0.
|
|
9
|
+
export const VER = '5.0.2';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/db/conn.js
CHANGED
|
@@ -174,7 +174,7 @@ export class Connection {
|
|
|
174
174
|
catch (e) {
|
|
175
175
|
rtn.error = {
|
|
176
176
|
'message': e.message,
|
|
177
|
-
'errno': e.errno ?? Number(e.code),
|
|
177
|
+
'errno': e.errno ?? Number(e.code.replace(/[a-zA-Z]/g, '')),
|
|
178
178
|
};
|
|
179
179
|
rtn.result = -500;
|
|
180
180
|
}
|
|
@@ -241,7 +241,7 @@ export class Connection {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
catch (e) {
|
|
244
|
-
let errno = e.errno ?? Number(e.code);
|
|
244
|
+
let errno = e.errno ?? Number(e.code.replace(/[a-zA-Z]/g, ''));
|
|
245
245
|
if (errno === 23505) {
|
|
246
246
|
errno = 1062;
|
|
247
247
|
}
|
package/lib/db/pool.js
CHANGED
|
@@ -217,7 +217,7 @@ export class Pool {
|
|
|
217
217
|
c.using();
|
|
218
218
|
link.on('error', function (err) {
|
|
219
219
|
c.setLost();
|
|
220
|
-
if (err.code !== 'PROTOCOL_CONNECTION_LOST') {
|
|
220
|
+
if (err.code !== 'PROTOCOL_CONNECTION_LOST' && err.code !== 'ECONNRESET') {
|
|
221
221
|
lCore.debug('[DB][_getConnection][MYSQL][error]', err);
|
|
222
222
|
lCore.log({}, '[DB][_getConnection][MYSQL][error] ' + err.message, '-error');
|
|
223
223
|
}
|
package/lib/sql.js
CHANGED
|
@@ -253,6 +253,7 @@ export class Sql {
|
|
|
253
253
|
*/
|
|
254
254
|
select(c, f) {
|
|
255
255
|
this._data = [];
|
|
256
|
+
this._placeholder = 1;
|
|
256
257
|
let sql = 'SELECT ';
|
|
257
258
|
if (typeof c === 'string') {
|
|
258
259
|
sql += this.field(c);
|
|
@@ -292,6 +293,7 @@ export class Sql {
|
|
|
292
293
|
*/
|
|
293
294
|
update(f, s) {
|
|
294
295
|
this._data = [];
|
|
296
|
+
this._placeholder = 1;
|
|
295
297
|
const sql = `UPDATE ${this.field(f, this._pre)} SET ${this._updateSub(s)}`;
|
|
296
298
|
this._sql = [sql];
|
|
297
299
|
return this;
|
|
@@ -438,6 +440,7 @@ export class Sql {
|
|
|
438
440
|
*/
|
|
439
441
|
delete(f) {
|
|
440
442
|
this._data = [];
|
|
443
|
+
this._placeholder = 1;
|
|
441
444
|
this._sql = ['DELETE FROM ' + this.field(f, this._pre)];
|
|
442
445
|
return this;
|
|
443
446
|
}
|
package/package.json
CHANGED
package/sys/child.js
CHANGED
|
@@ -227,11 +227,12 @@ async function requestHandler(req, res, https) {
|
|
|
227
227
|
let host = req.headers[':authority'];
|
|
228
228
|
if (host === undefined || typeof host !== 'string') {
|
|
229
229
|
host = req.headers['host'];
|
|
230
|
-
if (host === undefined) {
|
|
231
|
-
res.end();
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
230
|
}
|
|
231
|
+
if (host === undefined) {
|
|
232
|
+
res.end();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
host = host.split(':')[0] + ':' + (req.socket.localPort ?? (https ? '443' : '80'));
|
|
235
236
|
const uri = lText.parseUrl(`http${https ? 's' : ''}://${host}${req.url ?? ''}`);
|
|
236
237
|
/** --- 当前的 vhost 配置文件 --- */
|
|
237
238
|
const vhost = await getVhostByHostname(uri.hostname ?? '');
|
package/sys/mod.js
CHANGED
|
@@ -565,7 +565,7 @@ export default class Mod {
|
|
|
565
565
|
}
|
|
566
566
|
const r = await this._db.query(this._sql.getSql(), this._sql.getData());
|
|
567
567
|
if (r.rows === null) {
|
|
568
|
-
lCore.log(this._ctr ?? {}, '[refresh
|
|
568
|
+
lCore.log(this._ctr ?? {}, '[MOD][refresh] ' + lText.stringifyJson(r.error?.message ?? '').slice(1, -1).replace(/"/g, '""'), '-error');
|
|
569
569
|
return false;
|
|
570
570
|
}
|
|
571
571
|
if (r.rows.length === 0) {
|
|
@@ -595,7 +595,7 @@ export default class Mod {
|
|
|
595
595
|
}]);
|
|
596
596
|
const r = await this._db.execute(this._sql.getSql(), this._sql.getData());
|
|
597
597
|
if (r.packet === null) {
|
|
598
|
-
lCore.log(this._ctr ?? {}, '[save
|
|
598
|
+
lCore.log(this._ctr ?? {}, '[MOD][save] ' + lText.stringifyJson(r.error?.message ?? '').slice(1, -1).replace(/"/g, '""'), '-error');
|
|
599
599
|
return false;
|
|
600
600
|
}
|
|
601
601
|
if (r.packet.affected) {
|
|
Binary file
|