comment out auto_publish code

This commit is contained in:
Omer Sabic 2024-08-26 20:37:23 +02:00
parent 1f10d5fc95
commit 647d6fc6cb

View File

@ -433,20 +433,20 @@ export const dashboardRoutes = (fastify, _, done) => {
});
}
if (site.auto_publish !== req.body.auto_publish) {
const [user] = await db.select().from(users).where(eq(users.id, req.session.user_id));
if (!user) throw new Error("Problem getting user");
let form = new FormData();
form.set("hub.callback", env.PUBLIC_API_URL + "/webhooks/youtube");
form.set("hub.topic", "https://www.youtube.com/xml/feeds/videos.xml?channel_id=" + user.channel_id);
form.set("hub.verify", "async");
form.set("hub.mode", req.body.auto_publish ? "subscribe" : "unsubscribe");
form.set("hub.verify_token", websubVerifyToken);
await fetch("https://pubsubhubbub.appspot.com/subscribe", {
method: "POST",
body: form
});
}
// if (site.auto_publish !== req.body.auto_publish) {
// const [user] = await db.select().from(users).where(eq(users.id, req.session.user_id));
// if (!user) throw new Error("Problem getting user");
// let form = new FormData();
// form.set("hub.callback", env.PUBLIC_API_URL + "/webhooks/youtube");
// form.set("hub.topic", "https://www.youtube.com/xml/feeds/videos.xml?channel_id=" + user.channel_id);
// form.set("hub.verify", "async");
// form.set("hub.mode", req.body.auto_publish ? "subscribe" : "unsubscribe");
// form.set("hub.verify_token", websubVerifyToken);
// await fetch("https://pubsubhubbub.appspot.com/subscribe", {
// method: "POST",
// body: form
// });
// }
const data = structuredClone(req.body);