mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
commit
26c47a0d3a
6 changed files with 43 additions and 20 deletions
|
@ -38,4 +38,5 @@ Matrix](https://matrix.to/#/#freenode_#pixelfed:matrix.org))
|
|||
|
||||
We would like to extend our thanks to the following sponsors for funding Pixelfed development. If you are interested in becoming a sponsor, please visit the Pixelfed [Patreon Page](https://www.patreon.com/dansup/overview)
|
||||
|
||||
- [<img src="https://td-misc-public.s3.amazonaws.com/OscillasLogo.png" width="100px">](https://oscillas.com/)
|
||||
- [<img src="https://td-misc-public.s3.amazonaws.com/OscillasLogo.png" width="100px">](https://oscillas.com/)
|
||||
- Managed Pixelfed Hosting by [Spacebear](https://app.spacebear.ee/)
|
|
@ -45,20 +45,21 @@ class AdminController extends Controller
|
|||
|
||||
public function home()
|
||||
{
|
||||
$data = Cache::remember('admin:dashboard:home:data', now()->addMinutes(15), function() {
|
||||
$day = config('database.default') == 'pgsql' ? 'DATE_PART(\'day\',' : 'day(';
|
||||
$day = config('database.default') == 'pgsql' ? 'DATE_PART(\'day\',' : 'day(';
|
||||
|
||||
$recent = Cache::remember('admin:dashboard:home:data:15min', now()->addMinutes(15), function() use ($day) {
|
||||
return [
|
||||
'contact' => [
|
||||
'count' => PrettyNumber::convert(Contact::whereNull('read_at')->count()),
|
||||
'graph' => Contact::selectRaw('count(*) as count, '.$day.'created_at) as day')->whereNull('read_at')->whereBetween('created_at',[now()->subDays(14), now()])->groupBy('day')->orderBy('day')->pluck('count')
|
||||
'graph' => Contact::selectRaw('count(*) as count, '.$day.'created_at) as d')->groupBy('d')->whereNull('read_at')->whereBetween('created_at',[now()->subDays(14), now()])->orderBy('d')->pluck('count')
|
||||
],
|
||||
'failedjobs' => [
|
||||
'count' => PrettyNumber::convert(FailedJob::where('failed_at', '>=', \Carbon\Carbon::now()->subDay())->count()),
|
||||
'graph' => FailedJob::selectRaw('count(*) as count, '.$day.'failed_at) as d')->groupBy('d')->whereBetween('failed_at',[now()->subDays(24), now()])->orderBy('d')->pluck('count')
|
||||
'graph' => FailedJob::selectRaw('count(*) as count, '.$day.'failed_at) as d')->groupBy('d')->whereBetween('failed_at',[now()->subDays(14), now()])->orderBy('d')->pluck('count')
|
||||
],
|
||||
'reports' => [
|
||||
'count' => PrettyNumber::convert(Report::whereNull('admin_seen')->count()),
|
||||
'graph' => Report::selectRaw('count(*) as count, '.$day.'created_at) as day')->whereBetween('created_at',[now()->subDays(14), now()])->groupBy('day')->orderBy('day')->pluck('count')
|
||||
'graph' => Report::selectRaw('count(*) as count, '.$day.'created_at) as d')->whereBetween('created_at',[now()->subDays(14), now()])->groupBy('d')->orderBy('d')->pluck('count')
|
||||
],
|
||||
'statuses' => [
|
||||
'count' => PrettyNumber::convert(Status::whereNull('in_reply_to_id')->whereNull('reblog_of_id')->count()),
|
||||
|
@ -80,6 +81,11 @@ class AdminController extends Controller
|
|||
'count' => PrettyNumber::convert(Profile::count()),
|
||||
'graph' => Profile::selectRaw('count(*) as count, '.$day.'created_at) as day')->whereBetween('created_at',[now()->subDays(14), now()])->groupBy('day')->orderBy('day')->pluck('count')
|
||||
],
|
||||
];
|
||||
});
|
||||
|
||||
$longer = Cache::remember('admin:dashboard:home:data:24hr', now()->addHours(24), function() use ($day) {
|
||||
return [
|
||||
'users' => [
|
||||
'count' => PrettyNumber::convert(User::count()),
|
||||
'graph' => User::selectRaw('count(*) as count, '.$day.'created_at) as day')->whereBetween('created_at',[now()->subDays(14), now()])->groupBy('day')->orderBy('day')->pluck('count')
|
||||
|
@ -98,6 +104,8 @@ class AdminController extends Controller
|
|||
]
|
||||
];
|
||||
});
|
||||
|
||||
$data = array_merge($recent, $longer);
|
||||
return view('admin.home', compact('data'));
|
||||
}
|
||||
|
||||
|
|
|
@ -900,7 +900,14 @@ class ApiV1Controller extends Controller
|
|||
'title' => 'Pixelfed (' . config('pixelfed.domain.app') . ')',
|
||||
'uri' => config('app.url'),
|
||||
'urls' => [],
|
||||
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') . ')'
|
||||
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') . ')',
|
||||
'environment' => [
|
||||
'max_photo_size' => config('pixelfed.max_photo_size'),
|
||||
'max_avatar_size' => config('pixelfed.max_avatar_size'),
|
||||
'max_caption_length' => config('pixelfed.max_caption_length'),
|
||||
'max_bio_length' => config('pixelfed.max_bio_length'),
|
||||
'max_album_length' => config('pixelfed.max_album_length')
|
||||
]
|
||||
];
|
||||
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class TwoFactorAuth
|
|||
if($request->session()->has('2fa.session.active') !== true && !$request->is($checkpoint))
|
||||
{
|
||||
return redirect('/i/auth/checkpoint');
|
||||
} elseif($request->session()->has('2fa.attempts') || (int) $request->session()->get('2fa.attempts') > 3) {
|
||||
} elseif($request->session()->has('2fa.attempts') && (int) $request->session()->get('2fa.attempts') > 3) {
|
||||
$request->session()->pull('2fa.attempts');
|
||||
Auth::logout();
|
||||
}
|
||||
|
|
|
@ -307,11 +307,8 @@ class Inbox
|
|||
$id = $this->payload['object']['id'];
|
||||
switch ($type) {
|
||||
case 'Person':
|
||||
$profile = Profile::whereNull('domain')
|
||||
->whereNull('private_key')
|
||||
->whereRemoteUrl($id)
|
||||
->first();
|
||||
if(!$profile) {
|
||||
$profile = Helpers::profileFetch($actor);
|
||||
if(!$profile || $profile->private_key != null) {
|
||||
return;
|
||||
}
|
||||
Notification::whereActorId($profile->id)->delete();
|
||||
|
@ -326,11 +323,18 @@ class Inbox
|
|||
break;
|
||||
|
||||
case 'Tombstone':
|
||||
$status = Status::whereUri($id)->orWhere('object_url', $id)->first();
|
||||
$profile = Helpers::profileFetch($actor);
|
||||
$status = Status::whereProfileId($profile->id)
|
||||
->whereUri($id)
|
||||
->orWhere('url', $id)
|
||||
->orWhere('object_url', $id)
|
||||
->first();
|
||||
if(!$status) {
|
||||
return;
|
||||
}
|
||||
$status->media->delete();
|
||||
$status->media()->delete();
|
||||
$status->likes()->delete();
|
||||
$status->shares()->delete();
|
||||
$status->delete();
|
||||
return;
|
||||
break;
|
||||
|
|
|
@ -110,7 +110,8 @@
|
|||
<div class="media-body">
|
||||
<div class="form-group">
|
||||
<label class="font-weight-bold text-muted small d-none">Caption</label>
|
||||
<textarea class="form-control border-0 rounded-0 no-focus" rows="2" placeholder="Write a caption..." style="resize:none" v-model="composeText"></textarea>
|
||||
<textarea class="form-control border-0 rounded-0 no-focus" rows="2" placeholder="Write a caption..." style="resize:none" v-model="composeText" v-on:keyup="composeTextLength = composeText.length"></textarea>
|
||||
<p class="help-text small text-right text-muted mb-0">{{composeTextLength}}/{{config.uploader.max_caption_length}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -474,9 +475,11 @@ export default {
|
|||
},
|
||||
|
||||
mediaDragAndDrop() {
|
||||
|
||||
let self = this;
|
||||
let pdz = document.getElementById('content');
|
||||
|
||||
|
||||
function allowDrag(e) {
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
e.preventDefault();
|
||||
|
@ -484,10 +487,10 @@ export default {
|
|||
|
||||
function handleDrop(e) {
|
||||
e.preventDefault();
|
||||
let dz = document.querySelector('#pf-dz');
|
||||
dz.files = e.dataTransfer.files;
|
||||
$('#composeModal').modal('show');
|
||||
self.mediaUpload();
|
||||
// let dz = document.querySelector('#pf-dz');
|
||||
// dz.files = e.dataTransfer.files;
|
||||
// $('#composeModal').modal('show');
|
||||
// self.mediaUpload();
|
||||
}
|
||||
|
||||
window.addEventListener('dragenter', function(e) {
|
||||
|
|
Loading…
Reference in a new issue