From 9c834518310d843c61503b013bb781bdeb1054bc Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 21 Apr 2019 23:38:06 -0600 Subject: [PATCH 1/8] Update UserDelete command --- app/Console/Commands/UserDelete.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/UserDelete.php b/app/Console/Commands/UserDelete.php index a11c7d750..8d03c8fde 100644 --- a/app/Console/Commands/UserDelete.php +++ b/app/Console/Commands/UserDelete.php @@ -67,6 +67,6 @@ class UserDelete extends Command $profile->save(); $user->save(); - DeleteAccountPipeline::dispatchNow($user); + DeleteAccountPipeline::dispatch($user)->onQueue('high'); } } From fae385989e71438b42057ef0f29820c844da9aad Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 21 Apr 2019 23:38:34 -0600 Subject: [PATCH 2/8] Update DeleteAccountPipeline --- app/Jobs/DeletePipeline/DeleteAccountPipeline.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Jobs/DeletePipeline/DeleteAccountPipeline.php b/app/Jobs/DeletePipeline/DeleteAccountPipeline.php index ba036e51a..bcb02fe99 100644 --- a/app/Jobs/DeletePipeline/DeleteAccountPipeline.php +++ b/app/Jobs/DeletePipeline/DeleteAccountPipeline.php @@ -8,6 +8,7 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use DB; +use Illuminate\Support\Str; use App\{ AccountLog, Activity, @@ -74,11 +75,15 @@ class DeleteAccountPipeline implements ShouldQueue $avatar = $user->profile->avatar; if(is_file($avatar->media_path)) { - unlink($avatar->media_path); + if($avatar->media_path != 'public/avatars/default.png') { + unlink($avatar->media_path); + } } if(is_file($avatar->thumb_path)) { - unlink($avatar->thumb_path); + if($avatar->thumb_path != 'public/avatars/default.png') { + unlink($avatar->thumb_path); + } } $avatar->forceDelete(); } From f1edf83af4f58ab52d099e1fe8afa75f75eab0c8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 21 Apr 2019 23:39:00 -0600 Subject: [PATCH 3/8] Update SettingsController --- app/Http/Controllers/SettingsController.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 66f684164..264ab3939 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -6,7 +6,7 @@ use App\AccountLog; use App\Following; use App\Report; use App\UserFilter; -use Auth, DB, Cache, Purify; +use Auth, Cookie, DB, Cache, Purify; use Carbon\Carbon; use Illuminate\Http\Request; use App\Http\Controllers\Settings\{ @@ -176,7 +176,7 @@ class SettingsController extends Controller $profile->save(); Cache::forget('profiles:private'); Auth::logout(); - DeleteAccountPipeline::dispatch($user); + DeleteAccountPipeline::dispatch($user)->onQueue('high'); return redirect('/'); } @@ -192,5 +192,22 @@ class SettingsController extends Controller $reports = Report::whereProfileId($profile->id)->orderByDesc('created_at')->paginate(10); return view('settings.reports', compact('reports')); } + + public function metroDarkMode(Request $request) + { + $this->validate($request, [ + 'mode' => 'required|string|in:light,dark' + ]); + + $mode = $request->input('mode'); + + if($mode == 'dark') { + $cookie = Cookie::make('dark-mode', true, 43800); + } else { + $cookie = Cookie::forget('dark-mode'); + } + + return response()->json([200])->cookie($cookie); + } } From efab7a9ba00b8bc58df0c697c3c06ab3c5929de9 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 21 Apr 2019 23:40:54 -0600 Subject: [PATCH 4/8] Update app layout --- resources/views/layouts/app.blade.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index b5fd60f62..ef9b714a0 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -24,7 +24,11 @@ + @if(request()->cookie('dark-mode')) + + @else + @endif @stack('styles') From ca4c556a9390ee78b8936f950f17bbc486bde23b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 21 Apr 2019 23:42:37 -0600 Subject: [PATCH 5/8] Update Timeline, add persistent dark mode --- resources/assets/js/components/Timeline.vue | 30 ++++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index 22f05e5c3..db52aa34a 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -374,6 +374,10 @@ }, mounted() { + if($('link[data-stylesheet="dark"]').length != 0) { + this.modes.dark = true; + } + this.$nextTick(function () { $('[data-toggle="tooltip"]').tooltip() }); @@ -810,17 +814,23 @@ modeDarkToggle() { // todo: more graceful stylesheet change if(this.modes.dark == true) { - this.modes.dark = false; - $('link[data-stylesheet=dark]').remove(); + axios.post('/i/metro/dark-mode', { + mode: 'light' + }).then(res => { + $('link[data-stylesheet=dark]') + .attr('data-stylesheet', 'light') + .attr('href', '/css/app.css?v=' + Date.now()); + this.modes.dark = false; + }); } else { - this.modes.dark = true; - let head = document.head; - let link = document.createElement("link"); - link.type = "text/css"; - link.rel = "stylesheet"; - link.href = "/css/appdark.css"; - link.setAttribute('data-stylesheet','dark'); - head.appendChild(link); + axios.post('/i/metro/dark-mode', { + mode: 'dark' + }).then(res => { + $('link[data-stylesheet=light]') + .attr('data-stylesheet', 'dark') + .attr('href', '/css/appdark.css?v=' + Date.now()); + this.modes.dark = true; + }); } window.ls.set('pixelfed-classicui-settings', this.modes); }, From 557c0251ffb2dbabcf78d6496c3cb9d713abbb27 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 21 Apr 2019 23:43:06 -0600 Subject: [PATCH 6/8] Update compiled assets --- public/js/timeline.js | Bin 59613 -> 59810 bytes public/mix-manifest.json | Bin 845 -> 845 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/public/js/timeline.js b/public/js/timeline.js index a6f8884a3ae2da60dc3237bf5901eb73a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J54jsx(gYxTGO#*VeJ zy{(QTMW+3xq@BjRQ7o>3459E7qcE%>eqlLWMG&Jc z>$gw6bXg_vtAov`=wAodhzMQ?a_LU;0LE?_qQ3;A_X$?bkL~xK%-_1DfuHYgn2V+ z#1KcaQHFq0Y!3wC5lcL2G&MyypmXSh-AC&?iJBwWpQAd;P5;V8o``;bi8O`#I(CYZ zKoJF{o#?{0qyBYY!k3@sm{zM$1l`i5a0*DYGB|g1r8v7SO<9`Vld!`$j%_Goc*k}I z4WYCY0bzoJ44!&BOa{6fssKDyZ`-(jH~?e=OL!e>JGuFNdUWNd;pPyw{v`; z_>7T~)#DVy_sA=QcHVG){fdQfyg}{8_bT!DVk6QOUkI~dop^Ppz|(OOT$NbR91>8% zb3BArzkS?`2`NYn9p!0dFmRlCu-C|PljvR1jCIc=uWLH(^RCZiyQL@t$7m8o)1&R^ z(N9O+bNCbQr3prGoR}Ep-u`*?Xakw;OiD83fmyT7YbUzqVZ+oAVmKgriB)!TSXhVC z3ax<5a`)NjY{`M)G{z2x^*!k_>ZGb9$@> zhd=HY4p!}=*vfcJ;4h=_O!|99AHv|-%@&K5Wl2hJX}fqXsyhpf`L zwJM!@d31l&<(=4E{G7QmfhMtGH>3YwY}PAa>3D6C>V_TTJnfS$cxasSULK!}*j6iaZMWxt DY^m^q diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 70fdaeed3fd02bd41c0cde7bbd170e5bb56e06ea..200cdbb20216d228421a6fd08c40ae6d8e47a316 100644 GIT binary patch delta 32 ncmX@hc9v~}DYHbPscEXYd6H>jlBtogc}l85Vq%&SS1lI+qp%4? delta 32 ncmX@hc9v~}DYJxyX>v-cxn-JRvPn{kQEF Date: Sun, 21 Apr 2019 23:43:33 -0600 Subject: [PATCH 7/8] Bump version to v0.9.1 --- config/pixelfed.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/pixelfed.php b/config/pixelfed.php index f1111e843..90f85d5e1 100644 --- a/config/pixelfed.php +++ b/config/pixelfed.php @@ -23,7 +23,7 @@ return [ | This value is the version of your PixelFed instance. | */ - 'version' => '0.9.0', + 'version' => '0.9.1', /* |-------------------------------------------------------------------------- From 6d9c30e79158efd340d5387929409c4959703d47 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 21 Apr 2019 23:44:02 -0600 Subject: [PATCH 8/8] Update web routes --- routes/web.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/routes/web.php b/routes/web.php index 88b2852c5..167c688db 100644 --- a/routes/web.php +++ b/routes/web.php @@ -134,6 +134,8 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::get('results', 'SearchController@results'); Route::post('visibility', 'StatusController@toggleVisibility'); + Route::post('metro/dark-mode', 'SettingsController@metroDarkMode'); + Route::group(['prefix' => 'report'], function () { Route::get('/', 'ReportController@showForm')->name('report.form'); Route::post('/', 'ReportController@formStore'); @@ -222,10 +224,10 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact }); Route::get('applications', 'SettingsController@applications')->name('settings.applications')->middleware('dangerzone'); - Route::get('data-export', 'SettingsController@dataExport')->name('settings.dataexport'); - Route::post('data-export/following', 'SettingsController@exportFollowing'); - Route::post('data-export/followers', 'SettingsController@exportFollowers'); - Route::post('data-export/mute-block-list', 'SettingsController@exportMuteBlockList'); + Route::get('data-export', 'SettingsController@dataExport')->name('settings.dataexport')->middleware('dangerzone'); + Route::post('data-export/following', 'SettingsController@exportFollowing')->middleware('dangerzone'); + Route::post('data-export/followers', 'SettingsController@exportFollowers')->middleware('dangerzone'); + Route::post('data-export/mute-block-list', 'SettingsController@exportMuteBlockList')->middleware('dangerzone'); Route::get('developers', 'SettingsController@developers')->name('settings.developers')->middleware('dangerzone'); });