mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
32 lines
804 B
TypeScript
32 lines
804 B
TypeScript
import { apiRoute, applyConfig } from "@/api";
|
|
import { config } from "~/packages/config-manager";
|
|
|
|
export const meta = applyConfig({
|
|
allowedMethods: ["POST"],
|
|
ratelimits: {
|
|
max: 4,
|
|
duration: 60,
|
|
},
|
|
route: "/api/auth/mastodon-logout",
|
|
auth: {
|
|
required: false,
|
|
},
|
|
});
|
|
|
|
/**
|
|
* Mastodon-FE logout route
|
|
*/
|
|
export default apiRoute((app) =>
|
|
app.on(meta.allowedMethods, meta.route, () => {
|
|
return new Response(null, {
|
|
headers: {
|
|
Location: "/",
|
|
"Set-Cookie": `_session_id=; Domain=${
|
|
new URL(config.http.base_url).hostname
|
|
}; SameSite=Lax; Path=/; HttpOnly; Max-Age=0; Expires=${new Date().toUTCString()}`,
|
|
},
|
|
status: 303,
|
|
});
|
|
}),
|
|
);
|