mirror of
https://github.com/System-End/slack-end.git
synced 2026-04-19 18:35:19 +00:00
Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
commit
c211684f9c
1 changed files with 17 additions and 14 deletions
|
|
@ -103,8 +103,8 @@ export const app = new App({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "/project-feed-journey.xml",
|
path: "/project-feed-journey.xml",
|
||||||
"method": ["GET"],
|
method: ["GET"],
|
||||||
async handler(req, res) {
|
async handler(req, res) {
|
||||||
// get ID query
|
// get ID query
|
||||||
const query = new URLSearchParams(req.url.split("?")[1]);
|
const query = new URLSearchParams(req.url.split("?")[1]);
|
||||||
|
|
@ -112,35 +112,38 @@ export const app = new App({
|
||||||
if (!id) return res.writeHead(400).end(`I cant find that project`);
|
if (!id) return res.writeHead(400).end(`I cant find that project`);
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const entry = app.dbs.journey.get(id);
|
const entry = app.dbs.journey.get(id);
|
||||||
if (!entry) return res.writeHead(400).end(`I cant find that project - db`);
|
if (!entry)
|
||||||
|
return res.writeHead(400).end(`I cant find that project - db`);
|
||||||
const rss = new RSS({
|
const rss = new RSS({
|
||||||
title: `Journey for ${id}`,
|
title: `Journey for ${id}`,
|
||||||
site_url: `https://journey.hackclub.com/projects/${id}`,
|
site_url: `https://journey.hackclub.com/projects/${id}`,
|
||||||
feed_url: `https://slack.mybot.saahild.com/project-feed-journey.xml?id=${id}`,
|
feed_url: `https://slack.mybot.saahild.com/project-feed-journey.xml?id=${id}`,
|
||||||
description: `Journey for ${id}`,
|
description: `Journey for ${id}`,
|
||||||
});
|
});
|
||||||
const updates = entry.updates
|
const updates = entry.updates;
|
||||||
for (const m of updates) {
|
for (const m of updates) {
|
||||||
const meta = m.meta as Update
|
const meta = m.meta as Update;
|
||||||
rss.item({
|
rss.item({
|
||||||
title: m.text,
|
title: m.text,
|
||||||
// description: m.text,
|
// description: m.text,
|
||||||
link: `https://journey.hackclub.com/projects/${id}`,
|
link: `https://journey.hackclub.com/projects/${id}`,
|
||||||
guid: m.ts,
|
guid: m.ts,
|
||||||
author: meta.slack_id,
|
author: meta.slack_id,
|
||||||
enclosure: meta.attachment ? {
|
enclosure: meta.attachment
|
||||||
url: meta.attachment,
|
? {
|
||||||
type: "image/png",
|
url: meta.attachment,
|
||||||
} : undefined,
|
type: "image/png",
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
date: new Date(m.meta.created_at),
|
date: new Date(m.meta.created_at),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
res
|
res
|
||||||
.writeHead(200, {
|
.writeHead(200, {
|
||||||
"Content-Type": "text/xml",
|
"Content-Type": "text/xml",
|
||||||
})
|
})
|
||||||
.end(rss.xml({ indent: true }));
|
.end(rss.xml({ indent: true }));
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/happenings.xml",
|
path: "/happenings.xml",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue