From 83a05639ac57a97e591caf125fe76dde606c2ce0 Mon Sep 17 00:00:00 2001 From: Abel C Dixon Date: Thu, 27 Jan 2022 18:28:14 +0530 Subject: [PATCH 1/2] added toast for sending empty string under message tab --- src/components/Shares.vue | 40 +++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/components/Shares.vue b/src/components/Shares.vue index 02712ec..738bf61 100644 --- a/src/components/Shares.vue +++ b/src/components/Shares.vue @@ -563,25 +563,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 = '' }, From cec6313e0b22d6bf20ab3c44c166efdf8412d879 Mon Sep 17 00:00:00 2001 From: Abel C Dixon Date: Thu, 27 Jan 2022 19:39:27 +0530 Subject: [PATCH 2/2] added share target for send image and pdfs from other apps don't know if it works --- src/components/Shares.vue | 3 +++ vue.config.js | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/components/Shares.vue b/src/components/Shares.vue index 738bf61..e081cd6 100644 --- a/src/components/Shares.vue +++ b/src/components/Shares.vue @@ -14,6 +14,9 @@ Add File +
+ +
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",