2022-04-25 14:09:37 +02:00
|
|
|
const { getRedirectUrl } = require("../../../lib/oauth/mw.js");
|
2022-04-21 08:49:16 +02:00
|
|
|
|
|
|
|
module.exports = async (state = "abc123") => {
|
|
|
|
if (context.params.state) {
|
|
|
|
return {
|
2022-04-25 14:09:37 +02:00
|
|
|
headers: { Location: getRedirectUrl(context.params.state) },
|
2022-04-21 08:49:16 +02:00
|
|
|
statusCode: 302,
|
2022-04-25 14:09:37 +02:00
|
|
|
body: Buffer.from(""),
|
|
|
|
};
|
2022-04-21 08:49:16 +02:00
|
|
|
} else {
|
|
|
|
return {
|
2022-04-25 14:09:37 +02:00
|
|
|
headers: {
|
|
|
|
Location:
|
|
|
|
"https://recaptime.miraheze.org/wiki/Portal:NoStateCodeDetected",
|
|
|
|
},
|
2022-04-21 08:49:16 +02:00
|
|
|
statusCode: 302,
|
2022-04-25 14:09:37 +02:00
|
|
|
body: Buffer.from(""),
|
|
|
|
};
|
2022-04-21 08:49:16 +02:00
|
|
|
}
|
2022-04-25 14:09:37 +02:00
|
|
|
};
|