Browse Source

Lint & Fix workdir in Dockerfile

pull/937/head
Sergei Birukov 2 years ago
parent
commit
2fc1cc4873
  1. 2
      Dockerfile
  2. 4
      src/lib/Server.js
  3. 7
      webui/src/store/store.js

2
Dockerfile

@ -48,5 +48,5 @@ RUN update-alternatives --install /sbin/iptables iptables /sbin/iptables-legacy
ENV DEBUG=Server,WireGuard
# Run Web UI
WORKDIR /app/server
WORKDIR /app
CMD ["/usr/bin/dumb-init", "node", "server.js"]

4
src/lib/Server.js

@ -64,11 +64,12 @@ const isPasswordValid = (password) => {
};
module.exports = class Server {
constructor() {
const app = createApp();
this.app = app;
// Middleware to add CORS headers
// Middleware to add CORS headers
app.use('*', defineEventHandler((event) => {
setHeader(event, 'Access-Control-Allow-Origin', '*'); // Allows all origins
setHeader(event, 'Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); // Allowed methods
@ -340,4 +341,5 @@ module.exports = class Server {
createServer(toNodeListener(app)).listen(PORT, WEBUI_HOST);
debug(`Listening on http://${WEBUI_HOST}:${PORT}`);
}
};

7
webui/src/store/store.js

@ -21,9 +21,7 @@ export const useStore = defineStore('store', () => {
const dateFnsLocale = ref();
const uiTheme = ref(localStorage.theme || 'auto');
const prefersDarkScheme = computed(() =>
window.matchMedia('(prefers-color-scheme: dark)')
);
const prefersDarkScheme = computed(() => window.matchMedia('(prefers-color-scheme: dark)'));
const uiChartType = ref(0);
const uiShowCharts = ref(localStorage.getItem('uiShowCharts') === '1');
@ -166,7 +164,8 @@ export const useStore = defineStore('store', () => {
}
function setTheme() {
const { classList } = document.documentElement;
const shouldAddDarkClass = uiTheme.value === 'dark' || (uiTheme.value === 'auto' && prefersDarkScheme.value.matches);
const shouldAddDarkClass =
uiTheme.value === 'dark' || (uiTheme.value === 'auto' && prefersDarkScheme.value.matches);
classList.toggle('dark', shouldAddDarkClass);
}

Loading…
Cancel
Save