diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 9b6c85f73..f82277782 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -3,9 +3,11 @@ namespace App\Http\Controllers; use App\AccountLog; - +use App\Following; +use App\UserFilter; use Auth; use DB; +use Cache; use Illuminate\Http\Request; use App\Http\Controllers\Settings\{ HomeSettings, @@ -69,6 +71,50 @@ class SettingsController extends Controller return view('settings.dataexport'); } + public function exportFollowing() + { + $data = Cache::remember('account:export:profile:following:'.Auth::user()->profile->id, 1440, function() { + return Auth::user()->profile->following()->get()->map(function($i) { + return $i->url(); + }); + }); + return response()->streamDownload(function () use($data) { + echo $data; + }, 'following.json'); + } + + public function exportFollowers() + { + $data = Cache::remember('account:export:profile:followers:'.Auth::user()->profile->id, 1440, function() { + return Auth::user()->profile->followers()->get()->map(function($i) { + return $i->url(); + }); + }); + return response()->streamDownload(function () use($data) { + echo $data; + }, 'followers.json'); + } + + public function exportMuteBlockList() + { + $profile = Auth::user()->profile; + $exists = UserFilter::select('id') + ->whereUserId($profile->id) + ->exists(); + if(!$exists) { + return redirect()->back(); + } + $data = Cache::remember('account:export:profile:muteblocklist:'.Auth::user()->profile->id, 1440, function() use($profile) { + return json_encode([ + 'muted' => $profile->mutedProfileUrls(), + 'blocked' => $profile->blockedProfileUrls() + ], JSON_PRETTY_PRINT); + }); + return response()->streamDownload(function () use($data) { + echo $data; + }, 'muted-and-blocked-accounts.json'); + } + public function dataImport() { return view('settings.import.home'); diff --git a/resources/views/admin/home.blade.php b/resources/views/admin/home.blade.php index e96459040..5cc59d605 100644 --- a/resources/views/admin/home.blade.php +++ b/resources/views/admin/home.blade.php @@ -24,8 +24,8 @@
-

{{App\Util\Lexer\PrettyNumber::convert(App\Status::whereLocal(true)->count())}}

-

Local Statuses

+

{{App\Util\Lexer\PrettyNumber::convert(DB::table('failed_jobs')->where('failed_at', '>=', \Carbon\Carbon::now()->subDay())->count())}}

+

Failed Jobs (24h)

@@ -33,8 +33,36 @@
-

{{App\Util\Lexer\PrettyNumber::convert(App\Status::count())}}

-

All Statuses

+

{{App\Util\Lexer\PrettyNumber::convert(App\Report::whereNull('admin_seen')->count())}}

+

Reports

+
+
+
+ + +
+
+
+
+

{{App\Util\Lexer\PrettyNumber::convert(App\Status::whereNull('in_reply_to_id')->whereNull('reblog_of_id')->count())}}

+

Statuses

+
+
+
+ +
+
+
+

{{App\Util\Lexer\PrettyNumber::convert(App\Status::whereNotNull('in_reply_to_id')->count())}}

+

Replies

+
+
+
+
+
+
+

{{App\Util\Lexer\PrettyNumber::convert(App\Status::whereNotNull('reblog_of_id')->count())}}

+

Shares (Reblogs)

@@ -87,7 +115,6 @@
- @php($filesum = filesize(storage_path('app/public/m/')))