mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 04:43:35 +00:00
V2 fix offline (#294)
* fix: resolve path to UI build in dev * fix: configure offline fetching
This commit is contained in:
@@ -8,7 +8,7 @@ import { join, resolve } from 'path';
|
||||
|
||||
import { initiateOSC, shutdownOSCServer } from './controllers/OscController.js';
|
||||
import { initSentry } from './modules/sentry.js';
|
||||
import { currentDirectory, environment, isProduction, resolvedPath, uiPath } from './setup.js';
|
||||
import { currentDirectory, environment, isProduction, resolvedPath } from './setup.js';
|
||||
import { ONTIME_VERSION } from './ONTIME_VERSION.js';
|
||||
import { OSCSettings } from 'ontime-types';
|
||||
|
||||
@@ -62,10 +62,13 @@ app.use('/playback', playbackRouter);
|
||||
app.use('/external', express.static(join(currentDirectory, 'external')));
|
||||
|
||||
// serve static - react, in test mode we fetch the React app from module
|
||||
app.use(express.static(join(currentDirectory, resolvedPath(), uiPath)));
|
||||
const newpath = join(currentDirectory, resolvedPath());
|
||||
console.log('serving content at ', newpath);
|
||||
|
||||
app.use(express.static(join(currentDirectory, resolvedPath())));
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
res.sendFile(resolve(currentDirectory, resolvedPath(), uiPath, 'index.html'));
|
||||
res.sendFile(resolve(currentDirectory, resolvedPath(), 'index.html'));
|
||||
});
|
||||
|
||||
// Implement catch all
|
||||
|
||||
@@ -40,10 +40,9 @@ export const isProduction = env === 'production' && !isTest;
|
||||
|
||||
// =================================================
|
||||
// resolve path to external
|
||||
const productionPath = '../../Resources/extraResources/';
|
||||
const devPath = '../../';
|
||||
const productionPath = '../../Resources/extraResources/client';
|
||||
const devPath = '../../client/build/';
|
||||
|
||||
export const uiPath = 'client/';
|
||||
export const resolvedPath = (): string => (isProduction ? productionPath : devPath);
|
||||
|
||||
// resolve file URL in both CJS and ESM (build and dev)
|
||||
|
||||
Reference in New Issue
Block a user