mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-25 14:47:45 -06:00
git actions v2
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Contact, Message } from '@prisma/client';
|
||||
import { WASocket } from '@whiskeysockets/baileys';
|
||||
import axios from 'axios';
|
||||
import { execSync } from 'child_process';
|
||||
import { isURL } from 'class-validator';
|
||||
import EventEmitter2 from 'eventemitter2';
|
||||
import { join } from 'path';
|
||||
@@ -10,9 +9,7 @@ import { v4 } from 'uuid';
|
||||
import {
|
||||
Auth,
|
||||
Chatwoot,
|
||||
CleanStoreConf,
|
||||
ConfigService,
|
||||
Database,
|
||||
HttpServer,
|
||||
Log,
|
||||
Rabbitmq,
|
||||
@@ -986,26 +983,6 @@ export class ChannelStartupService {
|
||||
}
|
||||
}
|
||||
|
||||
public cleanStore() {
|
||||
const cleanStore = this.configService.get<CleanStoreConf>('CLEAN_STORE');
|
||||
const database = this.configService.get<Database>('DATABASE');
|
||||
if (cleanStore?.CLEANING_INTERVAL && !database.ENABLED) {
|
||||
setInterval(() => {
|
||||
try {
|
||||
for (const [key, value] of Object.entries(cleanStore)) {
|
||||
if (value === true) {
|
||||
execSync(
|
||||
`rm -rf ${join(this.storePath, key.toLowerCase().replace('_', '-'), this.instance.name)}/*.json`,
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(error);
|
||||
}
|
||||
}, (cleanStore?.CLEANING_INTERVAL ?? 3600) * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the number is MX or AR
|
||||
public formatMXOrARNumber(jid: string): string {
|
||||
const countryCode = jid.substring(0, 2);
|
||||
|
||||
@@ -139,7 +139,6 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
private readonly providerFiles: ProviderFiles,
|
||||
) {
|
||||
super(configService, eventEmitter, prismaRepository, chatwootCache);
|
||||
this.cleanStore();
|
||||
this.instance.qrcode = { count: 0 };
|
||||
this.recoveringMessages();
|
||||
this.cronForceUpdateGroupMetadataCache();
|
||||
|
||||
@@ -39,7 +39,6 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
private readonly providerFiles: ProviderFiles,
|
||||
) {
|
||||
super(configService, eventEmitter, prismaRepository, chatwootCache);
|
||||
this.cleanStore();
|
||||
}
|
||||
|
||||
public stateConnection: wa.StateConnection = { state: 'open' };
|
||||
|
||||
@@ -44,22 +44,6 @@ export type SaveData = {
|
||||
LABELS: boolean;
|
||||
};
|
||||
|
||||
export type StoreConf = {
|
||||
MESSAGES: boolean;
|
||||
MESSAGE_UP: boolean;
|
||||
CONTACTS: boolean;
|
||||
CHATS: boolean;
|
||||
LABELS: boolean;
|
||||
};
|
||||
|
||||
export type CleanStoreConf = {
|
||||
CLEANING_INTERVAL: number;
|
||||
MESSAGES: boolean;
|
||||
MESSAGE_UP: boolean;
|
||||
CONTACTS: boolean;
|
||||
CHATS: boolean;
|
||||
};
|
||||
|
||||
export type DBConnection = {
|
||||
URI: string;
|
||||
CLIENT_NAME: string;
|
||||
@@ -215,8 +199,6 @@ export interface Env {
|
||||
CORS: Cors;
|
||||
SSL_CONF: SslConf;
|
||||
PROVIDER: ProviderSession;
|
||||
STORE: StoreConf;
|
||||
CLEAN_STORE: CleanStoreConf;
|
||||
DATABASE: Database;
|
||||
RABBITMQ: Rabbitmq;
|
||||
SQS: Sqs;
|
||||
@@ -282,22 +264,6 @@ export class ConfigService {
|
||||
PORT: process.env?.PROVIDER_PORT || '5656',
|
||||
PREFIX: process.env?.PROVIDER_PREFIX || 'evolution',
|
||||
},
|
||||
STORE: {
|
||||
MESSAGES: process.env?.STORE_MESSAGES === 'true',
|
||||
MESSAGE_UP: process.env?.STORE_MESSAGE_UP === 'true',
|
||||
CONTACTS: process.env?.STORE_CONTACTS === 'true',
|
||||
CHATS: process.env?.STORE_CHATS === 'true',
|
||||
LABELS: process.env?.STORE_LABELS === 'true',
|
||||
},
|
||||
CLEAN_STORE: {
|
||||
CLEANING_INTERVAL: Number.isInteger(process.env?.CLEAN_STORE_CLEANING_INTERVAL)
|
||||
? Number.parseInt(process.env.CLEAN_STORE_CLEANING_INTERVAL)
|
||||
: 7200,
|
||||
MESSAGES: process.env?.CLEAN_STORE_MESSAGES === 'true',
|
||||
MESSAGE_UP: process.env?.CLEAN_STORE_MESSAGE_UP === 'true',
|
||||
CONTACTS: process.env?.CLEAN_STORE_CONTACTS === 'true',
|
||||
CHATS: process.env?.CLEAN_STORE_CHATS === 'true',
|
||||
},
|
||||
DATABASE: {
|
||||
CONNECTION: {
|
||||
URI: process.env.DATABASE_CONNECTION_URI || '',
|
||||
|
||||
Reference in New Issue
Block a user