From aca16c9d0b9131855d2d46df1b57998b71b2dc5b Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Mon, 13 Mar 2017 16:18:15 +0000 Subject: [PATCH] Add a config display page for the micropub client --- app/Http/Controllers/MicropubClientController.php | 14 ++++++++++++++ resources/views/micropub/config.blade.php | 14 ++++++++++++++ resources/views/micropub/create.blade.php | 1 + routes/web.php | 1 + 4 files changed, 30 insertions(+) create mode 100644 resources/views/micropub/config.blade.php diff --git a/app/Http/Controllers/MicropubClientController.php b/app/Http/Controllers/MicropubClientController.php index c2ecbc2c..d442c28f 100644 --- a/app/Http/Controllers/MicropubClientController.php +++ b/app/Http/Controllers/MicropubClientController.php @@ -79,6 +79,20 @@ class MicropubClientController extends Controller return redirect(route('micropub-client'))->with('error', 'Endpoint didn’t create the note.'); } + /** + * Show currently stored configuration values. + * + * @param Illuminate\Http\Request $request + * @return view + */ + public function config(Request $request) + { + $data['me'] = $request->session()->get('me'); + $data['token'] = $request->session()->get('token'); + $data['syndication'] = $request->session()->get('syndication') ?? 'none defined'; + return view('micropub.config', compact('data')); + } + /** * We make a request to the micropub endpoint requesting syndication targets * and store them in the session. diff --git a/resources/views/micropub/config.blade.php b/resources/views/micropub/config.blade.php new file mode 100644 index 00000000..8ad97248 --- /dev/null +++ b/resources/views/micropub/config.blade.php @@ -0,0 +1,14 @@ +@extends('master') + +@section('title') +Micropub Config « +@stop + +@section('content') +

The values for your micropub endpoint.

+
+
Me (your url)
{{ $data['me'] }}
+
Token
{{ $data['token'] }}
+
Syndication Targets
{{ $data['syndication'] }}
+
+@stop diff --git a/resources/views/micropub/create.blade.php b/resources/views/micropub/create.blade.php index 6cf8be4e..c170b397 100644 --- a/resources/views/micropub/create.blade.php +++ b/resources/views/micropub/create.blade.php @@ -20,6 +20,7 @@ New Note « @else

You are authenticated as {{ $url }}, log out.

+

Check your configuration.

@endif @include('templates.new-note-form', [ 'micropub' => true, diff --git a/routes/web.php b/routes/web.php index 6d0dc09a..70df1ddd 100644 --- a/routes/web.php +++ b/routes/web.php @@ -108,6 +108,7 @@ Route::group(['domain' => config('url.longurl')], function () { // Micropub Client Route::get('micropub/create', 'MicropubClientController@create')->name('micropub-client'); Route::post('micropub', 'MicropubClientController@store')->name('micropub-client-post'); + Route::get('micropub/config', 'MicropubClientController@config')->name('micropub-config'); Route::get('micropub/refresh-syndication-targets', 'MicropubClientController@refreshSyndicationTargets'); Route::get('micropub/places', 'MicropubClientController@nearbyPlaces'); Route::post('micropub/places', 'MicropubClientController@newPlace');