@dongdev/fca-unofficial 1.0.18 → 1.0.20
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/CHANGELOG.md +6 -0
- package/index.js +34 -34
- package/package.json +1 -1
- package/src/listenMqtt.js +50 -50
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
@@ -279,40 +279,40 @@ function loginHelper(appState, email, password, globalOptions, callback, prCallb
|
|
279
279
|
|
280
280
|
mainPromise
|
281
281
|
.then(async () => {
|
282
|
-
if (global.fca.config.autoUpdate) {
|
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
|
-
}
|
282
|
+
// if (global.fca.config.autoUpdate) {
|
283
|
+
// try {
|
284
|
+
// exec('npm view @dongdev/fca-unofficial version', async (error, stdout, stderr) => {
|
285
|
+
// if (error) {
|
286
|
+
// logger('Error checking version: ' + error, 'error');
|
287
|
+
// return;
|
288
|
+
// }
|
289
|
+
// const npmVersion = stdout.trim();
|
290
|
+
// const localbrand = JSON.parse(readFileSync('./node_modules/@dongdev/fca-unofficial/package.json')).version;
|
291
|
+
// if (localbrand !== npmVersion) {
|
292
|
+
// logger(`New Version Published: ${localbrand} => ${npmVersion}`, 'warn');
|
293
|
+
// logger(`Perform Automatic Update to the Latest Version !`, 'warn');
|
294
|
+
// try {
|
295
|
+
// execSync('npm install @dongdev/fca-unofficial@latest', { stdio: 'inherit' });
|
296
|
+
// logger("Upgrade Version Successfully!", "[ FCA-UNO ] >")
|
297
|
+
// logger('Restarting...', '[ FCA-UNO ] >');
|
298
|
+
// await new Promise(resolve => setTimeout(resolve, 5 * 1000));
|
299
|
+
// console.clear();
|
300
|
+
// process.exit(1);
|
301
|
+
// } catch (err) {
|
302
|
+
// logger('Error Auto Update ! ' + err, 'error');
|
303
|
+
// }
|
304
|
+
// } else {
|
305
|
+
// logger(`You Are Currently Using Version: ${localbrand} !`, "[ FCA-UNO ] >");
|
306
|
+
// logger(`Have a good day !`, "[ FCA-UNO ] >")
|
307
|
+
// await new Promise(resolve => setTimeout(resolve, 5 * 1000));
|
308
|
+
// callback(null, api);
|
309
|
+
// }
|
310
|
+
// });
|
311
|
+
// } catch (err) {
|
312
|
+
// logger('Error checking for updates: ' + err, 'error');
|
313
|
+
// callback(null, api);
|
314
|
+
// }
|
315
|
+
// }
|
316
316
|
logger('Login successful!', '[ FCA-UNO ] >');
|
317
317
|
callback(null, api);
|
318
318
|
})
|
package/package.json
CHANGED
package/src/listenMqtt.js
CHANGED
@@ -229,56 +229,56 @@ function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
|
|
229
229
|
}
|
230
230
|
});
|
231
231
|
mqttClient.on("connect", function () {
|
232
|
-
let
|
233
|
-
mqttReconnectCount = 0;
|
234
|
-
setInterval(() => {
|
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
|
-
}, 60 * 60 * 1000);
|
232
|
+
// let StopProcessing = true;
|
233
|
+
// mqttReconnectCount = 0;
|
234
|
+
// setInterval(() => {
|
235
|
+
// console.log('Đang chuẩn bị ngắt kết nối MQTT...');
|
236
|
+
// StopProcessing = true;
|
237
|
+
// if (ctx.mqttClient) {
|
238
|
+
// topics.forEach((topic) => {
|
239
|
+
// try {
|
240
|
+
// ctx.mqttClient.unsubscribe(topic);
|
241
|
+
// } catch (e) { }
|
242
|
+
// });
|
243
|
+
// try {
|
244
|
+
// ctx.mqttClient.publish("/browser_close", "{}");
|
245
|
+
// } catch (e) { }
|
246
|
+
// ctx.mqttClient.removeAllListeners();
|
247
|
+
// console.log('Ngắt Kết Nối MQTT...');
|
248
|
+
// let connectionClosed = false;
|
249
|
+
// const afterConnectionClosed = () => {
|
250
|
+
// if (connectionClosed) return;
|
251
|
+
// connectionClosed = true;
|
252
|
+
// ctx.lastSeqId = null;
|
253
|
+
// ctx.syncToken = undefined;
|
254
|
+
// ctx.t_mqttCalled = false;
|
255
|
+
// mqttReconnectCount = 0;
|
256
|
+
// StopProcessing = false;
|
257
|
+
// console.log('Đang Kết Nối Lại MQTT...');
|
258
|
+
// setTimeout(() => {
|
259
|
+
// getSeqID();
|
260
|
+
// console.log('Kết Nối Lại MQTT Thành Công');
|
261
|
+
// }, 1000);
|
262
|
+
// };
|
263
|
+
// try {
|
264
|
+
// ctx.mqttClient.end(false, afterConnectionClosed);
|
265
|
+
// setTimeout(() => {
|
266
|
+
// if (!connectionClosed) {
|
267
|
+
// console.warn('Đóng kết nối MQTT bằng timeout');
|
268
|
+
// ctx.mqttClient = undefined;
|
269
|
+
// afterConnectionClosed();
|
270
|
+
// }
|
271
|
+
// }, 5000);
|
272
|
+
// } catch (e) {
|
273
|
+
// console.error('Lỗi khi đóng kết nối MQTT:', e);
|
274
|
+
// ctx.mqttClient = undefined;
|
275
|
+
// afterConnectionClosed();
|
276
|
+
// }
|
277
|
+
// } else {
|
278
|
+
// getSeqID();
|
279
|
+
// console.log('Kết Nối Lại MQTT Thành Công');
|
280
|
+
// }
|
281
|
+
// }, 60 * 60 * 1000);
|
282
282
|
if (process.env.OnStatus === undefined) {
|
283
283
|
logger("fca-unoffcial premium", "info");
|
284
284
|
process.env.OnStatus = true;
|