Modrinth OAuth support
This commit is contained in:
parent
b72301bea2
commit
52e28067d8
10 changed files with 125 additions and 66 deletions
|
|
@ -16,7 +16,7 @@ const getNextQueuePlace = async () => {
|
|||
export default async (req: Request, res: Response) => {
|
||||
try {
|
||||
if (
|
||||
!req.body.githubPat ||
|
||||
!req.body.oauthToken ||
|
||||
!req.body.curseforgeSlug ||
|
||||
!req.body.modrinthId
|
||||
) {
|
||||
|
|
@ -25,7 +25,7 @@ export default async (req: Request, res: Response) => {
|
|||
.send(
|
||||
[
|
||||
"Missing a required parameter in the JSON body",
|
||||
"Required params: githubPat: string, curseforgeSlug: string, modrinthId: string",
|
||||
"Required params: oauthToken: string, curseforgeSlug: string, modrinthId: string",
|
||||
].join(" ")
|
||||
);
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ export default async (req: Request, res: Response) => {
|
|||
const fern = new Fernet(process.env.SECRET);
|
||||
|
||||
const newJob = new Job({
|
||||
githubPat: fern.encrypt(req.body.githubPat),
|
||||
oauthToken: fern.encrypt(req.body.oauthToken),
|
||||
curseforgeSlug: req.body.curseforgeSlug,
|
||||
modrinthId: req.body.modrinthId,
|
||||
queuePlace: await getNextQueuePlace(),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import Status from "../status";
|
|||
|
||||
export type JobType = Document & {
|
||||
jobId: string;
|
||||
githubPat: string;
|
||||
oauthToken: string;
|
||||
curseforgeSlug: string;
|
||||
modrinthId: string;
|
||||
logs: string;
|
||||
|
|
@ -18,7 +18,7 @@ const JobSchema = new Schema<JobType>({
|
|||
default: shortid.generate,
|
||||
required: true,
|
||||
},
|
||||
githubPat: {
|
||||
oauthToken: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue