forked from mirror/pixelfed
Merge pull request #1171 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
36929de8da
|
@ -67,6 +67,6 @@ class UserDelete extends Command
|
|||
$profile->save();
|
||||
$user->save();
|
||||
|
||||
DeleteAccountPipeline::dispatchNow($user);
|
||||
DeleteAccountPipeline::dispatch($user)->onQueue('high');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ return [
|
|||
| This value is the version of your PixelFed instance.
|
||||
|
|
||||
*/
|
||||
'version' => '0.9.0',
|
||||
'version' => '0.9.1',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,5 +11,5 @@
|
|||
"/js/profile.js": "/js/profile.js?id=bf431aa6387f69c6a91d",
|
||||
"/js/search.js": "/js/search.js?id=0d3d080dc05f4f49b204",
|
||||
"/js/status.js": "/js/status.js?id=0b11c2129b9ebdb0eddf",
|
||||
"/js/timeline.js": "/js/timeline.js?id=85cde79f1c4bd2eeb6e5"
|
||||
"/js/timeline.js": "/js/timeline.js?id=a55e77b5ab5237de0aaf"
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
|
|
|
@ -24,7 +24,11 @@
|
|||
<link rel="shortcut icon" type="image/png" href="/img/favicon.png?v=2">
|
||||
<link rel="apple-touch-icon" type="image/png" href="/img/favicon.png?v=2">
|
||||
<link rel="canonical" href="{{request()->url()}}">
|
||||
@if(request()->cookie('dark-mode'))
|
||||
<link href="{{ mix('css/appdark.css') }}" rel="stylesheet" data-stylesheet="dark">
|
||||
@else
|
||||
<link href="{{ mix('css/app.css') }}" rel="stylesheet" data-stylesheet="light">
|
||||
@endif
|
||||
@stack('styles')
|
||||
|
||||
</head>
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue