refactor: migrate project upload (#796)

* refactor: migrate project upload
This commit is contained in:
Carlos Valente
2024-03-01 22:59:00 +01:00
committed by GitHub
parent 8df419d835
commit 5b01329c37
54 changed files with 698 additions and 1134 deletions
+11 -11
View File
@@ -7,16 +7,16 @@ import http, { type Server } from 'http';
import cors from 'cors';
// import utils
import { join, resolve } from 'path';
import { resolve } from 'path';
import {
currentDirectory,
srcDirectory,
environment,
isProduction,
resolveDbPath,
resolveExternalsDirectory,
resolveStylesDirectory,
resolvedPath,
} from './setup.js';
} from './setup/index.js';
import { ONTIME_VERSION } from './ONTIME_VERSION.js';
// Import Routes
@@ -29,19 +29,19 @@ import { router as apiRouter } from './routes/apiRouter.js';
import { OscServer } from './adapters/OscAdapter.js';
import { socket } from './adapters/WebsocketAdapter.js';
import { DataProvider } from './classes/data-provider/DataProvider.js';
import { dbLoadingProcess } from './modules/loadDb.js';
import { dbLoadingProcess } from './setup/loadDb.js';
// Services
import { integrationService } from './services/integration-service/IntegrationService.js';
import { logger } from './classes/Logger.js';
import { oscIntegration } from './services/integration-service/OscIntegration.js';
import { httpIntegration } from './services/integration-service/HttpIntegration.js';
import { populateStyles } from './modules/loadStyles.js';
import { populateStyles } from './setup/loadStyles.js';
import { eventStore } from './stores/EventStore.js';
import { runtimeService } from './services/runtime-service/RuntimeService.js';
import { restoreService } from './services/RestoreService.js';
import { messageService } from './services/message-service/MessageService.js';
import { populateDemo } from './modules/loadDemo.js';
import { populateDemo } from './setup/loadDemo.js';
import { getState, updateRundownData } from './stores/runtimeState.js';
import { initRundown } from './services/rundown-service/RundownService.js';
import { getPlayableEvents } from './services/rundown-service/rundownUtils.js';
@@ -51,7 +51,7 @@ console.log(`Starting Ontime version ${ONTIME_VERSION}`);
if (!isProduction) {
console.log(`Ontime running in ${environment} environment`);
console.log(`Ontime directory at ${currentDirectory} `);
console.log(`Ontime directory at ${srcDirectory} `);
console.log(`Ontime database at ${resolveDbPath}`);
}
@@ -83,7 +83,7 @@ app.use('/external', (req, res) => {
});
// serve static - react, in dev/test mode we fetch the React app from module
const reactAppPath = join(currentDirectory, resolvedPath());
const reactAppPath = resolvedPath();
app.use(
expressStaticGzip(reactAppPath, {
enableBrotli: true,
@@ -91,12 +91,12 @@ app.use(
}),
);
app.get('*', (req, res) => {
res.sendFile(resolve(currentDirectory, resolvedPath(), 'index.html'));
app.get('*', (_req, res) => {
res.sendFile(resolve(resolvedPath(), 'index.html'));
});
// Implement catch all
app.use((error, response) => {
app.use((_error, response) => {
response.status(400).send('Unhandled request');
});