mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-08 00:43:54 +00:00
initial config
This commit is contained in:
@@ -32,3 +32,4 @@ server/db.json
|
||||
yarn.lock
|
||||
package.json
|
||||
package-lock.json
|
||||
db.json
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
const { app, BrowserWindow } = require('electron');
|
||||
const path = require('path');
|
||||
const nodeapp = require('./server/app.js');
|
||||
|
||||
function createWindow() {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js'),
|
||||
nodeIntegration: true,
|
||||
},
|
||||
});
|
||||
|
||||
win.loadURL('http://localhost:4001/editor');
|
||||
win.webContents.openDevTools();
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow();
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const replaceText = (selector, text) => {
|
||||
const element = document.getElementById(selector);
|
||||
if (element) element.innerText = text;
|
||||
};
|
||||
|
||||
for (const type of ['chrome', 'node', 'electron']) {
|
||||
replaceText(`${type}-version`, process.versions[type]);
|
||||
}
|
||||
});
|
||||
+6
-3
@@ -13,6 +13,7 @@ const express = require('express');
|
||||
const http = require('http');
|
||||
const cors = require('cors');
|
||||
const { dbModel } = require('./data/dataModel.js');
|
||||
const path = require('path');
|
||||
|
||||
db.defaults(dbModel).write();
|
||||
|
||||
@@ -48,9 +49,11 @@ app.use(express.json());
|
||||
app.use('/events', eventsRouter);
|
||||
app.use('/event', eventRouter);
|
||||
|
||||
// implement general router
|
||||
app.get('/', (req, res) => {
|
||||
res.send('ontime API');
|
||||
// serve react
|
||||
app.use(express.static(path.join(__dirname, '../client/build')));
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
res.sendFile(path.resolve(__dirname, '../client', 'build', 'index.html'));
|
||||
});
|
||||
|
||||
// Implement route for errors
|
||||
|
||||
Reference in New Issue
Block a user