Move syndication targets to a config file, fixes #27, also more dynamically generate micropub token

This commit is contained in:
Jonny Barnes 2016-12-08 14:28:42 +00:00
parent 42841eca08
commit e12b4d39ef
7 changed files with 107 additions and 60 deletions

View file

@ -0,0 +1,59 @@
<?php
namespace App\Console\Commands;
use App\Services\TokenService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
class GenerateToken extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'token:generate';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Generate a token that can be used for testing purposes';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* The token service class.
*
* @var TokenService
*/
protected $tokenService;
/**
* Execute the console command.
*
* @return mixed
*/
public function handle(TokenService $tokenService)
{
$data = [
'me' => env('APP_URL'),
'client_id' => env('APP_URL') . '/notes/new',
'scope' => 'post',
];
$token = $tokenService->getNewToken($data);
Storage::disk('local')->put('dev-token', $token);
$this->info('Set token');
}
}

View file

@ -16,6 +16,7 @@ class Kernel extends ConsoleKernel
Commands\SecurityCheck::class,
Commands\ParseCachedWebMentions::class,
Commands\ReDownloadWebMentions::class,
Commands\GenerateToken::class,
];
/**