From f3f99ea3b20d76af6bf62e6163bd0413be386fee Mon Sep 17 00:00:00 2001 From: sousuke0422 Date: Sat, 8 Oct 2022 20:03:42 +0900 Subject: [PATCH] refactor: eslint fix --- src/server/well-known.ts | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/server/well-known.ts b/src/server/well-known.ts index 8ac571a42d..07a7741b80 100644 --- a/src/server/well-known.ts +++ b/src/server/well-known.ts @@ -13,11 +13,11 @@ const router = new Router(); const XRD = (...x: { element: string, value?: string, attributes?: Record }[]) => `${x.map(({ element, value, attributes }) => - `<${ - Object.entries(typeof attributes === 'object' && attributes || {}).reduce((a, [k, v]) => `${a} ${k}="${escapeAttribute(v)}"`, element) - }${ - typeof value === 'string' ? `>${escapeValue(value)}`).reduce((a, c) => a + c, '')}`; + `<${ + Object.entries(typeof attributes === 'object' && attributes || {}).reduce((a, [k, v]) => `${a} ${k}="${escapeAttribute(v)}"`, element) + }${ + typeof value === 'string' ? `>${escapeValue(value)}`).reduce((a, c) => a + c, '')}`; const allPath = '/.well-known/*'; const webFingerPath = '/.well-known/webfinger'; @@ -45,8 +45,9 @@ router.get('/.well-known/host-meta', async ctx => { ctx.body = XRD({ element: 'Link', attributes: { rel: 'lrdd', type: xrd, - template: `${config.url}${webFingerPath}?resource={uri}` - }}); + template: `${config.url}${webFingerPath}?resource={uri}`, + }, + }); }); router.get('/.well-known/host-meta.json', async ctx => { @@ -57,8 +58,8 @@ router.get('/.well-known/host-meta.json', async ctx => { links: [{ rel: 'lrdd', type: jrd, - template: `${config.url}${webFingerPath}?resource={uri}` - }] + template: `${config.url}${webFingerPath}?resource={uri}`, + }], }; }); @@ -70,7 +71,7 @@ router.get(webFingerPath, async ctx => { const fromId = (id: User['id']): Record => ({ id, host: null, - isSuspended: false + isSuspended: false, }); const generateQuery = (resource: string) => @@ -85,7 +86,7 @@ router.get(webFingerPath, async ctx => { !acct.host || acct.host === config.host.toLowerCase() ? { usernameLower: acct.username, host: null, - isSuspended: false + isSuspended: false, } : 422; if (typeof ctx.query.resource !== 'string') { @@ -111,16 +112,16 @@ router.get(webFingerPath, async ctx => { const self = { rel: 'self', type: 'application/activity+json', - href: `${config.url}/users/${user.id}` + href: `${config.url}/users/${user.id}`, }; const profilePage = { rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', - href: `${config.url}/@${user.username}` + href: `${config.url}/@${user.username}`, }; const subscribe = { rel: 'http://ostatus.org/schema/1.0/subscribe', - template: `${config.url}/authorize-follow?acct={uri}` + template: `${config.url}/authorize-follow?acct={uri}`, }; if (ctx.accepts(jrd, xrd) === xrd) { @@ -133,7 +134,7 @@ router.get(webFingerPath, async ctx => { } else { ctx.body = { subject, - links: [self, profilePage, subscribe] + links: [self, profilePage, subscribe], }; ctx.type = jrd; }