mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 06:59:09 +00:00
fix: missing demo logo (#1954)
This commit is contained in:
committed by
GitHub
parent
7b5f797c95
commit
04c5b67475
@@ -37,6 +37,7 @@ import {
|
|||||||
moveCorruptFile,
|
moveCorruptFile,
|
||||||
parseJsonFile,
|
parseJsonFile,
|
||||||
} from './projectServiceUtils.js';
|
} from './projectServiceUtils.js';
|
||||||
|
import { populateOntimeLogo } from '../../setup/loadOntimeLogo.js';
|
||||||
|
|
||||||
type ProjectState =
|
type ProjectState =
|
||||||
| {
|
| {
|
||||||
@@ -113,6 +114,7 @@ async function loadProject(projectData: DatabaseModel, fileName: string, rundown
|
|||||||
* Loads the demo project
|
* Loads the demo project
|
||||||
*/
|
*/
|
||||||
export async function loadDemoProject(): Promise<string> {
|
export async function loadDemoProject(): Promise<string> {
|
||||||
|
populateOntimeLogo();
|
||||||
return createProject(config.demoProject, demoDb);
|
return createProject(config.demoProject, demoDb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ export const srcFiles = {
|
|||||||
translationReadme: join(srcDir.root, config.user, config.translations.directory, 'README.md'),
|
translationReadme: join(srcDir.root, config.user, config.translations.directory, 'README.md'),
|
||||||
/** Path to login */
|
/** Path to login */
|
||||||
login: join(srcDir.root, 'html/login.html'),
|
login: join(srcDir.root, 'html/login.html'),
|
||||||
|
/** Path to ontime-logo */
|
||||||
|
logo: join(srcDir.root, config.user, config.logo, 'ontime-logo.png'),
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { copyFileSync } from 'fs';
|
||||||
|
import { ensureDirectory } from '../utils/fileManagement.js';
|
||||||
|
|
||||||
|
import { publicDir, srcFiles } from './index.js';
|
||||||
|
import { basename, join } from 'path';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description ensures directories exist and populates ontime logo
|
||||||
|
*/
|
||||||
|
export function populateOntimeLogo() {
|
||||||
|
ensureDirectory(publicDir.logoDir);
|
||||||
|
try {
|
||||||
|
const logoName = basename(srcFiles.logo);
|
||||||
|
copyFileSync(srcFiles.logo, join(publicDir.logoDir, logoName));
|
||||||
|
} catch (_) {
|
||||||
|
/* we do not handle this */
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user