* wip

* wip

* wip

* wip

* wip

* Update define.ts

* Update update.ts

* Update user.ts

* wip

* wip

* Update request.ts

* URL

* wip

* wip

* wip

* wip

* Update invite.ts

* Update create.ts
This commit is contained in:
syuilo
2021-03-24 11:05:37 +09:00
committed by GitHub
parent 62cc14c93b
commit ce340aba7a
109 changed files with 252 additions and 201 deletions

View File

@@ -1,7 +1,7 @@
import config from '@/config';
import { ILocalUser } from '../../../models/entities/user';
import { User } from '../../../models/entities/user';
export default (object: any, user: ILocalUser) => ({
export default (object: any, user: { id: User['id']; host: null }) => ({
type: 'Delete',
actor: `${config.url}/users/${user.id}`,
object

View File

@@ -2,7 +2,7 @@ import config from '@/config';
import { User } from '../../../models/entities/user';
import { Users } from '../../../models';
export default (follower: User, followee: User, requestId?: string) => {
export default (follower: { id: User['id']; host: User['host']; uri: User['host'] }, followee: { id: User['id']; host: User['host']; uri: User['host'] }, requestId?: string) => {
const follow = {
type: 'Follow',
actor: Users.isLocalUser(follower) ? `${config.url}/users/${follower.id}` : follower.uri,

View File

@@ -2,8 +2,8 @@ import config from '@/config';
import { v4 as uuid } from 'uuid';
import { IActivity } from '../type';
import { LdSignature } from '../misc/ld-signature';
import { ILocalUser } from '../../../models/entities/user';
import { getUserKeypair } from '@/misc/keypair-store';
import { User } from '@/models/entities/user';
export const renderActivity = (x: any): IActivity | null => {
if (x == null) return null;
@@ -20,7 +20,7 @@ export const renderActivity = (x: any): IActivity | null => {
}, x);
};
export const attachLdSignature = async (activity: any, user: ILocalUser): Promise<IActivity | null> => {
export const attachLdSignature = async (activity: any, user: { id: User['id']; host: null; }): Promise<IActivity | null> => {
if (activity == null) return null;
const keypair = await getUserKeypair(user.id);

View File

@@ -1,3 +1,4 @@
import { URL } from 'url';
import renderImage from './image';
import renderKey from './key';
import config from '@/config';

View File

@@ -1,9 +1,9 @@
import config from '@/config';
import { ILocalUser } from '../../../models/entities/user';
import { User } from '@/models/entities/user';
import { Note } from '../../../models/entities/note';
import { Poll } from '../../../models/entities/poll';
export default async function renderQuestion(user: ILocalUser, note: Note, poll: Poll) {
export default async function renderQuestion(user: { id: User['id'] }, note: Note, poll: Poll) {
const question = {
type: 'Question',
id: `${config.url}/questions/${note.id}`,

View File

@@ -1,8 +1,8 @@
import config from '@/config';
import { ILocalUser } from '../../../models/entities/user';
import { User } from '@/models/entities/user';
import { MessagingMessage } from '../../../models/entities/messaging-message';
export const renderReadActivity = (user: ILocalUser, message: MessagingMessage) => ({
export const renderReadActivity = (user: { id: User['id'] }, message: MessagingMessage) => ({
type: 'Read',
actor: `${config.url}/users/${user.id}`,
object: message.uri

View File

@@ -1,7 +1,7 @@
import config from '@/config';
import { ILocalUser } from '../../../models/entities/user';
import { User } from '@/models/entities/user';
export default (object: any, user: ILocalUser) => ({
export default (object: any, user: { id: User['id'] }) => ({
type: 'Reject',
actor: `${config.url}/users/${user.id}`,
object

View File

@@ -1,7 +1,7 @@
import config from '@/config';
import { ILocalUser } from '../../../models/entities/user';
import { User } from '@/models/entities/user';
export default (user: ILocalUser, target: any, object: any) => ({
export default (user: { id: User['id'] }, target: any, object: any) => ({
type: 'Remove',
actor: `${config.url}/users/${user.id}`,
target,

View File

@@ -1,7 +1,7 @@
import config from '@/config';
import { ILocalUser, User } from '../../../models/entities/user';
export default (object: any, user: ILocalUser | User) => ({
export default (object: any, user: { id: User['id'] }) => ({
type: 'Undo',
actor: `${config.url}/users/${user.id}`,
object

View File

@@ -1,7 +1,7 @@
import config from '@/config';
import { ILocalUser } from '../../../models/entities/user';
import { User } from '@/models/entities/user';
export default (object: any, user: ILocalUser) => {
export default (object: any, user: { id: User['id'] }) => {
const activity = {
id: `${config.url}/users/${user.id}#updates/${new Date().getTime()}`,
actor: `${config.url}/users/${user.id}`,

View File

@@ -1,10 +1,10 @@
import config from '@/config';
import { Note } from '../../../models/entities/note';
import { IRemoteUser, ILocalUser } from '../../../models/entities/user';
import { IRemoteUser, User } from '../../../models/entities/user';
import { PollVote } from '../../../models/entities/poll-vote';
import { Poll } from '../../../models/entities/poll';
export default async function renderVote(user: ILocalUser, vote: PollVote, note: Note, poll: Poll, pollOwner: IRemoteUser): Promise<any> {
export default async function renderVote(user: { id: User['id'] }, vote: PollVote, note: Note, poll: Poll, pollOwner: IRemoteUser): Promise<any> {
return {
id: `${config.url}/users/${user.id}#votes/${vote.id}/activity`,
actor: `${config.url}/users/${user.id}`,