@tuya-sat/micro-script 3.1.3 → 3.1.4

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.
@@ -55,6 +55,14 @@ function parse__MAIN_APP_PUBLIC_PATH(html) {
55
55
  const REGEX = /(?<=window.__MAIN_APP_PUBLIC_PATH=).*?(?=(;|<\/script>))/;
56
56
  return ((_a = REGEX.exec(html)) === null || _a === void 0 ? void 0 : _a[0]) || '';
57
57
  }
58
+ const grabSaasPage = (target) => __awaiter(void 0, void 0, void 0, function* () {
59
+ try {
60
+ return axios_1.default.get(target);
61
+ }
62
+ catch (e) {
63
+ return axios_1.default.get(new URL('/login?disable_third_login=true', target).href);
64
+ }
65
+ });
58
66
  function getFakeSaas(config) {
59
67
  var _a;
60
68
  return __awaiter(this, void 0, void 0, function* () {
@@ -100,7 +108,7 @@ function getFakeSaas(config) {
100
108
  return saas;
101
109
  }
102
110
  else {
103
- const { data } = yield axios_1.default.get(new URL('/login?disable_third_login=true', config.target).href);
111
+ const { data } = yield grabSaasPage(config.target);
104
112
  const _SDF_CONFIG = parse_SDF_CONFIG(data);
105
113
  const _SDF = parse_SDF(data);
106
114
  const __MAIN_APP_PUBLIC_PATH = parse__MAIN_APP_PUBLIC_PATH(data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-sat/micro-script",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "bin": "./dist/bin/cli.js",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
@@ -23,9 +23,9 @@
23
23
  "@babel/preset-typescript": "7.16.7",
24
24
  "@babel/traverse": "^7.20.13",
25
25
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
26
- "@tuya-sat/micro-dev-loader": "3.1.3",
27
- "@tuya-sat/micro-dev-proxy": "3.1.3",
28
- "@tuya-sat/micro-utils": "3.1.3",
26
+ "@tuya-sat/micro-dev-loader": "3.1.4",
27
+ "@tuya-sat/micro-dev-proxy": "3.1.4",
28
+ "@tuya-sat/micro-utils": "3.1.4",
29
29
  "@types/kill-port": "^2.0.0",
30
30
  "babel-loader": "8.2.4",
31
31
  "babel-plugin-import": "1.13.3",