@gct-paas/core 6.0.0-dev.36 → 6.0.0-dev.38
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/dist/index.esm.min.js +2 -2
- package/dist/{redirect-index-BslisRYH.js → redirect-index-Ch1652Mu.js} +1 -1
- package/es/modules/mqtt/mqtt-manager.d.ts +1 -1
- package/es/modules/mqtt/mqtt-manager.mjs +3 -2
- package/es/modules/mqtt/utils/mqtt-broker-url.util.d.ts +6 -0
- package/es/modules/mqtt/utils/mqtt-broker-url.util.mjs +11 -0
- package/es/modules/user-stores/store/user.store.d.ts +4 -0
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @gct-paas/core v6.0.0-dev.
|
|
1
|
+
/*! @gct-paas/core v6.0.0-dev.37 */
|
|
2
2
|
import{createElementBlock as e,defineComponent as r,openBlock as t,unref as a}from"vue";import{useRouter as p}from"vue-router";var o=/* @__PURE__ */r({__name:"redirect-index",setup(r){const{currentRoute:o,replace:i}=p(),{params:s,query:u}=a(o),{path:m,_redirect_type:n="path"}=s;Reflect.deleteProperty(s,"_redirect_type"),Reflect.deleteProperty(s,"path");const c=Array.isArray(m)?m.join("/"):m;return i("name"===n?{name:c,query:u,params:JSON.parse(s._origin_params??"{}")}:{path:c.startsWith("/")?c:"/"+c,query:u}),(r,a)=>(t(),e("div"))}});export{o as default};
|
|
@@ -12,10 +12,10 @@ import { IMqttClient, IMqttConnectOptions, IMqttManager } from './interfaces/i-m
|
|
|
12
12
|
*
|
|
13
13
|
* // 创建一个 MQTT 客户端实例
|
|
14
14
|
* const client = manager.create('device-001', {
|
|
15
|
-
* brokerUrl: 'ws://localhost:8083/mqtt',
|
|
16
15
|
* username: 'admin',
|
|
17
16
|
* password: 'password',
|
|
18
17
|
* });
|
|
18
|
+
* // 默认连接地址随页面协议自动切换:HTTP 使用 ws,HTTPS 使用 wss。
|
|
19
19
|
*
|
|
20
20
|
* // 连接
|
|
21
21
|
* client.connect();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_MQTT_INSTANCE_ID } from "./enums/mqtt-status.enum.mjs";
|
|
2
2
|
import { MqttClient } from "./mqtt-client.mjs";
|
|
3
|
+
import { getMqttBrokerUrl } from "./utils/mqtt-broker-url.util.mjs";
|
|
3
4
|
import { createUUID } from "qx-util";
|
|
4
5
|
//#region src/modules/mqtt/mqtt-manager.ts
|
|
5
6
|
/**
|
|
@@ -15,10 +16,10 @@ import { createUUID } from "qx-util";
|
|
|
15
16
|
*
|
|
16
17
|
* // 创建一个 MQTT 客户端实例
|
|
17
18
|
* const client = manager.create('device-001', {
|
|
18
|
-
* brokerUrl: 'ws://localhost:8083/mqtt',
|
|
19
19
|
* username: 'admin',
|
|
20
20
|
* password: 'password',
|
|
21
21
|
* });
|
|
22
|
+
* // 默认连接地址随页面协议自动切换:HTTP 使用 ws,HTTPS 使用 wss。
|
|
22
23
|
*
|
|
23
24
|
* // 连接
|
|
24
25
|
* client.connect();
|
|
@@ -64,7 +65,7 @@ var MqttManager = class {
|
|
|
64
65
|
console.warn(`MqttManager: 实例 ${instanceId} 已存在,返回已注册的实例`);
|
|
65
66
|
return this._clients.get(instanceId);
|
|
66
67
|
}
|
|
67
|
-
const client = new MqttClient(instanceId,
|
|
68
|
+
const client = new MqttClient(instanceId, getMqttBrokerUrl(location.protocol, location.host), {
|
|
68
69
|
clientId: `gct_mqtt_${_gct.store.userInfo.userId}_${instanceId}_${this.uuid}`,
|
|
69
70
|
...options
|
|
70
71
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/modules/mqtt/utils/mqtt-broker-url.util.ts
|
|
2
|
+
/**
|
|
3
|
+
* 根据页面地址生成 MQTT WebSocket 连接地址。
|
|
4
|
+
*
|
|
5
|
+
* HTTPS 页面必须使用 WSS,避免浏览器因 Mixed Content 拦截 MQTT 连接。
|
|
6
|
+
*/
|
|
7
|
+
function getMqttBrokerUrl(protocol, host) {
|
|
8
|
+
return `${protocol === "https:" ? "wss:" : "ws:"}//${host}/mqtt`;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { getMqttBrokerUrl };
|
|
@@ -23,6 +23,7 @@ export declare const useUserStore: import('pinia').StoreDefinition<"user", UserS
|
|
|
23
23
|
gender?: number | undefined;
|
|
24
24
|
globalSuperAdmin?: number | undefined;
|
|
25
25
|
ip?: string | undefined;
|
|
26
|
+
kickOut?: boolean | undefined;
|
|
26
27
|
match?: boolean | undefined;
|
|
27
28
|
minioDomain?: string | undefined;
|
|
28
29
|
mobile?: string | undefined;
|
|
@@ -95,6 +96,7 @@ export declare const useUserStore: import('pinia').StoreDefinition<"user", UserS
|
|
|
95
96
|
gender?: number | undefined;
|
|
96
97
|
globalSuperAdmin?: number | undefined;
|
|
97
98
|
ip?: string | undefined;
|
|
99
|
+
kickOut?: boolean | undefined;
|
|
98
100
|
match?: boolean | undefined;
|
|
99
101
|
minioDomain?: string | undefined;
|
|
100
102
|
mobile?: string | undefined;
|
|
@@ -164,6 +166,7 @@ export declare const useUserStore: import('pinia').StoreDefinition<"user", UserS
|
|
|
164
166
|
gender?: number | undefined;
|
|
165
167
|
globalSuperAdmin?: number | undefined;
|
|
166
168
|
ip?: string | undefined;
|
|
169
|
+
kickOut?: boolean | undefined;
|
|
167
170
|
match?: boolean | undefined;
|
|
168
171
|
minioDomain?: string | undefined;
|
|
169
172
|
mobile?: string | undefined;
|
|
@@ -239,6 +242,7 @@ export declare const useUserStore: import('pinia').StoreDefinition<"user", UserS
|
|
|
239
242
|
gender?: number | undefined;
|
|
240
243
|
globalSuperAdmin?: number | undefined;
|
|
241
244
|
ip?: string | undefined;
|
|
245
|
+
kickOut?: boolean | undefined;
|
|
242
246
|
match?: boolean | undefined;
|
|
243
247
|
minioDomain?: string | undefined;
|
|
244
248
|
mobile?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/core",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.38",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"loader": "dist/index.esm.min.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@fingerprintjs/fingerprintjs": "^5.1.0",
|
|
35
35
|
"@floating-ui/dom": "^1.7.6",
|
|
36
|
-
"@gct-paas/api": "^6.0.0-dev.
|
|
36
|
+
"@gct-paas/api": "^6.0.0-dev.13",
|
|
37
37
|
"@module-federation/runtime": "^2.2.3",
|
|
38
38
|
"@vueuse/core": "^14.1.0",
|
|
39
39
|
"async-validator": "^4.2.5",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"playwright": "^1.58.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@gct-paas/api": "^6.0.0-dev.
|
|
63
|
+
"@gct-paas/api": "^6.0.0-dev.13",
|
|
64
64
|
"vue": ">=3",
|
|
65
65
|
"vue-i18n": ">=11",
|
|
66
66
|
"vue-router": ">=4"
|