mirror of
https://github.com/EvolutionAPI/evolution-manager.git
synced 2025-12-19 11:32:18 -06:00
fix: loading manager before dist
This commit is contained in:
@@ -8,8 +8,9 @@ import { RouterBroker } from '../abstract/abstract.router';
|
||||
export class ViewsRouter extends RouterBroker {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
const index = fs.readFileSync(path.join(__dirname, '../../../', 'Extras/evolution-manager', 'index.html'));
|
||||
const baseDir = __dirname.includes('dist') ? '../../../../' : '../../../';
|
||||
const indexPath = path.join(__dirname, baseDir, 'Extras/evolution-manager', 'index.html');
|
||||
const index = fs.readFileSync(indexPath);
|
||||
|
||||
this.router.get('/*', (req, res) => {
|
||||
try {
|
||||
@@ -17,7 +18,7 @@ export class ViewsRouter extends RouterBroker {
|
||||
|
||||
// verify if url is a file in dist folder
|
||||
if (pathname === '/') throw {};
|
||||
const filePath = path.join(__dirname, '../../../', 'Extras/evolution-manager', pathname);
|
||||
const filePath = path.join(__dirname, baseDir, 'Extras/evolution-manager', pathname);
|
||||
|
||||
if (fs.existsSync(filePath)) {
|
||||
const contentType = mime.lookup(filePath) || 'text/plain';
|
||||
|
||||
Reference in New Issue
Block a user