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:
Davidson Gomes 2024-07-30 09:17:49 -03:00
parent 5047e6281a
commit 95bc5e6b21
10 changed files with 403 additions and 44 deletions

View File

@ -1,5 +1,9 @@
# 2.0.4-beta (beta)
### Features
* New manager v2.0.0
### Fixed
* Update Baileys Version

View File

@ -3,7 +3,7 @@ FROM node:20-alpine AS builder
RUN apk update && \
apk add git ffmpeg wget curl bash
LABEL version="2.0.0" description="Api to control whatsapp features through http requests."
LABEL version="2.0.4-beta" description="Api to control whatsapp features through http requests."
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
LABEL contact="contato@agenciadgcode.com"
@ -16,7 +16,7 @@ RUN npm install
COPY ./src ./src
COPY ./public ./public
COPY ./prisma ./prisma
COPY ./views ./views
COPY ./manager ./manager
COPY ./.env.example ./.env
COPY ./Docker ./Docker
@ -43,8 +43,8 @@ RUN npm install --omit=dev
COPY --from=builder /evolution/dist ./dist
COPY --from=builder /evolution/prisma ./prisma
COPY --from=builder /evolution/manager ./manager
COPY --from=builder /evolution/public ./public
COPY --from=builder /evolution/views ./views
COPY --from=builder /evolution/.env ./.env
COPY --from=builder /evolution/Docker ./Docker

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

351
manager/dist/assets/index-A9DaT62F.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

14
manager/dist/index.html vendored Normal file
View File

@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/assets/images/evolution-logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Evolution Manager</title>
<script type="module" crossorigin src="/assets/index-A9DaT62F.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DbxiEs0X.css">
</head>
<body>
<div id="root"></div>
</body>
</html>

View File

@ -1,6 +1,6 @@
{
"name": "evolution-api",
"version": "2.0.3-beta",
"version": "2.0.4-beta",
"description": "Rest api for communication with WhatsApp",
"main": "./dist/src/main.js",
"scripts": {
@ -62,7 +62,7 @@
"dayjs": "^1.11.7",
"dotenv": "^16.4.5",
"eventemitter2": "^6.4.9",
"evolution-manager": "^0.4.13",
"evolution-manager-v2": "^0.0.2",
"exiftool-vendored": "^22.0.0",
"express": "^4.18.2",
"express-async-errors": "^3.1.1",

View File

@ -1,5 +1,7 @@
import { Router } from 'express';
import fs from 'fs';
import mime from 'mime';
import path from 'path';
import { configService, WaBusiness } from '../../config/env.config';
import { authGuard } from '../guards/auth.guard';
@ -44,6 +46,20 @@ const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
if (!serverConfig.DISABLE_MANAGER) router.use('/manager', new ViewsRouter().router);
router.get('/assets/*', (req, res) => {
const fileName = req.params[0];
const basePath = path.join(__dirname, '../../../manager/dist');
const filePath = path.join(basePath, 'assets/', fileName);
if (fs.existsSync(filePath)) {
res.set('Content-Type', mime.lookup(filePath) || 'text/css');
res.send(fs.readFileSync(filePath));
} else {
res.status(404).send('File not found');
}
});
router
.use((req, res, next) => telemetry.collectTelemetry(req, res, next))

View File

@ -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();
}

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="https://evolution-api.com/files/evolution-api-favicon.png" type="image/x-icon">
<title>Instance Manager</title>
</head>
<body>
<iframe src="https://manager.evolution-api.com" frameborder="0" style="width: 100%; height: 100vh;"></iframe>
</body>
</html>