5 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
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
16 changed files with 142 additions and 14 deletions

No files matched your search

+18 -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",
+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,
},
+2
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",
}
+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 = {
+3
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.
@@ -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();
}
}
@@ -48,12 +48,13 @@ 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
@@ -66,6 +67,10 @@ export class LiveStreamsService implements OnModuleInit {
'ASC',
)
.getMany();
return streams.sort((a, b) => {
return (b.startedAt?.getTime() || 0) - (a.startedAt?.getTime() || 0);
});
}
async updateLiveStreams(dto: CreateLiveStreamDto[]) {
@@ -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',
);
}
}
+2
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',
}