-
-
-
-
-
-
-
This is taking longer than it should, there might be connectivity issues.
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
This is taking longer than it should, there might be connectivity issues.
+
+
+
diff --git a/client/js/socket-events/configuration.js b/client/js/socket-events/configuration.js
index 2cb14ae2..2f48af5a 100644
--- a/client/js/socket-events/configuration.js
+++ b/client/js/socket-events/configuration.js
@@ -8,6 +8,7 @@ const webpush = require("../webpush");
const connect = $("#connect");
const utils = require("../utils");
const upload = require("../upload");
+const {vueApp} = require("../vue");
window.addEventListener("beforeinstallprompt", (installPromptEvent) => {
$("#webapp-install-button")
@@ -24,11 +25,7 @@ window.addEventListener("beforeinstallprompt", (installPromptEvent) => {
});
socket.on("configuration", function(data) {
- if (data.fileUpload) {
- $("#upload").show();
- } else {
- $("#upload").hide();
- }
+ vueApp.fileUploadEnabled = data.fileUpload;
if (options.initialized) {
// Likely a reconnect, request sync for possibly missed settings.
@@ -52,7 +49,6 @@ socket.on("configuration", function(data) {
});
if (data.fileUpload) {
- upload.initialize();
upload.setMaxFileSize(data.fileUploadMaxFileSize);
}
diff --git a/client/js/upload.js b/client/js/upload.js
index 4abb0a16..cccfdc24 100644
--- a/client/js/upload.js
+++ b/client/js/upload.js
@@ -4,15 +4,12 @@ const $ = require("jquery");
const socket = require("./socket");
const SocketIOFileUpload = require("socketio-file-upload/client");
const instance = new SocketIOFileUpload(socket);
+const {vueApp} = require("./vue");
function initialize() {
instance.listenOnInput(document.getElementById("upload-input"));
instance.listenOnDrop(document);
- $("#upload").on("click", () => {
- $("#upload-input").trigger("click");
- });
-
instance.addEventListener("complete", () => {
// Reset progressbar
$("#upload-progressbar").width(0);
@@ -26,7 +23,7 @@ function initialize() {
instance.addEventListener("error", (event) => {
// Reset progressbar
$("#upload-progressbar").width(0);
- $("#connection-error").addClass("shown").text(event.message);
+ vueApp.connectionError = event.message;
});
const $form = $(document);
diff --git a/client/js/vue.js b/client/js/vue.js
index 844c6821..beb31374 100644
--- a/client/js/vue.js
+++ b/client/js/vue.js
@@ -24,6 +24,7 @@ const vueApp = new Vue({
initialized: false,
connected: false,
connectionError: false,
+ fileUploadEnabled: false,
appName: document.title,
activeChannel: null,
networks: [],