diff --git a/mstream.js b/mstream.js
index 498f82a..94fc94c 100755
--- a/mstream.js
+++ b/mstream.js
@@ -4,6 +4,7 @@ const winston = require('winston');
const express = require('express');
const mstream = express();
const fs = require('fs');
+const path = require('path');
const bodyParser = require('body-parser');
const jukebox = require('./modules/jukebox.js');
@@ -54,6 +55,7 @@ exports.serveIt = async configFile => {
// Give access to public folder
mstream.use('/public', express.static( config.program.webAppDirectory ));
+ mstream.use('/', express.static(path.join(__dirname, 'webapp')));
// Serve the webapp
mstream.get('/', (req, res) => {
res.sendFile('mstream.html', { root: config.program.webAppDirectory });
diff --git a/public/admin.html b/public/admin.html
index c873728..388bf1c 100644
--- a/public/admin.html
+++ b/public/admin.html
@@ -6,14 +6,14 @@
mStream Admin
-
-
-
-
-
-
+
+
+
+
+
+
-
+
@@ -23,7 +23,6 @@
-
@@ -35,6 +34,9 @@
+
+
+
diff --git a/public/js/admin.js b/public/js/admin.js
index 1149115..b6d707a 100644
--- a/public/js/admin.js
+++ b/public/js/admin.js
@@ -292,7 +292,6 @@ const usersView = Vue.component('users-view', {
guest: this.userClass === 'guest' ? true : false
};
- console.log(data)
await API.axios({
method: 'PUT',
url: `${API.url()}/api/v1/admin/user`,
@@ -303,6 +302,23 @@ const usersView = Vue.component('users-view', {
this.newUsername = '';
this.newPassword = '';
+ // if this is the first user, prompt user and take them to login page
+ if (Object.keys(ADMINDATA.users).length === 1) {
+ iziToast.question({
+ timeout: false,
+ close: false,
+ overlay: true,
+ displayMode: 'once',
+ id: 'question',
+ zindex: 99999,
+ title: 'You will be taken the login page',
+ position: 'center',
+ buttons: [['', (instance, toast) => {
+ API.checkAuthAndKickToLogin();
+ }, true]],
+ });
+ }
+
this.$nextTick(() => {
M.updateTextFields();
});
diff --git a/public/js/api.js b/public/js/api.js
deleted file mode 100644
index a622129..0000000
--- a/public/js/api.js
+++ /dev/null
@@ -1,61 +0,0 @@
-const API = (() => {
- const module = {};
-
- // initialize with a default server
- module.servers = [{
- name: "default",
- url: window.location.origin,
- token: localStorage.getItem('token')
- }];
-
- module.selectedServer = 0;
-
- module.addServer = (name, url, username, password) => {
- module.servers.push({
- name: name,
- url: url,
- token: null
- })
- }
-
- module.name = () => {
- return module.servers[module.selectedServer].name;
- }
-
- module.token = () => {
- return module.servers[module.selectedServer].token;
- }
-
- module.url = () => {
- return module.servers[module.selectedServer].url;
- }
-
- module.checkAuthAndKickToLogin = async () => {
- if (module.servers[0].token === null) {
- window.location.replace(`/login?redirect=${encodeURIComponent(window.location.pathname)}`);
- }
-
- // Send request to server
- try {
- await axios({
- method: 'GET',
- url: `${module.url()}/api/`,
- headers: { 'x-access-token': module.token() }
- });
- } catch (err) {
- window.location.replace(`/login?redirect=${encodeURIComponent(window.location.pathname)}`);
- }
- }
-
- module.logout = () => {
- localStorage.removeItem('authToken');
- window.location.replace(`/login`);
- }
-
- module.axios = axios.create({
- baseURL: module.url(),
- headers: { 'x-access-token': module.token() }
- });
-
- return module;
-})();
\ No newline at end of file
diff --git a/public/mstream.html b/public/mstream.html
index 929d96c..ffe35fe 100755
--- a/public/mstream.html
+++ b/public/mstream.html
@@ -10,14 +10,14 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
+
diff --git a/public/qr-tool.html b/public/qr-tool.html
index 11d199c..5ffbf66 100644
--- a/public/qr-tool.html
+++ b/public/qr-tool.html
@@ -7,14 +7,14 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
+
diff --git a/public/remote.html b/public/remote.html
index ff5244b..74960b6 100644
--- a/public/remote.html
+++ b/public/remote.html
@@ -6,14 +6,14 @@
mStream Remote
-
-
-
-
-
-
+
+
+
+
+
+
-
+
diff --git a/public/shared.html b/public/shared.html
index 198730e..ba647ac 100644
--- a/public/shared.html
+++ b/public/shared.html
@@ -6,14 +6,14 @@
mStream Music
-
-
-
-
-
-
+
+
+
+
+
+
-
+
diff --git a/webapp-beta/css/izi-toast.css b/webapp/assets/css/izi-toast.css
similarity index 100%
rename from webapp-beta/css/izi-toast.css
rename to webapp/assets/css/izi-toast.css
diff --git a/webapp-beta/css/material-input.css b/webapp/assets/css/material-input.css
similarity index 100%
rename from webapp-beta/css/material-input.css
rename to webapp/assets/css/material-input.css
diff --git a/webapp-beta/css/waves.css b/webapp/assets/css/waves.css
similarity index 100%
rename from webapp-beta/css/waves.css
rename to webapp/assets/css/waves.css
diff --git a/public/assets/fav/android-chrome-192x192.png b/webapp/assets/fav/android-chrome-192x192.png
similarity index 100%
rename from public/assets/fav/android-chrome-192x192.png
rename to webapp/assets/fav/android-chrome-192x192.png
diff --git a/public/assets/fav/android-chrome-512x512.png b/webapp/assets/fav/android-chrome-512x512.png
similarity index 100%
rename from public/assets/fav/android-chrome-512x512.png
rename to webapp/assets/fav/android-chrome-512x512.png
diff --git a/public/assets/fav/apple-touch-icon.png b/webapp/assets/fav/apple-touch-icon.png
similarity index 100%
rename from public/assets/fav/apple-touch-icon.png
rename to webapp/assets/fav/apple-touch-icon.png
diff --git a/public/assets/fav/browserconfig.xml b/webapp/assets/fav/browserconfig.xml
similarity index 100%
rename from public/assets/fav/browserconfig.xml
rename to webapp/assets/fav/browserconfig.xml
diff --git a/public/assets/fav/favicon-16x16.png b/webapp/assets/fav/favicon-16x16.png
similarity index 100%
rename from public/assets/fav/favicon-16x16.png
rename to webapp/assets/fav/favicon-16x16.png
diff --git a/public/assets/fav/favicon-32x32.png b/webapp/assets/fav/favicon-32x32.png
similarity index 100%
rename from public/assets/fav/favicon-32x32.png
rename to webapp/assets/fav/favicon-32x32.png
diff --git a/public/assets/fav/favicon.ico b/webapp/assets/fav/favicon.ico
similarity index 100%
rename from public/assets/fav/favicon.ico
rename to webapp/assets/fav/favicon.ico
diff --git a/public/assets/fav/mstile-150x150.png b/webapp/assets/fav/mstile-150x150.png
similarity index 100%
rename from public/assets/fav/mstile-150x150.png
rename to webapp/assets/fav/mstile-150x150.png
diff --git a/public/assets/fav/safari-pinned-tab.svg b/webapp/assets/fav/safari-pinned-tab.svg
similarity index 100%
rename from public/assets/fav/safari-pinned-tab.svg
rename to webapp/assets/fav/safari-pinned-tab.svg
diff --git a/public/assets/fav/site.webmanifest b/webapp/assets/fav/site.webmanifest
similarity index 100%
rename from public/assets/fav/site.webmanifest
rename to webapp/assets/fav/site.webmanifest
diff --git a/webapp-beta/js/api.js b/webapp/assets/js/api.js
similarity index 94%
rename from webapp-beta/js/api.js
rename to webapp/assets/js/api.js
index f4f0a96..a989c8b 100644
--- a/webapp-beta/js/api.js
+++ b/webapp/assets/js/api.js
@@ -5,7 +5,7 @@ const API = (() => {
module.servers = [{
name: "default",
url: window.location.origin,
- token: localStorage.getItem('authToken')
+ token: localStorage.getItem('token')
}];
module.selectedServer = 0;
@@ -48,7 +48,7 @@ const API = (() => {
}
module.logout = () => {
- localStorage.removeItem('authToken');
+ localStorage.removeItem('token');
window.location.replace(`/login`);
}
diff --git a/webapp-beta/js/lib/axios.js b/webapp/assets/js/lib/axios.js
similarity index 100%
rename from webapp-beta/js/lib/axios.js
rename to webapp/assets/js/lib/axios.js
diff --git a/webapp-beta/js/lib/izi-toast.js b/webapp/assets/js/lib/izi-toast.js
similarity index 100%
rename from webapp-beta/js/lib/izi-toast.js
rename to webapp/assets/js/lib/izi-toast.js
diff --git a/webapp-beta/js/waves.js b/webapp/assets/js/waves.js
similarity index 100%
rename from webapp-beta/js/waves.js
rename to webapp/assets/js/waves.js
diff --git a/webapp-beta/login/index.html b/webapp/login/index.html
similarity index 83%
rename from webapp-beta/login/index.html
rename to webapp/login/index.html
index d50fbaa..3bb5c43 100644
--- a/webapp-beta/login/index.html
+++ b/webapp/login/index.html
@@ -6,25 +6,25 @@
Login
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
-
-
-
+
+
+