From 937e9be34ef309015b94900a3643dbedaff19945 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 15 Apr 2023 21:30:41 +0200 Subject: [PATCH] fix import order --- .../src/server/oauth/OAuth2ProviderService.ts | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/packages/backend/src/server/oauth/OAuth2ProviderService.ts b/packages/backend/src/server/oauth/OAuth2ProviderService.ts index 76b88e35cc..30062ef20b 100644 --- a/packages/backend/src/server/oauth/OAuth2ProviderService.ts +++ b/packages/backend/src/server/oauth/OAuth2ProviderService.ts @@ -1,35 +1,31 @@ import dns from 'node:dns/promises'; +import { fileURLToPath } from 'node:url'; +import crypto from 'node:crypto'; import { Inject, Injectable } from '@nestjs/common'; -import fastifyMiddie, { IncomingMessageExtended } from '@fastify/middie'; import { JSDOM } from 'jsdom'; import httpLinkHeader from 'http-link-header'; import ipaddr from 'ipaddr.js'; import oauth2orize, { type OAuth2 } from 'oauth2orize'; import * as oauth2Query from 'oauth2orize/lib/response/query.js'; -import { bindThis } from '@/decorators.js'; -import { DI } from '@/di-symbols.js'; -import type { Config } from '@/config.js'; -import { kinds } from '@/misc/api-permissions.js'; -import { HttpRequestService } from '@/core/HttpRequestService.js'; -import type { FastifyInstance } from 'fastify'; -import fastifyCookie from '@fastify/cookie'; -import type Redis from 'ioredis'; import oauth2Pkce from 'oauth2orize-pkce'; -import { secureRndstr } from '@/misc/secure-rndstr.js'; import expressSession from 'express-session'; -import http from 'node:http'; import fastifyView from '@fastify/view'; import pug from 'pug'; -import { fileURLToPath } from 'node:url'; -import { MetaService } from '@/core/MetaService.js'; -import fastifyFormbody from '@fastify/formbody'; import bodyParser from 'body-parser'; import fastifyExpress from '@fastify/express'; -import crypto from 'node:crypto'; +import { secureRndstr } from '@/misc/secure-rndstr.js'; +import { MetaService } from '@/core/MetaService.js'; +import { HttpRequestService } from '@/core/HttpRequestService.js'; +import { kinds } from '@/misc/api-permissions.js'; +import type { Config } from '@/config.js'; +import { DI } from '@/di-symbols.js'; +import { bindThis } from '@/decorators.js'; import type { AccessTokensRepository, UsersRepository } from '@/models/index.js'; import { IdService } from '@/core/IdService.js'; import { CacheService } from '@/core/CacheService.js'; import type { LocalUser } from '@/models/entities/User.js'; +import type * as Redis from 'ioredis'; +import type { FastifyInstance } from 'fastify'; // https://indieauth.spec.indieweb.org/#client-identifier function validateClientId(raw: string): URL { @@ -337,7 +333,7 @@ export class OAuth2ProviderService { this.#server.grant(oauth2Pkce.extensions()); this.#server.grant(oauth2orize.grant.code({ - modes: { query } + modes: { query }, }, (client, redirectUri, token, ares, areq, done) => { (async (): Promise>> => { console.log('HIT grant code:', client, redirectUri, token, ares, areq);