From 3ac260837f29f699e5377f0476341691210ea14d Mon Sep 17 00:00:00 2001 From: szaimen Date: Sun, 16 Oct 2022 18:23:27 +0200 Subject: [PATCH] add 2nd tab warning Signed-off-by: szaimen --- php/public/second-tab-warning.js | 12 ++++++++++++ php/templates/containers.twig | 3 +++ 2 files changed, 15 insertions(+) create mode 100644 php/public/second-tab-warning.js diff --git a/php/public/second-tab-warning.js b/php/public/second-tab-warning.js new file mode 100644 index 00000000..63abc18b --- /dev/null +++ b/php/public/second-tab-warning.js @@ -0,0 +1,12 @@ +const channel = new BroadcastChannel('tab') + +channel.postMessage('second-tab') +// note that listener is added after posting the message + +channel.addEventListener('message', (msg) => { + if (msg.data === 'second-tab') { + // message received from 2nd tab + document.getElementById('overlay').classList.add('loading') + alert('Cannot open multiple instances. You can use AIO here by reloading the page.') + } +}); \ No newline at end of file diff --git a/php/templates/containers.twig b/php/templates/containers.twig index e3851142..d698abb9 100644 --- a/php/templates/containers.twig +++ b/php/templates/containers.twig @@ -18,6 +18,9 @@

Nextcloud AIO v2.0.4

+ {# Add 2nd tab warning #} + + {% set isAnyRunning = false %} {% set isAnyRestarting = false %} {% set isWatchtowerRunning = false %}