mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-25 01:48:39 -06:00
Merge remote-tracking branch 'upstream/develop' into pr
This commit is contained in:
commit
cadc038966
38
.github/ISSUE_TEMPLATE/-en--bug-report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/-en--bug-report.md
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: "[EN] Bug report"
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: "[EN][BUG]"
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Title: [Brief Description of the Bug]
|
||||||
|
|
||||||
|
#### Description:
|
||||||
|
Describe in detail the problem you encountered. Include any relevant context that may help understand the origin of the bug.
|
||||||
|
|
||||||
|
#### Steps to Reproduce:
|
||||||
|
1. List the steps necessary to reproduce the problem.
|
||||||
|
2. Try to be as specific as possible.
|
||||||
|
3. If the problem occurs in a specific scenario, describe it here.
|
||||||
|
|
||||||
|
#### Expected Behavior:
|
||||||
|
Describe what you expected to happen when following the steps above.
|
||||||
|
|
||||||
|
#### Current Behavior:
|
||||||
|
Explain what actually happens when you follow the steps above.
|
||||||
|
|
||||||
|
#### Screenshots/Videos:
|
||||||
|
If possible, add screenshots or videos illustrating the problem. This can be extremely helpful in understanding the issue.
|
||||||
|
|
||||||
|
#### Environment:
|
||||||
|
- **Server:** [e.g., Ubuntu 18.04]
|
||||||
|
- **API Version:** [e.g., 1.5.4]
|
||||||
|
- **Other Hardware/Software Specifications:** [e.g., CPU, GPU]
|
||||||
|
|
||||||
|
#### Submitting Logs:
|
||||||
|
Please attach logs that may be related to the problem. If the logs contain sensitive information, consider sending them privately to one of the project maintainers.
|
||||||
|
|
||||||
|
#### Additional Notes:
|
||||||
|
Include here any other information that you think might be useful in understanding or resolving the bug.
|
28
.github/ISSUE_TEMPLATE/-en--feature-request.md
vendored
Normal file
28
.github/ISSUE_TEMPLATE/-en--feature-request.md
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
name: "[EN] Feature request"
|
||||||
|
about: Suggest an idea for the API
|
||||||
|
title: "[EN][FEAT]"
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Title: [Brief Description of Feature Request]
|
||||||
|
|
||||||
|
#### Detailed Description:
|
||||||
|
Clearly and in detail, describe the functionality you wish to be implemented. Explain how this fits into the context of the project.
|
||||||
|
|
||||||
|
#### Rationale:
|
||||||
|
Explain why this functionality would be useful for the project. This helps in understanding the importance and priority of the request.
|
||||||
|
|
||||||
|
#### Usage Examples:
|
||||||
|
Provide specific examples of how this feature could be used. This can include scenarios or use cases where the feature would be particularly beneficial.
|
||||||
|
|
||||||
|
#### Possible Implementations:
|
||||||
|
If you have ideas on how this feature might be implemented, please share them here. This is not mandatory but can be helpful for the development team.
|
||||||
|
|
||||||
|
#### Impact on the Project:
|
||||||
|
Discuss how this new feature could impact other parts of the project, if applicable.
|
||||||
|
|
||||||
|
#### Additional Notes:
|
||||||
|
Any other information you believe is relevant to your request.
|
38
.github/ISSUE_TEMPLATE/-pt--reportar-bug.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/-pt--reportar-bug.md
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: "[PT] Reportar bug"
|
||||||
|
about: Reportar um problema
|
||||||
|
title: "[PT][BUG]"
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Título: [Breve Descrição do Bug]
|
||||||
|
|
||||||
|
#### Descrição:
|
||||||
|
Descreva detalhadamente o problema que você encontrou. Inclua qualquer contexto relevante que possa ajudar a entender a origem do bug.
|
||||||
|
|
||||||
|
#### Passos para Reproduzir:
|
||||||
|
1. Liste os passos necessários para reproduzir o problema.
|
||||||
|
2. Tente ser o mais específico possível.
|
||||||
|
3. Se o problema ocorrer em um cenário específico, descreva-o aqui.
|
||||||
|
|
||||||
|
#### Comportamento Esperado:
|
||||||
|
Descreva o que você esperava que acontecesse quando seguisse os passos acima.
|
||||||
|
|
||||||
|
#### Comportamento Atual:
|
||||||
|
Explique o que realmente acontece quando você segue os passos acima.
|
||||||
|
|
||||||
|
#### Capturas de Tela/Vídeos:
|
||||||
|
Se possível, adicione capturas de tela ou vídeos que ilustrem o problema. Isso pode ser extremamente útil para entender o problema.
|
||||||
|
|
||||||
|
#### Ambiente:
|
||||||
|
- **Servidor:** [ex: Ubuntu 18.04]
|
||||||
|
- **Versão da API:** [ex: 1.5.4]
|
||||||
|
- **Outras Especificações de Hardware/Software:** [ex: CPU, GPU]
|
||||||
|
|
||||||
|
#### Envio de Logs:
|
||||||
|
Por favor, anexe os logs que possam estar relacionados ao problema. Se os logs contiverem informações sensíveis, considere enviá-los de forma privada para um dos mantenedores do projeto.
|
||||||
|
|
||||||
|
#### Notas Adicionais:
|
||||||
|
Inclua aqui qualquer outra informação que você ache que possa ser útil para entender ou resolver o bug.
|
28
.github/ISSUE_TEMPLATE/-pt--solicitar-recurso.md
vendored
Normal file
28
.github/ISSUE_TEMPLATE/-pt--solicitar-recurso.md
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
name: "[PT] Solicitar recurso"
|
||||||
|
about: Sugira novos recursos para a API
|
||||||
|
title: "[PT][FEAT]"
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Título: [Breve Descrição da Solicitação de Recurso]
|
||||||
|
|
||||||
|
#### Descrição Detalhada:
|
||||||
|
Descreva claramente e em detalhes a funcionalidade que você deseja que seja implementada. Explique como isso se encaixa no contexto do projeto.
|
||||||
|
|
||||||
|
#### Racional:
|
||||||
|
Explique por que essa funcionalidade seria útil para o projeto. Isso ajuda a entender a importância e a prioridade da solicitação.
|
||||||
|
|
||||||
|
#### Exemplos de Uso:
|
||||||
|
Forneça exemplos específicos de como essa funcionalidade poderia ser utilizada. Isso pode incluir cenários ou casos de uso onde a funcionalidade seria particularmente benéfica.
|
||||||
|
|
||||||
|
#### Possíveis Implementações:
|
||||||
|
Se você tem ideias sobre como essa funcionalidade pode ser implementada, por favor, compartilhe-as aqui. Isso não é obrigatório, mas pode ser útil para a equipe de desenvolvimento.
|
||||||
|
|
||||||
|
#### Impacto no Projeto:
|
||||||
|
Discuta como essa nova funcionalidade poderia impactar outras partes do projeto, se aplicável.
|
||||||
|
|
||||||
|
#### Notas Adicionais:
|
||||||
|
Qualquer outra informação que você acredita ser relevante para a sua solicitação.
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -39,6 +39,7 @@ docker-compose.yaml
|
|||||||
/test/
|
/test/
|
||||||
/src/env.yml
|
/src/env.yml
|
||||||
/store
|
/store
|
||||||
|
*.env
|
||||||
|
|
||||||
/temp/*
|
/temp/*
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* Fixed the pairing code
|
* Fixed the pairing code
|
||||||
* Adjusts in typebot
|
* Adjusts in typebot
|
||||||
* Fix the problem when disconnecting the instance and connecting again using mongodb
|
* Fix the problem when disconnecting the instance and connecting again using mongodb
|
||||||
|
* Options to disable docs and manager
|
||||||
|
|
||||||
|
|
||||||
# 1.6.0 (2023-12-12 17:24)
|
# 1.6.0 (2023-12-12 17:24)
|
||||||
|
@ -3,7 +3,13 @@ import { readFileSync } from 'fs';
|
|||||||
import { load } from 'js-yaml';
|
import { load } from 'js-yaml';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
export type HttpServer = { TYPE: 'http' | 'https'; PORT: number; URL: string };
|
export type HttpServer = {
|
||||||
|
TYPE: 'http' | 'https';
|
||||||
|
PORT: number;
|
||||||
|
URL: string;
|
||||||
|
DISABLE_DOCS: boolean;
|
||||||
|
DISABLE_MANAGER: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export type HttpMethods = 'POST' | 'GET' | 'PUT' | 'DELETE';
|
export type HttpMethods = 'POST' | 'GET' | 'PUT' | 'DELETE';
|
||||||
export type Cors = {
|
export type Cors = {
|
||||||
@ -186,6 +192,8 @@ export class ConfigService {
|
|||||||
TYPE: (process.env.SERVER_TYPE as 'http' | 'https') || 'http',
|
TYPE: (process.env.SERVER_TYPE as 'http' | 'https') || 'http',
|
||||||
PORT: Number.parseInt(process.env.SERVER_PORT) || 8080,
|
PORT: Number.parseInt(process.env.SERVER_PORT) || 8080,
|
||||||
URL: process.env.SERVER_URL,
|
URL: process.env.SERVER_URL,
|
||||||
|
DISABLE_DOCS: process.env?.SERVER_DISABLE_DOCS === 'true',
|
||||||
|
DISABLE_MANAGER: process.env?.SERVER_DISABLE_MANAGER === 'true',
|
||||||
},
|
},
|
||||||
CORS: {
|
CORS: {
|
||||||
ORIGIN: process.env.CORS_ORIGIN.split(',') || ['*'],
|
ORIGIN: process.env.CORS_ORIGIN.split(',') || ['*'],
|
||||||
|
@ -9,6 +9,9 @@ SERVER:
|
|||||||
TYPE: http # https
|
TYPE: http # https
|
||||||
PORT: 8080 # 443
|
PORT: 8080 # 443
|
||||||
URL: localhost
|
URL: localhost
|
||||||
|
DISABLE_MANAGER: false
|
||||||
|
DISABLE_DOCS: false
|
||||||
|
|
||||||
|
|
||||||
CORS:
|
CORS:
|
||||||
ORIGIN:
|
ORIGIN:
|
||||||
|
@ -53,7 +53,8 @@ function bootstrap() {
|
|||||||
app.use('/store', express.static(join(ROOT_DIR, 'store')));
|
app.use('/store', express.static(join(ROOT_DIR, 'store')));
|
||||||
|
|
||||||
app.use('/', router);
|
app.use('/', router);
|
||||||
app.use(swaggerRouter);
|
|
||||||
|
if (!configService.get('SERVER').DISABLE_DOCS) app.use(swaggerRouter);
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
(err: Error, req: Request, res: Response, next: NextFunction) => {
|
(err: Error, req: Request, res: Response, next: NextFunction) => {
|
||||||
|
@ -31,23 +31,25 @@ enum HttpStatus {
|
|||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
const authType = configService.get<Auth>('AUTHENTICATION').TYPE;
|
const authType = configService.get<Auth>('AUTHENTICATION').TYPE;
|
||||||
|
const serverConfig = configService.get('SERVER');
|
||||||
const guards = [instanceExistsGuard, instanceLoggedGuard, authGuard[authType]];
|
const guards = [instanceExistsGuard, instanceLoggedGuard, authGuard[authType]];
|
||||||
|
|
||||||
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
||||||
|
|
||||||
|
if (!serverConfig.DISABLE_MANAGER) router.use('/manager', new ViewsRouter().router);
|
||||||
|
|
||||||
router
|
router
|
||||||
.get('/', (req, res) => {
|
.get('/', (req, res) => {
|
||||||
res.status(HttpStatus.OK).json({
|
res.status(HttpStatus.OK).json({
|
||||||
status: HttpStatus.OK,
|
status: HttpStatus.OK,
|
||||||
message: 'Welcome to the Evolution API, it is working!',
|
message: 'Welcome to the Evolution API, it is working!',
|
||||||
version: packageJson.version,
|
version: packageJson.version,
|
||||||
swagger: `${req.protocol}://${req.get('host')}/docs`,
|
swagger: !serverConfig.DISABLE_DOCS ? `${req.protocol}://${req.get('host')}/docs` : undefined,
|
||||||
|
manager: !serverConfig.DISABLE_MANAGER ? `${req.protocol}://${req.get('host')}/manager` : undefined,
|
||||||
documentation: `https://doc.evolution-api.com`,
|
documentation: `https://doc.evolution-api.com`,
|
||||||
manager: `${req.protocol}://${req.get('host')}/manager`,
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.use('/instance', new InstanceRouter(configService, ...guards).router)
|
.use('/instance', new InstanceRouter(configService, ...guards).router)
|
||||||
.use('/manager', new ViewsRouter().router)
|
|
||||||
.use('/message', new MessageRouter(...guards).router)
|
.use('/message', new MessageRouter(...guards).router)
|
||||||
.use('/chat', new ChatRouter(...guards).router)
|
.use('/chat', new ChatRouter(...guards).router)
|
||||||
.use('/group', new GroupRouter(...guards).router)
|
.use('/group', new GroupRouter(...guards).router)
|
||||||
|
Loading…
Reference in New Issue
Block a user