···3737 return <li>{el.message}</li>;
3838 })}
3939 </ul>
4040- </div>, 400);
4040+ </div>);
4141 } catch {
4242- return c.html(<div class="validation-error btn-error"><b>Internal Error</b>: Please try again</div>, 400);
4242+ return c.html(<div class="validation-error btn-error"><b>Internal Error</b>: Please try again</div>);
4343 }
4444}
4545···107107 c.header("HX-Trigger-After-Swap", "accountViolations");
108108 return c.html(<></>, 200);
109109 }
110110- return c.html(<b class="btn-error">Unknown error occurred</b>, 400);
110110+ return c.html(<b class="btn-error">Unknown error occurred</b>);
111111});
112112113113// endpoint that just returns current username
···299299300300 // Make sure we still have data
301301 if (!usrAccount || !usrAccount.password) {
302302- return c.html(<b class="btn-error">Failed: User Data Missing...</b>, 400);
302302+ return c.html(<b class="btn-error">Failed: User Data Missing...</b>);
303303 }
304304305305 // Do a hash verification on the user's input to see if the passwords match
···316316 c.header("HX-Redirect", "/?deleted");
317317 return c.html(<></>);
318318 } else {
319319- return c.html(<b class="btn-error">Failed: Invalid Password</b>, 400);
319319+ return c.html(<b class="btn-error">Failed: Invalid Password</b>);
320320 }
321321 } catch (err: any) {
322322 console.error(`failed to delete user ${userId} had error ${err.message || err.msg || 'no code'}`);
323323- return c.html(<b class="btn-error">Failed: Server Error</b>, 501);
323323+ return c.html(<b class="btn-error">Failed: Server Error</b>);
324324 }
325325});
+12-12
src/endpoints/post.tsx
···9595post.get("/edit/:id", async (c: Context) => {
9696 const { id } = c.req.param();
9797 if (!isValid(id))
9898- return c.html(<></>, 400);
9898+ return c.html(<></>);
9999100100 const postInfo = await getPostById(c, id);
101101 if (postInfo !== null) {
102102 c.header("HX-Trigger-After-Swap", `{"editPost": "${id}"}`);
103103 return c.html(<PostEdit post={postInfo} />);
104104 }
105105- return c.html(<></>, 400);
105105+ return c.html(<></>);
106106});
107107108108post.post("/edit/:id", async (c: Context) => {
···110110 const swapErrEvents: string = "refreshPosts, scrollTop, scrollListTop";
111111 if (!isValid(id)) {
112112 c.header("HX-Trigger-After-Swap", swapErrEvents);
113113- return c.html(<b class="btn-error">Post was invalid</b>, 400);
113113+ return c.html(<b class="btn-error">Post was invalid</b>);
114114 }
115115116116 const body = await c.req.json();
117117 const validation = EditSchema.safeParse(body);
118118 if (!validation.success) {
119119- return c.html(<b class="btn-error">New post had invalid data</b>, 400);
119119+ return c.html(<b class="btn-error">New post had invalid data</b>);
120120 }
121121122122 const { content, altEdits } = validation.data;
···124124 // get the original data for the post so that we can just inline edit it via a push
125125 if (originalPost === null) {
126126 c.header("HX-Trigger-After-Settle", swapErrEvents);
127127- return c.html(<b class="btn-error">Could not find post to edit</b>, 400);
127127+ return c.html(<b class="btn-error">Could not find post to edit</b>);
128128 }
129129130130 let hasEmbedEdits = false;
131131 if (originalPost.posted === true) {
132132 c.header("HX-Trigger-After-Settle", "scrollTop");
133133- return c.html(<b class="btn-error">This post has already been posted</b>, 400);
133133+ return c.html(<b class="btn-error">This post has already been posted</b>);
134134 }
135135136136 // Handle alt text and stuffs
···138138 // Check to see if this post had editable data
139139 if (originalPost.embeds === undefined) {
140140 c.header("HX-Trigger-After-Settle", swapErrEvents);
141141- return c.html(<b class="btn-error">Post did not have media content that was editable</b>, 400);
141141+ return c.html(<b class="btn-error">Post did not have media content that was editable</b>);
142142 }
143143144144 // Create an easy map to match content with quickly
···153153 // if we have anything other than an image, this is an error
154154 if (embedData.type !== EmbedDataType.Image) {
155155 c.header("HX-Trigger-After-Settle", swapErrEvents);
156156- return c.html(<b class="btn-error">Invalid operation performed</b>, 400);
156156+ return c.html(<b class="btn-error">Invalid operation performed</b>);
157157 }
158158 // Check to see if this text was edited
159159 const newAltText = editsMap.get(embedData.content);
···177177 }
178178179179 c.header("HX-Trigger-After-Settle", swapErrEvents);
180180- return c.html(<b class="btn-error">Failed to process edit</b>, 400);
180180+ return c.html(<b class="btn-error">Failed to process edit</b>);
181181});
182182183183post.get("/edit/:id/cancel", async (c: Context) => {
184184 const { id } = c.req.param();
185185 if (!isValid(id))
186186- return c.html(<></>, 400);
186186+ return c.html(<></>);
187187188188 const postInfo = await getPostByIdWithReposts(c, id);
189189 // Get the original post to replace with
···194194195195 // Refresh sidebar otherwise
196196 c.header("HX-Trigger-After-Swap", "refreshPosts, timeSidebar, scrollListTop, scrollTop");
197197- return c.html(<b class="btn-error">Internal error occurred, reloading...</b>, 400);
197197+ return c.html(<b class="btn-error">Internal error occurred, reloading...</b>);
198198});
199199200200// delete a post
···215215 }
216216 }
217217 c.header("HX-Trigger-After-Swap", "postFailedDelete");
218218- return c.html(<></>, 400);
218218+ return c.html(<></>);
219219});
+1-1
src/middleware/rateLimit.ts
···2323 await next();
2424 } else {
2525 if (prop.html) {
2626- return c.html(html`<b class="btn-error">You are being rate limited, try again later</b>`, 429);
2626+ return c.html(html`<b class="btn-error">You are being rate limited, try again later</b>`);
2727 } else {
2828 return c.json({ok: false, msg: "You are currently rate limited, try again in a minute"}, 429);
2929 }