mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +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)
|
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()
|
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 [
|
return [
|
||||||
'contact' => [
|
'contact' => [
|
||||||
'count' => PrettyNumber::convert(Contact::whereNull('read_at')->count()),
|
'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' => [
|
'failedjobs' => [
|
||||||
'count' => PrettyNumber::convert(FailedJob::where('failed_at', '>=', \Carbon\Carbon::now()->subDay())->count()),
|
'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' => [
|
'reports' => [
|
||||||
'count' => PrettyNumber::convert(Report::whereNull('admin_seen')->count()),
|
'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' => [
|
'statuses' => [
|
||||||
'count' => PrettyNumber::convert(Status::whereNull('in_reply_to_id')->whereNull('reblog_of_id')->count()),
|
'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()),
|
'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')
|
'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' => [
|
'users' => [
|
||||||
'count' => PrettyNumber::convert(User::count()),
|
'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')
|
'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'));
|
return view('admin.home', compact('data'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -900,7 +900,14 @@ class ApiV1Controller extends Controller
|
||||||
'title' => 'Pixelfed (' . config('pixelfed.domain.app') . ')',
|
'title' => 'Pixelfed (' . config('pixelfed.domain.app') . ')',
|
||||||
'uri' => config('app.url'),
|
'uri' => config('app.url'),
|
||||||
'urls' => [],
|
'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);
|
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))
|
if($request->session()->has('2fa.session.active') !== true && !$request->is($checkpoint))
|
||||||
{
|
{
|
||||||
return redirect('/i/auth/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');
|
$request->session()->pull('2fa.attempts');
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,11 +307,8 @@ class Inbox
|
||||||
$id = $this->payload['object']['id'];
|
$id = $this->payload['object']['id'];
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'Person':
|
case 'Person':
|
||||||
$profile = Profile::whereNull('domain')
|
$profile = Helpers::profileFetch($actor);
|
||||||
->whereNull('private_key')
|
if(!$profile || $profile->private_key != null) {
|
||||||
->whereRemoteUrl($id)
|
|
||||||
->first();
|
|
||||||
if(!$profile) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Notification::whereActorId($profile->id)->delete();
|
Notification::whereActorId($profile->id)->delete();
|
||||||
|
@ -326,11 +323,18 @@ class Inbox
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Tombstone':
|
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) {
|
if(!$status) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$status->media->delete();
|
$status->media()->delete();
|
||||||
|
$status->likes()->delete();
|
||||||
|
$status->shares()->delete();
|
||||||
$status->delete();
|
$status->delete();
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -110,7 +110,8 @@
|
||||||
<div class="media-body">
|
<div class="media-body">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="font-weight-bold text-muted small d-none">Caption</label>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -474,9 +475,11 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
mediaDragAndDrop() {
|
mediaDragAndDrop() {
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
let pdz = document.getElementById('content');
|
let pdz = document.getElementById('content');
|
||||||
|
|
||||||
|
|
||||||
function allowDrag(e) {
|
function allowDrag(e) {
|
||||||
e.dataTransfer.dropEffect = 'copy';
|
e.dataTransfer.dropEffect = 'copy';
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -484,10 +487,10 @@ export default {
|
||||||
|
|
||||||
function handleDrop(e) {
|
function handleDrop(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let dz = document.querySelector('#pf-dz');
|
// let dz = document.querySelector('#pf-dz');
|
||||||
dz.files = e.dataTransfer.files;
|
// dz.files = e.dataTransfer.files;
|
||||||
$('#composeModal').modal('show');
|
// $('#composeModal').modal('show');
|
||||||
self.mediaUpload();
|
// self.mediaUpload();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('dragenter', function(e) {
|
window.addEventListener('dragenter', function(e) {
|
||||||
|
|
Loading…
Reference in a new issue