Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

Get conf.yml on client side

aterox727f6b1fc0a5
diff --git a/server.js b/server.js
index 7d395ade..6b81e2b6 100644
--- a/server.js
+++ b/server.js
@@ -27,7 +27,6 @@ const rebuild = require('./services/rebuild-app'); // A script to programmatical
const systemInfo = require('./services/system-info'); // Basic system info, for resource widget
const sslServer = require('./services/ssl-server'); // TLS-enabled web server
const corsProxy = require('./services/cors-proxy'); // Enables API requests to CORS-blocked services
-const getConf = require('./services/get-conf'); // Returns the configuration as a JSON object
/* Helper functions, and default config */
const printMessage = require('./services/print-message'); // Function to print welcome msg on start
@@ -69,7 +68,7 @@ const method = (m, mw) => (req, res, next) => (req.method === m ? mw(req, res, n
const app = express()
// Serves up static files
.use(express.static(path.join(__dirname, 'dist')))
- .use(express.static(path.join(__dirname, 'public'), { index: 'initialization.html' }))
+ .use(express.static(path.join(__dirname, 'public')))
// Load middlewares for parsing JSON, and supporting HTML5 history routing
.use(express.json({ limit: '1mb' }))
.use(history())
@@ -117,14 +116,6 @@ const app = express()
} catch (e) {
res.end(JSON.stringify({ success: false, message: e }));
}
- })
- // GET endpoint returns the app configuration
- .use(ENDPOINTS.getConf, (req, res) => {
- try {
- res.end(JSON.stringify(getConf()));
- } catch (e) {
- res.end(JSON.stringify({ success: false, message: e }));
- }
});
/* Create HTTP server from app on port, and print welcome message */
diff --git a/src/store.js b/src/store.js
index 83bf628b..e453628a 100644
--- a/src/store.js
+++ b/src/store.js
@@ -2,6 +2,7 @@
import Vue from 'vue';
import Vuex from 'vuex';
import axios from 'axios';
+import yaml from 'js-yaml';
import Keys from '@/utils/StoreMutations';
import ConfigAccumulator from '@/utils/ConfigAccumalator';
import { componentVisibility } from '@/utils/ConfigHelpers';
@@ -9,7 +10,6 @@ import { applyItemId } from '@/utils/SectionHelpers';
import filterUserSections from '@/utils/CheckSectionVisibility';
import { InfoHandler, InfoKeys } from '@/utils/ErrorHandler';
import { isUserAdmin } from '@/utils/Auth';
-import { serviceEndpoints } from '@/utils/defaults';
Vue.use(Vuex);
@@ -280,7 +280,7 @@ const store = new Vuex.Store({
/* Called when app first loaded. Reads config and sets state */
async [INITIALIZE_CONFIG]({ commit }) {
// Get the config file from the server and store it for use by the accumulator
- commit(SET_REMOTE_CONFIG, (await axios.get(serviceEndpoints.getConf)).data);
+ commit(SET_REMOTE_CONFIG, yaml.load((await axios.get('conf.yml')).data));
const deepCopy = (json) => JSON.parse(JSON.stringify(json));
const config = deepCopy(new ConfigAccumulator().config());
commit(SET_CONFIG, config);
diff --git a/src/utils/defaults.js b/src/utils/defaults.js
index aba08691..57cabb6d 100644
--- a/src/utils/defaults.js
+++ b/src/utils/defaults.js
@@ -42,7 +42,6 @@ module.exports = {
statusCheck: '/status-check',
save: '/config-manager/save',
rebuild: '/config-manager/rebuild',
- getConf: '/config-manager/get',
systemInfo: '/system-info',
corsProxy: '/cors-proxy',
},