Added feature for "sendToZulip", fixed visual issue, .gitignore for db dump files

This commit is contained in:
Koper
2023-12-05 20:17:25 +07:00
parent 702dd5968b
commit 9df6ab4429
8 changed files with 28 additions and 12 deletions

View File

@@ -1,15 +1,19 @@
import axios from "axios";
import { URLSearchParams } from "url";
import { featureEnabled } from "../../app/[domain]/domainContext";
export default async function handler(req, res) {
if (req.method === "POST") {
const { stream, topic, message } = req.body;
console.log("Sending zulip message", stream, topic);
if (!stream || !topic || !message) {
return res.status(400).json({ error: "Missing required parameters" });
}
if (!featureEnabled("sendToZulip")) {
return res.status(403).json({ error: "Zulip integration disabled" });
}
try {
// Construct URL-encoded data
const params = new URLSearchParams();