mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
yatta
This commit is contained in:
parent
a640a1e4d4
commit
b094260f3c
@ -1,4 +1,4 @@
|
||||
import { IUser } from "../models/user";
|
||||
import { IUser } from '../models/user';
|
||||
|
||||
export default (user: IUser) => {
|
||||
return user.host === null ? user.username : `${user.username}@${user.host}`;
|
||||
|
@ -48,7 +48,7 @@ export default class Replacer {
|
||||
if (error) {
|
||||
console.warn(`key '${key}' not found in '${path}' of '${this.lang}'`);
|
||||
return key; // Fallback
|
||||
} else if (typeof text !== "string") {
|
||||
} else if (typeof text !== 'string') {
|
||||
console.warn(`key '${key}' is not string in '${path}' of '${this.lang}'`);
|
||||
return key; // Fallback
|
||||
} else {
|
||||
|
@ -220,7 +220,7 @@ export const pack = async (
|
||||
hide = false;
|
||||
} else {
|
||||
// 指定されているかどうか
|
||||
const specified = _note.visibleUserIds.some(id => id.equals(meId));
|
||||
const specified = _note.visibleUserIds.some((id: mongo.ObjectID) => id.equals(meId));
|
||||
|
||||
if (specified) {
|
||||
hide = false;
|
||||
@ -272,7 +272,7 @@ export const pack = async (
|
||||
}
|
||||
|
||||
// Populate media
|
||||
_note.media = hide ? [] : Promise.all(_note.mediaIds.map(fileId =>
|
||||
_note.media = hide ? [] : Promise.all(_note.mediaIds.map((fileId: mongo.ObjectID) =>
|
||||
packFile(fileId)
|
||||
));
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as mongo from 'mongodb';
|
||||
const deepcopy = require('deepcopy');
|
||||
import sequential = require('promise-sequential');
|
||||
const sequential = require('promise-sequential');
|
||||
import rap from '@prezzemolo/rap';
|
||||
import db from '../db/mongodb';
|
||||
import Note, { pack as packNote, deleteNote } from './note';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as nopt from 'nopt';
|
||||
|
||||
export default (vector, index) => {
|
||||
export default (vector: any, index: any) => {
|
||||
const parsed = nopt({
|
||||
'only-processor': Boolean,
|
||||
'only-server': Boolean
|
||||
|
@ -11,7 +11,7 @@ if (config.sw) {
|
||||
config.sw.private_key);
|
||||
}
|
||||
|
||||
export default async function(userId: mongo.ObjectID | string, type, body?) {
|
||||
export default async function(userId: mongo.ObjectID | string, type: string, body?: any) {
|
||||
if (!config.sw) return;
|
||||
|
||||
if (typeof userId === 'string') {
|
||||
@ -34,7 +34,7 @@ export default async function(userId: mongo.ObjectID | string, type, body?) {
|
||||
|
||||
push.sendNotification(pushSubscription, JSON.stringify({
|
||||
type, body
|
||||
})).catch(err => {
|
||||
})).catch((err: any) => {
|
||||
//console.log(err.statusCode);
|
||||
//console.log(err.headers);
|
||||
//console.log(err.body);
|
||||
|
@ -12,7 +12,7 @@ const queue = createQueue({
|
||||
}
|
||||
});
|
||||
|
||||
export function createHttp(data) {
|
||||
export function createHttp(data: any) {
|
||||
return queue
|
||||
.create('http', data)
|
||||
.removeOnComplete(true)
|
||||
@ -21,7 +21,7 @@ export function createHttp(data) {
|
||||
.backoff({ delay: 16384, type: 'exponential' });
|
||||
}
|
||||
|
||||
export function deliver(user: ILocalUser, content, to) {
|
||||
export function deliver(user: ILocalUser, content: any, to: any) {
|
||||
createHttp({
|
||||
title: 'deliver',
|
||||
type: 'deliver',
|
||||
|
@ -2,7 +2,7 @@ import * as kue from 'kue';
|
||||
|
||||
import request from '../../../remote/activitypub/request';
|
||||
|
||||
export default async (job: kue.Job, done): Promise<void> => {
|
||||
export default async (job: kue.Job, done: any): Promise<void> => {
|
||||
try {
|
||||
await request(job.data.user, job.data.to, job.data.content);
|
||||
done();
|
||||
|
@ -1,12 +1,12 @@
|
||||
import deliver from './deliver';
|
||||
import processInbox from './process-inbox';
|
||||
|
||||
const handlers = {
|
||||
const handlers: any = {
|
||||
deliver,
|
||||
processInbox,
|
||||
};
|
||||
|
||||
export default (job, done) => {
|
||||
export default (job: any, done: any) => {
|
||||
const handler = handlers[job.data.type];
|
||||
|
||||
if (handler) {
|
||||
|
@ -10,7 +10,7 @@ import { resolvePerson } from '../../../remote/activitypub/models/person';
|
||||
const log = debug('misskey:queue:inbox');
|
||||
|
||||
// ユーザーのinboxにアクティビティが届いた時の処理
|
||||
export default async (job: kue.Job, done): Promise<void> => {
|
||||
export default async (job: kue.Job, done: any): Promise<void> => {
|
||||
const signature = job.data.signature;
|
||||
const activity = job.data.activity;
|
||||
|
||||
@ -22,7 +22,7 @@ export default async (job: kue.Job, done): Promise<void> => {
|
||||
//#endregion
|
||||
|
||||
const keyIdLower = signature.keyId.toLowerCase();
|
||||
let user;
|
||||
let user: IRemoteUser;
|
||||
|
||||
if (keyIdLower.startsWith('acct:')) {
|
||||
const { username, host } = parseAcct(keyIdLower.slice('acct:'.length));
|
||||
@ -36,7 +36,7 @@ export default async (job: kue.Job, done): Promise<void> => {
|
||||
|
||||
// アクティビティを送信してきたユーザーがまだMisskeyサーバーに登録されていなかったら登録する
|
||||
if (user === null) {
|
||||
user = await resolvePerson(activity.actor);
|
||||
user = await resolvePerson(activity.actor) as IRemoteUser;
|
||||
}
|
||||
} else {
|
||||
user = await User.findOne({
|
||||
@ -46,7 +46,7 @@ export default async (job: kue.Job, done): Promise<void> => {
|
||||
|
||||
// アクティビティを送信してきたユーザーがまだMisskeyサーバーに登録されていなかったら登録する
|
||||
if (user === null) {
|
||||
user = await resolvePerson(signature.keyId);
|
||||
user = await resolvePerson(signature.keyId) as IRemoteUser;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ import * as debug from 'debug';
|
||||
import Resolver from '../../resolver';
|
||||
import { IRemoteUser } from '../../../../models/user';
|
||||
import acceptFollow from './follow';
|
||||
import { IAccept } from '../../type';
|
||||
import { IAccept, IFollow } from '../../type';
|
||||
|
||||
const log = debug('misskey:activitypub');
|
||||
|
||||
@ -25,7 +25,7 @@ export default async (actor: IRemoteUser, activity: IAccept): Promise<void> => {
|
||||
|
||||
switch (object.type) {
|
||||
case 'Follow':
|
||||
acceptFollow(actor, object);
|
||||
acceptFollow(actor, object as IFollow);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -3,7 +3,7 @@ import * as debug from 'debug';
|
||||
import Resolver from '../../resolver';
|
||||
import { IRemoteUser } from '../../../../models/user';
|
||||
import announceNote from './note';
|
||||
import { IAnnounce } from '../../type';
|
||||
import { IAnnounce, INote } from '../../type';
|
||||
|
||||
const log = debug('misskey:activitypub');
|
||||
|
||||
@ -25,7 +25,7 @@ export default async (actor: IRemoteUser, activity: IAnnounce): Promise<void> =>
|
||||
|
||||
switch (object.type) {
|
||||
case 'Note':
|
||||
announceNote(resolver, actor, activity, object);
|
||||
announceNote(resolver, actor, activity, object as INote);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2,7 +2,7 @@ import * as debug from 'debug';
|
||||
|
||||
import Resolver from '../../resolver';
|
||||
import post from '../../../../services/note/create';
|
||||
import { IRemoteUser } from '../../../../models/user';
|
||||
import { IRemoteUser, IUser } from '../../../../models/user';
|
||||
import { IAnnounce, INote } from '../../type';
|
||||
import { fetchNote, resolveNote } from '../../models/note';
|
||||
import { resolvePerson } from '../../models/person';
|
||||
@ -36,7 +36,7 @@ export default async function(resolver: Resolver, actor: IRemoteUser, activity:
|
||||
|
||||
//#region Visibility
|
||||
let visibility = 'public';
|
||||
let visibleUsers = [];
|
||||
let visibleUsers: IUser[] = [];
|
||||
if (!note.to.includes('https://www.w3.org/ns/activitystreams#Public')) {
|
||||
if (note.cc.includes('https://www.w3.org/ns/activitystreams#Public')) {
|
||||
visibility = 'home';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { IRemoteUser } from '../../../../models/user';
|
||||
import { createImage } from '../../models/image';
|
||||
|
||||
export default async function(actor: IRemoteUser, image): Promise<void> {
|
||||
export default async function(actor: IRemoteUser, image: any): Promise<void> {
|
||||
await createImage(image.url, actor);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { createNote, fetchNote } from '../../models/note';
|
||||
/**
|
||||
* 投稿作成アクティビティを捌きます
|
||||
*/
|
||||
export default async function(resolver: Resolver, actor: IRemoteUser, note, silent = false): Promise<void> {
|
||||
export default async function(resolver: Resolver, actor: IRemoteUser, note: any, silent = false): Promise<void> {
|
||||
const exist = await fetchNote(note);
|
||||
if (exist == null) {
|
||||
await createNote(note);
|
||||
|
@ -2,11 +2,12 @@ import Resolver from '../../resolver';
|
||||
import deleteNote from './note';
|
||||
import Note from '../../../../models/note';
|
||||
import { IRemoteUser } from '../../../../models/user';
|
||||
import { IDelete } from '../../type';
|
||||
|
||||
/**
|
||||
* 削除アクティビティを捌きます
|
||||
*/
|
||||
export default async (actor: IRemoteUser, activity): Promise<void> => {
|
||||
export default async (actor: IRemoteUser, activity: IDelete): Promise<void> => {
|
||||
if ('actor' in activity && actor.uri !== activity.actor) {
|
||||
throw new Error('invalid actor');
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import * as debug from 'debug';
|
||||
import Resolver from '../../resolver';
|
||||
import { IRemoteUser } from '../../../../models/user';
|
||||
import rejectFollow from './follow';
|
||||
import { IReject } from '../../type';
|
||||
import { IReject, IFollow } from '../../type';
|
||||
|
||||
const log = debug('misskey:activitypub');
|
||||
|
||||
@ -25,7 +25,7 @@ export default async (actor: IRemoteUser, activity: IReject): Promise<void> => {
|
||||
|
||||
switch (object.type) {
|
||||
case 'Follow':
|
||||
rejectFollow(actor, object);
|
||||
rejectFollow(actor, object as IFollow);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as debug from 'debug';
|
||||
|
||||
import { IRemoteUser } from '../../../../models/user';
|
||||
import { IUndo } from '../../type';
|
||||
import { IUndo, IFollow } from '../../type';
|
||||
import unfollow from './follow';
|
||||
import Resolver from '../../resolver';
|
||||
|
||||
@ -29,7 +29,7 @@ export default async (actor: IRemoteUser, activity: IUndo): Promise<void> => {
|
||||
|
||||
switch (object.type) {
|
||||
case 'Follow':
|
||||
unfollow(actor, object);
|
||||
unfollow(actor, object as IFollow);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { INote } from "../../../models/note";
|
||||
import { INote } from '../../../models/note';
|
||||
import toHtml from '../../../text/html';
|
||||
import parse from '../../../text/parse';
|
||||
import config from '../../../config';
|
||||
|
@ -10,7 +10,7 @@ const log = debug('misskey:activitypub');
|
||||
/**
|
||||
* Imageを作成します。
|
||||
*/
|
||||
export async function createImage(actor: IRemoteUser, value): Promise<IDriveFile> {
|
||||
export async function createImage(actor: IRemoteUser, value: any): Promise<IDriveFile> {
|
||||
// 投稿者が凍結されていたらスキップ
|
||||
if (actor.isSuspended) {
|
||||
return null;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as mongo from 'mongodb';
|
||||
import * as parse5 from 'parse5';
|
||||
const parse5 = require('parse5');
|
||||
import * as debug from 'debug';
|
||||
|
||||
import config from '../../../config';
|
||||
@ -9,30 +9,30 @@ import post from '../../../services/note/create';
|
||||
import { INote as INoteActivityStreamsObject, IObject } from '../type';
|
||||
import { resolvePerson, updatePerson } from './person';
|
||||
import { resolveImage } from './image';
|
||||
import { IRemoteUser } from '../../../models/user';
|
||||
import { IRemoteUser, IUser } from '../../../models/user';
|
||||
|
||||
const log = debug('misskey:activitypub');
|
||||
|
||||
function parse(html: string): string {
|
||||
const dom = parse5.parseFragment(html) as parse5.AST.Default.Document;
|
||||
const dom = parse5.parseFragment(html);
|
||||
|
||||
let text = '';
|
||||
|
||||
dom.childNodes.forEach(n => analyze(n));
|
||||
dom.childNodes.forEach((n: any) => analyze(n));
|
||||
|
||||
return text.trim();
|
||||
|
||||
function getText(node) {
|
||||
function getText(node: any) {
|
||||
if (node.nodeName == '#text') return node.value;
|
||||
|
||||
if (node.childNodes) {
|
||||
return node.childNodes.map(n => getText(n)).join('');
|
||||
return node.childNodes.map((n: any) => getText(n)).join('');
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function analyze(node) {
|
||||
function analyze(node: any) {
|
||||
switch (node.nodeName) {
|
||||
case '#text':
|
||||
text += node.value;
|
||||
@ -51,7 +51,7 @@ function parse(html: string): string {
|
||||
|
||||
if (part.length == 2) {
|
||||
//#region ホスト名部分が省略されているので復元する
|
||||
const href = new URL(node.attrs.find(x => x.name == 'href').value);
|
||||
const href = new URL(node.attrs.find((x: any) => x.name == 'href').value);
|
||||
const acct = txt + '@' + href.hostname;
|
||||
text += acct;
|
||||
break;
|
||||
@ -63,20 +63,20 @@ function parse(html: string): string {
|
||||
}
|
||||
|
||||
if (node.childNodes) {
|
||||
node.childNodes.forEach(n => analyze(n));
|
||||
node.childNodes.forEach((n: any) => analyze(n));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
text += '\n\n';
|
||||
if (node.childNodes) {
|
||||
node.childNodes.forEach(n => analyze(n));
|
||||
node.childNodes.forEach((n: any) => analyze(n));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (node.childNodes) {
|
||||
node.childNodes.forEach(n => analyze(n));
|
||||
node.childNodes.forEach((n: any) => analyze(n));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -135,7 +135,7 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
|
||||
|
||||
//#region Visibility
|
||||
let visibility = 'public';
|
||||
let visibleUsers = [];
|
||||
let visibleUsers: IUser[] = [];
|
||||
if (!note.to.includes('https://www.w3.org/ns/activitystreams#Public')) {
|
||||
if (note.cc.includes('https://www.w3.org/ns/activitystreams#Public')) {
|
||||
visibility = 'home';
|
||||
|
@ -1,4 +1,4 @@
|
||||
export default object => ({
|
||||
export default (object: any) => ({
|
||||
type: 'Accept',
|
||||
object
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
export default object => ({
|
||||
export default (object: any) => ({
|
||||
type: 'Announce',
|
||||
object
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
export default object => ({
|
||||
export default (object: any) => ({
|
||||
type: 'Create',
|
||||
object
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
export default object => ({
|
||||
export default (object: any) => ({
|
||||
type: 'Delete',
|
||||
object
|
||||
});
|
||||
|
@ -1,7 +1,8 @@
|
||||
import config from '../../../config';
|
||||
import { IDriveFile } from '../../../models/drive-file';
|
||||
|
||||
export default ({ _id, contentType }) => ({
|
||||
export default (file: IDriveFile) => ({
|
||||
type: 'Document',
|
||||
mediaType: contentType,
|
||||
url: `${config.drive_url}/${_id}`
|
||||
mediaType: file.contentType,
|
||||
url: `${config.drive_url}/${file._id}`
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
import config from '../../../config';
|
||||
import { IDriveFile } from '../../../models/drive-file';
|
||||
|
||||
export default ({ _id }) => ({
|
||||
export default (fileId: IDriveFile['_id']) => ({
|
||||
type: 'Image',
|
||||
url: `${config.drive_url}/${_id}`
|
||||
url: `${config.drive_url}/${fileId}`
|
||||
});
|
||||
|
@ -1,7 +1,8 @@
|
||||
import config from '../../../config';
|
||||
import { ILocalUser } from '../../../models/user';
|
||||
import { INote } from '../../../models/note';
|
||||
|
||||
export default (user: ILocalUser, note, reaction: string) => ({
|
||||
export default (user: ILocalUser, note: INote, reaction: string) => ({
|
||||
type: 'Like',
|
||||
actor: `${config.url}/users/${user._id}`,
|
||||
object: note.uri ? note.uri : `${config.url}/notes/${note._id}`,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IUser, isRemoteUser } from "../../../models/user";
|
||||
import config from "../../../config";
|
||||
import { IUser, isRemoteUser } from '../../../models/user';
|
||||
import config from '../../../config';
|
||||
|
||||
export default (mention: IUser) => ({
|
||||
type: 'Mention',
|
||||
|
@ -2,13 +2,13 @@ import renderDocument from './document';
|
||||
import renderHashtag from './hashtag';
|
||||
import renderMention from './mention';
|
||||
import config from '../../../config';
|
||||
import DriveFile from '../../../models/drive-file';
|
||||
import DriveFile, { IDriveFile } from '../../../models/drive-file';
|
||||
import Note, { INote } from '../../../models/note';
|
||||
import User from '../../../models/user';
|
||||
import toHtml from '../misc/get-note-html';
|
||||
|
||||
export default async function renderNote(note: INote, dive = true) {
|
||||
const promisedFiles = note.mediaIds
|
||||
export default async function renderNote(note: INote, dive = true): Promise<any> {
|
||||
const promisedFiles: Promise<IDriveFile[]> = note.mediaIds
|
||||
? DriveFile.find({ _id: { $in: note.mediaIds } })
|
||||
: Promise.resolve([]);
|
||||
|
||||
|
@ -16,8 +16,8 @@ export default (user: ILocalUser) => {
|
||||
preferredUsername: user.username,
|
||||
name: user.name,
|
||||
summary: user.description,
|
||||
icon: user.avatarId && renderImage({ _id: user.avatarId }),
|
||||
image: user.bannerId && renderImage({ _id: user.bannerId }),
|
||||
icon: user.avatarId && renderImage(user.avatarId),
|
||||
image: user.bannerId && renderImage(user.bannerId),
|
||||
manuallyApprovesFollowers: user.isLocked,
|
||||
publicKey: renderKey(user)
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
export default object => ({
|
||||
export default (object: any) => ({
|
||||
type: 'Undo',
|
||||
object
|
||||
});
|
||||
|
@ -12,7 +12,7 @@ export default class Resolver {
|
||||
this.history = new Set();
|
||||
}
|
||||
|
||||
public async resolveCollection(value) {
|
||||
public async resolveCollection(value: any) {
|
||||
const collection = typeof value === 'string'
|
||||
? await this.resolve(value)
|
||||
: value;
|
||||
@ -33,7 +33,7 @@ export default class Resolver {
|
||||
return collection;
|
||||
}
|
||||
|
||||
public async resolve(value): Promise<IObject> {
|
||||
public async resolve(value: any): Promise<IObject> {
|
||||
if (value == null) {
|
||||
throw new Error('resolvee is null (or undefined)');
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import webFinger from './webfinger';
|
||||
import config from '../config';
|
||||
import { createPerson } from './activitypub/models/person';
|
||||
|
||||
export default async (username, _host, option?): Promise<IUser> => {
|
||||
export default async (username: string, _host: string, option?: any): Promise<IUser> => {
|
||||
const usernameLower = username.toLowerCase();
|
||||
|
||||
if (_host == null) {
|
||||
|
@ -49,13 +49,13 @@ module.exports = (params: any) => new Promise(async (res, rej) => {
|
||||
} }
|
||||
]);
|
||||
|
||||
datas.forEach(data => {
|
||||
datas.forEach((data: any) => {
|
||||
data.date = data._id;
|
||||
delete data._id;
|
||||
|
||||
data.notes = (data.data.filter(x => x.type == 'note')[0] || { count: 0 }).count;
|
||||
data.renotes = (data.data.filter(x => x.type == 'renote')[0] || { count: 0 }).count;
|
||||
data.replies = (data.data.filter(x => x.type == 'reply')[0] || { count: 0 }).count;
|
||||
data.notes = (data.data.filter((x: any) => x.type == 'note')[0] || { count: 0 }).count;
|
||||
data.renotes = (data.data.filter((x: any) => x.type == 'renote')[0] || { count: 0 }).count;
|
||||
data.replies = (data.data.filter((x: any) => x.type == 'reply')[0] || { count: 0 }).count;
|
||||
|
||||
delete data.data;
|
||||
});
|
||||
@ -65,7 +65,7 @@ module.exports = (params: any) => new Promise(async (res, rej) => {
|
||||
for (let i = 0; i < limit; i++) {
|
||||
const day = new Date(new Date().setDate(new Date().getDate() - i));
|
||||
|
||||
const data = datas.filter(d =>
|
||||
const data = datas.filter((d: any) =>
|
||||
d.date.year == day.getFullYear() && d.date.month == day.getMonth() + 1 && d.date.day == day.getDate()
|
||||
)[0];
|
||||
|
||||
|
@ -4,11 +4,12 @@
|
||||
import $ from 'cafy'; import ID from '../../../../../cafy-id';
|
||||
import { pack } from '../../../../../models/drive-file';
|
||||
import uploadFromUrl from '../../../../../services/drive/upload-from-url';
|
||||
import { ILocalUser } from '../../../../../models/user';
|
||||
|
||||
/**
|
||||
* Create a file from a URL
|
||||
*/
|
||||
module.exports = async (params, user): Promise<any> => {
|
||||
module.exports = async (params: any, user: ILocalUser): Promise<any> => {
|
||||
// Get 'url' parameter
|
||||
// TODO: Validate this url
|
||||
const [url, urlErr] = $.str.get(params.url);
|
||||
|
@ -1,13 +1,11 @@
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
|
||||
import DriveFolder, { pack } from '../../../../models/drive-folder';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
|
||||
/**
|
||||
* Get drive folders
|
||||
*/
|
||||
module.exports = (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
|
||||
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
@ -1,4 +1,4 @@
|
||||
import DriveFile, { DriveFileChunk, IDriveFile } from "../../models/drive-file";
|
||||
import DriveFile, { DriveFileChunk, IDriveFile } from '../../models/drive-file';
|
||||
import DriveFileThumbnail, { DriveFileThumbnailChunk } from '../../models/drive-file-thumbnail';
|
||||
|
||||
export default async function(file: IDriveFile, isExpired = false) {
|
||||
|
@ -9,7 +9,7 @@ import { IDriveFile, validateFileName } from '../../models/drive-file';
|
||||
import create from './add-file';
|
||||
import config from '../../config';
|
||||
import { IUser } from '../../models/user';
|
||||
import * as mongodb from "mongodb";
|
||||
import * as mongodb from 'mongodb';
|
||||
|
||||
const log = debug('misskey:drive:upload-from-url');
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import User, { IUser } from "../../../models/user";
|
||||
import FollowRequest from "../../../models/follow-request";
|
||||
import User, { IUser } from '../../../models/user';
|
||||
import FollowRequest from '../../../models/follow-request';
|
||||
import accept from './accept';
|
||||
|
||||
/**
|
||||
|
@ -1,12 +1,12 @@
|
||||
import User, { IUser, isRemoteUser, ILocalUser, pack as packUser } from "../../../models/user";
|
||||
import FollowRequest from "../../../models/follow-request";
|
||||
import User, { IUser, isRemoteUser, ILocalUser, pack as packUser } from '../../../models/user';
|
||||
import FollowRequest from '../../../models/follow-request';
|
||||
import pack from '../../../remote/activitypub/renderer';
|
||||
import renderFollow from '../../../remote/activitypub/renderer/follow';
|
||||
import renderAccept from '../../../remote/activitypub/renderer/accept';
|
||||
import { deliver } from '../../../queue';
|
||||
import Following from "../../../models/following";
|
||||
import FollowingLog from "../../../models/following-log";
|
||||
import FollowedLog from "../../../models/followed-log";
|
||||
import Following from '../../../models/following';
|
||||
import FollowingLog from '../../../models/following-log';
|
||||
import FollowedLog from '../../../models/followed-log';
|
||||
import event from '../../../publishers/stream';
|
||||
|
||||
export default async function(followee: IUser, follower: IUser) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import User, { IUser, isRemoteUser, ILocalUser, pack as packUser } from "../../../models/user";
|
||||
import FollowRequest from "../../../models/follow-request";
|
||||
import User, { IUser, isRemoteUser, ILocalUser, pack as packUser } from '../../../models/user';
|
||||
import FollowRequest from '../../../models/follow-request';
|
||||
import pack from '../../../remote/activitypub/renderer';
|
||||
import renderFollow from '../../../remote/activitypub/renderer/follow';
|
||||
import renderUndo from '../../../remote/activitypub/renderer/undo';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import User, { IUser, isRemoteUser, ILocalUser } from "../../../models/user";
|
||||
import FollowRequest from "../../../models/follow-request";
|
||||
import User, { IUser, isRemoteUser, ILocalUser } from '../../../models/user';
|
||||
import FollowRequest from '../../../models/follow-request';
|
||||
import pack from '../../../remote/activitypub/renderer';
|
||||
import renderFollow from '../../../remote/activitypub/renderer/follow';
|
||||
import renderReject from '../../../remote/activitypub/renderer/reject';
|
||||
|
@ -4,7 +4,7 @@ import config from '../config';
|
||||
import { INote } from '../models/note';
|
||||
import { TextElement } from './parse';
|
||||
|
||||
const handlers: {[key: string]: (window: any, token: any, mentionedRemoteUsers: INote["mentionedRemoteUsers"]) => void} = {
|
||||
const handlers: { [key: string]: (window: any, token: any, mentionedRemoteUsers: INote['mentionedRemoteUsers']) => void } = {
|
||||
bold({ document }, { bold }) {
|
||||
const b = document.createElement('b');
|
||||
b.textContent = bold;
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
export type TextElementBold = {
|
||||
type: "bold"
|
||||
type: 'bold'
|
||||
content: string
|
||||
bold: string
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
import genHtml from '../core/syntax-highlighter';
|
||||
|
||||
export type TextElementCode = {
|
||||
type: "code"
|
||||
type: 'code'
|
||||
content: string
|
||||
code: string
|
||||
html: string
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
export type TextElementEmoji = {
|
||||
type: "emoji"
|
||||
type: 'emoji'
|
||||
content: string
|
||||
emoji: string
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
export type TextElementHashtag = {
|
||||
type: "hashtag"
|
||||
type: 'hashtag'
|
||||
content: string
|
||||
hashtag: string
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
import genHtml from '../core/syntax-highlighter';
|
||||
|
||||
export type TextElementInlineCode = {
|
||||
type: "inline-code"
|
||||
type: 'inline-code'
|
||||
content: string
|
||||
code: string
|
||||
html: string
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
export type TextElementLink = {
|
||||
type: "link"
|
||||
type: 'link'
|
||||
content: string
|
||||
title: string
|
||||
url: string
|
||||
|
@ -4,7 +4,7 @@
|
||||
import parseAcct from '../../../acct/parse';
|
||||
|
||||
export type TextElementMention = {
|
||||
type: "mention"
|
||||
type: 'mention'
|
||||
content: string
|
||||
username: string
|
||||
host: string
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
export type TextElementQuote = {
|
||||
type: "quote"
|
||||
type: 'quote'
|
||||
content: string
|
||||
quote: string
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
export type TextElementSearch = {
|
||||
type: "search"
|
||||
type: 'search'
|
||||
content: string
|
||||
query: string
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
export type TextElementTitle = {
|
||||
type: "title"
|
||||
type: 'title'
|
||||
content: string
|
||||
title: string
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
export type TextElementUrl = {
|
||||
type: "url"
|
||||
type: 'url'
|
||||
content: string
|
||||
url: string
|
||||
};
|
||||
|
@ -2,17 +2,17 @@
|
||||
* Misskey Text Analyzer
|
||||
*/
|
||||
|
||||
import { TextElementBold } from "./elements/bold";
|
||||
import { TextElementCode } from "./elements/code";
|
||||
import { TextElementEmoji } from "./elements/emoji";
|
||||
import { TextElementHashtag } from "./elements/hashtag";
|
||||
import { TextElementInlineCode } from "./elements/inline-code";
|
||||
import { TextElementLink } from "./elements/link";
|
||||
import { TextElementMention } from "./elements/mention";
|
||||
import { TextElementQuote } from "./elements/quote";
|
||||
import { TextElementSearch } from "./elements/search";
|
||||
import { TextElementTitle } from "./elements/title";
|
||||
import { TextElementUrl } from "./elements/url";
|
||||
import { TextElementBold } from './elements/bold';
|
||||
import { TextElementCode } from './elements/code';
|
||||
import { TextElementEmoji } from './elements/emoji';
|
||||
import { TextElementHashtag } from './elements/hashtag';
|
||||
import { TextElementInlineCode } from './elements/inline-code';
|
||||
import { TextElementLink } from './elements/link';
|
||||
import { TextElementMention } from './elements/mention';
|
||||
import { TextElementQuote } from './elements/quote';
|
||||
import { TextElementSearch } from './elements/search';
|
||||
import { TextElementTitle } from './elements/title';
|
||||
import { TextElementUrl } from './elements/url';
|
||||
|
||||
const elements = [
|
||||
require('./elements/bold'),
|
||||
@ -28,7 +28,7 @@ const elements = [
|
||||
require('./elements/search')
|
||||
].map(element => element.default as TextElementProcessor);
|
||||
|
||||
export type TextElement = {type: "text", content: string}
|
||||
export type TextElement = { type: 'text', content: string }
|
||||
| TextElementBold
|
||||
| TextElementCode
|
||||
| TextElementEmoji
|
||||
|
Loading…
Reference in New Issue
Block a user