refactor: session resource

This commit is contained in:
Carlos Valente
2024-10-20 21:49:52 +02:00
committed by Carlos Valente
parent cf40001a2a
commit 71c468d069
10 changed files with 69 additions and 54 deletions
@@ -1,11 +1,10 @@
import { DatabaseModel, GetInfo, LogOrigin, ProjectData, ProjectFileListResponse } from 'ontime-types';
import { DatabaseModel, LogOrigin, ProjectData, ProjectFileListResponse } from 'ontime-types';
import { getErrorMessage } from 'ontime-utils';
import { copyFile, rename } from 'fs/promises';
import { logger } from '../../classes/Logger.js';
import { getNetworkInterfaces } from '../../utils/networkInterfaces.js';
import { publicDir, publicFiles } from '../../setup/index.js';
import { publicDir } from '../../setup/index.js';
import {
appendToName,
ensureDirectory,
@@ -306,26 +305,6 @@ export async function deleteProjectFile(filename: string) {
await deleteFile(projectFilePath);
}
/**
* Adds business logic to gathering data for the info endpoint
*/
export async function getInfo(): Promise<GetInfo> {
const { version, serverPort } = getDataProvider().getSettings();
const osc = getDataProvider().getOsc();
// get nif and inject localhost
const ni = getNetworkInterfaces();
ni.unshift({ name: 'localhost', address: '127.0.0.1' });
return {
networkInterfaces: ni,
version,
serverPort,
osc,
cssOverride: publicFiles.cssOverride,
};
}
/**
* applies a partial database model
*/