separation of concerns

This commit is contained in:
2025-07-07 18:26:09 +00:00
parent 71ae54930c
commit 57ab59d342
2 changed files with 16 additions and 11 deletions

View File

@ -2,7 +2,6 @@ import striptags from "striptags";
import { prisma } from "./main.js";
import { envConfig } from "./main.js";
import { Notification } from "../types.js";
import { deleteNotification } from "./api.js";
const trimInputData = (input: string): string => {
const strippedInput = striptags(input);
@ -26,9 +25,7 @@ const recordPendingResponse = async (notification: Notification) => {
}
};
const isFromWhitelistedDomain = async (
notification: Notification
): Promise<boolean> => {
const isFromWhitelistedDomain = (notification: Notification): boolean => {
try {
const domain = notification.status.account.fqn.split("@")[1];
if (envConfig.whitelistedDomains.includes(domain)) {
@ -37,8 +34,6 @@ const isFromWhitelistedDomain = async (
console.log(
`Rejecting prompt request from non-whitelisted domain: ${domain}`
);
// delete the notification so we don't keep trying to fetch it
await deleteNotification(notification);
return false;
} catch (error: any) {
console.error(`Error with domain check: ${error.message}`);