summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/models
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-06-18 14:28:43 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-06-18 14:28:43 +0900
commite66d7babc5ae477d7a60628e5599f9c390426c81 (patch)
tree84733fc7b2a158e6d5786ccd72a58e40c301f140 /src/remote/activitypub/models
parentwip (diff)
downloadmisskey-e66d7babc5ae477d7a60628e5599f9c390426c81.tar.gz
misskey-e66d7babc5ae477d7a60628e5599f9c390426c81.tar.bz2
misskey-e66d7babc5ae477d7a60628e5599f9c390426c81.zip
yatta
Diffstat (limited to 'src/remote/activitypub/models')
-rw-r--r--src/remote/activitypub/models/image.ts2
-rw-r--r--src/remote/activitypub/models/note.ts24
2 files changed, 13 insertions, 13 deletions
diff --git a/src/remote/activitypub/models/image.ts b/src/remote/activitypub/models/image.ts
index 0d5a690c6c..fb17a7c9e5 100644
--- a/src/remote/activitypub/models/image.ts
+++ b/src/remote/activitypub/models/image.ts
@@ -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;
diff --git a/src/remote/activitypub/models/note.ts b/src/remote/activitypub/models/note.ts
index 974fce433b..b0fe045e6d 100644
--- a/src/remote/activitypub/models/note.ts
+++ b/src/remote/activitypub/models/note.ts
@@ -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';