mirror of
https://github.com/EvolutionAPI/evolution-manager.git
synced 2025-07-16 04:02:54 -06:00
fix: loading manager before dist
This commit is contained in:
parent
217cab0e5f
commit
c2065ff526
@ -8,8 +8,9 @@ import { RouterBroker } from '../abstract/abstract.router';
|
|||||||
export class ViewsRouter extends RouterBroker {
|
export class ViewsRouter extends RouterBroker {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
const baseDir = __dirname.includes('dist') ? '../../../../' : '../../../';
|
||||||
const index = fs.readFileSync(path.join(__dirname, '../../../', 'Extras/evolution-manager', 'index.html'));
|
const indexPath = path.join(__dirname, baseDir, 'Extras/evolution-manager', 'index.html');
|
||||||
|
const index = fs.readFileSync(indexPath);
|
||||||
|
|
||||||
this.router.get('/*', (req, res) => {
|
this.router.get('/*', (req, res) => {
|
||||||
try {
|
try {
|
||||||
@ -17,7 +18,7 @@ export class ViewsRouter extends RouterBroker {
|
|||||||
|
|
||||||
// verify if url is a file in dist folder
|
// verify if url is a file in dist folder
|
||||||
if (pathname === '/') throw {};
|
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)) {
|
if (fs.existsSync(filePath)) {
|
||||||
const contentType = mime.lookup(filePath) || 'text/plain';
|
const contentType = mime.lookup(filePath) || 'text/plain';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "evolution-manager",
|
"name": "evolution-manager",
|
||||||
"version": "0.3.2",
|
"version": "0.3.3",
|
||||||
"main": "dist",
|
"main": "dist",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0"
|
"node": ">=16.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user