mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-15 13:25:44 +01:00
Better log
This commit is contained in:
parent
2f215ea34c
commit
6071fc7077
1 changed files with 5 additions and 4 deletions
|
@ -5,6 +5,7 @@ import config from '../config';
|
||||||
import { createPerson, updatePerson } from './activitypub/models/person';
|
import { createPerson, updatePerson } from './activitypub/models/person';
|
||||||
import { URL } from 'url';
|
import { URL } from 'url';
|
||||||
import { remoteLogger } from './logger';
|
import { remoteLogger } from './logger';
|
||||||
|
import chalk from 'chalk';
|
||||||
|
|
||||||
const logger = remoteLogger.createSubLogger('resolve-user');
|
const logger = remoteLogger.createSubLogger('resolve-user');
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ export default async (username: string, _host: string, option?: any, resync?: bo
|
||||||
if (user === null) {
|
if (user === null) {
|
||||||
const self = await resolveSelf(acctLower);
|
const self = await resolveSelf(acctLower);
|
||||||
|
|
||||||
logger.info(`return new remote user: ${acctLower}`);
|
logger.succ(`return new remote user: ${chalk.magenta(acctLower)}`);
|
||||||
return await createPerson(self.href);
|
return await createPerson(self.href);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ logger.info(`return existing remote user: ${acctLower}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
async function resolveSelf(acctLower: string) {
|
async function resolveSelf(acctLower: string) {
|
||||||
logger.info(`WebFinger for ${acctLower}`);
|
logger.info(`WebFinger for ${chalk.yellow(acctLower)}`);
|
||||||
const finger = await webFinger(acctLower);
|
const finger = await webFinger(acctLower);
|
||||||
const self = finger.links.find(link => link.rel && link.rel.toLowerCase() === 'self');
|
const self = finger.links.find(link => link.rel && link.rel.toLowerCase() === 'self');
|
||||||
if (!self) {
|
if (!self) {
|
||||||
|
|
Loading…
Reference in a new issue