mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 09:51:24 -06:00
fix: Adjusted set in webhook to go empty when enabled false
This commit is contained in:
parent
24712c4c2d
commit
27aa0add4e
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* Route to send status broadcast
|
* Route to send status broadcast¼
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Adjusted set in webhook to go empty when enabled false
|
||||||
|
|
||||||
# 1.1.3 (2023-07-06 11:43)
|
# 1.1.3 (2023-07-06 11:43)
|
||||||
|
|
||||||
|
@ -7,16 +7,6 @@ networks:
|
|||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
command: >
|
|
||||||
redis-server
|
|
||||||
--port 6379
|
|
||||||
--appendonly yes
|
|
||||||
--save 900 1
|
|
||||||
--save 300 10
|
|
||||||
--save 60 10000
|
|
||||||
--appendfsync everysec
|
|
||||||
volumes:
|
|
||||||
- evolution_redis:/data
|
|
||||||
container_name: redis
|
container_name: redis
|
||||||
ports:
|
ports:
|
||||||
- 6379:6379
|
- 6379:6379
|
||||||
|
@ -104,9 +104,11 @@ export class RedisCache {
|
|||||||
public async delAll(hash?: string) {
|
public async delAll(hash?: string) {
|
||||||
try {
|
try {
|
||||||
this.logger.verbose('instance delAll: ' + hash);
|
this.logger.verbose('instance delAll: ' + hash);
|
||||||
return await this.client.del(
|
const result = await this.client.del(
|
||||||
hash || this.redisEnv.PREFIX_KEY + ':' + this.instanceName,
|
hash || this.redisEnv.PREFIX_KEY + ':' + this.instanceName,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(error);
|
this.logger.error(error);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ export const instanceNameSchema: JSONSchema7 = {
|
|||||||
webhook_by_events: { type: 'boolean' },
|
webhook_by_events: { type: 'boolean' },
|
||||||
events: {
|
events: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
minItems: 1,
|
minItems: 0,
|
||||||
items: {
|
items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
enum: [
|
enum: [
|
||||||
@ -825,7 +825,7 @@ export const webhookSchema: JSONSchema7 = {
|
|||||||
enabled: { type: 'boolean', enum: [true, false] },
|
enabled: { type: 'boolean', enum: [true, false] },
|
||||||
events: {
|
events: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
minItems: 1,
|
minItems: 0,
|
||||||
items: {
|
items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
enum: [
|
enum: [
|
||||||
|
@ -8,9 +8,15 @@ export class WebhookController {
|
|||||||
constructor(private readonly webhookService: WebhookService) {}
|
constructor(private readonly webhookService: WebhookService) {}
|
||||||
|
|
||||||
public async createWebhook(instance: InstanceDto, data: WebhookDto) {
|
public async createWebhook(instance: InstanceDto, data: WebhookDto) {
|
||||||
if (!isURL(data.url, { require_tld: false })) {
|
if (data.enabled && !isURL(data.url, { require_tld: false })) {
|
||||||
throw new BadRequestException('Invalid "url" property');
|
throw new BadRequestException('Invalid "url" property');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!data.enabled) {
|
||||||
|
data.url = '';
|
||||||
|
data.events = [];
|
||||||
|
}
|
||||||
|
|
||||||
return this.webhookService.create(instance, data);
|
return this.webhookService.create(instance, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,6 +216,8 @@ export class WAMonitoringService {
|
|||||||
rmSync(join(INSTANCE_DIR, instanceName), { recursive: true, force: true });
|
rmSync(join(INSTANCE_DIR, instanceName), { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async clearStoreFiles(instanceName: string) {}
|
||||||
|
|
||||||
public async loadInstance() {
|
public async loadInstance() {
|
||||||
this.logger.verbose('load instances');
|
this.logger.verbose('load instances');
|
||||||
const set = async (name: string) => {
|
const set = async (name: string) => {
|
||||||
@ -300,6 +302,7 @@ export class WAMonitoringService {
|
|||||||
try {
|
try {
|
||||||
this.logger.verbose('request cleaning up instance: ' + instanceName);
|
this.logger.verbose('request cleaning up instance: ' + instanceName);
|
||||||
this.cleaningUp(instanceName);
|
this.cleaningUp(instanceName);
|
||||||
|
this.clearStoreFiles(instanceName);
|
||||||
} finally {
|
} finally {
|
||||||
this.logger.warn(`Instance "${instanceName}" - REMOVED`);
|
this.logger.warn(`Instance "${instanceName}" - REMOVED`);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user