pd blacklist

This commit is contained in:
MeowcaTheoRange 2024-08-30 01:13:00 -05:00
parent 1aa8d7b9d1
commit 98d3e0a2c2
2 changed files with 22 additions and 0 deletions

View file

@ -19,6 +19,7 @@ const db = new Kysely({
}); });
rawDB.exec(`CREATE TABLE IF NOT EXISTS blurbs( 'id' TEXT, 'site' TEXT, 'blurb' TEXT, 'verified' INTEGER, 'time' INTEGER );`); rawDB.exec(`CREATE TABLE IF NOT EXISTS blurbs( 'id' TEXT, 'site' TEXT, 'blurb' TEXT, 'verified' INTEGER, 'time' INTEGER );`);
rawDB.exec(`CREATE TABLE IF NOT EXISTS blacklist( 'domain' TEXT );`);
const app = express(); const app = express();
@ -141,6 +142,26 @@ app.get('/blurbs/send', async (req, res) => {
message: errors.join(", ") message: errors.join(", ")
}); });
try {
const domain = new URL(body.site).hostname;
const isBadSite = await db
.selectFrom('blacklist')
.selectAll()
.where('domain', '=', domain)
.executeTakeFirst();
if (isBadSite != null)
return res.status(403).json({
error: "Forbidden",
message: "\u{1f595}"
});
} catch (err) {
return res.status(500).json({
error: "Internal Server Error",
message: "URL CONSTRUCTOR FAILED???? i think this might be your fault...."
});
}
const postId = nanoid(32); const postId = nanoid(32);
try { try {

View file

@ -20,6 +20,7 @@
</p> </p>
<p style="opacity: 0.5;">by clicking this button and successfully submitting a blurb, you agree that your input may be displayed on this site and stored on abtmtr.link servers.</p> <p style="opacity: 0.5;">by clicking this button and successfully submitting a blurb, you agree that your input may be displayed on this site and stored on abtmtr.link servers.</p>
<p style="opacity: 0.5;">you'll also need to verify your blurb by leaving a X/HTML snippet on your site. further instructions will be given to do this after you submit your blurb. thanks!</p> <p style="opacity: 0.5;">you'll also need to verify your blurb by leaving a X/HTML snippet on your site. further instructions will be given to do this after you submit your blurb. thanks!</p>
<p style="opacity: 0.5;">rules: no slurs, no politics, no nsfw, no spam. if you break these rules outside of plausible deniability, your domain will be blacklisted.</p>
</form> </form>
<h2>current blurbs (<%= data.length %>)</h2> <h2>current blurbs (<%= data.length %>)</h2>
<ul> <ul>