@jeniex/utils 1.0.24 → 1.0.25

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/browser/index.cjs CHANGED
@@ -308,13 +308,14 @@ function removeSearchParams(keys, fullURL) {
308
308
  }
309
309
 
310
310
  async function checkVPN() {
311
- let pass;
311
+ let pass = false;
312
312
  try {
313
313
  await fishXResponse('http://192.168.1.1/index.html', { method: 'HEAD' });
314
- pass = false;
315
314
  }
316
- catch {
317
- pass = true;
315
+ catch (exception) {
316
+ if (exception.message.includes('ended with 0 status')) {
317
+ pass = true;
318
+ }
318
319
  }
319
320
  if (pass === false) {
320
321
  throw new Error('VPN is not enabled!');
package/browser/index.js CHANGED
@@ -306,13 +306,14 @@ function removeSearchParams(keys, fullURL) {
306
306
  }
307
307
 
308
308
  async function checkVPN() {
309
- let pass;
309
+ let pass = false;
310
310
  try {
311
311
  await fishXResponse('http://192.168.1.1/index.html', { method: 'HEAD' });
312
- pass = false;
313
312
  }
314
- catch {
315
- pass = true;
313
+ catch (exception) {
314
+ if (exception.message.includes('ended with 0 status')) {
315
+ pass = true;
316
+ }
316
317
  }
317
318
  if (pass === false) {
318
319
  throw new Error('VPN is not enabled!');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeniex/utils",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "author": "JenieX",
5
5
  "homepage": "https://github.com/JenieX/utils",
6
6
  "type": "module",