mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 17:53:16 +00:00
Add custom content warnings for remote posts
This commit is contained in:
parent
85b537346a
commit
6afc61a409
3 changed files with 12 additions and 5 deletions
|
@ -552,6 +552,7 @@ class PublicApiController extends Controller
|
||||||
'reblogs_count',
|
'reblogs_count',
|
||||||
'scope',
|
'scope',
|
||||||
'local',
|
'local',
|
||||||
|
'cw_summary',
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at'
|
'updated_at'
|
||||||
)->whereProfileId($profile->id)
|
)->whereProfileId($profile->id)
|
||||||
|
|
|
@ -327,6 +327,8 @@ class Helpers {
|
||||||
$status->is_nsfw = $cw;
|
$status->is_nsfw = $cw;
|
||||||
$status->scope = $scope;
|
$status->scope = $scope;
|
||||||
$status->visibility = $scope;
|
$status->visibility = $scope;
|
||||||
|
$status->cw_summary = $cw == true && isset($res['summary']) ?
|
||||||
|
Purify::clean(strip_tags($res['summary'])) : null;
|
||||||
$status->save();
|
$status->save();
|
||||||
if($reply_to == null) {
|
if($reply_to == null) {
|
||||||
self::importNoteAttachment($res, $status);
|
self::importNoteAttachment($res, $status);
|
||||||
|
@ -404,7 +406,8 @@ class Helpers {
|
||||||
if(empty($username)) {
|
if(empty($username)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$remoteUsername = "@{$username}@{$domain}";
|
$remoteUsername = $username;
|
||||||
|
$webfinger = "@{$username}@{$domain}";
|
||||||
|
|
||||||
abort_if(!self::validateUrl($res['inbox']), 400);
|
abort_if(!self::validateUrl($res['inbox']), 400);
|
||||||
abort_if(!self::validateUrl($res['id']), 400);
|
abort_if(!self::validateUrl($res['id']), 400);
|
||||||
|
@ -422,6 +425,8 @@ class Helpers {
|
||||||
$profile->remote_url = strtolower($res['id']);
|
$profile->remote_url = strtolower($res['id']);
|
||||||
$profile->public_key = $res['publicKey']['publicKeyPem'];
|
$profile->public_key = $res['publicKey']['publicKeyPem'];
|
||||||
$profile->key_id = $res['publicKey']['id'];
|
$profile->key_id = $res['publicKey']['id'];
|
||||||
|
$profile->webfinger = strtolower(Purify::clean($webfinger));
|
||||||
|
$profile->last_fetched_at = now();
|
||||||
$profile->save();
|
$profile->save();
|
||||||
if($runJobs == true) {
|
if($runJobs == true) {
|
||||||
// RemoteFollowImportRecent::dispatch($res, $profile);
|
// RemoteFollowImportRecent::dispatch($res, $profile);
|
||||||
|
|
|
@ -73,16 +73,16 @@
|
||||||
<div v-if="status.sensitive == true">
|
<div v-if="status.sensitive == true">
|
||||||
<details class="details-animated" @click="status.sensitive = false;">
|
<details class="details-animated" @click="status.sensitive = false;">
|
||||||
<summary>
|
<summary>
|
||||||
<p class="mb-0 lead font-weight-bold">CW / NSFW / Hidden Media</p>
|
<p class="mb-0 lead font-weight-bold">{{status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media'}}</p>
|
||||||
<p class="font-weight-light">(click to show)</p>
|
<p class="font-weight-light">(click to show)</p>
|
||||||
</summary>
|
</summary>
|
||||||
<a :href="status.url">
|
<a :href="remotePostUrl(status)">
|
||||||
<img v-once :src="status.thumb" class="w-100 h-100">
|
<img v-once :src="status.thumb" class="w-100 h-100">
|
||||||
</a>
|
</a>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<a :href="status.url">
|
<a :href="remotePostUrl(status)">
|
||||||
<img v-once :src="status.thumb" class="w-100 h-100">
|
<img v-once :src="status.thumb" class="w-100 h-100">
|
||||||
</a>
|
</a>
|
||||||
<button v-if="status.cw == true && status.sensitive == false" class="btn btn-block btn-primary font-weight-bold rounded-0" @click="status.sensitive = true;">Hide Media</button>
|
<button v-if="status.cw == true && status.sensitive == false" class="btn btn-block btn-primary font-weight-bold rounded-0" @click="status.sensitive = true;">Hide Media</button>
|
||||||
|
@ -241,7 +241,8 @@
|
||||||
type: status.pf_type,
|
type: status.pf_type,
|
||||||
url: status.url,
|
url: status.url,
|
||||||
sensitive: status.sensitive,
|
sensitive: status.sensitive,
|
||||||
cw: status.sensitive
|
cw: status.sensitive,
|
||||||
|
spoiler_text: status.spoiler_text
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let ids = data.map(status => status.id);
|
let ids = data.map(status => status.id);
|
||||||
|
|
Loading…
Reference in a new issue