From cb1f2637807c5f315a535cb0c4a7ad0489f55396 Mon Sep 17 00:00:00 2001 From: Raccoon Date: Sat, 12 Jun 2021 18:54:01 +0800 Subject: [PATCH] format Signed-off-by: Raccoon --- lib/auth/github/index.ts | 2 +- lib/auth/oauth2/strategy.ts | 9 +++++---- lib/models/revision.ts | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/auth/github/index.ts b/lib/auth/github/index.ts index 7c0125ea..2661ff34 100644 --- a/lib/auth/github/index.ts +++ b/lib/auth/github/index.ts @@ -9,7 +9,7 @@ import {URL} from "url"; const githubAuth = Router() export = githubAuth -function githubUrl (path) { +function githubUrl(path) { return config.github.enterpriseURL && new URL(path, config.github.enterpriseURL).toString() } diff --git a/lib/auth/oauth2/strategy.ts b/lib/auth/oauth2/strategy.ts index 33c165c5..80fdbf21 100644 --- a/lib/auth/oauth2/strategy.ts +++ b/lib/auth/oauth2/strategy.ts @@ -1,7 +1,7 @@ import {InternalOAuthError, Strategy} from "passport-oauth2"; import config from "../../config"; -export function parseProfile (data) { +export function parseProfile(data) { const username = extractProfileAttribute(data, config.oauth2.userProfileUsernameAttr) const displayName = extractProfileAttribute(data, config.oauth2.userProfileDisplayNameAttr) const email = extractProfileAttribute(data, config.oauth2.userProfileEmailAttr) @@ -20,7 +20,7 @@ export function parseProfile (data) { } } -export function extractProfileAttribute (data, path) { +export function extractProfileAttribute(data, path) { if (!data) return undefined if (typeof path !== 'string') return undefined // can handle stuff like `attrs[0].name` @@ -41,7 +41,8 @@ export function extractProfileAttribute (data, path) { export class OAuth2CustomStrategy extends Strategy { private _userProfileURL: any; - constructor (options, verify) { + + constructor(options, verify) { options.customHeaders = options.customHeaders || {} super(options, verify) this.name = 'oauth2' @@ -49,7 +50,7 @@ export class OAuth2CustomStrategy extends Strategy { this._oauth2.useAuthorizationHeaderforGET(true) } - userProfile (accessToken, done) { + userProfile(accessToken, done) { this._oauth2.get(this._userProfileURL, accessToken, function (err, body, res) { if (err) { return done(new InternalOAuthError('Failed to fetch user profile', err)) diff --git a/lib/models/revision.ts b/lib/models/revision.ts index 9b9d7e04..003303dd 100644 --- a/lib/models/revision.ts +++ b/lib/models/revision.ts @@ -71,7 +71,7 @@ export class Revision extends Model implements RevisionAttri length: number; patch: string; - public readonly createdAt ?:number + public readonly createdAt ?: number static initialize(sequelize: MySequelize): void { Revision.init({