2023-08-28 09:25:31 +00:00
|
|
|
/*
|
2024-02-13 15:59:27 +00:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-08-28 09:25:31 +00:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-04-04 00:38:34 +00:00
|
|
|
import type { entities } from 'misskey-js'
|
2024-02-23 00:34:26 +00:00
|
|
|
import { imageDataUrl, text } from "./fake-utils.js";
|
2023-04-04 00:38:34 +00:00
|
|
|
|
2023-04-05 23:19:49 +00:00
|
|
|
export function abuseUserReport() {
|
|
|
|
return {
|
|
|
|
id: 'someabusereportid',
|
|
|
|
createdAt: '2016-12-28T22:49:51.000Z',
|
|
|
|
comment: 'This user is a spammer!',
|
|
|
|
resolved: false,
|
|
|
|
reporterId: 'reporterid',
|
|
|
|
targetUserId: 'targetuserid',
|
|
|
|
assigneeId: 'assigneeid',
|
|
|
|
reporter: userDetailed('reporterid', 'reporter', 'misskey-hub.net', 'Reporter'),
|
|
|
|
targetUser: userDetailed('targetuserid', 'target', 'misskey-hub.net', 'Target'),
|
|
|
|
assignee: userDetailed('assigneeid', 'assignee', 'misskey-hub.net', 'Assignee'),
|
|
|
|
me: null,
|
|
|
|
forwarded: false,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-06-08 09:00:54 +00:00
|
|
|
export function channel(id = 'somechannelid', name = 'Some Channel', bannerUrl: string | null = 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true'): entities.Channel {
|
|
|
|
return {
|
|
|
|
id,
|
|
|
|
createdAt: '2016-12-28T22:49:51.000Z',
|
|
|
|
lastNotedAt: '2016-12-28T22:49:51.000Z',
|
|
|
|
name,
|
|
|
|
description: null,
|
|
|
|
userId: null,
|
|
|
|
bannerUrl,
|
|
|
|
pinnedNoteIds: [],
|
|
|
|
color: '#000',
|
|
|
|
isArchived: false,
|
|
|
|
usersCount: 1,
|
|
|
|
notesCount: 1,
|
|
|
|
isSensitive: false,
|
|
|
|
allowRenoteToExternal: false,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function clip(id = 'someclipid', name = 'Some Clip'): entities.Clip {
|
|
|
|
return {
|
|
|
|
id,
|
|
|
|
createdAt: '2016-12-28T22:49:51.000Z',
|
|
|
|
lastClippedAt: null,
|
|
|
|
userId: 'someuserid',
|
|
|
|
user: {
|
|
|
|
id: 'someuserid',
|
|
|
|
name: 'Misskey User',
|
|
|
|
username: 'miskist',
|
|
|
|
host: 'misskey-hub.net',
|
|
|
|
avatarUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true',
|
|
|
|
avatarBlurhash: 'eQFRshof5NWBRi},juayfPju53WB?0ofs;s*a{ofjuay^SoMEJR%ay',
|
|
|
|
avatarDecorations: [],
|
|
|
|
emojis: {},
|
|
|
|
badgeRoles: [],
|
|
|
|
onlineStatus: 'unknown',
|
|
|
|
},
|
|
|
|
notesCount: undefined,
|
|
|
|
name,
|
|
|
|
description: 'Some clip description',
|
|
|
|
isPublic: false,
|
|
|
|
favoritedCount: 0,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function emojiDetailed(id = 'someemojiid', name = 'some_emoji'): entities.EmojiDetailed {
|
|
|
|
return {
|
|
|
|
id,
|
|
|
|
aliases: ['alias1', 'alias2'],
|
|
|
|
name,
|
|
|
|
category: 'emojiCategory',
|
|
|
|
host: null,
|
|
|
|
url: '/client-assets/about-icon.png',
|
|
|
|
license: null,
|
|
|
|
isSensitive: false,
|
|
|
|
localOnly: false,
|
|
|
|
roleIdsThatCanBeUsedThisEmojiAsReaction: ['roleId1', 'roleId2'],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-04-05 23:19:49 +00:00
|
|
|
export function galleryPost(isSensitive = false) {
|
|
|
|
return {
|
|
|
|
id: 'somepostid',
|
|
|
|
createdAt: '2016-12-28T22:49:51.000Z',
|
|
|
|
updatedAt: '2016-12-28T22:49:51.000Z',
|
2024-05-01 07:39:16 +00:00
|
|
|
userId: 'someuserid',
|
2023-04-05 23:19:49 +00:00
|
|
|
user: userDetailed(),
|
|
|
|
title: 'Some post title',
|
|
|
|
description: 'Some post description',
|
|
|
|
fileIds: ['somefileid'],
|
|
|
|
files: [
|
|
|
|
file(isSensitive),
|
|
|
|
],
|
|
|
|
isSensitive,
|
|
|
|
likedCount: 0,
|
|
|
|
isLiked: false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function file(isSensitive = false) {
|
|
|
|
return {
|
|
|
|
id: 'somefileid',
|
|
|
|
createdAt: '2016-12-28T22:49:51.000Z',
|
|
|
|
name: 'somefile.jpg',
|
|
|
|
type: 'image/jpeg',
|
|
|
|
md5: 'f6fc51c73dc21b1fb85ead2cdf57530a',
|
|
|
|
size: 77752,
|
|
|
|
isSensitive,
|
|
|
|
blurhash: 'eQAmoa^-MH8w9ZIvNLSvo^$*MwRPbwtSxutRozjEiwR.RjWBoeozog',
|
|
|
|
properties: {
|
|
|
|
width: 1024,
|
|
|
|
height: 270
|
2023-04-04 00:38:34 +00:00
|
|
|
},
|
2023-04-05 23:19:49 +00:00
|
|
|
url: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true',
|
|
|
|
thumbnailUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true',
|
|
|
|
comment: null,
|
|
|
|
folderId: null,
|
|
|
|
folder: null,
|
|
|
|
userId: null,
|
|
|
|
user: null,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function userDetailed(id = 'someuserid', username = 'miskist', host = 'misskey-hub.net', name = 'Misskey User'): entities.UserDetailed {
|
|
|
|
return {
|
|
|
|
id,
|
|
|
|
username,
|
|
|
|
host,
|
|
|
|
name,
|
|
|
|
onlineStatus: 'unknown',
|
|
|
|
avatarUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true',
|
|
|
|
avatarBlurhash: 'eQFRshof5NWBRi},juayfPju53WB?0ofs;s*a{ofjuay^SoMEJR%ay',
|
2023-10-21 09:38:07 +00:00
|
|
|
avatarDecorations: [],
|
2024-05-01 07:39:16 +00:00
|
|
|
emojis: {},
|
2023-04-05 23:19:49 +00:00
|
|
|
bannerBlurhash: 'eQA^IW^-MH8w9tE8I=S^o{$*R4RikXtSxutRozjEnNR.RQadoyozog',
|
|
|
|
bannerUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true',
|
|
|
|
birthday: '2014-06-20',
|
|
|
|
createdAt: '2016-12-28T22:49:51.000Z',
|
|
|
|
description: 'I am a cool user!',
|
2023-12-18 11:59:20 +00:00
|
|
|
followingVisibility: 'public',
|
|
|
|
followersVisibility: 'public',
|
2023-04-09 04:16:56 +00:00
|
|
|
roles: [],
|
2023-04-05 23:19:49 +00:00
|
|
|
fields: [
|
|
|
|
{
|
|
|
|
name: 'Website',
|
|
|
|
value: 'https://misskey-hub.net',
|
|
|
|
},
|
|
|
|
],
|
2023-09-21 02:58:51 +00:00
|
|
|
verifiedLinks: [],
|
2023-04-05 23:19:49 +00:00
|
|
|
followersCount: 1024,
|
|
|
|
followingCount: 16,
|
|
|
|
hasPendingFollowRequestFromYou: false,
|
|
|
|
hasPendingFollowRequestToYou: false,
|
|
|
|
isAdmin: false,
|
|
|
|
isBlocked: false,
|
|
|
|
isBlocking: false,
|
|
|
|
isBot: false,
|
|
|
|
isCat: false,
|
|
|
|
isFollowed: false,
|
|
|
|
isFollowing: false,
|
|
|
|
isLocked: false,
|
|
|
|
isModerator: false,
|
|
|
|
isMuted: false,
|
|
|
|
isSilenced: false,
|
|
|
|
isSuspended: false,
|
|
|
|
lang: 'en',
|
|
|
|
location: 'Fediverse',
|
|
|
|
notesCount: 65536,
|
|
|
|
pinnedNoteIds: [],
|
|
|
|
pinnedNotes: [],
|
|
|
|
pinnedPage: null,
|
|
|
|
pinnedPageId: null,
|
|
|
|
publicReactions: false,
|
|
|
|
securityKeys: false,
|
|
|
|
twoFactorEnabled: false,
|
2024-05-01 07:39:16 +00:00
|
|
|
usePasswordLessLogin: false,
|
2023-08-28 09:25:31 +00:00
|
|
|
twoFactorBackupCodesStock: 'none',
|
2023-04-05 23:19:49 +00:00
|
|
|
updatedAt: null,
|
2024-05-01 07:39:16 +00:00
|
|
|
lastFetchedAt: null,
|
2023-04-05 23:19:49 +00:00
|
|
|
uri: null,
|
|
|
|
url: null,
|
2024-05-01 07:39:16 +00:00
|
|
|
movedTo: null,
|
|
|
|
alsoKnownAs: null,
|
2023-09-21 09:48:15 +00:00
|
|
|
notify: 'none',
|
2024-05-01 07:39:16 +00:00
|
|
|
memo: null
|
2023-04-05 23:19:49 +00:00
|
|
|
};
|
|
|
|
}
|
2023-07-15 00:57:58 +00:00
|
|
|
|
|
|
|
export function inviteCode(isUsed = false, hasExpiration = false, isExpired = false, isCreatedBySystem = false) {
|
|
|
|
const date = new Date();
|
|
|
|
const createdAt = new Date();
|
|
|
|
createdAt.setDate(date.getDate() - 1)
|
|
|
|
const expiresAt = new Date();
|
|
|
|
|
|
|
|
if (isExpired) {
|
|
|
|
expiresAt.setHours(date.getHours() - 1)
|
|
|
|
} else {
|
|
|
|
expiresAt.setHours(date.getHours() + 1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
id: "9gyqzizw77",
|
|
|
|
code: "SLF3JKF7UV2H9",
|
|
|
|
expiresAt: hasExpiration ? expiresAt.toISOString() : null,
|
|
|
|
createdAt: createdAt.toISOString(),
|
|
|
|
createdBy: isCreatedBySystem ? null : userDetailed('8i3rvznx32'),
|
|
|
|
usedBy: isUsed ? userDetailed('3i3r2znx1v') : null,
|
|
|
|
usedAt: isUsed ? date.toISOString() : null,
|
|
|
|
used: isUsed,
|
|
|
|
}
|
|
|
|
}
|
2024-02-20 23:40:08 +00:00
|
|
|
|
|
|
|
export function role(params: {
|
|
|
|
id?: string,
|
|
|
|
name?: string,
|
|
|
|
color?: string | null,
|
|
|
|
iconUrl?: string | null,
|
|
|
|
description?: string,
|
|
|
|
isModerator?: boolean,
|
|
|
|
isAdministrator?: boolean,
|
|
|
|
displayOrder?: number,
|
|
|
|
createdAt?: string,
|
|
|
|
updatedAt?: string,
|
|
|
|
target?: 'manual' | 'conditional',
|
|
|
|
isPublic?: boolean,
|
|
|
|
isExplorable?: boolean,
|
|
|
|
asBadge?: boolean,
|
|
|
|
canEditMembersByModerator?: boolean,
|
|
|
|
usersCount?: number,
|
|
|
|
}): entities.Role {
|
|
|
|
const prefix = params.displayOrder ? params.displayOrder.toString().padStart(3, '0') + '-' : '';
|
|
|
|
const genId = Math.random().toString(36).substring(10);
|
|
|
|
|
|
|
|
return {
|
|
|
|
id: params.id ?? genId,
|
|
|
|
name: params.name ?? `${prefix}TestRole-${genId}`,
|
|
|
|
color: params.color ?? '#445566',
|
|
|
|
iconUrl: params.iconUrl ?? null,
|
|
|
|
description: params.description ?? '',
|
|
|
|
isModerator: params.isModerator ?? false,
|
|
|
|
isAdministrator: params.isAdministrator ?? false,
|
|
|
|
displayOrder: params.displayOrder ?? 0,
|
|
|
|
createdAt: params.createdAt ?? new Date().toISOString(),
|
|
|
|
updatedAt: params.updatedAt ?? new Date().toISOString(),
|
|
|
|
target: params.target ?? 'manual',
|
|
|
|
isPublic: params.isPublic ?? true,
|
|
|
|
isExplorable: params.isExplorable ?? true,
|
|
|
|
asBadge: params.asBadge ?? true,
|
|
|
|
canEditMembersByModerator: params.canEditMembersByModerator ?? false,
|
|
|
|
usersCount: params.usersCount ?? 10,
|
|
|
|
condFormula: {
|
|
|
|
id: '',
|
|
|
|
type: 'or',
|
|
|
|
values: []
|
|
|
|
},
|
|
|
|
policies: {},
|
|
|
|
}
|
|
|
|
}
|
2024-02-23 00:34:26 +00:00
|
|
|
|
|
|
|
export function emoji(params?: {
|
|
|
|
id?: string,
|
|
|
|
name?: string,
|
|
|
|
host?: string,
|
|
|
|
uri?: string,
|
|
|
|
publicUrl?: string,
|
|
|
|
originalUrl?: string,
|
|
|
|
type?: string,
|
|
|
|
aliases?: string[],
|
|
|
|
category?: string,
|
|
|
|
license?: string,
|
|
|
|
isSensitive?: boolean,
|
|
|
|
localOnly?: boolean,
|
|
|
|
roleIdsThatCanBeUsedThisEmojiAsReaction?: {id:string, name:string}[],
|
|
|
|
updatedAt?: string,
|
|
|
|
}): entities.EmojiDetailedAdmin {
|
|
|
|
const id = params?.id ?? new Date().getTime().toString() + text(5);
|
|
|
|
const name = params?.name ?? text(8);
|
|
|
|
|
|
|
|
const image = imageDataUrl()
|
|
|
|
|
|
|
|
return {
|
|
|
|
id: id,
|
|
|
|
name: name,
|
|
|
|
host: params?.host ?? null,
|
|
|
|
uri: params?.uri ?? null,
|
|
|
|
publicUrl: params?.publicUrl ?? image,
|
|
|
|
originalUrl: params?.originalUrl ?? image,
|
|
|
|
type: params?.type ?? 'image/png',
|
|
|
|
aliases: params?.aliases ?? [`alias1-${name}`, `alias2-${name}`],
|
|
|
|
category: params?.category ?? null,
|
|
|
|
license: params?.license ?? null,
|
|
|
|
isSensitive: params?.isSensitive ?? false,
|
|
|
|
localOnly: params?.localOnly ?? false,
|
|
|
|
roleIdsThatCanBeUsedThisEmojiAsReaction: params?.roleIdsThatCanBeUsedThisEmojiAsReaction ?? [],
|
|
|
|
updatedAt: params?.updatedAt ?? new Date().toISOString(),
|
|
|
|
}
|
|
|
|
}
|