mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-02-06 20:00:48 +00:00
commit
4d68580da4
6 changed files with 9 additions and 41 deletions
|
@ -90,7 +90,7 @@ class FixUsernames extends Command
|
|||
break;
|
||||
|
||||
case $opts[1]:
|
||||
$new = filter_var($old, FILTER_SANITIZE_STRING|FILTER_FLAG_STRIP_LOW);
|
||||
$new = htmlspecialchars($old, ENT_QUOTES, 'UTF-8');
|
||||
if(strlen($new) < 6) {
|
||||
$new = $new . '_' . str_random(4);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class StoreStatusEditRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'status' => 'sometimes|max:'.config('pixelfed.max_caption_length', 500),
|
||||
'status' => 'sometimes|max:'.config_cache('pixelfed.max_caption_length', 500),
|
||||
'spoiler_text' => 'nullable|string|max:140',
|
||||
'sensitive' => 'sometimes|boolean',
|
||||
'media_ids' => [
|
||||
|
|
|
@ -90,7 +90,6 @@ class AdminStatsService
|
|||
|
||||
protected static function additionalData()
|
||||
{
|
||||
$day = config('database.default') == 'pgsql' ? 'DATE_PART(\'day\',' : 'day(';
|
||||
$ttl = now()->addHours(24);
|
||||
|
||||
return Cache::remember('admin:dashboard:home:data:v0:24hr', $ttl, function () {
|
||||
|
@ -99,8 +98,8 @@ class AdminStatsService
|
|||
'statuses' => PrettyNumber::convert(intval(StatusService::totalLocalStatuses())),
|
||||
'statuses_monthly' => PrettyNumber::convert(Status::where('created_at', '>', now()->subMonth())->count()),
|
||||
'profiles' => PrettyNumber::convert(Profile::count()),
|
||||
'users' => PrettyNumber::convert(User::count()),
|
||||
'users_monthly' => PrettyNumber::convert(User::where('created_at', '>', now()->subMonth())->count()),
|
||||
'users' => PrettyNumber::convert(User::whereNull('status')->count()),
|
||||
'users_monthly' => PrettyNumber::convert(User::where('created_at', '>', now()->subMonth())->whereNull('status')->count()),
|
||||
'instances' => PrettyNumber::convert(Instance::count()),
|
||||
'media' => PrettyNumber::convert(Media::count()),
|
||||
'storage' => Media::sum('size'),
|
||||
|
@ -116,7 +115,7 @@ class AdminStatsService
|
|||
return [
|
||||
'statuses' => PrettyNumber::convert(intval(StatusService::totalLocalStatuses())),
|
||||
'profiles' => PrettyNumber::convert(Profile::count()),
|
||||
'users' => PrettyNumber::convert(User::count()),
|
||||
'users' => PrettyNumber::convert(User::whereNull('status')->count()),
|
||||
'instances' => PrettyNumber::convert(Instance::count()),
|
||||
];
|
||||
});
|
||||
|
|
|
@ -85,7 +85,9 @@ class MediaStorageService
|
|||
protected function localToCloud($media)
|
||||
{
|
||||
$path = storage_path('app/'.$media->media_path);
|
||||
if ($media->thumbnail_path) {
|
||||
$thumb = storage_path('app/'.$media->thumbnail_path);
|
||||
}
|
||||
|
||||
$p = explode('/', $media->media_path);
|
||||
$name = array_pop($p);
|
||||
|
@ -94,7 +96,7 @@ class MediaStorageService
|
|||
$storagePath = implode('/', $p);
|
||||
|
||||
$url = ResilientMediaStorageService::store($storagePath, $path, $name);
|
||||
if ($thumb) {
|
||||
if ($media->thumbnail_path) {
|
||||
$thumbUrl = ResilientMediaStorageService::store($storagePath, $thumb, $thumbname);
|
||||
$media->thumbnail_url = $thumbUrl;
|
||||
}
|
||||
|
|
|
@ -75,13 +75,6 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
|||
'location' => $profile->location,
|
||||
];
|
||||
|
||||
if ($profile->moved_to_profile_id) {
|
||||
$mt = AccountService::getMastodon($profile->moved_to_profile_id, true);
|
||||
if ($mt) {
|
||||
$res['moved'] = $mt;
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
|
|
@ -846,32 +846,6 @@
|
|||
})
|
||||
},
|
||||
|
||||
handleBookmark(index) {
|
||||
let p = this.feed[index];
|
||||
|
||||
if(p.reblog) {
|
||||
p = p.reblog;
|
||||
}
|
||||
|
||||
axios.post('/i/bookmark', {
|
||||
item: p.id
|
||||
})
|
||||
.then(res => {
|
||||
if(this.feed[index].reblog) {
|
||||
this.feed[index].reblog.bookmarked = !p.bookmarked;
|
||||
} else {
|
||||
this.feed[index].bookmarked = !p.bookmarked;
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$bvToast.toast('Cannot bookmark post at this time.', {
|
||||
title: 'Bookmark Error',
|
||||
variant: 'danger',
|
||||
autoHideDelay: 5000
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
formatCount(val) {
|
||||
return App.util.format.count(val);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue