mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-21 21:02:21 -06:00
chore: Updated dependencies and added new manager
In this commit, the following changes were made: - Updated the version of the project to 2.0.4-beta. - Added the new manager with version 2.0.0. - Updated the Baileys version. - Modified several files such as CHANGELOG.md, Dockerfile, package.json, src/api/routes/index.router.ts, and src/api/routes/view.router.ts. - Deleted the views/manager.hbs file and added the manager/ folder. These changes update the dependencies and include a new manager, which may impact the application's functionality.
This commit is contained in:
@@ -1,34 +1,25 @@
|
||||
import { Router } from 'express';
|
||||
import fs from 'fs';
|
||||
import mime from 'mime-types';
|
||||
import express, { Router } from 'express';
|
||||
import path from 'path';
|
||||
|
||||
import { RouterBroker } from '../abstract/abstract.router';
|
||||
|
||||
export class ViewsRouter extends RouterBroker {
|
||||
public readonly router: Router;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.router = Router();
|
||||
|
||||
const basePath = 'evolution-manager/dist';
|
||||
const basePath = path.join(__dirname, '../../../manager/dist');
|
||||
const indexPath = path.join(basePath, 'index.html');
|
||||
|
||||
const indexPath = require.resolve(`${basePath}/index.html`);
|
||||
console.log('Base path:', basePath);
|
||||
console.log('Index path:', indexPath);
|
||||
|
||||
this.router.get('/*', (req, res) => {
|
||||
try {
|
||||
const pathname = req.url.split('?')[0];
|
||||
this.router.use(express.static(basePath));
|
||||
|
||||
// verify if url is a file in dist folder
|
||||
if (pathname === '/') throw {};
|
||||
const filePath = require.resolve(`${basePath}${pathname}`);
|
||||
|
||||
const contentType = mime.lookup(filePath) || 'text/plain';
|
||||
res.set('Content-Type', contentType);
|
||||
res.end(fs.readFileSync(filePath));
|
||||
} catch {
|
||||
res.set('Content-Type', 'text/html');
|
||||
res.send(fs.readFileSync(indexPath));
|
||||
}
|
||||
this.router.get('*', (req, res) => {
|
||||
res.sendFile(indexPath);
|
||||
});
|
||||
}
|
||||
|
||||
public readonly router = Router();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user