diff --git a/app/CodeIsSpeech.php b/app/CodeIsSpeech.php new file mode 100644 index 00000000..90f431d2 --- /dev/null +++ b/app/CodeIsSpeech.php @@ -0,0 +1,213 @@ +withCount('orangePills') + ->orderByDesc('orange_pills_count') + ->first(); + return sprintf(" + Derzeit liegt %s ganz vorne in der Highscore-Tabelle. + Er oder sie hat sage und schreibe %s Bücher in Schränke gestellt. + ", + $firstUser->name, + $firstUser->orange_pills_count + ); + } + + public function bookCasesCommentBookcase() + { + return sprintf(" + %s ist ein cooler Bittcoiner und hat ein Buch in einen Schrank gestellt. + Finde den Schrank mit Hilfe der Karte und trage auch deine Buch-Eingabe hier ein. + Gehe auf die Highscore-Tabelle um zu sehen, wer die meisten Bücher in Schränke gestellt hat. + ", + $this->bookCase->orangePills->first()->user->name + ); + } + + public function bookCasesWorld() + { + return sprintf(" + Hier siehst du die Anzahl der Bücherschranke-Einträge und auch die Anzahl der Bittcoiner, die ein Buch in ein Regal gestellt haben. + Auf der Weltkarte kannst du sehen, welche Regale noch kein Buch haben. + Diese Regale sind gräulich gefärbt. + Regale in oransch haben bereits ein Buch. + Es kann jedoch sein, dass das Buch schon eine lange Reise hinter sich hat und ganz wo anders auf der Welt zu finden ist. + Wenn du auf einen Marker klickst gelangst du zu den Details des Regals. + Derzeit haben %s Bittcoiner %s Bücher in Regale eingestellt. + ", + User::query() + ->whereHas('orangePills') + ->count(), + OrangePill::query() + ->count() + ); + } + + public function bitcoinEventTableBitcoinEvent() + { + return sprintf(" + Alle Termine für Bitcoin-Ivents werden hier angezeigt. + Finde einen Termin, der dir passt und klicke auf den 'Link', um zu den Details zu gelangen. + Die Termine haben eine Flagge, die das Land anzeigt, in dem das Event stattfindet. + ", + ); + } + + public function libraryTableLibraryItems() + { + return sprintf(" + Du kannst in unserer Bibliothek nach Themen suchen, die dich interessieren. + Tippe einen Suchbegriff ein oder wähle einen Schlagwort aus, um die Ergebnisse zu filtern. + Wenn du selbst eigene interessante Artikel oder Bibliotheks-Einträge eingeben möchtest, musst du eingeloggt sein. + Klicke auf 'Inhalte eintragen' und fülle das Formular aus. + So wird die Bibliothek immer besser und du kannst die Inhalte mit anderen teilen. + ", + ); + } + + public function schoolTableEvent() + { + $filterId = null; + if (isset($this->getAppliedFilters()['course_id'])) { + $filterId = $this->getAppliedFilters()['course_id']; + } else { + + return; + } + $course = Course::query() + ->with(['lecturer']) + ->find($filterId); + + return sprintf(" + Du hast den Kurs '%s' von %s gefiltert. + Finde hier einen Termin, der dir passt und klicke auf 'Registrieren', um zu den Details zu gelangen. + Auf der Karte findest du weitere Kurse, die in deiner Nähe stattfinden. + Klicke einen Marker um die Filterung nach Terminen zu ändern. + ", + $course->name, + $course->lecturer->name + ); + } + + public function schoolTableCourse() + { + return sprintf(" + Du bist auf der Übersichts-Seite der Kurse. + Finde hier ein Themen-Gebiet, das dich interessiert und klicke auf den Link, um zu den Terminen zu gelangen. + ", + ); + } + + public function meetupLanding() + { + return sprintf(" + Du bist auf der Mietap Seite von %s. + Suche dir einen Termin aus und freue dich auf ein Treffen mit Gleichgesinnten oder einfach nur auf einen gemütlichen Abend. + Wenn ein Mietap Termin fehlt, dann logge dich im System ein und wähle deine Mietaps unter 'Meine Meetups' aus, um einen neuen Termin anzulegen. + ", + $this->meetup->name, + ); + } + + public function meetupWorld() + { + return sprintf(" + Du bist auf der Mietap Weltkarte von Einundzwanzig. + Suche dir ein Land aus und klicke auf den Marker, um zu einem Mietap zu gelangen. + Wenn ein Mietap fehlt, dann logge dich im System ein und lege ein neues Mietap an. + "); + } + + public function profileLnbits() + { + return sprintf(" + Setze hier die Einstellungen für deine LN Bitts Wollet. Bitte verwende deine eigene Instanz von LN Bitts, die auf deiner eigenen Bitcoin Nod installiert ist. + "); + } + + public function articleView(): string + { + return str(strip_tags($this->libraryItem->value)) + ->stripTags() + ->words(255, '') + ->toString(); + } + + public function articleOverview() + { + $tip = Http::get('https://mempool.space/api/blocks/tip/height'); + $fees = Http::get('https://mempool.space/api/v1/fees/recommended') + ->json(); + + $createText = "Um einen Artikel zu schreiben, klicke auf den 'Artikel einreichen' Link oder um einen bezahlten Artikel zu schreiben, klicke auf 'Reiche einen bezahlten News-Artikel ein'."; + if (auth()->check() && !auth()->user()->lnbits['read_key']) { + $createText = "Um einen Artikel zu schreiben, klicke auf den 'Artikel einreichen' Link oder um einen bezahlten Artikel zu schreiben, richte zuerst deine Verbindung zu LN Bitts ein. Klicke dazu auf 'Setze LN Bitts für bezahlte Artikel ein'"; + } + + return sprintf(" + Du bist auf der News Seite von Einundzwanzig. + Wir haben für dich derzeit insgesamt %s Artikel geschrieben. + Die derzeitige Bitcoin Blockzeit ist %s. + Die schnellsten Transaktionen verschickst du derzeit mit einer Gebühr von %s Satoschi pro Byte. + %s + ", + LibraryItem::query() + ->where('news', true) + ->count(), + $tip->json(), + $fees['fastestFee'], + $createText + ); + } + + public function authLn() + { + return sprintf(" + Du bist auf der Login Seite von Einundzwanzig. + Du kannst dich hier mit deiner Lightning Applikation einloggen. + Benutze diesen QR-Code oder kopiere ihn in deine Lightning-App. Oder klicke auf den QR-Code, um dich mit der Applikation einzuloggen. + Deine Lightning Applikation muss L N URL auth unterstützen. + Du siehst ganz unten in der Box eine Liste von Lightning Applikationen, die L N URL auth unterstützen. + "); + } + + public function welcome() + { + return sprintf(" + Hallo und herzlich willkommen auf dem Portal von Einundzwanzig. + Klicke einfach auf Login, um Events einzutragen oder News Artikel zu schreiben. + Du brauchst eine Lightning Applikation dafür. + Viel Spaß! + + Derzeit sind %s Events eingetragen. + Markus Turm hat %s Artikel geschrieben und %s Artikel dezentralisiert. + Wir haben %s Bitcoin Bücher in Bücherregale verteilt. + Du kannst die einen Termin von insgesamt %s Treffen aussuchen. + ", + BitcoinEvent::count(), + LibraryItem::where('created_by', 2) + ->where('news', true) + ->count(), + LibraryItem::where('created_by', '<>', 2) + ->where('news', true) + ->count(), + OrangePill::count(), + MeetupEvent::where('start', '>=', now()) + ->count() + ); + } +} diff --git a/app/Console/Commands/TTS/CodeIsSpeech.php b/app/Console/Commands/TTS/CodeIsSpeech.php new file mode 100644 index 00000000..3d3c3f91 --- /dev/null +++ b/app/Console/Commands/TTS/CodeIsSpeech.php @@ -0,0 +1,40 @@ + File::get(storage_path('app/public/tts/'.$this->option('text').'.txt')), + 'speaker_id' => null, + 'style_wav' => null, + 'language_id' => null, + ]); + + File::put(storage_path('app/public/tts/'.$this->option('text').'.wav'), $response->body()); + + event(new AudioTextToSpeechChangedEvent(url('storage/tts/'.$this->option('text').'.wav'))); + } +} diff --git a/app/Events/AudioTextToSpeechChangedEvent.php b/app/Events/AudioTextToSpeechChangedEvent.php new file mode 100644 index 00000000..805b0395 --- /dev/null +++ b/app/Events/AudioTextToSpeechChangedEvent.php @@ -0,0 +1,33 @@ +bookCase->load([ + 'orangePills.user', + ]); + } + public function save() { $this->validate([ diff --git a/app/Http/Livewire/BookCase/HighscoreTable.php b/app/Http/Livewire/BookCase/HighscoreTable.php index 8d00d5f1..336e12a9 100644 --- a/app/Http/Livewire/BookCase/HighscoreTable.php +++ b/app/Http/Livewire/BookCase/HighscoreTable.php @@ -4,11 +4,14 @@ namespace App\Http\Livewire\BookCase; use App\Models\Country; use App\Models\User; +use App\Traits\HasTextToSpeech; use Livewire\Component; use RalphJSmit\Laravel\SEO\Support\SEOData; class HighscoreTable extends Component { + use HasTextToSpeech; + public Country $country; public bool $viewingModal = false; diff --git a/app/Http/Livewire/BookCase/WorldMap.php b/app/Http/Livewire/BookCase/WorldMap.php index b5f07b66..d6d8e016 100644 --- a/app/Http/Livewire/BookCase/WorldMap.php +++ b/app/Http/Livewire/BookCase/WorldMap.php @@ -4,11 +4,14 @@ namespace App\Http\Livewire\BookCase; use App\Models\BookCase; use App\Models\Country; +use App\Traits\HasTextToSpeech; use Livewire\Component; use RalphJSmit\Laravel\SEO\Support\SEOData; class WorldMap extends Component { + use HasTextToSpeech; + public Country $country; public function render() diff --git a/app/Http/Livewire/Frontend/Header.php b/app/Http/Livewire/Frontend/Header.php index f14a7500..36c12b8f 100644 --- a/app/Http/Livewire/Frontend/Header.php +++ b/app/Http/Livewire/Frontend/Header.php @@ -137,7 +137,7 @@ class Header extends Component ->orderByDesc('date') ->take(2) ->get(), - 'projectProposals' => ProjectProposal::query()->with(['votes'])->get(), + 'projectProposals' => ProjectProposal::query()->with(['user','votes'])->get(), 'cities' => City::query() ->select(['latitude', 'longitude']) ->get(), diff --git a/app/Http/Livewire/Frontend/Welcome.php b/app/Http/Livewire/Frontend/Welcome.php index e45c4d96..bc145d61 100644 --- a/app/Http/Livewire/Frontend/Welcome.php +++ b/app/Http/Livewire/Frontend/Welcome.php @@ -3,12 +3,15 @@ namespace App\Http\Livewire\Frontend; use App\Models\Country; +use App\Traits\HasTextToSpeech; use Illuminate\Support\Facades\Cookie; use Livewire\Component; use RalphJSmit\Laravel\SEO\Support\SEOData; class Welcome extends Component { + use HasTextToSpeech; + public string $c = 'de'; public string $l = 'de'; diff --git a/app/Http/Livewire/Hello.php b/app/Http/Livewire/Hello.php new file mode 100644 index 00000000..76e87aae --- /dev/null +++ b/app/Http/Livewire/Hello.php @@ -0,0 +1,87 @@ + 'required|string|max:255', + ]; + } + + public function mount() + { + try { + // {"url":"","wallet_id":"","read_key":""} + $invoice = $this->createInvoice( + sats: 21, + memo: 'Payment for: Bitcoin im Ländle 2023 - Code is Speech', + lnbits: [ + 'url' => 'https://legend.lnbits.com', + 'wallet_id' => 'b9b095edd0db4bf8995f1bbc90b195c5', + 'read_key' => '67e6d7f94f5345119d6c799d768a029e', + ], + ); + } catch (\Exception $e) { + $this->notification() + ->error('LNBits error: '.$e->getMessage()); + + return; + } + + $this->paymentHash = $invoice['payment_hash']; + $this->qrCode = base64_encode(QrCode::format('png') + ->size(300) + ->merge('/public/img/einundzwanzig.png', .3) + ->errorCorrection('H') + ->generate($invoice['payment_request'])); + $this->invoice = $invoice['payment_request']; + $this->checkid = $invoice['checking_id']; + } + + public function checkPaymentHash() + { + try { + $invoice = $this->check($this->checkid, [ + 'url' => 'https://legend.lnbits.com', + 'wallet_id' => 'b9b095edd0db4bf8995f1bbc90b195c5', + 'read_key' => '67e6d7f94f5345119d6c799d768a029e', + ]); + } catch (\Exception $e) { + $this->notification() + ->error('LNBits error: '.$e->getMessage()); + + return; + } + if (isset($invoice['paid']) && $invoice['paid']) { + $this->invoicePaid = true; + + } else { + Log::error(json_encode($invoice, JSON_THROW_ON_ERROR)); + } + } + + public function render() + { + return view('livewire.hello')->layout('layouts.guest'); + } +} diff --git a/app/Http/Livewire/LaravelEcho.php b/app/Http/Livewire/LaravelEcho.php index 7478deed..1a8c2ae8 100644 --- a/app/Http/Livewire/LaravelEcho.php +++ b/app/Http/Livewire/LaravelEcho.php @@ -2,6 +2,7 @@ namespace App\Http\Livewire; +use Illuminate\Support\Facades\File; use Livewire\Component; use WireUi\Traits\Actions; @@ -9,21 +10,60 @@ class LaravelEcho extends Component { use Actions; - protected $listeners = ['echo:plebchannel,.App\Events\PlebLoggedInEvent' => 'plebLoggedIn']; + public $audioSrc = ''; + + protected $listeners = [ + 'echo:plebchannel,.App\Events\PlebLoggedInEvent' => 'plebLoggedIn', + 'echo:plebchannel,.App\Events\AudioTextToSpeechChangedEvent' => 'audioTextToSpeechChanged', + 'echo:plebchannel,.App\Events\PaidMessageEvent' => 'paidMessage', + ]; + + public function rules() + { + return [ + 'audioSrc' => 'required', + ]; + } + + public function paidMessage($data) + { + $text = sprintf(" + %s + %s. + ", + 'Nachricht aus dem Publikum.', + str($data['message']) + ->stripTags() + ->toString() + ); + File::put(storage_path('app/public/tts/'.$data['checkid'].'.txt'), $text); + dispatch(new \App\Jobs\CodeIsSpeech($data['checkid']))->delay(now()->addSecond()); + } + + public function audioTextToSpeechChanged($data) + { + $this->audioSrc = $data['src']; + } public function plebLoggedIn($data) { if (auth()->check()) { + $text = sprintf(" + %s hat sich gerade eingeloggt. Markus Turm ist begeistert. + ", $data['name']); + File::put(storage_path('app/public/tts/userLoggedIn.txt'), $text); + dispatch(new \App\Jobs\CodeIsSpeech('userLoggedIn'))->delay(now()->addSecond()); + $this->notification() ->confirm([ - 'img' => $data['img'], - 'title' => 'Pleb alert!', + 'img' => $data['img'], + 'title' => 'Pleb alert!', 'description' => $data['name'].' logged in', - 'icon' => 'bell', + 'icon' => 'bell', 'acceptLabel' => '', 'rejectLabel' => '', - 'iconColor' => 'primary', - 'timeout' => 60000, + 'iconColor' => 'primary', + 'timeout' => 60000, ]); } } diff --git a/app/Http/Livewire/Library/LibraryTable.php b/app/Http/Livewire/Library/LibraryTable.php index 6ec2bfa8..0b604e71 100644 --- a/app/Http/Livewire/Library/LibraryTable.php +++ b/app/Http/Livewire/Library/LibraryTable.php @@ -6,11 +6,14 @@ use App\Models\Country; use App\Models\Library; use App\Models\LibraryItem; use App\Models\Tag; +use App\Traits\HasTextToSpeech; use Livewire\Component; use RalphJSmit\Laravel\SEO\Support\SEOData; class LibraryTable extends Component { + use HasTextToSpeech; + public Country $country; public array $filters = []; diff --git a/app/Http/Livewire/Meetup/LandingPage.php b/app/Http/Livewire/Meetup/LandingPage.php index 6837f324..db317694 100644 --- a/app/Http/Livewire/Meetup/LandingPage.php +++ b/app/Http/Livewire/Meetup/LandingPage.php @@ -5,11 +5,14 @@ namespace App\Http\Livewire\Meetup; use App\Models\Country; use App\Models\Meetup; use App\Models\MeetupEvent; +use App\Traits\HasTextToSpeech; use Livewire\Component; use RalphJSmit\Laravel\SEO\Support\SEOData; class LandingPage extends Component { + use HasTextToSpeech; + public Meetup $meetup; public Country $country; diff --git a/app/Http/Livewire/Meetup/WorldMap.php b/app/Http/Livewire/Meetup/WorldMap.php index 2607b3ef..7b89dda2 100644 --- a/app/Http/Livewire/Meetup/WorldMap.php +++ b/app/Http/Livewire/Meetup/WorldMap.php @@ -4,11 +4,14 @@ namespace App\Http\Livewire\Meetup; use App\Models\Country; use App\Models\Meetup; +use App\Traits\HasTextToSpeech; use Livewire\Component; use RalphJSmit\Laravel\SEO\Support\SEOData; class WorldMap extends Component { + use HasTextToSpeech; + public Country $country; public function filterByMarker($id) diff --git a/app/Http/Livewire/News/ArticleOverview.php b/app/Http/Livewire/News/ArticleOverview.php index 1e9cc5d7..79557168 100644 --- a/app/Http/Livewire/News/ArticleOverview.php +++ b/app/Http/Livewire/News/ArticleOverview.php @@ -3,6 +3,7 @@ namespace App\Http\Livewire\News; use App\Models\LibraryItem; +use App\Traits\HasTextToSpeech; use App\Traits\NostrTrait; use Livewire\Component; use RalphJSmit\Laravel\SEO\Support\SEOData; @@ -12,6 +13,7 @@ class ArticleOverview extends Component { use Actions; use NostrTrait; + use HasTextToSpeech; public $perPage = 9; diff --git a/app/Http/Livewire/News/Form/NewsArticleForm.php b/app/Http/Livewire/News/Form/NewsArticleForm.php index 2261bbc3..0c12231b 100644 --- a/app/Http/Livewire/News/Form/NewsArticleForm.php +++ b/app/Http/Livewire/News/Form/NewsArticleForm.php @@ -4,12 +4,15 @@ namespace App\Http\Livewire\News\Form; use App\Models\LibraryItem; use App\Traits\HasTagsTrait; +use Illuminate\Support\Facades\File; use Illuminate\Validation\Rule; use Livewire\Component; use Livewire\WithFileUploads; +use WireUi\Traits\Actions; class NewsArticleForm extends Component { + use Actions; use HasTagsTrait; use WithFileUploads; @@ -104,6 +107,20 @@ class NewsArticleForm extends Component public function save() { $this->validate(); + + if (str($this->libraryItem->value)->contains('Turm')) { + $text = sprintf(" + Markus Turm hat deinen Artikel geprüft aber nicht freigegeben. + Dein Artikel ist leider nicht toxisch genug. + Außerdem musst du mindestens 2 Provokation pro Absatz einbauen, um die gewünschte Turm Qualität zu erreichen. + "); + File::put(storage_path('app/public/tts/news_error.txt'), $text); + dispatch(new \App\Jobs\CodeIsSpeech('news_error', false))->delay(now()->addSecond()); + $this->notification()->error('Markus Turm hat deinen Artikel abgelehnt.'); + + return; + } + $this->libraryItem->save(); $this->libraryItem->syncTagsWithType( diff --git a/app/Http/Livewire/News/InternArticleView.php b/app/Http/Livewire/News/InternArticleView.php index 4d9b17ce..b9d727c8 100644 --- a/app/Http/Livewire/News/InternArticleView.php +++ b/app/Http/Livewire/News/InternArticleView.php @@ -3,6 +3,7 @@ namespace App\Http\Livewire\News; use App\Models\LibraryItem; +use App\Traits\HasTextToSpeech; use App\Traits\LNBitsTrait; use Carbon\Carbon; use Illuminate\Support\Facades\Log; @@ -17,6 +18,7 @@ class InternArticleView extends Component { use Actions; use LNBitsTrait; + use HasTextToSpeech; public LibraryItem $libraryItem; diff --git a/app/Http/Livewire/Profile/LNBits.php b/app/Http/Livewire/Profile/LNBits.php index 16359be0..9c191766 100644 --- a/app/Http/Livewire/Profile/LNBits.php +++ b/app/Http/Livewire/Profile/LNBits.php @@ -2,7 +2,9 @@ namespace App\Http\Livewire\Profile; +use App\Traits\HasTextToSpeech; use App\Traits\LNBitsTrait; +use Illuminate\Support\Facades\File; use Livewire\Component; use WireUi\Traits\Actions; @@ -10,6 +12,7 @@ class LNBits extends Component { use Actions; use LNBitsTrait; + use HasTextToSpeech; public array $settings = [ 'url' => 'https://legend.lnbits.com', @@ -30,6 +33,9 @@ class LNBits extends Component { if (auth()->user()->lnbits) { $this->settings = auth()->user()->lnbits; + if ($this->settings['url'] === null) { + $this->settings['url'] = 'https://legend.lnbits.com'; + } } } @@ -39,6 +45,12 @@ class LNBits extends Component if ($this->checkLnbitsSettings($this->settings['read_key'], $this->settings['url'], $this->settings['wallet_id']) === false) { $this->notification() ->error(__('LNBits settings are not valid!')); + $legends = "Außerdem hast du nicht deine eigene Nod verwendet. Markus Turm wird darüber sehr traurig sein. Komm in die Einundzwanzig Telegramm Gruppe, und melde dich sofort bei Markus Turm mit einer Entschuldigung."; + $text = sprintf(" + Es gab einen Fehler beim Speichern der LN Bitts Einstellungen. Bitte überprüfe die A P I Daten. %s + ", $this->settings['url'] === 'https://legend.lnbits.com' ? $legends : ''); + File::put(storage_path('app/public/tts/lnbits_error.txt'), $text); + dispatch(new \App\Jobs\CodeIsSpeech('lnbits_error', false))->delay(now()->addSecond()); return; } diff --git a/app/Http/Livewire/School/CourseTable.php b/app/Http/Livewire/School/CourseTable.php index 2705e8a6..d3f47750 100644 --- a/app/Http/Livewire/School/CourseTable.php +++ b/app/Http/Livewire/School/CourseTable.php @@ -3,11 +3,14 @@ namespace App\Http\Livewire\School; use App\Models\Country; +use App\Traits\HasTextToSpeech; use Livewire\Component; use RalphJSmit\Laravel\SEO\Support\SEOData; class CourseTable extends Component { + use HasTextToSpeech; + public Country $country; public function render() diff --git a/app/Http/Livewire/School/EventTable.php b/app/Http/Livewire/School/EventTable.php index 22be0b6e..c0c32d0c 100644 --- a/app/Http/Livewire/School/EventTable.php +++ b/app/Http/Livewire/School/EventTable.php @@ -4,6 +4,7 @@ namespace App\Http\Livewire\School; use App\Models\Country; use App\Models\CourseEvent; +use App\Traits\HasTextToSpeech; use Livewire\Component; use RalphJSmit\Laravel\SEO\Support\SEOData; diff --git a/app/Http/Livewire/Tables/EventTable.php b/app/Http/Livewire/Tables/EventTable.php index f5a3c9ad..aefe06f7 100644 --- a/app/Http/Livewire/Tables/EventTable.php +++ b/app/Http/Livewire/Tables/EventTable.php @@ -5,6 +5,7 @@ namespace App\Http\Livewire\Tables; use App\Models\Category; use App\Models\CourseEvent; use App\Models\Lecturer; +use App\Traits\HasTextToSpeech; use Illuminate\Database\Eloquent\Builder; use Rappasoft\LaravelLivewireTables\DataTableComponent; use Rappasoft\LaravelLivewireTables\Views\Column; @@ -14,6 +15,8 @@ use Rappasoft\LaravelLivewireTables\Views\Filters\TextFilter; class EventTable extends DataTableComponent { + use HasTextToSpeech; + public string $country; public bool $viewingModal = false; diff --git a/app/Jobs/CodeIsSpeech.php b/app/Jobs/CodeIsSpeech.php new file mode 100644 index 00000000..d89cf5d9 --- /dev/null +++ b/app/Jobs/CodeIsSpeech.php @@ -0,0 +1,54 @@ +encode) { + $response = Http::get('http://host.docker.internal:5002/api/tts', [ + 'text' => File::get(storage_path('app/public/tts/'.$this->id.'.txt')), + 'speaker_id' => null, + 'style_wav' => null, + 'language_id' => null, + ]); + + File::put(storage_path('app/public/tts/'.$this->id.'.wav'), $response->body()); + } elseif (!File::exists(storage_path('app/public/tts/'.$this->id.'.wav'))) { + $response = Http::get('http://host.docker.internal:5002/api/tts', [ + 'text' => File::get(storage_path('app/public/tts/'.$this->id.'.txt')), + 'speaker_id' => null, + 'style_wav' => null, + 'language_id' => null, + ]); + + File::put(storage_path('app/public/tts/'.$this->id.'.wav'), $response->body()); + } + + event(new AudioTextToSpeechChangedEvent(url('storage/tts/'.$this->id.'.wav'))); + } +} diff --git a/app/Listeners/AddLoginReputation.php b/app/Listeners/AddLoginReputation.php index cd8aafe1..dcc5fc39 100644 --- a/app/Listeners/AddLoginReputation.php +++ b/app/Listeners/AddLoginReputation.php @@ -4,6 +4,7 @@ namespace App\Listeners; use App\Events\PlebLoggedInEvent; use App\Gamify\Points\LoggedIn; +use Illuminate\Support\Facades\File; class AddLoginReputation { diff --git a/app/Traits/HasTextToSpeech.php b/app/Traits/HasTextToSpeech.php new file mode 100644 index 00000000..9a2bf985 --- /dev/null +++ b/app/Traits/HasTextToSpeech.php @@ -0,0 +1,40 @@ +replace('.', ' ') + ->camel() + ->toString(); + $text = $this->$id(); + File::put(storage_path('app/public/tts/'.$id.'.txt'), $text); + + if ( + in_array($id, [ + //'authLn', + 'profileLnbits', + 'meetupWorld', + 'bitcoinEventTableBitcoinEvent', + 'libraryTableLibraryItems', + 'schoolTableCourse', + ]) + && File::exists(storage_path('app/public/tts/'.$id.'.wav')) + ) { + dispatch(new \App\Jobs\CodeIsSpeech($id, false))->delay(now()->addSecond()); + } elseif (in_array($id, ['welcome']) && auth()->check()) { + + } else { + dispatch(new \App\Jobs\CodeIsSpeech($id))->delay(now()->addSecond()); + } + } +} diff --git a/docker-compose.yml b/docker-compose.yml index e6a4b8e1..f510c2bf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: args: WWWGROUP: '${WWWGROUP}' NOSTR_PRIVATE_KEY: '${NOSTR_PRIVATE_KEY}' - image: sail-8.2/app + image: sail-8.2/einundzwanzig extra_hosts: - 'host.docker.internal:host-gateway' ports: diff --git a/docker/8.2/supervisord.conf b/docker/8.2/supervisord.conf index 9d284795..84b73799 100644 --- a/docker/8.2/supervisord.conf +++ b/docker/8.2/supervisord.conf @@ -12,3 +12,14 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 + +[program:horizon] +command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan horizon +user=sail +autostart=true +autorestart=true +stopwaitsecs=3600 +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/resources/views/livewire/banner/mempool-weather.blade.php b/resources/views/livewire/banner/mempool-weather.blade.php index e9e585e0..b87e4a87 100644 --- a/resources/views/livewire/banner/mempool-weather.blade.php +++ b/resources/views/livewire/banner/mempool-weather.blade.php @@ -37,9 +37,9 @@ {{ $weather }} (um {{ \App\Support\Carbon::parse($changed)->asTime() }} Uhr aktualisiert - jede 4. Stunde) @else -