@tuya-sat/micro-dev-proxy 0.0.1-beta.0 → 0.0.1

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/README.md CHANGED
@@ -1,10 +1,4 @@
1
1
  <div id="top"></div>
2
- <a href="https://www.npmjs.com/package/@tuya/connector" target="_blank">
3
- <img src="https://img.shields.io/badge/Node-v14.0.0-green" />
4
- </a>
5
- <img src="https://img.shields.io/github/license/tuya/tuya-connector-fe.svg" />
6
-
7
- <!-- PROJECT LOGO -->
8
2
  <br />
9
3
  <div align="center">
10
4
  <a href="https://github.com/othneildrew/Best-README-Template">
@@ -15,6 +9,12 @@
15
9
 
16
10
  <p align="center">
17
11
  用于微应用本地联调
12
+ <br/>
13
+ <a href="https://github.com/tuya-sat/discuss">土星项目</a>
14
+ ·
15
+ <a href="https://github.com/tuya-sat/discuss/issues">报告问题</a>
16
+ ·
17
+ <a href="https://github.com/tuya-sat/discuss/issues">提交需求</a>
18
18
  </p>
19
19
  </div>
20
20
 
@@ -41,3 +41,8 @@ yarn add @tuya-sat/micro-dev-proxy -D
41
41
  ## License
42
42
 
43
43
  MIT
44
+
45
+ ## 联系我们
46
+
47
+ 欢迎在 [https://github.com/tuya-sat/discuss/issues](https://github.com/tuya-sat/discuss/issues) 向我们提交反馈
48
+
@@ -4,7 +4,7 @@ export interface AppProxyConfig {
4
4
  target: string;
5
5
  username: string;
6
6
  password: string;
7
- csrf: boolean;
7
+ csrf?: boolean;
8
8
  loginApi?: string;
9
9
  additionHeaders?: {
10
10
  [key: string]: any;
package/dist/appProxy.js CHANGED
@@ -37,6 +37,7 @@ const csrf_1 = __importStar(require("./csrf"));
37
37
  const initLogin_1 = __importStar(require("./initLogin"));
38
38
  const token_1 = __importDefault(require("./token"));
39
39
  const util_1 = require("./util");
40
+ const url_1 = require("url");
40
41
  class AppProxy {
41
42
  constructor({ target, username, password, additionHeaders, isMainApp, loginApi, csrf = true, logSign, }) {
42
43
  this.loginCookie = new token_1.default();
@@ -63,6 +64,7 @@ class AppProxy {
63
64
  yield this.getLoginCookie();
64
65
  });
65
66
  }
67
+ //获取csrf
66
68
  getCsrf() {
67
69
  return __awaiter(this, void 0, void 0, function* () {
68
70
  yield (0, csrf_1.default)(this.target)
@@ -76,9 +78,11 @@ class AppProxy {
76
78
  });
77
79
  });
78
80
  }
81
+ //模拟登录
79
82
  getLoginCookie() {
80
83
  return __awaiter(this, void 0, void 0, function* () {
81
- yield (0, initLogin_1.default)(this.target + this.loginApi, { username: this.username, password: this.password }, {
84
+ const { href: loginUrl } = new url_1.URL(this.loginApi, this.target);
85
+ yield (0, initLogin_1.default)(loginUrl, { username: this.username, password: this.password }, {
82
86
  headers: this.combinedHeader({ cookie: this.csrfCookie.value }),
83
87
  })
84
88
  .then((cookie) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-sat/micro-dev-proxy",
3
- "version": "0.0.1-beta.0",
3
+ "version": "0.0.1",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -22,5 +22,14 @@
22
22
  "jest": "^27.0.6",
23
23
  "ts-jest": "^27.0.4",
24
24
  "typescript": "^4.4.4"
25
- }
25
+ },
26
+ "keywords": [
27
+ "saturn-project",
28
+ "micro-frontend",
29
+ "no-code",
30
+ "IoT",
31
+ "saas",
32
+ "cloud",
33
+ "tuya"
34
+ ]
26
35
  }