first copies from portal

This commit is contained in:
fsociety
2024-09-04 19:37:46 +02:00
parent b38f3f8bed
commit a0ef037b2d
741 changed files with 78623 additions and 387 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Console\Commands\Einundzwanzig;
use App\Models\EinundzwanzigPleb;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use swentel\nostr\Key\Key;
class SyncPlebs extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'sync:plebs';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
$response = Http::get('https://portal.einundzwanzig.space/api/nostrplebs');
$plebs = $response->json();
foreach ($plebs as $pleb) {
$npub = str($pleb)->trim();
EinundzwanzigPleb::updateOrCreate(
['npub' => $npub],
['pubkey' => (new Key())->convertToHex($npub)]
);
}
}
}