diff --git a/src/components/Shares.vue b/src/components/Shares.vue index 02712ec..e081cd6 100644 --- a/src/components/Shares.vue +++ b/src/components/Shares.vue @@ -14,6 +14,9 @@ Add File +
+ +
@@ -563,25 +566,33 @@ export default { }, sendMsg () { - const data = { - type: 'msg', - msg: this.msg, - time: new Date().toLocaleTimeString() - } - - this.$store.commit('addMessage', { - ...data, - ...{ - name: this.$store.state.settings.name, - color: this.$store.state.settings.color + // Check if message is empty + if (this.msg === '') { + this.$buefy.toast.open({ + duration: 2000, + message: 'Message cannot be empty!', + position: 'is-top', + type: 'is-danger' + }) + } else { + const data = { + type: 'msg', + msg: this.msg, + time: new Date().toLocaleTimeString() } - }) + this.$store.commit('addMessage', { + ...data, + ...{ + name: this.$store.state.settings.name, + color: this.$store.state.settings.color + } + }) - for (const key in this.$store.state.users) { - const user = this.$store.state.users[key] - this.$store.state.p2pt.send(user.conn, data) + for (const key in this.$store.state.users) { + const user = this.$store.state.users[key] + this.$store.state.p2pt.send(user.conn, data) + } } - this.msg = '' }, diff --git a/vue.config.js b/vue.config.js index c566b53..fe151ad 100644 --- a/vue.config.js +++ b/vue.config.js @@ -19,6 +19,28 @@ module.exports = { purpose: "any maskable", }, ], + share_targets: [ + { + action: "./upload", + method: "POST", + enctype: "multipart/form-data", + params: { + title: "WebDrop", + text: "WebDrop", + url: "https://webdrop.space", + files: [ + { + name: "image", + accept: ["image/*"], + }, + { + name: "pdf", + accept: "application/pdf", + }, + ], + }, + }, + ], }, themeColor: "#23D160", msTileColor: "#000000",