fix: apply biome fixes

This commit is contained in:
Yarmo Mackenbach 2024-06-21 15:48:12 +02:00
parent e0297d90fb
commit c4b8423c6a
No known key found for this signature in database
GPG key ID: C248C28D432560ED
7 changed files with 32 additions and 33 deletions

View file

@ -77,9 +77,9 @@ const doVerification = async (profile) => {
}
await Promise.all(promises)
results.forEach(result => {
for (const result of results) {
profile.personas[result[0]].claims[result[1]] = result[2]
})
}
return profile
}

View file

@ -30,8 +30,8 @@ more information on this, and how to apply and follow the GNU AGPL, see <https:/
import express from 'express'
import * as httpContext from 'express-http-context2'
import { nanoid } from 'nanoid'
import { readFileSync } from 'fs'
import { execSync } from 'child_process'
import { readFileSync } from 'node:fs'
import { execSync } from 'node:child_process'
import { stringReplace } from 'string-replace-middleware'
import * as pug from 'pug'
import * as dotenv from 'dotenv'

View file

@ -29,7 +29,7 @@ more information on this, and how to apply and follow the GNU AGPL, see <https:/
*/
import express from 'express'
import markdownImport from 'markdown-it'
import { readFileSync } from 'fs'
import { readFileSync } from 'node:fs'
import { getMetaFromReq } from '../server/utils.js'
const router = express.Router()
@ -74,7 +74,8 @@ router.get('/.well-known/webfinger', (req, res) => {
if (!req.query.resource) {
res.status(400).send()
return
} else if (![body.subject, ...body.aliases].includes(req.query.resource)) {
}
if (![body.subject, ...body.aliases].includes(req.query.resource)) {
res.status(404).send()
return
}

View file

@ -32,60 +32,60 @@ import { escapedParam, getMetaFromReq } from '../server/utils.js'
const router = express.Router()
router.get('/', function (req, res) {
router.get('/', (req, res) => {
res.render('util/index', { meta: getMetaFromReq(req) })
})
router.get('/profile-url', function (req, res) {
router.get('/profile-url', (req, res) => {
res.render('util/profile-url', { meta: getMetaFromReq(req) })
})
router.get('/profile-url/:input',
escapedParam('input'),
function (req, res) {
(req, res) => {
res.render('util/profile-url', { input: req.params.input, meta: getMetaFromReq(req) })
})
router.get('/qr', function (req, res) {
router.get('/qr', (req, res) => {
res.render('util/qr', { meta: getMetaFromReq(req) })
})
router.get('/qr/:input',
escapedParam('input'),
function (req, res) {
(req, res) => {
res.render('util/qr', { input: req.params.input, meta: getMetaFromReq(req) })
})
router.get('/qrfp', function (req, res) {
router.get('/qrfp', (req, res) => {
res.render('util/qrfp', { meta: getMetaFromReq(req) })
})
router.get('/qrfp/:input',
escapedParam('input'),
function (req, res) {
(req, res) => {
res.render('util/qrfp', { input: req.params.input, meta: getMetaFromReq(req) })
})
router.get('/wkd', function (req, res) {
router.get('/wkd', (req, res) => {
res.render('util/wkd', { meta: getMetaFromReq(req) })
})
router.get('/wkd/:input',
escapedParam('input'),
function (req, res) {
(req, res) => {
res.render('util/wkd', { input: req.params.input, meta: getMetaFromReq(req) })
})
router.get('/argon2', function (req, res) {
router.get('/argon2', (req, res) => {
res.render('util/argon2', { meta: getMetaFromReq(req) })
})
router.get('/argon2/:input',
escapedParam('input'),
function (req, res) {
(req, res) => {
res.render('util/argon2', { input: req.params.input, meta: getMetaFromReq(req) })
})
router.get('/bcrypt', function (req, res) {
router.get('/bcrypt', (req, res) => {
res.render('util/bcrypt', { meta: getMetaFromReq(req) })
})
router.get('/bcrypt/:input',
escapedParam('input'),
function (req, res) {
(req, res) => {
res.render('util/bcrypt', { input: req.params.input, meta: getMetaFromReq(req) })
})

View file

@ -205,16 +205,16 @@ const generateKeybaseProfile = async (username, fingerprint) => {
}
const processAspProfile = async (/** @type {import('doipjs').Profile */ profile) => {
profile.personas.forEach(persona => {
for (const persona of profile.personas) {
// Remove faulty claims
persona.claims = persona.claims.filter(claim => {
return claim instanceof doipjs.Claim
})
// Match claims
persona.claims.forEach(claim => {
for (const claim of persona.claims) {
claim.match()
})
}
// Sort claims
persona.claims.sort((a, b) => {
@ -229,7 +229,7 @@ const processAspProfile = async (/** @type {import('doipjs').Profile */ profile)
}
return 0
})
})
}
// Overwrite avatarUrl
// TODO: don't overwrite avatarUrl once it's fully supported
@ -240,16 +240,16 @@ const processAspProfile = async (/** @type {import('doipjs').Profile */ profile)
}
const processOpenPgpProfile = async (/** @type {import('doipjs').Profile */ profile) => {
profile.personas.forEach(persona => {
for (const persona of profile.personas) {
// Remove faulty claims
persona.claims = persona.claims.filter(claim => {
return claim instanceof doipjs.Claim
})
// Match claims
persona.claims.forEach(claim => {
for (const claim of persona.claims) {
claim.match()
})
}
// Sort claims
persona.claims.sort((a, b) => {
@ -264,7 +264,7 @@ const processOpenPgpProfile = async (/** @type {import('doipjs').Profile */ prof
}
return 0
})
})
}
// Overwrite avatarUrl
// TODO: don't overwrite avatarUrl once it's fully supported

View file

@ -32,7 +32,7 @@ import got from 'got'
import * as doipjs from 'doipjs'
import { readKey } from 'openpgp'
import { computeWKDLocalPart } from './utils.js'
import { createHash } from 'crypto'
import { createHash } from 'node:crypto'
import Keyv from 'keyv'
let c = null
@ -82,9 +82,8 @@ const fetchWKD = (id) => {
if (response.statusCode === 200) {
fetchURL = urlAdvanced
return new Uint8Array(response.rawBody)
} else {
return null
}
return null
})
} catch (errorAdvanced) {
logger.debug('Failed to fetch an OpenPGP profile via WKD (advanced URL)',
@ -95,9 +94,8 @@ const fetchWKD = (id) => {
if (response.statusCode === 200) {
fetchURL = urlDirect
return new Uint8Array(response.rawBody)
} else {
return null
}
return null
})
} catch (errorDirect) {
logger.debug('Failed to fetch an OpenPGP profile via WKD (direct URL)',

View file

@ -27,7 +27,7 @@ You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary. For
more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>.
*/
import { webcrypto as crypto } from 'crypto'
import { webcrypto as crypto } from 'node:crypto'
import { Profile } from 'doipjs'
import Color from 'colorjs.io'
import { param } from 'express-validator'