mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
28 lines
666 B
PHP
28 lines
666 B
PHP
<?php
|
|
|
|
namespace App\Traits;
|
|
|
|
use Illuminate\Support\Facades\Process;
|
|
|
|
trait NostrTrait
|
|
{
|
|
public function publishOnNostr($model, $text): array
|
|
{
|
|
//noscl publish "Good morning!"
|
|
$result = Process::timeout(60 * 5)
|
|
->run('noscl publish "'.$text.'"');
|
|
|
|
if ($result->successful()) {
|
|
$model->nostr_status = $result->output();
|
|
$model->save();
|
|
}
|
|
|
|
return [
|
|
'success' => $result->successful(),
|
|
'output' => $result->output(),
|
|
'exitCode' => $result->exitCode(),
|
|
'errorOutput' => $result->errorOutput()
|
|
];
|
|
}
|
|
}
|