Skip to content

Commit

Permalink
feat(desktop): add topic validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Red-Asuka authored and ysfscream committed Jul 28, 2022
1 parent 6dbf0c4 commit 43849ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lang/connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,13 @@ export default {
ja: 'トピックを入力してください',
hu: 'Téma szükséges',
},
topicCannotContain: {
zh: '不能向包含通配符 #、+、$ 的 Topic 发布消息',
en: 'You cannot publish the message to a Topic that contains wildcards characters #, +, $',
tr: '#, +, $ karakterlerini içeren bir Konuya mesaj gönderemezsiniz',
ja: 'ワイルドカード文字 #、+、$ を含むトピックにメッセージを送信できません',
hu: '#, +, $ karakterlerini tartalmazó témához nem küldhetsz üzenetet',
},
topicTips: {
zh: '可订阅单个或多个主题,订阅多主题时,请使用逗号分隔(,)',
en: 'You can subscribe to single or multiple topics, please use comma separation to subscribe to multiple topics (,)',
Expand Down
6 changes: 6 additions & 0 deletions src/views/connections/ConnectionsDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,12 @@ export default class ConnectionsDetail extends Vue {
return false
}
if (topic && (topic.includes('+') || topic.includes('#') || topic.includes('$'))) {
this.$message.warning(this.$tc('connections.topicCannotContain'))
this.stopTimedSend()
return false
}
let props: PushPropertiesModel | undefined = undefined
if (properties && Object.entries(properties).filter(([_, v]) => v !== null && v !== undefined).length > 0) {
const propRecords = Object.entries(properties).filter(([_, v]) => v !== null && v !== undefined)
Expand Down

0 comments on commit 43849ce

Please sign in to comment.