Add a config display page for the micropub client

This commit is contained in:
Jonny Barnes 2017-03-13 16:18:15 +00:00
parent 2f5ad52181
commit aca16c9d0b
4 changed files with 30 additions and 0 deletions

View file

@ -79,6 +79,20 @@ class MicropubClientController extends Controller
return redirect(route('micropub-client'))->with('error', 'Endpoint didnt 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.

View file

@ -0,0 +1,14 @@
@extends('master')
@section('title')
Micropub Config «
@stop
@section('content')
<p>The values for your micropub endpoint.</p>
<dl>
<dt>Me (your url)</dt><dd>{{ $data['me'] }}</dd>
<dt>Token</dt><dd>{{ $data['token'] }}</dd>
<dt>Syndication Targets</dt><dd>{{ $data['syndication'] }}</dd>
</dl>
@stop

View file

@ -20,6 +20,7 @@ New Note «
</form>
@else
<p>You are authenticated as <code>{{ $url }}</code>, <a href="/logout">log out</a>.</p>
<p>Check your <a href="{{ route('micropub-config') }}">configuration</a>.</p>
@endif
@include('templates.new-note-form', [
'micropub' => true,

View file

@ -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');