mirror of
https://github.com/Wolvan/poll.horse.git
synced 2024-11-25 14:08:01 +01:00
Remove vote API
This could easily be used to rig votes and doesn't really make sense.
This commit is contained in:
parent
9e8a93a449
commit
6a155f2eb4
1 changed files with 0 additions and 24 deletions
|
@ -208,30 +208,6 @@ export default async function init(router: Router, polls: Storage): Promise<void
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
router.post("/vote/:id", async (req, res) => {
|
|
||||||
try {
|
|
||||||
const id = req.params.id;
|
|
||||||
|
|
||||||
const error = await voteOnPoll(id, req.body.votes, {
|
|
||||||
ip: req.headers["x-forwarded-for"] as string || req.socket.remoteAddress || "",
|
|
||||||
setCookie: res.cookie.bind(res),
|
|
||||||
cookies: req.cookies
|
|
||||||
});
|
|
||||||
|
|
||||||
if (error) res.status(error.statusCode).json({
|
|
||||||
error: error.error
|
|
||||||
});
|
|
||||||
else res.json({ status: "ok", id });
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
if (error instanceof Error) res.status(500).json({
|
|
||||||
error: error.message
|
|
||||||
});
|
|
||||||
else res.status(500).json({
|
|
||||||
error: error
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
router.post("/vote-form/:id", async (req, res) => {
|
router.post("/vote-form/:id", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const id = req.params.id;
|
const id = req.params.id;
|
||||||
|
|
Loading…
Reference in a new issue