Merge pull request #5670 from pixelfed/staging

Staging
This commit is contained in:
daniel 2025-02-03 17:02:17 -07:00 committed by GitHub
commit 4d68580da4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 9 additions and 41 deletions

View file

@ -90,7 +90,7 @@ class FixUsernames extends Command
break; break;
case $opts[1]: 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) { if(strlen($new) < 6) {
$new = $new . '_' . str_random(4); $new = $new . '_' . str_random(4);
} }

View file

@ -44,7 +44,7 @@ class StoreStatusEditRequest extends FormRequest
public function rules(): array public function rules(): array
{ {
return [ 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', 'spoiler_text' => 'nullable|string|max:140',
'sensitive' => 'sometimes|boolean', 'sensitive' => 'sometimes|boolean',
'media_ids' => [ 'media_ids' => [

View file

@ -90,7 +90,6 @@ class AdminStatsService
protected static function additionalData() protected static function additionalData()
{ {
$day = config('database.default') == 'pgsql' ? 'DATE_PART(\'day\',' : 'day(';
$ttl = now()->addHours(24); $ttl = now()->addHours(24);
return Cache::remember('admin:dashboard:home:data:v0:24hr', $ttl, function () { return Cache::remember('admin:dashboard:home:data:v0:24hr', $ttl, function () {
@ -99,8 +98,8 @@ class AdminStatsService
'statuses' => PrettyNumber::convert(intval(StatusService::totalLocalStatuses())), 'statuses' => PrettyNumber::convert(intval(StatusService::totalLocalStatuses())),
'statuses_monthly' => PrettyNumber::convert(Status::where('created_at', '>', now()->subMonth())->count()), 'statuses_monthly' => PrettyNumber::convert(Status::where('created_at', '>', now()->subMonth())->count()),
'profiles' => PrettyNumber::convert(Profile::count()), 'profiles' => PrettyNumber::convert(Profile::count()),
'users' => PrettyNumber::convert(User::count()), 'users' => PrettyNumber::convert(User::whereNull('status')->count()),
'users_monthly' => PrettyNumber::convert(User::where('created_at', '>', now()->subMonth())->count()), 'users_monthly' => PrettyNumber::convert(User::where('created_at', '>', now()->subMonth())->whereNull('status')->count()),
'instances' => PrettyNumber::convert(Instance::count()), 'instances' => PrettyNumber::convert(Instance::count()),
'media' => PrettyNumber::convert(Media::count()), 'media' => PrettyNumber::convert(Media::count()),
'storage' => Media::sum('size'), 'storage' => Media::sum('size'),
@ -116,7 +115,7 @@ class AdminStatsService
return [ return [
'statuses' => PrettyNumber::convert(intval(StatusService::totalLocalStatuses())), 'statuses' => PrettyNumber::convert(intval(StatusService::totalLocalStatuses())),
'profiles' => PrettyNumber::convert(Profile::count()), 'profiles' => PrettyNumber::convert(Profile::count()),
'users' => PrettyNumber::convert(User::count()), 'users' => PrettyNumber::convert(User::whereNull('status')->count()),
'instances' => PrettyNumber::convert(Instance::count()), 'instances' => PrettyNumber::convert(Instance::count()),
]; ];
}); });

View file

@ -85,7 +85,9 @@ class MediaStorageService
protected function localToCloud($media) protected function localToCloud($media)
{ {
$path = storage_path('app/'.$media->media_path); $path = storage_path('app/'.$media->media_path);
if ($media->thumbnail_path) {
$thumb = storage_path('app/'.$media->thumbnail_path); $thumb = storage_path('app/'.$media->thumbnail_path);
}
$p = explode('/', $media->media_path); $p = explode('/', $media->media_path);
$name = array_pop($p); $name = array_pop($p);
@ -94,7 +96,7 @@ class MediaStorageService
$storagePath = implode('/', $p); $storagePath = implode('/', $p);
$url = ResilientMediaStorageService::store($storagePath, $path, $name); $url = ResilientMediaStorageService::store($storagePath, $path, $name);
if ($thumb) { if ($media->thumbnail_path) {
$thumbUrl = ResilientMediaStorageService::store($storagePath, $thumb, $thumbname); $thumbUrl = ResilientMediaStorageService::store($storagePath, $thumb, $thumbname);
$media->thumbnail_url = $thumbUrl; $media->thumbnail_url = $thumbUrl;
} }

View file

@ -75,13 +75,6 @@ class AccountTransformer extends Fractal\TransformerAbstract
'location' => $profile->location, '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; return $res;
} }

View file

@ -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) { formatCount(val) {
return App.util.format.count(val); return App.util.format.count(val);
}, },