From 237b12a9f963e7db70e0598bf21ebf9b853cb054 Mon Sep 17 00:00:00 2001 From: ysfscream <894402575@qq.com> Date: Mon, 27 Apr 2020 10:15:19 +0800 Subject: [PATCH 01/11] fix(about): modify emqx website url --- src/views/about/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/about/index.vue b/src/views/about/index.vue index 11576c52f..5afefa6c2 100644 --- a/src/views/about/index.vue +++ b/src/views/about/index.vue @@ -54,7 +54,7 @@ Copyright © 2020 EMQ X From 14938b54da9586792326992cc1a8bd0b8db7b3e9 Mon Sep 17 00:00:00 2001 From: ysfscream <894402575@qq.com> Date: Mon, 27 Apr 2020 10:52:58 +0800 Subject: [PATCH 02/11] chore(package): change version to v1.3.1 --- package.json | 2 +- src/main/updateChecker.ts | 2 +- src/views/about/index.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 5b81a9b61..b190edbe6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "MQTTX", "author": "EMQ X Team", - "version": "1.3.0", + "version": "1.3.1", "license": "Apache", "description": "MQTT desktop client", "repository": "https://github.com/emqx/MQTTX", diff --git a/src/main/updateChecker.ts b/src/main/updateChecker.ts index cc06a2231..d247e67a4 100644 --- a/src/main/updateChecker.ts +++ b/src/main/updateChecker.ts @@ -1,7 +1,7 @@ import { dialog, shell } from 'electron' import axios from 'axios' -const version = 'v1.3.0' +const version = 'v1.3.1' const release = 'https://api.github.com/repos/emqx/MQTTX/releases/latest' const downloadUrl = 'https://github.com/emqx/MQTTX/releases/latest' diff --git a/src/views/about/index.vue b/src/views/about/index.vue index 5afefa6c2..52520a7e4 100644 --- a/src/views/about/index.vue +++ b/src/views/about/index.vue @@ -4,7 +4,7 @@
-

v1.3.0

+

v1.3.1

{{ $t('about.update') }} From 44bdb8e26f3fc6fcf2bef1b8569a10ece9adb12e Mon Sep 17 00:00:00 2001 From: ysfscream <894402575@qq.com> Date: Mon, 27 Apr 2020 23:45:52 +0800 Subject: [PATCH 03/11] fix(about): modify emqx website url --- src/views/about/index.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/views/about/index.vue b/src/views/about/index.vue index 52520a7e4..37131fae3 100644 --- a/src/views/about/index.vue +++ b/src/views/about/index.vue @@ -54,7 +54,7 @@ Copyright © 2020 EMQ X @@ -120,6 +120,14 @@ export default class About extends Vue { return require('../../assets/images/mqttx-dark.png') } + get emqxWebsite(): string { + let url = 'https://www.emqx.io' + if (this.getterLang === 'zh') { + url = `${url}/cn/` + } + return url + } + private checkUpdate(): void { ipcRenderer.send('checkUpdate') } From 08ab43add3d8e15b3f7d7a737f67689f26dff5d6 Mon Sep 17 00:00:00 2001 From: ysfscream <894402575@qq.com> Date: Mon, 27 Apr 2020 23:56:51 +0800 Subject: [PATCH 04/11] perf(mqttUtils): imporve the code --- src/store/modules/app.ts | 20 ++++++++++---------- src/utils/getFiles.ts | 7 +++---- src/utils/mqttUtils.ts | 7 +++---- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index a63da0a45..a04972432 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -1,17 +1,17 @@ import Vue from 'vue' import { loadSettings, setSettings } from '@/utils/api/setting' -const TOGGLE_THEME: string = 'TOGGLE_THEME' -const TOGGLE_LANG: string = 'TOGGLE_LANG' -const TOGGLE_AUTO_CHECK: string = 'TOGGLE_AUTO_CHECK' +const TOGGLE_THEME = 'TOGGLE_THEME' +const TOGGLE_LANG = 'TOGGLE_LANG' +const TOGGLE_AUTO_CHECK = 'TOGGLE_AUTO_CHECK' const SET_MAX_RECONNECT_TIMES = 'SET_MAX_RECONNECT_TIMES' -const CHANGE_ACTIVE_CONNECTION: string = 'CHANGE_ACTIVE_CONNECTION' -const PUSH_MESSAGE: string = 'PUSH_MESSAGE' -const REMOVE_ACTIVE_CONNECTION: string = 'REMOVE_ACTIVE_CONNECTION' -const CHANGE_SUBSCRIPTIONS: string = 'CHANGE_SUBSCRIPTIONS' -const SHOW_CLIENT_INFO: string = 'SHOW_CLIENT_INFO' -const SHOW_SUBSCRIPTIONS: string = 'SHOW_SUBSCRIPTIONS' -const UNREAD_MESSAGE_COUNT_INCREMENT: string = 'UNREAD_MESSAGE_COUNT_INCREMENT' +const CHANGE_ACTIVE_CONNECTION = 'CHANGE_ACTIVE_CONNECTION' +const PUSH_MESSAGE = 'PUSH_MESSAGE' +const REMOVE_ACTIVE_CONNECTION = 'REMOVE_ACTIVE_CONNECTION' +const CHANGE_SUBSCRIPTIONS = 'CHANGE_SUBSCRIPTIONS' +const SHOW_CLIENT_INFO = 'SHOW_CLIENT_INFO' +const SHOW_SUBSCRIPTIONS = 'SHOW_SUBSCRIPTIONS' +const UNREAD_MESSAGE_COUNT_INCREMENT = 'UNREAD_MESSAGE_COUNT_INCREMENT' const stateRecord: App = loadSettings() diff --git a/src/utils/getFiles.ts b/src/utils/getFiles.ts index 496bdbdcb..5533367c0 100644 --- a/src/utils/getFiles.ts +++ b/src/utils/getFiles.ts @@ -1,13 +1,12 @@ import fs from 'fs' -import path from 'path' import { SSLPath, SSLContent } from '@/views/connections/types' export const getSSLFile = (sslPath: SSLPath): SSLContent | undefined => { const { ca, cert, key } = sslPath const res: SSLContent = { - ca: ca !== '' ? [fs.readFileSync(path.join(ca), 'utf-8')] : undefined, - cert: cert !== '' ? fs.readFileSync(path.join(cert), 'utf-8') : undefined, - key: key !== '' ? fs.readFileSync(path.join(key), 'utf-8') : undefined, + ca: ca !== '' ? [fs.readFileSync(ca)] : undefined, + cert: cert !== '' ? fs.readFileSync(cert) : undefined, + key: key !== '' ? fs.readFileSync(key) : undefined, } return res } diff --git a/src/utils/mqttUtils.ts b/src/utils/mqttUtils.ts index 884e63075..5425e1c45 100644 --- a/src/utils/mqttUtils.ts +++ b/src/utils/mqttUtils.ts @@ -1,7 +1,7 @@ import { IClientOptions } from 'mqtt' import time from '@/utils/time' import { getSSLFile } from '@/utils/getFiles' -import { ConnectionModel, SSLPath, SSLContent } from '@/views/connections/types' +import { ConnectionModel, SSLContent } from '@/views/connections/types' const setMQTT5Properties = ( option: IClientOptions['properties'], @@ -63,12 +63,11 @@ export const getClientOptions = ( } // SSL if (ssl && certType === 'self') { - const filePath: SSLPath = { + const sslRes: SSLContent | undefined = getSSLFile({ ca: record.ca, cert: record.cert, key: record.key, - } - const sslRes: SSLContent | undefined = getSSLFile(filePath) + }) if (sslRes) { options.rejectUnauthorized = false options.ca = sslRes.ca From cd66a4329b68cf54006ddcb811815c064a4271d6 Mon Sep 17 00:00:00 2001 From: ysfscream <894402575@qq.com> Date: Fri, 8 May 2020 22:47:24 +0800 Subject: [PATCH 05/11] feat(connection): support more MQTT 5.0 features --- src/lang/connections.ts | 12 ++++++++ src/utils/mqttUtils.ts | 19 ++++++++++++- src/views/connections/ConnectionForm.vue | 36 ++++++++++++++++++++++++ src/views/connections/types.ts | 3 ++ 4 files changed, 69 insertions(+), 1 deletion(-) diff --git a/src/lang/connections.ts b/src/lang/connections.ts index 52304f7da..22c08b347 100644 --- a/src/lang/connections.ts +++ b/src/lang/connections.ts @@ -155,6 +155,18 @@ export default { zh: '接收最大数值', en: 'Receive Maximum', }, + topicAliasMaximum: { + zh: '主题别名最大值', + en: 'Topic Alias Maximum', + }, + requestResponseInformation: { + zh: '请求响应信息', + en: 'Request Response Information', + }, + requestProblemInformation: { + zh: '请求失败信息', + en: 'Request Problem Information', + }, topicReuired: { zh: '请输入 Topic', en: 'Topic is required', diff --git a/src/utils/mqttUtils.ts b/src/utils/mqttUtils.ts index 5425e1c45..4eb862fd7 100644 --- a/src/utils/mqttUtils.ts +++ b/src/utils/mqttUtils.ts @@ -18,6 +18,18 @@ const setMQTT5Properties = ( option.sessionExpiryInterval === 0) { properties.receiveMaximum = option.receiveMaximum } + if (option.topicAliasMaximum || + option.topicAliasMaximum === 0) { + properties.topicAliasMaximum = option.topicAliasMaximum + } + if (option.requestResponseInformation === true || + option.requestResponseInformation === false) { + properties.requestResponseInformation = option.requestResponseInformation + } + if (option.requestProblemInformation === true || + option.requestProblemInformation === false) { + properties.requestProblemInformation = option.requestProblemInformation + } return properties } @@ -52,10 +64,15 @@ export const getClientOptions = ( } // MQTT Version if (protocolVersion === 5) { - const { sessionExpiryInterval, receiveMaximum } = record + const { sessionExpiryInterval, receiveMaximum, + topicAliasMaximum, requestResponseInformation, requestProblemInformation, + } = record const properties = setMQTT5Properties({ sessionExpiryInterval, receiveMaximum, + topicAliasMaximum, + requestResponseInformation, + requestProblemInformation, }) if (properties && Object.keys(properties).length > 0) { options.properties = properties diff --git a/src/views/connections/ConnectionForm.vue b/src/views/connections/ConnectionForm.vue index 5f1bf9a2f..b1e48700a 100644 --- a/src/views/connections/ConnectionForm.vue +++ b/src/views/connections/ConnectionForm.vue @@ -234,6 +234,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -355,6 +386,11 @@ export default class ConnectionCreate extends Vue { lastWillQos: 0, lastWillRetain: false, }, + sessionExpiryInterval: undefined, + receiveMaximum: undefined, + topicAliasMaximum: undefined, + requestResponseInformation: undefined, + requestProblemInformation: undefined, } get rules() { diff --git a/src/views/connections/types.ts b/src/views/connections/types.ts index 115bf522d..ad6be71a2 100644 --- a/src/views/connections/types.ts +++ b/src/views/connections/types.ts @@ -42,6 +42,9 @@ export interface ConnectionModel extends SSLPath { }, sessionExpiryInterval?: number, receiveMaximum?: number, + topicAliasMaximum?: number, + requestResponseInformation?: boolean, + requestProblemInformation?: boolean, will?: { lastWillTopic: string, lastWillPayload: string, From b41c7476cdbfc4cae2bc0e263d03931a6766253d Mon Sep 17 00:00:00 2001 From: ysfscream <894402575@qq.com> Date: Sat, 9 May 2020 16:35:01 +0800 Subject: [PATCH 06/11] feat(msg_publish): remove required verification of the payload --- src/components/MsgPublish.vue | 9 ++++----- src/views/connections/ConnectionsContent.vue | 4 ---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/components/MsgPublish.vue b/src/components/MsgPublish.vue index 5ea34dbef..d4eb6f7fd 100644 --- a/src/components/MsgPublish.vue +++ b/src/components/MsgPublish.vue @@ -126,15 +126,14 @@ export default class MsgPublish extends Vue { private handleInputBlur() { ipcRenderer.removeAllListeners('sendPayload') } - - private beforeDestroy() { - ipcRenderer.removeAllListeners('sendPayload') - } - private handleLayout() { const editorRef: EditorRef = this.$refs.payloadEditor as EditorRef editorRef.editorLayout() } + + private beforeDestroy() { + ipcRenderer.removeAllListeners('sendPayload') + } } diff --git a/src/views/connections/ConnectionsContent.vue b/src/views/connections/ConnectionsContent.vue index 3b163d878..9ae427428 100644 --- a/src/views/connections/ConnectionsContent.vue +++ b/src/views/connections/ConnectionsContent.vue @@ -582,10 +582,6 @@ export default class ConnectionsContent extends Vue { this.$message.warning(this.$t('connections.topicReuired') as string) return false } - if (!payload && !retain) { - this.$message.warning(this.$t('connections.payloadReuired') as string) - return false - } this.client.publish( topic, payload, From c7dbb5e5c6780f655c4451b0245ad3abb5218802 Mon Sep 17 00:00:00 2001 From: ysfscream <894402575@qq.com> Date: Sun, 10 May 2020 20:33:31 +0800 Subject: [PATCH 07/11] refactor(connection): remove requestResponse properties --- src/utils/mqttUtils.ts | 13 +----------- src/views/connections/ConnectionForm.vue | 26 ------------------------ 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/src/utils/mqttUtils.ts b/src/utils/mqttUtils.ts index 4eb862fd7..b5b71c2e1 100644 --- a/src/utils/mqttUtils.ts +++ b/src/utils/mqttUtils.ts @@ -22,14 +22,6 @@ const setMQTT5Properties = ( option.topicAliasMaximum === 0) { properties.topicAliasMaximum = option.topicAliasMaximum } - if (option.requestResponseInformation === true || - option.requestResponseInformation === false) { - properties.requestResponseInformation = option.requestResponseInformation - } - if (option.requestProblemInformation === true || - option.requestProblemInformation === false) { - properties.requestProblemInformation = option.requestProblemInformation - } return properties } @@ -64,15 +56,12 @@ export const getClientOptions = ( } // MQTT Version if (protocolVersion === 5) { - const { sessionExpiryInterval, receiveMaximum, - topicAliasMaximum, requestResponseInformation, requestProblemInformation, + const { sessionExpiryInterval, receiveMaximum, topicAliasMaximum, } = record const properties = setMQTT5Properties({ sessionExpiryInterval, receiveMaximum, topicAliasMaximum, - requestResponseInformation, - requestProblemInformation, }) if (properties && Object.keys(properties).length > 0) { options.properties = properties diff --git a/src/views/connections/ConnectionForm.vue b/src/views/connections/ConnectionForm.vue index b1e48700a..88179fdeb 100644 --- a/src/views/connections/ConnectionForm.vue +++ b/src/views/connections/ConnectionForm.vue @@ -241,30 +241,6 @@ - - - - - - - - - - - - - - - - - - @@ -389,8 +365,6 @@ export default class ConnectionCreate extends Vue { sessionExpiryInterval: undefined, receiveMaximum: undefined, topicAliasMaximum: undefined, - requestResponseInformation: undefined, - requestProblemInformation: undefined, } get rules() { From 6b6452763d2ce405f3137c81edde3ce2d7cb7bc9 Mon Sep 17 00:00:00 2001 From: ysfscream <894402575@qq.com> Date: Mon, 11 May 2020 16:22:05 +0800 Subject: [PATCH 08/11] feat(topics): split messages view by clicking topic item --- package.json | 1 + src/assets/scss/theme/dark.scss | 1 + src/assets/scss/theme/light.scss | 1 + src/assets/scss/theme/night.scss | 1 + src/components/SubscriptionsList.vue | 62 ++++++++++---------- src/main.ts | 3 +- src/utils/clickHide.ts | 10 ---- src/utils/topicMatch.ts | 37 ++++++------ src/views/connections/ConnectionsContent.vue | 41 +++++++++++-- yarn.lock | 38 ++++++++++++ 10 files changed, 130 insertions(+), 65 deletions(-) delete mode 100644 src/utils/clickHide.ts diff --git a/package.json b/package.json index b190edbe6..054a0d93a 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "mqtt": "^3.0.0", "vue": "^2.6.10", "vue-class-component": "^7.0.2", + "vue-clipboard2": "^0.3.1", "vue-i18n": "^8.11.2", "vue-property-decorator": "^8.1.0", "vue-router": "^3.0.3", diff --git a/src/assets/scss/theme/dark.scss b/src/assets/scss/theme/dark.scss index e7ed0aa77..61f13a709 100644 --- a/src/assets/scss/theme/dark.scss +++ b/src/assets/scss/theme/dark.scss @@ -3,6 +3,7 @@ body.dark { --color-bg-normal: #282828; --color-bg-primary: #232323; --color-bg-topics: #484848; + --color-bg-topics_active: #666666; --color-bg-leftbar: #282828; --color-bg-leftbar_item: #303030; --color-bg-item: #395449; diff --git a/src/assets/scss/theme/light.scss b/src/assets/scss/theme/light.scss index 0dfd43152..53391d1bd 100644 --- a/src/assets/scss/theme/light.scss +++ b/src/assets/scss/theme/light.scss @@ -3,6 +3,7 @@ body.light { --color-bg-normal: #ffffff; --color-bg-primary: #F9FAFD; --color-bg-topics: #F8F8F8; + --color-bg-topics_active: #ebebeb; --color-bg-leftbar: #333844; --color-bg-leftbar_item: #232731; --color-bg-item: #EBF8F2; diff --git a/src/assets/scss/theme/night.scss b/src/assets/scss/theme/night.scss index 6e35e3068..f51ea9eea 100644 --- a/src/assets/scss/theme/night.scss +++ b/src/assets/scss/theme/night.scss @@ -3,6 +3,7 @@ body.night { --color-bg-normal: #292B33; --color-bg-primary: #212328; --color-bg-topics: #414556; + --color-bg-topics_active: #ebebeb; --color-bg-leftbar: #333844; --color-bg-leftbar_item: #31333F; --color-bg-item: #31333F; diff --git a/src/components/SubscriptionsList.vue b/src/components/SubscriptionsList.vue index d5744180f..15b383613 100644 --- a/src/components/SubscriptionsList.vue +++ b/src/components/SubscriptionsList.vue @@ -1,10 +1,5 @@