mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
TTS
This commit is contained in:
@@ -5,12 +5,15 @@ namespace App\Http\Livewire\Auth;
|
||||
use App\Models\LoginKey;
|
||||
use App\Models\User;
|
||||
use App\Notifications\ModelCreatedNotification;
|
||||
use App\Traits\HasTextToSpeech;
|
||||
use eza\lnurl;
|
||||
use Livewire\Component;
|
||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||
|
||||
class LNUrlAuth extends Component
|
||||
{
|
||||
use HasTextToSpeech;
|
||||
|
||||
public ?string $k1 = null;
|
||||
|
||||
protected ?string $url = null;
|
||||
|
||||
@@ -4,11 +4,14 @@ namespace App\Http\Livewire\BitcoinEvent;
|
||||
|
||||
use App\Models\BitcoinEvent;
|
||||
use App\Models\Country;
|
||||
use App\Traits\HasTextToSpeech;
|
||||
use Livewire\Component;
|
||||
use RalphJSmit\Laravel\SEO\Support\SEOData;
|
||||
|
||||
class BitcoinEventTable extends Component
|
||||
{
|
||||
use HasTextToSpeech;
|
||||
|
||||
public Country $country;
|
||||
|
||||
public ?int $year = null;
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Livewire\BookCase;
|
||||
|
||||
use App\Models\BookCase;
|
||||
use App\Models\Country;
|
||||
use App\Traits\HasTextToSpeech;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithFileUploads;
|
||||
use RalphJSmit\Laravel\SEO\Support\SEOData;
|
||||
@@ -11,6 +12,7 @@ use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
class CommentBookCase extends Component
|
||||
{
|
||||
use HasTextToSpeech;
|
||||
use WithFileUploads;
|
||||
|
||||
public Country $country;
|
||||
@@ -21,6 +23,13 @@ class CommentBookCase extends Component
|
||||
|
||||
public BookCase $bookCase;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->bookCase->load([
|
||||
'orangePills.user',
|
||||
]);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$this->validate([
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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';
|
||||
|
||||
87
app/Http/Livewire/Hello.php
Normal file
87
app/Http/Livewire/Hello.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Traits\LNBitsTrait;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Livewire\Component;
|
||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||
use WireUi\Traits\Actions;
|
||||
|
||||
class Hello extends Component
|
||||
{
|
||||
use Actions;
|
||||
use LNBitsTrait;
|
||||
|
||||
public $message = '';
|
||||
public $qrCode = '';
|
||||
public $invoice = '';
|
||||
public $paymentHash = '';
|
||||
public $checkid = null;
|
||||
public bool $invoicePaid = false;
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'message' => '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');
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user