From 6979c554bc5acaf33611bd0a4e944e733dbf7d6f Mon Sep 17 00:00:00 2001 From: HolgerHatGarKeineNode Date: Fri, 17 Mar 2023 11:49:11 +0100 Subject: [PATCH] paynym support added --- .../Fortify/UpdateUserProfileInformation.php | 3 ++ .../Form/ContentCreatorForm.php | 1 + app/Http/Livewire/News/InternArticleView.php | 18 ++++++++++++ app/Models/User.php | 2 ++ ...103513_add_paynym_field_to_users_table.php | 28 +++++++++++++++++++ ...40_add_paynym_field_to_lecturers_table.php | 28 +++++++++++++++++++ resources/lang/de.json | 5 +++- resources/lang/en.json | 5 +++- resources/lang/es.json | 5 +++- resources/lang/fr.json | 5 +++- resources/lang/hr.json | 5 +++- resources/lang/it.json | 5 +++- resources/lang/mk.json | 5 +++- resources/lang/pl.json | 5 +++- resources/lang/pt.json | 5 +++- resources/lang/sv.json | 5 +++- resources/lang/tr.json | 5 +++- .../form/content-creator-form.blade.php | 7 ++++- .../news/intern-article-view.blade.php | 7 +++++ .../update-profile-information-form.blade.php | 10 +++++++ 20 files changed, 147 insertions(+), 12 deletions(-) create mode 100644 database/migrations/2023_03_17_103513_add_paynym_field_to_users_table.php create mode 100644 database/migrations/2023_03_17_104340_add_paynym_field_to_lecturers_table.php diff --git a/app/Actions/Fortify/UpdateUserProfileInformation.php b/app/Actions/Fortify/UpdateUserProfileInformation.php index 71f48219..6375cd00 100644 --- a/app/Actions/Fortify/UpdateUserProfileInformation.php +++ b/app/Actions/Fortify/UpdateUserProfileInformation.php @@ -21,6 +21,7 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation 'lightning_address' => ['nullable', 'string'], 'lnurl' => ['nullable', 'string'], 'nostr' => ['nullable', 'string'], + 'paynym' => ['nullable', 'string'], 'node_id' => ['nullable', 'string', 'max:66'], 'timezone' => ['required', 'string'], 'email' => [ @@ -44,6 +45,7 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation 'lightning_address' => $input['lightning_address'], 'lnurl' => $input['lnurl'], 'nostr' => $input['nostr'], + 'paynym' => $input['paynym'], 'node_id' => $input['node_id'], 'email' => $input['email'], 'timezone' => $input['timezone'], @@ -65,6 +67,7 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation 'lnurl' => $input['lnurl'], 'node_id' => $input['node_id'], 'nostr' => $input['nostr'], + 'paynym' => $input['paynym'], 'email' => $input['email'], 'timezone' => $input['timezone'], 'email_verified_at' => null, diff --git a/app/Http/Livewire/ContentCreator/Form/ContentCreatorForm.php b/app/Http/Livewire/ContentCreator/Form/ContentCreatorForm.php index 2ad42ea8..aa775d0e 100644 --- a/app/Http/Livewire/ContentCreator/Form/ContentCreatorForm.php +++ b/app/Http/Livewire/ContentCreator/Form/ContentCreatorForm.php @@ -32,6 +32,7 @@ class ContentCreatorForm extends Component 'lecturer.active' => 'boolean', 'lecturer.subtitle' => 'nullable|string', 'lecturer.intro' => 'nullable|string', + 'lecturer.paynym' => 'nullable|string', 'lecturer.nostr' => 'nullable|string', 'lecturer.twitter_username' => 'nullable|string', 'lecturer.website' => 'nullable|url', diff --git a/app/Http/Livewire/News/InternArticleView.php b/app/Http/Livewire/News/InternArticleView.php index 57acc611..a04d1d69 100644 --- a/app/Http/Livewire/News/InternArticleView.php +++ b/app/Http/Livewire/News/InternArticleView.php @@ -26,6 +26,8 @@ class InternArticleView extends Component public bool $invoicePaid = false; public bool $alreadyPaid = false; + public ?string $payNymQrCode = ''; + public function mount() { $this->libraryItem->load([ @@ -42,6 +44,22 @@ class InternArticleView extends Component ->count() > 0) { $this->invoicePaid = true; } + if ($this->libraryItem->lecturer->paynym) { + $this->payNymQrCode = base64_encode(QrCode::format('png') + ->size(300) + ->merge($this->libraryItem->lecturer->getFirstMedia('avatar') + ? str( + $this->libraryItem + ->lecturer + ->getFirstMediaPath('avatar')) + ->replace('/home/einundzwanzig/portal.einundzwanzig.space', + '' + ) + : '/public/img/einundzwanzig.png', + .3) + ->errorCorrection('H') + ->generate($this->libraryItem->lecturer->paynym)); + } } public function pay() diff --git a/app/Models/User.php b/app/Models/User.php index c8443f20..e12ed092 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -75,11 +75,13 @@ class User extends Authenticatable implements MustVerifyEmail, CanComment, Ciphe ->addField('lnurl') ->addField('node_id') ->addField('email') + ->addField('paynym') ->addJsonField('lnbits', $map) ->addBlindIndex('public_key', new BlindIndex('public_key_index')) ->addBlindIndex('lightning_address', new BlindIndex('lightning_address_index')) ->addBlindIndex('lnurl', new BlindIndex('lnurl_index')) ->addBlindIndex('node_id', new BlindIndex('node_id_index')) + ->addBlindIndex('paynym', new BlindIndex('paynym_index')) ->addBlindIndex('email', new BlindIndex('email_index')); } diff --git a/database/migrations/2023_03_17_103513_add_paynym_field_to_users_table.php b/database/migrations/2023_03_17_103513_add_paynym_field_to_users_table.php new file mode 100644 index 00000000..f0985e4b --- /dev/null +++ b/database/migrations/2023_03_17_103513_add_paynym_field_to_users_table.php @@ -0,0 +1,28 @@ +text('paynym') + ->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + // + }); + } +}; diff --git a/database/migrations/2023_03_17_104340_add_paynym_field_to_lecturers_table.php b/database/migrations/2023_03_17_104340_add_paynym_field_to_lecturers_table.php new file mode 100644 index 00000000..3c2a69f4 --- /dev/null +++ b/database/migrations/2023_03_17_104340_add_paynym_field_to_lecturers_table.php @@ -0,0 +1,28 @@ +text('paynym') + ->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('lecturers', function (Blueprint $table) { + // + }); + } +}; diff --git a/resources/lang/de.json b/resources/lang/de.json index 8a319cd5..ca2d2f93 100644 --- a/resources/lang/de.json +++ b/resources/lang/de.json @@ -857,5 +857,8 @@ "articles": "Artikel", "Participation confirmed": "Teilnahme bestätigt", "There was an error on row :row. :message": "Es gab einen Fehler in Zeile :row. :message", - "Calendar Stream-Url for my meetups only": "Kalender-Stream-Url nur für meine Meetups" + "Calendar Stream-Url for my meetups only": "Kalender-Stream-Url nur für meine Meetups", + "Avatar\/Picture": "Avatar\/Bild", + "PayNym": "", + "starts with PM...": "startet mit PM..." } diff --git a/resources/lang/en.json b/resources/lang/en.json index 17512bba..e678bef3 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -857,5 +857,8 @@ "Perhabs": "", "There was an error on row :row. :message": "", "Calendar Stream-Url for my meetups only": "", - "Calendar Stream-Url for my meetups": "" + "Calendar Stream-Url for my meetups": "", + "Avatar\/Picture": "", + "PayNym": "", + "starts with PM...": "" } \ No newline at end of file diff --git a/resources/lang/es.json b/resources/lang/es.json index 9febd169..0c178e1b 100644 --- a/resources/lang/es.json +++ b/resources/lang/es.json @@ -857,5 +857,8 @@ "Perhabs": "", "There was an error on row :row. :message": "", "Calendar Stream-Url for my meetups only": "", - "Calendar Stream-Url for my meetups": "" + "Calendar Stream-Url for my meetups": "", + "Avatar\/Picture": "", + "PayNym": "", + "starts with PM...": "" } \ No newline at end of file diff --git a/resources/lang/fr.json b/resources/lang/fr.json index 7fafac87..617b43be 100644 --- a/resources/lang/fr.json +++ b/resources/lang/fr.json @@ -858,5 +858,8 @@ "Perhabs": "", "There was an error on row :row. :message": "", "Calendar Stream-Url for my meetups only": "", - "Calendar Stream-Url for my meetups": "" + "Calendar Stream-Url for my meetups": "", + "Avatar\/Picture": "", + "PayNym": "", + "starts with PM...": "" } \ No newline at end of file diff --git a/resources/lang/hr.json b/resources/lang/hr.json index 2018c99d..aeaa6212 100644 --- a/resources/lang/hr.json +++ b/resources/lang/hr.json @@ -858,5 +858,8 @@ "Perhabs": "", "There was an error on row :row. :message": "", "Calendar Stream-Url for my meetups only": "", - "Calendar Stream-Url for my meetups": "" + "Calendar Stream-Url for my meetups": "", + "Avatar\/Picture": "", + "PayNym": "", + "starts with PM...": "" } \ No newline at end of file diff --git a/resources/lang/it.json b/resources/lang/it.json index 3edd7427..742885fa 100644 --- a/resources/lang/it.json +++ b/resources/lang/it.json @@ -858,5 +858,8 @@ "Perhabs": "", "There was an error on row :row. :message": "", "Calendar Stream-Url for my meetups only": "", - "Calendar Stream-Url for my meetups": "" + "Calendar Stream-Url for my meetups": "", + "Avatar\/Picture": "", + "PayNym": "", + "starts with PM...": "" } \ No newline at end of file diff --git a/resources/lang/mk.json b/resources/lang/mk.json index 4c6af955..262cdc89 100644 --- a/resources/lang/mk.json +++ b/resources/lang/mk.json @@ -858,5 +858,8 @@ "Perhabs": "", "There was an error on row :row. :message": "", "Calendar Stream-Url for my meetups only": "", - "Calendar Stream-Url for my meetups": "" + "Calendar Stream-Url for my meetups": "", + "Avatar\/Picture": "", + "PayNym": "", + "starts with PM...": "" } \ No newline at end of file diff --git a/resources/lang/pl.json b/resources/lang/pl.json index 3be8a8d1..e56b244f 100644 --- a/resources/lang/pl.json +++ b/resources/lang/pl.json @@ -858,5 +858,8 @@ "Perhabs": "", "There was an error on row :row. :message": "", "Calendar Stream-Url for my meetups only": "", - "Calendar Stream-Url for my meetups": "" + "Calendar Stream-Url for my meetups": "", + "Avatar\/Picture": "", + "PayNym": "", + "starts with PM...": "" } \ No newline at end of file diff --git a/resources/lang/pt.json b/resources/lang/pt.json index 89e3e72c..c1f9462d 100644 --- a/resources/lang/pt.json +++ b/resources/lang/pt.json @@ -858,5 +858,8 @@ "Perhabs": "", "There was an error on row :row. :message": "", "Calendar Stream-Url for my meetups only": "", - "Calendar Stream-Url for my meetups": "" + "Calendar Stream-Url for my meetups": "", + "Avatar\/Picture": "", + "PayNym": "", + "starts with PM...": "" } \ No newline at end of file diff --git a/resources/lang/sv.json b/resources/lang/sv.json index f1bacaeb..8365cc71 100644 --- a/resources/lang/sv.json +++ b/resources/lang/sv.json @@ -820,5 +820,8 @@ "Perhabs": "", "There was an error on row :row. :message": "", "Calendar Stream-Url for my meetups only": "", - "Calendar Stream-Url for my meetups": "" + "Calendar Stream-Url for my meetups": "", + "Avatar\/Picture": "", + "PayNym": "", + "starts with PM...": "" } \ No newline at end of file diff --git a/resources/lang/tr.json b/resources/lang/tr.json index 1d4180e6..d02c5c38 100644 --- a/resources/lang/tr.json +++ b/resources/lang/tr.json @@ -832,5 +832,8 @@ "Perhabs": "", "There was an error on row :row. :message": "", "Calendar Stream-Url for my meetups only": "", - "Calendar Stream-Url for my meetups": "" + "Calendar Stream-Url for my meetups": "", + "Avatar\/Picture": "", + "PayNym": "", + "starts with PM...": "" } \ No newline at end of file diff --git a/resources/views/livewire/content-creator/form/content-creator-form.blade.php b/resources/views/livewire/content-creator/form/content-creator-form.blade.php index 4d631e56..4cfc510e 100644 --- a/resources/views/livewire/content-creator/form/content-creator-form.blade.php +++ b/resources/views/livewire/content-creator/form/content-creator-form.blade.php @@ -20,7 +20,7 @@
- +
@if ($image)
{{ __('Preview') }}:
@@ -69,6 +69,11 @@ :placeholder="__('Website')"/> + + + + diff --git a/resources/views/livewire/news/intern-article-view.blade.php b/resources/views/livewire/news/intern-article-view.blade.php index 58d387a1..7564ee9f 100644 --- a/resources/views/livewire/news/intern-article-view.blade.php +++ b/resources/views/livewire/news/intern-article-view.blade.php @@ -264,6 +264,13 @@
@endif + @if($payNymQrCode) +
+

PayNym

+ qrcode +
+ @endif +
@if($libraryItem->lecturer->lightning_address || $libraryItem->lecturer->lnurl || $libraryItem->lecturer->node_id) diff --git a/resources/views/profile/update-profile-information-form.blade.php b/resources/views/profile/update-profile-information-form.blade.php index 66d5e1cd..e0cc760d 100644 --- a/resources/views/profile/update-profile-information-form.blade.php +++ b/resources/views/profile/update-profile-information-form.blade.php @@ -73,6 +73,16 @@
+ +
+ + +

{{ __('starts with PM...') }}

+ +
+