2017-09-08 04:13:01 +09:00
|
|
|
import * as mongo from 'mongodb';
|
2019-02-01 19:56:16 +09:00
|
|
|
import * as deepcopy from 'deepcopy';
|
2018-02-02 08:06:01 +09:00
|
|
|
import rap from '@prezzemolo/rap';
|
2019-02-03 18:16:57 +09:00
|
|
|
import db, { dbLogger } from '../db/mongodb';
|
2018-10-16 11:38:09 +09:00
|
|
|
import isObjectId from '../misc/is-objectid';
|
2018-10-29 21:06:23 +09:00
|
|
|
import { packMany as packNoteMany } from './note';
|
|
|
|
import Following from './following';
|
|
|
|
import Blocking from './blocking';
|
|
|
|
import Mute from './mute';
|
2018-04-19 12:43:25 +09:00
|
|
|
import { getFriendIds } from '../server/api/common/get-friends';
|
2018-04-02 13:15:53 +09:00
|
|
|
import config from '../config';
|
2018-10-29 21:06:23 +09:00
|
|
|
import FollowRequest from './follow-request';
|
2018-11-07 00:44:56 +09:00
|
|
|
import fetchMeta from '../misc/fetch-meta';
|
2018-12-06 10:02:04 +09:00
|
|
|
import Emoji from './emoji';
|
2017-01-17 09:12:33 +09:00
|
|
|
|
2018-02-02 08:06:01 +09:00
|
|
|
const User = db.get<IUser>('users');
|
2016-12-29 07:49:51 +09:00
|
|
|
|
2018-04-14 14:42:18 +09:00
|
|
|
User.createIndex('username');
|
|
|
|
User.createIndex('usernameLower');
|
2019-02-08 16:58:57 +09:00
|
|
|
User.createIndex('host');
|
2018-04-14 14:29:18 +09:00
|
|
|
User.createIndex(['username', 'host'], { unique: true });
|
|
|
|
User.createIndex(['usernameLower', 'host'], { unique: true });
|
2018-04-15 12:40:48 +09:00
|
|
|
User.createIndex('token', { sparse: true, unique: true });
|
2018-04-08 23:29:27 +09:00
|
|
|
User.createIndex('uri', { sparse: true, unique: true });
|
2016-12-29 07:49:51 +09:00
|
|
|
|
2018-02-02 08:06:01 +09:00
|
|
|
export default User;
|
2016-12-29 07:49:51 +09:00
|
|
|
|
2018-04-02 04:01:34 +09:00
|
|
|
type IUserBase = {
|
2017-09-08 04:13:01 +09:00
|
|
|
_id: mongo.ObjectID;
|
2018-03-29 14:48:47 +09:00
|
|
|
createdAt: Date;
|
2018-11-23 08:01:14 +09:00
|
|
|
updatedAt?: Date;
|
2018-04-26 20:22:51 +09:00
|
|
|
deletedAt?: Date;
|
2018-03-29 14:48:47 +09:00
|
|
|
followersCount: number;
|
|
|
|
followingCount: number;
|
2018-04-06 01:36:34 +09:00
|
|
|
name?: string;
|
2018-04-08 02:30:37 +09:00
|
|
|
notesCount: number;
|
2017-09-08 04:13:01 +09:00
|
|
|
username: string;
|
2018-03-29 14:48:47 +09:00
|
|
|
usernameLower: string;
|
|
|
|
avatarId: mongo.ObjectID;
|
|
|
|
bannerId: mongo.ObjectID;
|
2018-06-10 08:41:57 +09:00
|
|
|
avatarUrl?: string;
|
|
|
|
bannerUrl?: string;
|
2018-11-24 17:29:32 +09:00
|
|
|
avatarColor?: any;
|
|
|
|
bannerColor?: any;
|
2018-06-07 05:14:37 +09:00
|
|
|
wallpaperId: mongo.ObjectID;
|
2018-07-28 07:52:48 +09:00
|
|
|
wallpaperUrl?: string;
|
2017-09-08 04:13:01 +09:00
|
|
|
data: any;
|
|
|
|
description: string;
|
2018-12-03 20:08:18 +09:00
|
|
|
lang?: string;
|
2018-09-18 06:29:47 +09:00
|
|
|
pinnedNoteIds: mongo.ObjectID[];
|
2018-12-06 10:02:04 +09:00
|
|
|
emojis?: string[];
|
2019-01-31 20:42:45 +09:00
|
|
|
tags?: string[];
|
2018-05-31 18:08:47 +09:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 凍結されているか否か
|
|
|
|
*/
|
2018-03-29 14:48:47 +09:00
|
|
|
isSuspended: boolean;
|
2018-05-31 18:08:47 +09:00
|
|
|
|
2019-01-30 17:25:56 +09:00
|
|
|
/**
|
|
|
|
* サイレンスされているか否か
|
|
|
|
*/
|
|
|
|
isSilenced: boolean;
|
|
|
|
|
2018-05-31 18:08:47 +09:00
|
|
|
/**
|
|
|
|
* 鍵アカウントか否か
|
|
|
|
*/
|
|
|
|
isLocked: boolean;
|
|
|
|
|
2018-10-13 20:11:00 +09:00
|
|
|
/**
|
|
|
|
* Botか否か
|
|
|
|
*/
|
|
|
|
isBot: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Botからのフォローを承認制にするか
|
|
|
|
*/
|
|
|
|
carefulBot: boolean;
|
|
|
|
|
2018-12-28 21:36:58 +09:00
|
|
|
/**
|
|
|
|
* フォローしているユーザーからのフォローリクエストを自動承認するか
|
|
|
|
*/
|
|
|
|
autoAcceptFollowed: boolean;
|
|
|
|
|
2018-06-01 01:12:02 +09:00
|
|
|
/**
|
|
|
|
* このアカウントに届いているフォローリクエストの数
|
|
|
|
*/
|
|
|
|
pendingReceivedFollowRequestsCount: number;
|
|
|
|
|
2018-04-02 11:14:45 +09:00
|
|
|
host: string;
|
2017-09-08 04:13:01 +09:00
|
|
|
};
|
2017-10-07 07:23:00 +09:00
|
|
|
|
2018-04-02 04:48:38 +09:00
|
|
|
export interface ILocalUser extends IUserBase {
|
|
|
|
host: null;
|
2018-04-08 03:58:11 +09:00
|
|
|
keypair: string;
|
|
|
|
email: string;
|
2018-11-29 16:23:45 +09:00
|
|
|
emailVerified?: boolean;
|
|
|
|
emailVerifyCode?: string;
|
2018-04-08 03:58:11 +09:00
|
|
|
password: string;
|
|
|
|
token: string;
|
|
|
|
twitter: {
|
|
|
|
accessToken: string;
|
|
|
|
accessTokenSecret: string;
|
|
|
|
userId: string;
|
|
|
|
screenName: string;
|
2018-04-02 04:48:38 +09:00
|
|
|
};
|
2018-11-04 22:03:55 +09:00
|
|
|
github: {
|
|
|
|
accessToken: string;
|
|
|
|
id: string;
|
|
|
|
login: string;
|
|
|
|
};
|
2018-11-15 19:15:04 +09:00
|
|
|
discord: {
|
|
|
|
accessToken: string;
|
|
|
|
refreshToken: string;
|
|
|
|
expiresDate: number;
|
|
|
|
id: string;
|
|
|
|
username: string;
|
|
|
|
discriminator: string;
|
|
|
|
};
|
2018-04-08 03:58:11 +09:00
|
|
|
profile: {
|
|
|
|
location: string;
|
|
|
|
birthday: string; // 'YYYY-MM-DD'
|
|
|
|
tags: string[];
|
|
|
|
};
|
2018-12-11 20:18:12 +09:00
|
|
|
fields?: {
|
|
|
|
name: string;
|
|
|
|
value: string;
|
|
|
|
}[];
|
2018-05-21 11:08:08 +09:00
|
|
|
isCat: boolean;
|
2018-07-25 01:14:38 +09:00
|
|
|
isAdmin?: boolean;
|
2018-11-15 04:15:42 +09:00
|
|
|
isModerator?: boolean;
|
2018-07-25 01:14:38 +09:00
|
|
|
isVerified?: boolean;
|
2018-04-08 03:58:11 +09:00
|
|
|
twoFactorSecret: string;
|
|
|
|
twoFactorEnabled: boolean;
|
2018-04-26 20:22:51 +09:00
|
|
|
twoFactorTempSecret?: string;
|
2018-04-08 03:58:11 +09:00
|
|
|
clientSettings: any;
|
2018-09-14 20:11:01 +09:00
|
|
|
settings: {
|
|
|
|
autoWatch: boolean;
|
|
|
|
alwaysMarkNsfw?: boolean;
|
|
|
|
};
|
2018-05-29 01:25:54 +09:00
|
|
|
hasUnreadNotification: boolean;
|
|
|
|
hasUnreadMessagingMessage: boolean;
|
2018-04-02 04:48:38 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IRemoteUser extends IUserBase {
|
2018-04-08 03:58:11 +09:00
|
|
|
inbox: string;
|
2018-07-19 22:40:44 +09:00
|
|
|
sharedInbox?: string;
|
2018-10-02 16:27:36 +09:00
|
|
|
featured?: string;
|
2018-05-16 17:06:12 +09:00
|
|
|
endpoints: string[];
|
2018-04-08 03:58:11 +09:00
|
|
|
uri: string;
|
2018-04-15 18:38:40 +09:00
|
|
|
url?: string;
|
2018-04-08 03:58:11 +09:00
|
|
|
publicKey: {
|
|
|
|
id: string;
|
|
|
|
publicKeyPem: string;
|
2018-04-02 04:48:38 +09:00
|
|
|
};
|
2018-11-23 08:01:14 +09:00
|
|
|
lastFetchedAt: Date;
|
2018-08-21 01:03:58 +09:00
|
|
|
isAdmin: false;
|
2018-11-15 04:15:42 +09:00
|
|
|
isModerator: false;
|
2018-04-02 04:48:38 +09:00
|
|
|
}
|
2018-04-02 04:01:34 +09:00
|
|
|
|
2018-04-02 04:52:11 +09:00
|
|
|
export type IUser = ILocalUser | IRemoteUser;
|
|
|
|
|
2018-04-02 04:01:34 +09:00
|
|
|
export const isLocalUser = (user: any): user is ILocalUser =>
|
|
|
|
user.host === null;
|
|
|
|
|
|
|
|
export const isRemoteUser = (user: any): user is IRemoteUser =>
|
|
|
|
!isLocalUser(user);
|
2018-03-31 19:55:00 +09:00
|
|
|
|
2018-04-02 11:14:45 +09:00
|
|
|
//#region Validators
|
2018-12-01 07:19:17 +09:00
|
|
|
export function validateUsername(username: string, remote?: boolean): boolean {
|
2018-12-17 19:11:38 +09:00
|
|
|
return typeof username == 'string' && (remote ? /^\w([\w-]*\w)?$/ : /^\w{1,20}$/).test(username);
|
2018-04-02 04:52:11 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
export function validatePassword(password: string): boolean {
|
|
|
|
return typeof password == 'string' && password != '';
|
|
|
|
}
|
|
|
|
|
2018-04-06 01:36:34 +09:00
|
|
|
export function isValidName(name?: string): boolean {
|
2018-05-16 17:04:39 +09:00
|
|
|
return name === null || (typeof name == 'string' && name.length < 50 && name.trim() != '');
|
2018-04-02 04:52:11 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
export function isValidDescription(description: string): boolean {
|
|
|
|
return typeof description == 'string' && description.length < 500 && description.trim() != '';
|
|
|
|
}
|
|
|
|
|
|
|
|
export function isValidLocation(location: string): boolean {
|
|
|
|
return typeof location == 'string' && location.length < 50 && location.trim() != '';
|
|
|
|
}
|
|
|
|
|
|
|
|
export function isValidBirthday(birthday: string): boolean {
|
|
|
|
return typeof birthday == 'string' && /^([0-9]{4})\-([0-9]{2})-([0-9]{2})$/.test(birthday);
|
|
|
|
}
|
2018-04-02 11:14:45 +09:00
|
|
|
//#endregion
|
2018-04-02 04:52:11 +09:00
|
|
|
|
2018-11-01 00:11:21 +09:00
|
|
|
export async function getRelation(me: mongo.ObjectId, target: mongo.ObjectId) {
|
|
|
|
const [following1, following2, followReq1, followReq2, toBlocking, fromBlocked, mute] = await Promise.all([
|
|
|
|
Following.findOne({
|
|
|
|
followerId: me,
|
|
|
|
followeeId: target
|
|
|
|
}),
|
|
|
|
Following.findOne({
|
|
|
|
followerId: target,
|
|
|
|
followeeId: me
|
|
|
|
}),
|
|
|
|
FollowRequest.findOne({
|
|
|
|
followerId: me,
|
|
|
|
followeeId: target
|
|
|
|
}),
|
|
|
|
FollowRequest.findOne({
|
|
|
|
followerId: target,
|
|
|
|
followeeId: me
|
|
|
|
}),
|
|
|
|
Blocking.findOne({
|
|
|
|
blockerId: me,
|
|
|
|
blockeeId: target
|
|
|
|
}),
|
|
|
|
Blocking.findOne({
|
|
|
|
blockerId: target,
|
|
|
|
blockeeId: me
|
|
|
|
}),
|
|
|
|
Mute.findOne({
|
|
|
|
muterId: me,
|
|
|
|
muteeId: target
|
|
|
|
})
|
|
|
|
]);
|
|
|
|
|
|
|
|
return {
|
2018-12-30 01:44:26 +09:00
|
|
|
id: target,
|
2018-11-01 00:11:21 +09:00
|
|
|
isFollowing: following1 !== null,
|
|
|
|
hasPendingFollowRequestFromYou: followReq1 !== null,
|
|
|
|
hasPendingFollowRequestToYou: followReq2 !== null,
|
|
|
|
isFollowed: following2 !== null,
|
|
|
|
isBlocking: toBlocking !== null,
|
|
|
|
isBlocked: fromBlocked !== null,
|
|
|
|
isMuted: mute !== null
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-02-02 08:06:01 +09:00
|
|
|
/**
|
|
|
|
* Pack a user for API response
|
|
|
|
*
|
|
|
|
* @param user target
|
|
|
|
* @param me? serializee
|
|
|
|
* @param options? serialize options
|
|
|
|
* @return Packed user
|
|
|
|
*/
|
|
|
|
export const pack = (
|
|
|
|
user: string | mongo.ObjectID | IUser,
|
|
|
|
me?: string | mongo.ObjectID | IUser,
|
|
|
|
options?: {
|
|
|
|
detail?: boolean,
|
2018-09-19 14:18:34 +09:00
|
|
|
includeSecrets?: boolean,
|
|
|
|
includeHasUnreadNotes?: boolean
|
2018-02-02 08:06:01 +09:00
|
|
|
}
|
|
|
|
) => new Promise<any>(async (resolve, reject) => {
|
|
|
|
const opts = Object.assign({
|
|
|
|
detail: false,
|
|
|
|
includeSecrets: false
|
|
|
|
}, options);
|
|
|
|
|
|
|
|
let _user: any;
|
|
|
|
|
2018-11-01 09:19:22 +09:00
|
|
|
const fields = opts.detail ? {} : {
|
|
|
|
name: true,
|
|
|
|
username: true,
|
|
|
|
host: true,
|
|
|
|
avatarColor: true,
|
|
|
|
avatarUrl: true,
|
2018-12-06 10:02:04 +09:00
|
|
|
emojis: true,
|
2018-11-01 09:19:22 +09:00
|
|
|
isCat: true,
|
|
|
|
isBot: true,
|
|
|
|
isAdmin: true,
|
|
|
|
isVerified: true
|
2018-02-02 08:06:01 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
// Populate the user if 'user' is ID
|
2018-10-16 11:38:09 +09:00
|
|
|
if (isObjectId(user)) {
|
2018-02-02 08:06:01 +09:00
|
|
|
_user = await User.findOne({
|
|
|
|
_id: user
|
|
|
|
}, { fields });
|
|
|
|
} else if (typeof user === 'string') {
|
|
|
|
_user = await User.findOne({
|
|
|
|
_id: new mongo.ObjectID(user)
|
|
|
|
}, { fields });
|
|
|
|
} else {
|
|
|
|
_user = deepcopy(user);
|
|
|
|
}
|
|
|
|
|
2018-10-05 01:43:47 +09:00
|
|
|
// (データベースの欠損などで)ユーザーがデータベース上に見つからなかったとき
|
2018-10-04 00:39:11 +09:00
|
|
|
if (_user == null) {
|
2019-02-03 18:16:57 +09:00
|
|
|
dbLogger.warn(`user not found on database: ${user}`);
|
2018-10-05 04:50:23 +09:00
|
|
|
return resolve(null);
|
2018-10-04 00:39:11 +09:00
|
|
|
}
|
2018-02-02 08:06:01 +09:00
|
|
|
|
|
|
|
// Me
|
|
|
|
const meId: mongo.ObjectID = me
|
2018-10-16 11:38:09 +09:00
|
|
|
? isObjectId(me)
|
2018-02-02 08:06:01 +09:00
|
|
|
? me as mongo.ObjectID
|
|
|
|
: typeof me === 'string'
|
|
|
|
? new mongo.ObjectID(me)
|
|
|
|
: (me as IUser)._id
|
|
|
|
: null;
|
|
|
|
|
|
|
|
// Rename _id to id
|
|
|
|
_user.id = _user._id;
|
|
|
|
delete _user._id;
|
|
|
|
|
2018-11-01 09:08:00 +09:00
|
|
|
delete _user.usernameLower;
|
2018-11-29 16:23:45 +09:00
|
|
|
delete _user.emailVerifyCode;
|
2018-11-01 09:08:00 +09:00
|
|
|
|
2018-04-08 03:58:11 +09:00
|
|
|
if (_user.host == null) {
|
2018-03-27 16:51:12 +09:00
|
|
|
// Remove private properties
|
2018-04-08 03:58:11 +09:00
|
|
|
delete _user.keypair;
|
|
|
|
delete _user.password;
|
|
|
|
delete _user.token;
|
|
|
|
delete _user.twoFactorTempSecret;
|
2019-01-30 21:31:45 +09:00
|
|
|
delete _user.two_factor_temp_secret; // 後方互換性のため
|
2018-04-08 03:58:11 +09:00
|
|
|
delete _user.twoFactorSecret;
|
|
|
|
if (_user.twitter) {
|
|
|
|
delete _user.twitter.accessToken;
|
|
|
|
delete _user.twitter.accessTokenSecret;
|
2018-03-27 16:51:12 +09:00
|
|
|
}
|
2018-11-04 22:03:55 +09:00
|
|
|
if (_user.github) {
|
|
|
|
delete _user.github.accessToken;
|
|
|
|
}
|
2018-11-15 19:15:04 +09:00
|
|
|
if (_user.discord) {
|
|
|
|
delete _user.discord.accessToken;
|
|
|
|
delete _user.discord.refreshToken;
|
|
|
|
delete _user.discord.expiresDate;
|
|
|
|
}
|
2018-03-27 16:51:12 +09:00
|
|
|
|
|
|
|
// Visible via only the official client
|
|
|
|
if (!opts.includeSecrets) {
|
2018-04-08 03:58:11 +09:00
|
|
|
delete _user.email;
|
2018-11-29 16:23:45 +09:00
|
|
|
delete _user.emailVerified;
|
2018-04-08 03:58:11 +09:00
|
|
|
delete _user.settings;
|
|
|
|
delete _user.clientSettings;
|
2018-03-27 16:51:12 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!opts.detail) {
|
2018-04-08 03:58:11 +09:00
|
|
|
delete _user.twoFactorEnabled;
|
2018-03-27 16:51:12 +09:00
|
|
|
}
|
2018-04-17 19:43:49 +09:00
|
|
|
} else {
|
|
|
|
delete _user.publicKey;
|
2018-02-02 08:06:01 +09:00
|
|
|
}
|
|
|
|
|
2018-06-10 08:34:46 +09:00
|
|
|
if (_user.avatarUrl == null) {
|
2018-07-28 07:52:48 +09:00
|
|
|
_user.avatarUrl = `${config.drive_url}/default-avatar.jpg`;
|
|
|
|
}
|
2018-06-07 05:14:37 +09:00
|
|
|
|
2018-02-02 08:06:01 +09:00
|
|
|
if (!meId || !meId.equals(_user.id) || !opts.detail) {
|
2018-03-29 14:48:47 +09:00
|
|
|
delete _user.avatarId;
|
|
|
|
delete _user.bannerId;
|
2018-05-29 01:25:54 +09:00
|
|
|
delete _user.hasUnreadMessagingMessage;
|
|
|
|
delete _user.hasUnreadNotification;
|
2018-02-02 08:06:01 +09:00
|
|
|
}
|
|
|
|
|
2018-10-29 21:35:46 +09:00
|
|
|
if (meId && !meId.equals(_user.id) && opts.detail) {
|
2018-11-01 00:11:21 +09:00
|
|
|
const relation = await getRelation(meId, _user.id);
|
|
|
|
|
|
|
|
_user.isFollowing = relation.isFollowing;
|
|
|
|
_user.isFollowed = relation.isFollowed;
|
|
|
|
_user.hasPendingFollowRequestFromYou = relation.hasPendingFollowRequestFromYou;
|
|
|
|
_user.hasPendingFollowRequestToYou = relation.hasPendingFollowRequestToYou;
|
|
|
|
_user.isBlocking = relation.isBlocking;
|
|
|
|
_user.isBlocked = relation.isBlocked;
|
|
|
|
_user.isMuted = relation.isMuted;
|
2018-02-02 08:06:01 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
if (opts.detail) {
|
2018-09-18 06:29:47 +09:00
|
|
|
if (_user.pinnedNoteIds) {
|
|
|
|
// Populate pinned notes
|
2019-02-05 03:51:54 +09:00
|
|
|
_user.pinnedNotes = packNoteMany(_user.pinnedNoteIds, meId, {
|
2018-02-02 08:06:01 +09:00
|
|
|
detail: true
|
2018-10-04 00:39:11 +09:00
|
|
|
});
|
2018-02-02 08:06:01 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
if (meId && !meId.equals(_user.id)) {
|
2018-04-19 12:43:25 +09:00
|
|
|
const myFollowingIds = await getFriendIds(meId);
|
2018-02-02 08:06:01 +09:00
|
|
|
|
|
|
|
// Get following you know count
|
2018-03-29 14:48:47 +09:00
|
|
|
_user.followingYouKnowCount = Following.count({
|
|
|
|
followeeId: { $in: myFollowingIds },
|
2018-04-02 21:57:36 +09:00
|
|
|
followerId: _user.id
|
2018-02-02 08:06:01 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
// Get followers you know count
|
2018-03-29 14:48:47 +09:00
|
|
|
_user.followersYouKnowCount = Following.count({
|
|
|
|
followeeId: _user.id,
|
2018-04-02 21:57:36 +09:00
|
|
|
followerId: { $in: myFollowingIds }
|
2018-02-02 08:06:01 +09:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-19 14:18:34 +09:00
|
|
|
if (!opts.includeHasUnreadNotes) {
|
|
|
|
delete _user.hasUnreadSpecifiedNotes;
|
|
|
|
delete _user.hasUnreadMentions;
|
|
|
|
}
|
|
|
|
|
2018-12-06 10:02:04 +09:00
|
|
|
// カスタム絵文字添付
|
|
|
|
if (_user.emojis) {
|
2019-02-05 03:51:54 +09:00
|
|
|
_user.emojis = Emoji.find({
|
2018-12-06 10:02:04 +09:00
|
|
|
name: { $in: _user.emojis },
|
|
|
|
host: _user.host
|
|
|
|
}, {
|
|
|
|
fields: { _id: false }
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-02-02 08:06:01 +09:00
|
|
|
// resolve promises in _user object
|
|
|
|
_user = await rap(_user);
|
|
|
|
|
|
|
|
resolve(_user);
|
|
|
|
});
|
|
|
|
|
|
|
|
/*
|
|
|
|
function img(url) {
|
|
|
|
return {
|
|
|
|
thumbnail: {
|
|
|
|
large: `${url}`,
|
|
|
|
medium: '',
|
|
|
|
small: ''
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
*/
|
2018-04-26 20:30:49 +09:00
|
|
|
|
2018-11-07 00:44:56 +09:00
|
|
|
export async function fetchProxyAccount(): Promise<ILocalUser> {
|
|
|
|
const meta = await fetchMeta();
|
|
|
|
return await User.findOne({ username: meta.proxyAccount, host: null }) as ILocalUser;
|
2018-04-26 20:30:49 +09:00
|
|
|
}
|