This commit is contained in:
syuilo 2019-04-07 23:06:07 +09:00
parent fffa32df48
commit d9780606b3
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
6 changed files with 9 additions and 9 deletions

View file

@ -3,7 +3,7 @@ import * as Bull from 'bull';
import { queueLogger } from '../../logger';
import follow from '../../../services/following/create';
import parseAcct from '../../../misc/acct/parse';
import resolveUser from '../../../remote/resolve-user';
import { resolveUser } from '../../../remote/resolve-user';
import { downloadTextFile } from '../../../misc/download-text-file';
import { isSelfHost, toDbHost } from '../../../misc/convert-host';
import { Users, DriveFiles } from '../../../models';

View file

@ -2,7 +2,7 @@ import * as Bull from 'bull';
import { queueLogger } from '../../logger';
import parseAcct from '../../../misc/acct/parse';
import resolveUser from '../../../remote/resolve-user';
import { resolveUser } from '../../../remote/resolve-user';
import { pushUserToUserList } from '../../../services/user-list/push';
import { downloadTextFile } from '../../../misc/download-text-file';
import { isSelfHost, toDbHost } from '../../../misc/convert-host';

View file

@ -10,7 +10,7 @@ import { Users } from '../models';
const logger = remoteLogger.createSubLogger('resolve-user');
export default async (username: string, _host: string, option?: any, resync = false): Promise<User> => {
export async function resolveUser(username: string, _host: string, option?: any, resync = false): Promise<User> {
const usernameLower = username.toLowerCase();
if (_host == null) {
@ -73,7 +73,7 @@ export default async (username: string, _host: string, option?: any, resync = fa
logger.info(`return existing remote user: ${acctLower}`);
return user;
};
}
async function resolveSelf(acctLower: string) {
logger.info(`WebFinger for ${chalk.yellow(acctLower)}`);

View file

@ -1,5 +1,5 @@
import $ from 'cafy';
import resolveRemoteUser from '../../../../remote/resolve-user';
import { resolveUser } from '../../../../remote/resolve-user';
import define from '../../define';
import { apiLogger } from '../../logger';
import { ApiError } from '../../error';
@ -75,7 +75,7 @@ export default define(meta, async (ps, me) => {
} else {
// Lookup user
if (typeof ps.host === 'string') {
user = await resolveRemoteUser(ps.username, ps.host).catch(e => {
user = await resolveUser(ps.username, ps.host).catch(e => {
apiLogger.warn(`failed to resolve remote user: ${e}`);
throw new ApiError(meta.errors.failedToResolveRemoteUser);
});
@ -94,7 +94,7 @@ export default define(meta, async (ps, me) => {
// ユーザー情報更新
if (Users.isRemoteUser(user)) {
if (user.lastFetchedAt == null || Date.now() - user.lastFetchedAt.getTime() > 1000 * 60 * 60 * 24) {
resolveRemoteUser(ps.username, ps.host, { }, true);
resolveUser(ps.username, ps.host, { }, true);
}
}

View file

@ -7,7 +7,7 @@ import renderAnnounce from '../../remote/activitypub/renderer/announce';
import { renderActivity } from '../../remote/activitypub/renderer';
import watch from './watch';
import { parse } from '../../mfm/parse';
import resolveUser from '../../remote/resolve-user';
import { resolveUser } from '../../remote/resolve-user';
import config from '../../config';
import { updateHashtag } from '../update-hashtag';
import { erase, concat } from '../../prelude/array';

View file

@ -1,5 +1,5 @@
import parseAcct from '../misc/acct/parse';
import resolveUser from '../remote/resolve-user';
import { resolveUser } from '../remote/resolve-user';
async function main(acct: string): Promise<any> {
const { username, host } = parseAcct(acct);