diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-28 11:16:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-28 11:16:08 +0100 |
commit | da854ddd502cd70685ef779c673b9e63757b8aa0 (patch) | |
tree | 21501d170cceaa044a5f23449cbd2eb47fd6415d /server/helpers | |
parent | f40bbe3146553ef45515ee6b6d93ce6028f045ca (diff) | |
download | PeerTube-da854ddd502cd70685ef779c673b9e63757b8aa0.tar.gz PeerTube-da854ddd502cd70685ef779c673b9e63757b8aa0.tar.zst PeerTube-da854ddd502cd70685ef779c673b9e63757b8aa0.zip |
Propagate old comment on new follow
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/custom-validators/activitypub/actor.ts | 3 | ||||
-rw-r--r-- | server/helpers/custom-validators/activitypub/announce.ts | 1 | ||||
-rw-r--r-- | server/helpers/custom-validators/activitypub/index.ts | 8 | ||||
-rw-r--r-- | server/helpers/index.ts | 9 | ||||
-rw-r--r-- | server/helpers/requests.ts | 8 | ||||
-rw-r--r-- | server/helpers/webfinger.ts | 2 |
6 files changed, 10 insertions, 21 deletions
diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.ts index ec8da3350..630bace30 100644 --- a/server/helpers/custom-validators/activitypub/actor.ts +++ b/server/helpers/custom-validators/activitypub/actor.ts | |||
@@ -46,7 +46,8 @@ function isActorPrivateKeyValid (privateKey: string) { | |||
46 | } | 46 | } |
47 | 47 | ||
48 | function isRemoteActorValid (remoteActor: any) { | 48 | function isRemoteActorValid (remoteActor: any) { |
49 | return isActivityPubUrlValid(remoteActor.id) && | 49 | return exists(remoteActor) && |
50 | isActivityPubUrlValid(remoteActor.id) && | ||
50 | isActorTypeValid(remoteActor.type) && | 51 | isActorTypeValid(remoteActor.type) && |
51 | isActivityPubUrlValid(remoteActor.following) && | 52 | isActivityPubUrlValid(remoteActor.following) && |
52 | isActivityPubUrlValid(remoteActor.followers) && | 53 | isActivityPubUrlValid(remoteActor.followers) && |
diff --git a/server/helpers/custom-validators/activitypub/announce.ts b/server/helpers/custom-validators/activitypub/announce.ts index 1baea4f60..7dd1d6988 100644 --- a/server/helpers/custom-validators/activitypub/announce.ts +++ b/server/helpers/custom-validators/activitypub/announce.ts | |||
@@ -2,7 +2,6 @@ import { isActivityPubUrlValid, isBaseActivityValid } from './misc' | |||
2 | import { isVideoTorrentCreateActivityValid } from './videos' | 2 | import { isVideoTorrentCreateActivityValid } from './videos' |
3 | 3 | ||
4 | function isAnnounceActivityValid (activity: any) { | 4 | function isAnnounceActivityValid (activity: any) { |
5 | console.log(activity) | ||
6 | return isBaseActivityValid(activity, 'Announce') && | 5 | return isBaseActivityValid(activity, 'Announce') && |
7 | ( | 6 | ( |
8 | isVideoTorrentCreateActivityValid(activity.object) || | 7 | isVideoTorrentCreateActivityValid(activity.object) || |
diff --git a/server/helpers/custom-validators/activitypub/index.ts b/server/helpers/custom-validators/activitypub/index.ts deleted file mode 100644 index ba411f1c6..000000000 --- a/server/helpers/custom-validators/activitypub/index.ts +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | export * from './actor' | ||
2 | export * from './activity' | ||
3 | export * from './misc' | ||
4 | export * from './signature' | ||
5 | export * from './undo' | ||
6 | export * from './video-channels' | ||
7 | export * from './videos' | ||
8 | export * from './view' | ||
diff --git a/server/helpers/index.ts b/server/helpers/index.ts deleted file mode 100644 index d96bc48e9..000000000 --- a/server/helpers/index.ts +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | export * from './activitypub' | ||
2 | export * from './core-utils' | ||
3 | export * from './logger' | ||
4 | export * from './ffmpeg-utils' | ||
5 | export * from './database-utils' | ||
6 | export * from './peertube-crypto' | ||
7 | export * from './requests' | ||
8 | export * from './utils' | ||
9 | export * from './webfinger' | ||
diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts index 4b1deeadc..ce185a2c0 100644 --- a/server/helpers/requests.ts +++ b/server/helpers/requests.ts | |||
@@ -1,8 +1,14 @@ | |||
1 | import * as Promise from 'bluebird' | 1 | import * as Promise from 'bluebird' |
2 | import { createWriteStream } from 'fs' | 2 | import { createWriteStream } from 'fs' |
3 | import * as request from 'request' | 3 | import * as request from 'request' |
4 | import { ACTIVITY_PUB } from '../initializers' | ||
5 | |||
6 | function doRequest (requestOptions: request.CoreOptions & request.UriOptions & { activityPub?: boolean }) { | ||
7 | if (requestOptions.activityPub === true) { | ||
8 | if (!Array.isArray(requestOptions.headers)) requestOptions.headers = {} | ||
9 | requestOptions.headers['accept'] = ACTIVITY_PUB.ACCEPT_HEADER | ||
10 | } | ||
4 | 11 | ||
5 | function doRequest (requestOptions: request.CoreOptions & request.UriOptions) { | ||
6 | return new Promise<{ response: request.RequestResponse, body: any }>((res, rej) => { | 12 | return new Promise<{ response: request.RequestResponse, body: any }>((res, rej) => { |
7 | request(requestOptions, (err, response, body) => err ? rej(err) : res({ response, body })) | 13 | request(requestOptions, (err, response, body) => err ? rej(err) : res({ response, body })) |
8 | }) | 14 | }) |
diff --git a/server/helpers/webfinger.ts b/server/helpers/webfinger.ts index 76444fbe3..de8d52c9b 100644 --- a/server/helpers/webfinger.ts +++ b/server/helpers/webfinger.ts | |||
@@ -2,7 +2,7 @@ import * as WebFinger from 'webfinger.js' | |||
2 | import { WebFingerData } from '../../shared' | 2 | import { WebFingerData } from '../../shared' |
3 | import { ActorModel } from '../models/activitypub/actor' | 3 | import { ActorModel } from '../models/activitypub/actor' |
4 | import { isTestInstance } from './core-utils' | 4 | import { isTestInstance } from './core-utils' |
5 | import { isActivityPubUrlValid } from './custom-validators/activitypub' | 5 | import { isActivityPubUrlValid } from './custom-validators/activitypub/misc' |
6 | 6 | ||
7 | const webfinger = new WebFinger({ | 7 | const webfinger = new WebFinger({ |
8 | webfist_fallback: false, | 8 | webfist_fallback: false, |