8 Commits
Author SHA1 Message Date
waozi 13b259c58c Add GitLab and Matrix links and sort live streams 2026-07-11 18:29:04 -03:00
sa8ab 2f2dab4f43 Merge pull request #137 from waozixyz/dev
Add Kick live stream support
2026-07-12 00:49:54 +03:30
waozi 21f0780f03 Add Kick live stream support 2026-07-10 22:32:30 -03:00
sa8ab e7331600bf Add sending email on failed Simplex and Signal 2026-07-11 03:32:35 +03:30
sa8ab 32d0873aeb Merge pull request #138 from sa8ab/links-update
Update github link to full link
2026-07-10 18:28:39 +03:30
sa8ab 66b916d8b1 Update github link to full link 2026-07-10 18:28:06 +03:30
sa8ab aeefc7c69e Use version of SImplex instead of latest 2026-07-09 01:06:06 +03:30
sa8ab 59fd5bba53 Merge pull request #134 from waozixyz/master
Add PeerTube live stream support
2026-07-04 15:40:41 +03:30
26 changed files with 509 additions and 26 deletions

No files matched your search

@@ -0,0 +1,25 @@
<script setup lang="ts">
import type { LiveStream } from "~/types";
const props = defineProps<{
liveStream?: LiveStream;
}>();
const channel = computed(
() => props.liveStream?.channelName || props.liveStream?.videoId,
);
const iframeUrl = computed(() => {
if (!channel.value) return;
return `https://player.kick.com/${channel.value}`;
});
</script>
<template>
<iframe
v-if="iframeUrl"
:src="iframeUrl"
allowfullscreen
class="w-full aspect-[16/9] rounded-md"
></iframe>
</template>
@@ -18,6 +18,10 @@ const type = computed(() => props.liveStream?.platform);
v-if="type === LiveStreamPlatformEnum.TWITCH"
:liveStream="liveStream"
/>
<LiveStreamKick
v-if="type === LiveStreamPlatformEnum.KICK"
:liveStream="liveStream"
/>
<LiveStreamRumble
v-if="type === LiveStreamPlatformEnum.RUMBLE"
:liveStream="liveStream"
+23 -2
View File
@@ -186,8 +186,24 @@ export const useConstants = () => {
colorClassName: "",
iconClassName: "",
icon: "i-tabler-brand-github",
inputLabel: t("xUsername", { platform: "GitHub" }),
linkCreator: (v?: string) => `https://github.com/${v}`,
inputLabel: "GitHub link (enter full URL)",
linkCreator: (v?: string) => `${v}`,
},
[ContentLinkPlatformEnum.GITLAB]: {
name: "GitLab",
colorClassName: "text-[#FC6D26]",
iconClassName: "",
icon: "i-tabler-brand-gitlab",
inputLabel: "GitLab link (enter full URL)",
linkCreator: (v?: string) => `${v}`,
},
[ContentLinkPlatformEnum.MATRIX]: {
name: "Matrix",
colorClassName: "",
iconClassName: "",
icon: "i-simple-icons-matrix",
inputLabel: "Matrix ID (for example @user:matrix.org)",
linkCreator: (v?: string) => `https://matrix.to/#/${v}`,
},
[ContentLinkPlatformEnum.MONERO_JOBS]: {
name: "Monero Jobs",
@@ -327,6 +343,11 @@ export const useConstants = () => {
icon: "i-tabler-brand-twitch",
colorClassName: "text-[#6441a5]",
},
[LiveStreamPlatformEnum.KICK]: {
name: "Kick",
icon: "i-tabler-brand-kick",
colorClassName: "text-[#53FC19]",
},
[LiveStreamPlatformEnum.X]: {
name: "X",
icon: "i-tabler-brand-x",
@@ -18,6 +18,12 @@ export const useLiveStreamPlayer = (
)
);
const kick = computed(() =>
streams.value?.find(
(stream) => stream.platform === LiveStreamPlatformEnum.KICK
)
);
const rumble = computed(() =>
streams.value?.find(
(stream) => stream.platform === LiveStreamPlatformEnum.RUMBLE
@@ -37,6 +43,7 @@ export const useLiveStreamPlayer = (
const liveStreamComputed = computed(() => {
if (twitch.value) return twitch.value;
if (kick.value) return kick.value;
if (peertube.value) return peertube.value;
if (youtube.value) return youtube.value;
if (rumble.value) return rumble.value;
+12
View File
@@ -132,6 +132,17 @@ export const useValidations = (generalV?: Ref<Validation>) => {
notStartingWithAtBase
);
const matrixIdBase = (v: any) => {
if (!v) return true;
if (typeof v !== "string") return false;
return /^@[^\s:]+:[^\s:]+$/.test(v.trim());
};
const matrixId = helpers.withMessage(
"Enter a Matrix ID like @user:matrix.org.",
matrixIdBase
);
const getValidationAttrs = (path: string, v?: MaybeRef<Validation>) => {
v = unref(v || generalV);
const instance = getProperty(v, path);
@@ -172,6 +183,7 @@ export const useValidations = (generalV?: Ref<Validation>) => {
moneroPrimaryAddress,
rumbleApiUrl,
notStartingWithAt,
matrixId,
getValidationAttrs,
validate,
};
+1 -1
View File
@@ -322,7 +322,7 @@ export default {
kunoFundraiser: "Kuno fundraiser",
rumbleLiveStreamApi: "Rumble live stream API",
rumbleLiveStreamApiHelp:
"Rumble live stream API from {guide}. XMRChat uses this URL for getting current live streams of your channel.",
"Rumble live stream API from {guide}. XMRChat uses this URL to feature your livestream on our homepage.",
thisGuide: "this guide",
// OBS
+10 -1
View File
@@ -18,7 +18,8 @@ interface State {
}
const { getMyLinks: getMyLinksReq, updateLinks } = useServices();
const { url, notUrl, rumbleApiUrl, notStartingWithAt } = useValidations();
const { url, notUrl, rumbleApiUrl, notStartingWithAt, matrixId } =
useValidations();
const toast = useToast();
const { getContentLink } = useConstants();
const { t } = useI18n();
@@ -67,6 +68,8 @@ const state = reactive<State>({
patreon: {},
subscribestar: {},
github: {},
gitlab: {},
matrix: {},
"monero-jobs": {},
facebook: {},
},
@@ -114,6 +117,9 @@ const rules = computed(() => {
DISCORD,
PATREON,
SUBSCRIBESTAR,
GITHUB,
GITLAB,
MATRIX,
MONERO_JOBS,
...rest
} = ContentLinkPlatformEnum;
@@ -141,6 +147,9 @@ const rules = computed(() => {
[DISCORD]: { value: { url } },
[PATREON]: { value: { url } },
[SUBSCRIBESTAR]: { value: { url } },
[GITHUB]: { value: { url } },
[GITLAB]: { value: { url } },
[MATRIX]: { value: { matrixId } },
[MONERO_JOBS]: { value: { url } },
...notUrls,
},
+3
View File
@@ -44,6 +44,8 @@ export enum ContentLinkPlatformEnum {
PATREON = "patreon",
SUBSCRIBESTAR = "subscribestar",
GITHUB = "github",
GITLAB = "gitlab",
MATRIX = "matrix",
MONERO_JOBS = "monero-jobs",
FACEBOOK = "facebook",
}
@@ -109,6 +111,7 @@ export enum PageRecipientVariant {
export enum LiveStreamPlatformEnum {
YOUTUBE = "youtube",
TWITCH = "twitch",
KICK = "kick",
X = "x",
RUMBLE = "rumble",
PEERTUBE = "peertube",
+3 -1
View File
@@ -13,7 +13,6 @@ export const CONTENT_LINKS_LIST = [
ContentLinkPlatformEnum.INSTAGRAM,
ContentLinkPlatformEnum.WEBSITE,
ContentLinkPlatformEnum.YOUTUBE,
ContentLinkPlatformEnum.RUMBLE,
ContentLinkPlatformEnum.TWITCH,
ContentLinkPlatformEnum.TIKTOK,
ContentLinkPlatformEnum.ODYSEE,
@@ -27,8 +26,11 @@ export const CONTENT_LINKS_LIST = [
ContentLinkPlatformEnum.PATREON,
ContentLinkPlatformEnum.SUBSCRIBESTAR,
ContentLinkPlatformEnum.GITHUB,
ContentLinkPlatformEnum.GITLAB,
ContentLinkPlatformEnum.MATRIX,
ContentLinkPlatformEnum.MONERO_JOBS,
ContentLinkPlatformEnum.FACEBOOK,
ContentLinkPlatformEnum.RUMBLE,
];
export const SWAP_STATUSES = {
+7 -1
View File
@@ -49,6 +49,9 @@ ADMIN_MONERO_PRIVATE_VIEW_KEY=
# Page report emails separated by space
PAGE_REPORT_RECEPIENTS=[email protected] [email protected]
# Failed report emails separated by space
FAILED_REPORT_RECEPIENTS=[email protected] [email protected]
# LWS_WEBHOOK_URL=http://localhost:3000/lws/webhooks
# LWS calls this url for sending the transaction info.
@@ -71,6 +74,9 @@ TWITCH_IMPLICIT_FLOW_ACCESS_TOKEN= # Token generated from implicit flow, example
TWITCH_CLIENT_ID= # Client id of the application created on twitch
TWITCH_CLIENT_SECRET= # Client secret of the application created on twitch
KICK_CLIENT_ID= # Client id of the application created on Kick
KICK_CLIENT_SECRET= # Client secret of the application created on Kick
TWITTER_BEARER_TOKEN= # Bearer token from X developers
@@ -114,4 +120,4 @@ MAX_COHOSTS=5
TEST_TIP=false
# Page paths that are used for testing separated by space
TEST_PAGE_PATHS=
TEST_PAGE_PATHS=
+5 -5
View File
@@ -2,14 +2,14 @@ FROM ubuntu:22.04
# 1) Install curl, bash, ca-certificates, and expect
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl bash ca-certificates expect socat && \
rm -rf /var/lib/apt/lists/*
apt-get install -y --no-install-recommends \
curl bash ca-certificates expect socat && \
rm -rf /var/lib/apt/lists/*
# Download simplex-chat binary directly
RUN curl -L -o /usr/local/bin/simplex-chat \
"https://github.com/simplex-chat/simplex-chat/releases/latest/download/simplex-chat-ubuntu-22_04-x86_64" && \
chmod +x /usr/local/bin/simplex-chat
"https://github.com/simplex-chat/simplex-chat/releases/download/v6.4.5/simplex-chat-ubuntu-22_04-x86_64" && \
chmod +x /usr/local/bin/simplex-chat
# Copy setup script to container
COPY entrypoint.sh /entrypoint.sh
@@ -3,6 +3,7 @@ import { Command, CommandRunner } from 'nest-commander';
import { TwitchTokenService } from 'src/integrations/twitch/twitch-token.service';
import { LinkVerificationsService } from 'src/link-verifications/link-verifications.service';
import { LiveStreamsService } from 'src/live-streams/live-streams.service';
import { NotificationTestsService } from 'src/notifications/notification-tests.service';
@Command({
name: 'config',
@@ -16,6 +17,7 @@ export class ConfigCommand extends CommandRunner {
private twitchTokenService: TwitchTokenService,
private liveStreamsService: LiveStreamsService,
private linkVerificationsService: LinkVerificationsService,
private notificationTestsService: NotificationTestsService,
) {
super();
}
@@ -53,6 +55,11 @@ export class ConfigCommand extends CommandRunner {
return;
}
if (config === 'test-simplex') {
await this.testSimplex();
return;
}
this.logger.error(`Parameter is invalid: ${config}`);
}
@@ -86,4 +93,9 @@ export class ConfigCommand extends CommandRunner {
this.logger.log('validating link verifications');
await this.linkVerificationsService.validateAll();
}
async testSimplex() {
this.logger.log('Testing Simplex');
await this.notificationTestsService.testSimplex();
}
}
@@ -0,0 +1,99 @@
import { HttpService } from '@nestjs/axios';
import { CACHE_MANAGER } from '@nestjs/cache-manager';
import {
Inject,
Injectable,
InternalServerErrorException,
Logger,
OnModuleInit,
} from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { Cron, CronExpression } from '@nestjs/schedule';
import { Cache } from 'cache-manager';
import { getAxiosMessage, getErrorMessage } from 'src/shared/utils/errors';
@Injectable()
export class KickTokenService implements OnModuleInit {
private logger = new Logger(KickTokenService.name);
constructor(
private readonly httpService: HttpService,
private readonly configService: ConfigService,
@Inject(CACHE_MANAGER) private cacheManager: Cache,
) {}
async onModuleInit() {
try {
await this.getClientToken();
} catch (error) {
this.logger.error(`On module init: ${getErrorMessage(error)}`);
}
}
async getClientToken() {
const token = await this.getCachedToken();
if (token) return token;
return this.getAndSaveClientToken();
}
async getAndSaveClientToken() {
const clientId = this.configService.get('KICK_CLIENT_ID');
const clientSecret = this.configService.get('KICK_CLIENT_SECRET');
if (!clientId || !clientSecret) {
this.logger.warn(
'KICK_CLIENT_ID or KICK_CLIENT_SECRET are not set. Kick client credentials token can not be generated.',
);
return null;
}
try {
const { data } = await this.httpService.axiosRef.post<{
access_token: string;
expires_in?: number;
}>('https://id.kick.com/oauth/token', {
client_id: clientId,
client_secret: clientSecret,
grant_type: 'client_credentials',
}, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
await this.saveToken(data.access_token, data.expires_in);
return data.access_token;
} catch (error) {
throw new InternalServerErrorException(
`Failed to get kick client credentials token: ${getAxiosMessage(error)}`,
);
}
}
async getCachedToken() {
return this.cacheManager.get<string | null>(
'kick-client-credentials-token',
);
}
async saveToken(token: string, expiresIn?: number) {
const ttl = Math.max((expiresIn || 3600) - 60, 60);
return await this.cacheManager.set('kick-client-credentials-token', token, {
ttl,
} as any);
}
@Cron(CronExpression.EVERY_30_MINUTES)
async refreshToken() {
try {
await this.getAndSaveClientToken();
} catch (error) {
this.logger.error('Failed to refresh kick client credentials token');
}
}
}
@@ -0,0 +1,11 @@
import { HttpModule } from '@nestjs/axios';
import { Module } from '@nestjs/common';
import { KickService } from './kick.service';
import { KickTokenService } from './kick-token.service';
@Module({
imports: [HttpModule.register({})],
providers: [KickService, KickTokenService],
exports: [KickService, KickTokenService],
})
export class KickModule {}
@@ -0,0 +1,89 @@
import { HttpService } from '@nestjs/axios';
import { Injectable, InternalServerErrorException } from '@nestjs/common';
import { getAxiosMessage } from 'src/shared/utils/errors';
import { KickTokenService } from './kick-token.service';
export interface KickChannel {
broadcaster_user_id?: number;
slug?: string;
}
export interface KickLivestream {
broadcaster_user_id?: number;
channel_id?: number;
slug?: string;
started_at?: string;
stream_title?: string;
thumbnail?: string;
viewer_count?: number;
}
@Injectable()
export class KickService {
constructor(
private readonly httpService: HttpService,
private readonly kickTokenService: KickTokenService,
) {}
async getChannelsBySlug(slugs: string[]) {
const uniqueSlugs = [...new Set(slugs.filter(Boolean))].slice(0, 50);
if (!uniqueSlugs.length) return [];
const accessToken = await this.kickTokenService.getClientToken();
if (!accessToken) return [];
try {
const { data } = await this.httpService.axiosRef.get<{
data?: KickChannel[];
}>('https://api.kick.com/public/v1/channels', {
headers: {
Authorization: `Bearer ${accessToken}`,
},
params: {
slug: uniqueSlugs,
},
paramsSerializer: {
indexes: null,
},
});
return data.data || [];
} catch (error) {
throw new InternalServerErrorException(
`Failed to get channels from Kick: ${getAxiosMessage(error)}`,
);
}
}
async getLivestreamsByBroadcasterIds(broadcasterIds: number[]) {
const uniqueIds = [
...new Set(broadcasterIds.filter((id): id is number => Boolean(id))),
].slice(0, 50);
if (!uniqueIds.length) return [];
const accessToken = await this.kickTokenService.getClientToken();
if (!accessToken) return [];
try {
const { data } = await this.httpService.axiosRef.get<{
data?: KickLivestream[];
}>('https://api.kick.com/public/v1/livestreams', {
headers: {
Authorization: `Bearer ${accessToken}`,
},
params: {
broadcaster_user_id: uniqueIds,
},
paramsSerializer: {
indexes: null,
},
});
return data.data || [];
} catch (error) {
throw new InternalServerErrorException(
`Failed to get live streams from Kick: ${getAxiosMessage(error)}`,
);
}
}
}
@@ -74,8 +74,7 @@ export class SimplexService implements IIntegrationVerifier {
this.chat.enableAddressAutoAccept();
} catch (error) {
console.log('Init error:', error.response);
console.log(error);
this.logger.error('SimpleX init failed', error);
}
}
@@ -16,11 +16,14 @@ import { RumbleProvider } from './providers/rumble.provider';
import { QueuesModule } from 'src/queues/queues.module';
import { PeertubeModule } from 'src/integrations/peertube/peertube.module';
import { PeertubeProvider } from './providers/peertube.provider';
import { KickModule } from 'src/integrations/kick/kick.module';
import { KickProvider } from './providers/kick.provider';
@Module({
imports: [
YoutubeModule,
TwitchModule,
KickModule,
RumbleModule,
PeertubeModule,
LinksModule,
@@ -32,6 +35,7 @@ import { PeertubeProvider } from './providers/peertube.provider';
LiveStreamsService,
YoutubeProvider,
TwitchProvider,
KickProvider,
RumbleProvider,
PeertubeProvider,
LiveStreamProcessor,
@@ -19,6 +19,7 @@ import { RumbleProvider } from './providers/rumble.provider';
import { Link } from 'src/links/link.entity';
import { Tip } from 'src/tips/tip.entity';
import { PeertubeProvider } from './providers/peertube.provider';
import { KickProvider } from './providers/kick.provider';
@Injectable()
export class LiveStreamsService implements OnModuleInit {
@@ -28,6 +29,7 @@ export class LiveStreamsService implements OnModuleInit {
private linksService: LinksService,
private youtubeProvider: YoutubeProvider,
private twitchProvider: TwitchProvider,
private kickProvider: KickProvider,
private rumbleProvider: RumbleProvider,
private peertubeProvider: PeertubeProvider,
private config: ConfigService,
@@ -46,23 +48,29 @@ export class LiveStreamsService implements OnModuleInit {
}
async findAll() {
return this.repo
const streams = await this.repo
.createQueryBuilder('liveStream')
.leftJoinAndSelect('liveStream.page', 'page')
.leftJoinAndSelect('page.logo', 'logo')
.distinctOn(['page.id'])
.orderBy('page.id', 'ASC')
.addOrderBy('liveStream.startedAt', 'DESC', 'NULLS LAST')
.addOrderBy(
`CASE
WHEN liveStream.platform = '${LiveStreamPlatformEnum.TWITCH}' THEN 1
WHEN liveStream.platform = '${LiveStreamPlatformEnum.PEERTUBE}' THEN 2
WHEN liveStream.platform = '${LiveStreamPlatformEnum.YOUTUBE}' THEN 3
WHEN liveStream.platform = '${LiveStreamPlatformEnum.RUMBLE}' THEN 4
ELSE 5
WHEN liveStream.platform = '${LiveStreamPlatformEnum.KICK}' THEN 2
WHEN liveStream.platform = '${LiveStreamPlatformEnum.PEERTUBE}' THEN 3
WHEN liveStream.platform = '${LiveStreamPlatformEnum.YOUTUBE}' THEN 4
WHEN liveStream.platform = '${LiveStreamPlatformEnum.RUMBLE}' THEN 5
ELSE 6
END`,
'ASC',
)
.getMany();
return streams.sort((a, b) => {
return (b.startedAt?.getTime() || 0) - (a.startedAt?.getTime() || 0);
});
}
async updateLiveStreams(dto: CreateLiveStreamDto[]) {
@@ -94,12 +102,14 @@ export class LiveStreamsService implements OnModuleInit {
async getAndUpdateLiveStreams() {
const youtube = await this.getYoutubeLiveStreams();
const twitch = await this.getTwitchLiveStreams();
const kick = await this.getKickLiveStreams();
const rumble = await this.getRumbleLiveStreams();
const peertube = await this.getPeertubeLiveStreams();
await this.updateLiveStreams([
...youtube,
...twitch,
...kick,
...rumble,
...peertube,
]);
@@ -144,6 +154,19 @@ export class LiveStreamsService implements OnModuleInit {
return this.twitchProvider.getLiveStreams(params);
}
async getKickLiveStreams() {
const links = await this.linksService.findByPlatform(LinkPlatformEnum.KICK);
const params = links.map((link) => ({
username: link.value,
pageId: link.page.id,
}));
const streams = await this.kickProvider.getLiveStreams(params);
return streams;
}
async getYoutubeLiveStreams() {
const query = this.linkRepo
.createQueryBuilder('link')
@@ -0,0 +1,89 @@
import { Injectable, Logger } from '@nestjs/common';
import {
KickChannel,
KickLivestream,
KickService,
} from 'src/integrations/kick/kick.service';
import { LiveStreamPlatformEnum } from 'src/shared/constants';
import { getErrorMessage } from 'src/shared/utils/errors';
import { CreateLiveStreamDto } from '../dtos/create-live-stream.dto';
import {
LiveStreamProvider,
LiveStreamProviderParams,
} from './live-stream-provider.interface';
type KickProviderParam = LiveStreamProviderParams & { username: string };
@Injectable()
export class KickProvider implements LiveStreamProvider {
private logger = new Logger(KickProvider.name);
constructor(private readonly kickService: KickService) {}
async getLiveStreams(
params: LiveStreamProviderParams[],
): Promise<CreateLiveStreamDto[]> {
if (!params.length) return [];
const pageParams = params.filter(
(param): param is KickProviderParam => Boolean(param.username),
);
if (!pageParams.length) return [];
try {
const channels = await this.kickService.getChannelsBySlug(
pageParams.map((param) => param.username),
);
const streams = await this.kickService.getLivestreamsByBroadcasterIds(
channels.map((channel) => channel.broadcaster_user_id).filter(Boolean),
);
return pageParams
.map((param) => {
const channel = this.findChannel(channels, param.username);
const stream = streams.find(
(stream) =>
stream.broadcaster_user_id === channel?.broadcaster_user_id,
);
if (!channel || !stream) return;
return this.toLiveStreamDto(stream, channel, param.pageId);
})
.filter((stream): stream is CreateLiveStreamDto => Boolean(stream));
} catch (error) {
this.logger.error(
`Failed to get live streams from Kick: ${getErrorMessage(error)}`,
);
}
return [];
}
private findChannel(channels: KickChannel[], slug: string) {
return channels.find(
(channel) => channel.slug?.toLowerCase() === slug.toLowerCase(),
);
}
private toLiveStreamDto(
stream: KickLivestream,
channel: KickChannel,
pageId: number,
): CreateLiveStreamDto {
const slug = stream.slug || channel.slug;
return {
title: stream.stream_title,
channelId: String(stream.channel_id || stream.broadcaster_user_id),
channelName: slug,
imageUrl: stream.thumbnail,
platform: LiveStreamPlatformEnum.KICK,
viewerCount: stream.viewer_count,
videoId: slug,
startedAt: stream.started_at,
pageId,
};
}
}
@@ -0,0 +1,28 @@
import { InjectQueue } from '@nestjs/bullmq';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { Job, Queue } from 'bullmq';
@Injectable()
export class NotificationFailureService {
constructor(
@InjectQueue('notifications-email') private emailQueue: Queue,
private configService: ConfigService,
) {}
async sendFailureNotification(job: Job, error: Error, provider: string) {
const emails =
this.configService.get('FAILED_REPORT_RECEPIENTS') ||
this.configService.get('PAGE_REPORT_RECEPIENTS');
const emailList = emails.split(' ') || [];
if (!emailList.length) return;
await this.emailQueue.add('send-email', {
to: emailList,
options: {
subject: `${provider} failed to send`,
html: `${provider} failed to send. ${JSON.stringify(job.data)}, Error: ${error.message}`,
},
});
}
}
@@ -20,4 +20,11 @@ export class NotificationTestsService {
message: 'Test message for signal',
});
}
async testSimplex() {
await this.simplexQueue.add('send-message', {
contactId: 1,
message: 'Test message for simplex',
});
}
}
@@ -2,9 +2,11 @@ import { Module } from '@nestjs/common';
import { SignalService } from './signal.service';
import { SignalModule as SignalIntegrationModule } from 'src/integrations/signal/signal.module';
import { SignalProcessor } from './signal.processor';
import { NotificationFailureService } from '../notification-failure.service';
import { QueuesModule } from 'src/queues/queues.module';
@Module({
imports: [SignalIntegrationModule],
providers: [SignalService, SignalProcessor],
imports: [SignalIntegrationModule, QueuesModule],
providers: [SignalService, SignalProcessor, NotificationFailureService],
})
export class SignalModule {}
@@ -1,10 +1,14 @@
import { Processor, WorkerHost } from '@nestjs/bullmq';
import { OnWorkerEvent, Processor, WorkerHost } from '@nestjs/bullmq';
import { SignalService } from './signal.service';
import { Job } from 'bullmq';
import { NotificationFailureService } from '../notification-failure.service';
@Processor('notifications-signal')
export class SignalProcessor extends WorkerHost {
constructor(private readonly signalService: SignalService) {
constructor(
private readonly signalService: SignalService,
private readonly notificationFailureService: NotificationFailureService,
) {
super();
}
@@ -15,4 +19,13 @@ export class SignalProcessor extends WorkerHost {
await this.signalService.sendMessage(data.account, data.message);
}
}
@OnWorkerEvent('failed')
async handleError(job: Job, error: Error) {
await this.notificationFailureService.sendFailureNotification(
job,
error,
'Signal',
);
}
}
@@ -2,9 +2,11 @@ import { Module } from '@nestjs/common';
import { SimplexService } from './simplex.service';
import { SimplexModule as SimplexIntegrationModule } from 'src/integrations/simplex/simplex.module';
import { SimplexProcessor } from './simplex.processor';
import { NotificationFailureService } from '../notification-failure.service';
import { QueuesModule } from 'src/queues/queues.module';
@Module({
imports: [SimplexIntegrationModule],
providers: [SimplexService, SimplexProcessor],
imports: [SimplexIntegrationModule, QueuesModule],
providers: [SimplexService, SimplexProcessor, NotificationFailureService],
})
export class SimplexModule {}
@@ -1,10 +1,14 @@
import { Processor, WorkerHost } from '@nestjs/bullmq';
import { OnWorkerEvent, Processor, WorkerHost } from '@nestjs/bullmq';
import { SimplexService } from './simplex.service';
import { Job } from 'bullmq';
import { NotificationFailureService } from '../notification-failure.service';
@Processor('notifications-simplex')
export class SimplexProcessor extends WorkerHost {
constructor(private readonly simplexService: SimplexService) {
constructor(
private readonly simplexService: SimplexService,
private readonly notificationFailureService: NotificationFailureService,
) {
super();
}
@@ -15,4 +19,13 @@ export class SimplexProcessor extends WorkerHost {
await this.simplexService.sendMessage(data.contactId, data.message);
}
}
@OnWorkerEvent('failed')
async handleError(job: Job, error: Error) {
await this.notificationFailureService.sendFailureNotification(
job,
error,
'Simplex',
);
}
}
+3
View File
@@ -81,6 +81,8 @@ export enum LinkPlatformEnum {
PATREON = 'patreon',
SUBSCRIBESTAR = 'subscribestar',
GITHUB = 'github',
GITLAB = 'gitlab',
MATRIX = 'matrix',
MONERO_JOBS = 'monero-jobs',
FACEBOOK = 'facebook',
}
@@ -170,6 +172,7 @@ export enum PageRecipientVariant {
export enum LiveStreamPlatformEnum {
YOUTUBE = 'youtube',
TWITCH = 'twitch',
KICK = 'kick',
X = 'x',
RUMBLE = 'rumble',
PEERTUBE = 'peertube',