diff --git a/app/Http/Livewire/News/Form/NewsArticleForm.php b/app/Http/Livewire/News/Form/NewsArticleForm.php index 6ca7d439..f58618c5 100644 --- a/app/Http/Livewire/News/Form/NewsArticleForm.php +++ b/app/Http/Livewire/News/Form/NewsArticleForm.php @@ -24,8 +24,9 @@ class NewsArticleForm extends Component public array $temporaryUrls = []; public ?string $fromUrl = ''; + public bool $paid = false; - protected $queryString = ['fromUrl' => ['except' => '']]; + protected $queryString = ['fromUrl' => ['except' => ''], 'paid' => ['except' => false]]; public function rules() { @@ -37,6 +38,7 @@ class NewsArticleForm extends Component 'libraryItem.type' => 'required', 'libraryItem.language_code' => 'required', 'libraryItem.value' => 'required', + 'libraryItem.sats' => 'required', 'libraryItem.subtitle' => 'string|nullable', 'libraryItem.excerpt' => 'required', 'libraryItem.main_image_caption' => 'string|nullable', @@ -50,12 +52,14 @@ class NewsArticleForm extends Component { if ($this->libraryItem === null) { $this->libraryItem = new LibraryItem([ - 'type' => 'markdown_article', - 'value' => '', - 'read_time' => 1, - 'news' => true, - 'language_code' => 'de', - 'approved' => auth() + 'type' => 'markdown_article', + 'value' => '', + 'value_to_be_paid' => '', + 'read_time' => 1, + 'sats' => 21, + 'news' => true, + 'language_code' => 'de', + 'approved' => auth() ->user() ->hasRole('news-editor'), ]); diff --git a/app/Http/Livewire/News/InternArticleView.php b/app/Http/Livewire/News/InternArticleView.php index b359bc97..4cefd700 100644 --- a/app/Http/Livewire/News/InternArticleView.php +++ b/app/Http/Livewire/News/InternArticleView.php @@ -3,23 +3,72 @@ namespace App\Http\Livewire\News; use App\Models\LibraryItem; +use App\Traits\LNBitsTrait; use Carbon\Carbon; use Livewire\Component; use RalphJSmit\Laravel\SEO\Support\SEOData; +use SimpleSoftwareIO\QrCode\Facades\QrCode; class InternArticleView extends Component { + use LNBitsTrait; + public LibraryItem $libraryItem; + public $qrCode = ''; + public $invoice = ''; + public $paymentHash = ''; + public $checkid = null; + public $checkThisPaymentHash = ''; + public bool $invoicePaid = false; + public bool $alreadyPaid = false; + public function mount() { $this->libraryItem->load([ 'libraries', ]); if ($this->libraryItem->libraries->where('is_public', false) - ->count() > 0 && ! auth()->check()) { + ->count() > 0 && !auth()->check()) { abort(403, __('Sorry! You are not authorized to perform this action.')); } + if (auth() + ->user() + ->paidArticles() + ->where('library_item_id', $this->libraryItem->id) + ->count() > 0) { + $this->invoicePaid = true; + } + } + + public function pay() + { + $invoice = $this->createInvoice( + sats: $this->libraryItem->sats, + memo: 'Payment for: "'.$this->libraryItem->slug.'" on Einundzwanzig Portal.' + ); + session('payment_hash_article_'.$this->libraryItem->id, $invoice['payment_hash']); + $this->paymentHash = $invoice['payment_hash']; + $this->qrCode = base64_encode(QrCode::format('png') + ->size(300) + ->merge($this->libraryItem->lecturer->getFirstMedia('avatar') ? $this->libraryItem->lecturer->getFirstMediaPath('avatar') : '/public/img/einundzwanzig.png', + .3) + ->errorCorrection('H') + ->generate($invoice['payment_request'])); + $this->invoice = $invoice['payment_request']; + $this->checkid = $invoice['checking_id']; + } + + public function checkPaymentHash() + { + $invoice = $this->check($this->checkid ?? $this->checkThisPaymentHash); + if ($invoice['paid']) { + $this->invoicePaid = true; + auth() + ->user() + ->paidArticles() + ->syncWithoutDetaching($this->libraryItem->id); + } } public function render() diff --git a/app/Http/Livewire/Profile/LNBits.php b/app/Http/Livewire/Profile/LNBits.php new file mode 100644 index 00000000..846cc6d0 --- /dev/null +++ b/app/Http/Livewire/Profile/LNBits.php @@ -0,0 +1,49 @@ + 'https://legend.lnbits.com', + 'wallet_id' => '', + 'read_key' => '', + ]; + + public function rules() + { + return [ + 'settings.url' => 'required|url', + 'settings.wallet_id' => 'required', + 'settings.read_key' => 'required', + ]; + } + + public function mount() + { + if (auth()->user()->lnbits) { + $this->settings = auth()->user()->lnbits; + } + } + + public function save() + { + $this->validate(); + $user = auth()->user(); + $user->lnbits = $this->settings; + $user->save(); + + $this->notification() + ->success(__('LNBits settings saved successfully!')); + } + + public function render() + { + return view('livewire.profile.l-n-bits'); + } +} diff --git a/app/Models/LibraryItem.php b/app/Models/LibraryItem.php index 27d49d29..9b533685 100644 --- a/app/Models/LibraryItem.php +++ b/app/Models/LibraryItem.php @@ -31,20 +31,22 @@ class LibraryItem extends Model implements HasMedia, Sortable, Feedable /** * The attributes that aren't mass assignable. - * * @var array */ protected $guarded = []; /** * The attributes that should be cast to native types. - * * @var array */ protected $casts = [ - 'id' => 'integer', + 'id' => 'integer', 'lecturer_id' => 'integer', - 'library_id' => 'integer', + 'library_id' => 'integer', + ]; + + protected $hidden = [ + 'value_to_be_paid', ]; public static function getFeedItems() @@ -63,7 +65,7 @@ class LibraryItem extends Model implements HasMedia, Sortable, Feedable protected static function booted() { static::creating(function ($model) { - if (! $model->created_by) { + if (!$model->created_by) { $model->created_by = auth()->id(); } }); diff --git a/app/Models/User.php b/app/Models/User.php index 6fc4cacf..c8443f20 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -12,6 +12,7 @@ use Laravel\Jetstream\HasTeams; use Laravel\Sanctum\HasApiTokens; use ParagonIE\CipherSweet\BlindIndex; use ParagonIE\CipherSweet\EncryptedRow; +use ParagonIE\CipherSweet\JsonFieldMap; use QCod\Gamify\Gamify; use Spatie\Comments\Models\Concerns\InteractsWithComments; use Spatie\Comments\Models\Concerns\Interfaces\CanComment; @@ -63,12 +64,18 @@ class User extends Authenticatable implements MustVerifyEmail, CanComment, Ciphe public static function configureCipherSweet(EncryptedRow $encryptedRow): void { + $map = (new JsonFieldMap()) + ->addTextField('url') + ->addTextField('read_key') + ->addTextField('wallet_id'); + $encryptedRow ->addField('public_key') ->addField('lightning_address') ->addField('lnurl') ->addField('node_id') ->addField('email') + ->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')) @@ -95,4 +102,9 @@ class User extends Authenticatable implements MustVerifyEmail, CanComment, Ciphe { return $this->hasMany(Vote::class); } + + public function paidArticles() + { + return $this->belongsToMany(LibraryItem::class, 'library_item_user', 'user_id', 'library_item_id'); + } } diff --git a/app/Traits/LNBitsTrait.php b/app/Traits/LNBitsTrait.php new file mode 100644 index 00000000..77013934 --- /dev/null +++ b/app/Traits/LNBitsTrait.php @@ -0,0 +1,36 @@ +user()->lnbits; + + $response = Http::withHeaders([ + 'X-Api-Key' => $lnbits['read_key'], + ]) + ->post($lnbits['url'].'/api/v1/payments', [ + 'out' => false, + 'amount' => $sats, + 'memo' => $memo, + ]); + + return $response->json(); + } + + public function check($paymentHash) + { + $lnbits = auth()->user()->lnbits; + + $response = Http::withHeaders([ + 'X-Api-Key' => $lnbits['read_key'], + ]) + ->get($lnbits['url'].'/api/v1/payments/' . $paymentHash); + + return $response->json(); + } +} diff --git a/composer.json b/composer.json index 8b5fce1e..500be761 100644 --- a/composer.json +++ b/composer.json @@ -76,7 +76,8 @@ "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^6.1", "phpunit/phpunit": "^9.5.10", - "spatie/laravel-ignition": "^2.0" + "spatie/laravel-ignition": "^2.0", + "laracasts/generators": "dev-master#7728ee6045ffdd5ae47fa209bc5fbd69492d90ce" }, "autoload": { "psr-4": { @@ -139,6 +140,10 @@ "symlink": false } }, + { + "type": "vcs", + "url": "https://github.com/HolgerHatGarKeineNode/Laravel-5-Generators-Extended" + }, { "type": "vcs", "url": "https://github.com/HolgerHatGarKeineNode/blade-country-flags" diff --git a/composer.lock b/composer.lock index f1f05f63..dd9c3743 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e0d111fae990e22e853f49e91eaf4138", + "content-hash": "82090857f80131ea826eeac73a9f26dd", "packages": [ { "name": "akuechler/laravel-geoly", @@ -5526,16 +5526,16 @@ }, { "name": "openspout/openspout", - "version": "v4.12.2", + "version": "v4.13.0", "source": { "type": "git", "url": "https://github.com/openspout/openspout.git", - "reference": "90ceeefef3750dd2afab95689ed2107dd576905e" + "reference": "e01cab951c04ef184c567a880290997e94386f94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/openspout/openspout/zipball/90ceeefef3750dd2afab95689ed2107dd576905e", - "reference": "90ceeefef3750dd2afab95689ed2107dd576905e", + "url": "https://api.github.com/repos/openspout/openspout/zipball/e01cab951c04ef184c567a880290997e94386f94", + "reference": "e01cab951c04ef184c567a880290997e94386f94", "shasum": "" }, "require": { @@ -5603,7 +5603,7 @@ ], "support": { "issues": "https://github.com/openspout/openspout/issues", - "source": "https://github.com/openspout/openspout/tree/v4.12.2" + "source": "https://github.com/openspout/openspout/tree/v4.13.0" }, "funding": [ { @@ -5615,7 +5615,7 @@ "type": "github" } ], - "time": "2023-03-03T07:45:00+00:00" + "time": "2023-03-13T14:32:53+00:00" }, { "name": "paragonie/ciphersweet", @@ -7557,16 +7557,16 @@ }, { "name": "rap2hpoutre/fast-excel", - "version": "v5.1.1", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/rap2hpoutre/fast-excel.git", - "reference": "05bc956fa6121b239c98960ea9b551116f20b058" + "reference": "c6d2b8b707b85f7c43028d3b4cc969388d8b6c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rap2hpoutre/fast-excel/zipball/05bc956fa6121b239c98960ea9b551116f20b058", - "reference": "05bc956fa6121b239c98960ea9b551116f20b058", + "url": "https://api.github.com/repos/rap2hpoutre/fast-excel/zipball/c6d2b8b707b85f7c43028d3b4cc969388d8b6c17", + "reference": "c6d2b8b707b85f7c43028d3b4cc969388d8b6c17", "shasum": "" }, "require": { @@ -7615,7 +7615,7 @@ ], "support": { "issues": "https://github.com/rap2hpoutre/fast-excel/issues", - "source": "https://github.com/rap2hpoutre/fast-excel/tree/v5.1.1" + "source": "https://github.com/rap2hpoutre/fast-excel/tree/v5.2.0" }, "funding": [ { @@ -7623,7 +7623,7 @@ "type": "github" } ], - "time": "2023-02-09T15:13:18+00:00" + "time": "2023-03-13T14:25:33+00:00" }, { "name": "rappasoft/laravel-livewire-tables", @@ -7755,16 +7755,16 @@ }, { "name": "sentry/sentry", - "version": "3.14.0", + "version": "3.15.0", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "60dd3f74ab21cc2bf53f39bf7c342798bc185c23" + "reference": "c6a0e24d2f8da8d8f57cdcc87ca635248c1a91c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/60dd3f74ab21cc2bf53f39bf7c342798bc185c23", - "reference": "60dd3f74ab21cc2bf53f39bf7c342798bc185c23", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/c6a0e24d2f8da8d8f57cdcc87ca635248c1a91c5", + "reference": "c6a0e24d2f8da8d8f57cdcc87ca635248c1a91c5", "shasum": "" }, "require": { @@ -7843,7 +7843,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-php/issues", - "source": "https://github.com/getsentry/sentry-php/tree/3.14.0" + "source": "https://github.com/getsentry/sentry-php/tree/3.15.0" }, "funding": [ { @@ -7855,7 +7855,7 @@ "type": "custom" } ], - "time": "2023-03-05T21:31:25+00:00" + "time": "2023-03-13T11:45:26+00:00" }, { "name": "sentry/sentry-laravel", @@ -14541,6 +14541,68 @@ }, "time": "2023-02-13T14:52:08+00:00" }, + { + "name": "laracasts/generators", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/HolgerHatGarKeineNode/Laravel-5-Generators-Extended.git", + "reference": "7728ee6045ffdd5ae47fa209bc5fbd69492d90ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/HolgerHatGarKeineNode/Laravel-5-Generators-Extended/zipball/7728ee6045ffdd5ae47fa209bc5fbd69492d90ce", + "reference": "7728ee6045ffdd5ae47fa209bc5fbd69492d90ce", + "shasum": "" + }, + "require": { + "illuminate/support": "~6.0|~7.0|~8.0|~9.0|~10.0" + }, + "require-dev": { + "phpspec/phpspec": "~6.0" + }, + "default-branch": true, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Laracasts\\Generators\\GeneratorsServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laracasts\\Generators\\": "src/" + } + }, + "scripts": { + "test": [ + "vendor/bin/phpspec run" + ] + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeffrey Way", + "email": "jeffrey@laracasts.com" + }, + { + "name": "Cristian Tabacitu", + "email": "hello@tabaciu.ro" + } + ], + "description": "Advanced Laravel generators, that include schema information.", + "keywords": [ + "generators", + "laravel" + ], + "support": { + "source": "https://github.com/HolgerHatGarKeineNode/Laravel-5-Generators-Extended/tree/master" + }, + "time": "2023-03-13T14:54:33+00:00" + }, { "name": "laravel-lang/attributes", "version": "v2.3.2", @@ -17253,7 +17315,8 @@ "ebess/advanced-nova-media-library": 20, "qcod/laravel-gamify": 20, "stijnvanouplines/blade-country-flags": 20, - "wireui/wireui": 20 + "wireui/wireui": 20, + "laracasts/generators": 20 }, "prefer-stable": true, "prefer-lowest": false, diff --git a/database/migrations/2023_03_13_130046_add_lnbits_field_to_users_table.php b/database/migrations/2023_03_13_130046_add_lnbits_field_to_users_table.php new file mode 100644 index 00000000..93340685 --- /dev/null +++ b/database/migrations/2023_03_13_130046_add_lnbits_field_to_users_table.php @@ -0,0 +1,28 @@ +json('lnbits') + ->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + // + }); + } +}; diff --git a/database/migrations/2023_03_13_133526_add_value_to_be_paid_field_to_library_items_table.php b/database/migrations/2023_03_13_133526_add_value_to_be_paid_field_to_library_items_table.php new file mode 100644 index 00000000..b0c0106d --- /dev/null +++ b/database/migrations/2023_03_13_133526_add_value_to_be_paid_field_to_library_items_table.php @@ -0,0 +1,28 @@ +text('value_to_be_paid') + ->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('library_items', function (Blueprint $table) { + // + }); + } +}; diff --git a/database/migrations/2023_03_13_134313_add_sats_field_to_library_items_table.php b/database/migrations/2023_03_13_134313_add_sats_field_to_library_items_table.php new file mode 100644 index 00000000..7c07df08 --- /dev/null +++ b/database/migrations/2023_03_13_134313_add_sats_field_to_library_items_table.php @@ -0,0 +1,28 @@ +unsignedBigInteger('sats') + ->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('library_items', function (Blueprint $table) { + // + }); + } +}; diff --git a/database/migrations/2023_03_13_145545_create_library_item_user_pivot_table.php b/database/migrations/2023_03_13_145545_create_library_item_user_pivot_table.php new file mode 100644 index 00000000..294fdebd --- /dev/null +++ b/database/migrations/2023_03_13_145545_create_library_item_user_pivot_table.php @@ -0,0 +1,33 @@ +unsignedBigInteger('library_item_id')->index(); + $table->foreign('library_item_id')->references('id')->on('library_items')->onDelete('cascade'); + $table->unsignedBigInteger('user_id')->index(); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + $table->primary(['library_item_id', 'user_id']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('library_item_user'); + } +} diff --git a/draft.yaml b/draft.yaml index 95a3ece0..c5593585 100644 --- a/draft.yaml +++ b/draft.yaml @@ -1,11 +1 @@ models: - ProjectProposal: - user_id: foreign - name: string unique - support_in_sats: integer unsigned - description: text - Vote: - user_id: foreign - project_proposal_id: foreign - value: integer unsigned - reason: text nullable diff --git a/resources/lang/de.json b/resources/lang/de.json index def57d94..04a4329b 100644 --- a/resources/lang/de.json +++ b/resources/lang/de.json @@ -820,6 +820,25 @@ "sats": "sats", "Your vote": "Deine Stimme", "Association": "Verein", - "for voting you have to be logged in": "", - "Yes, support it!": "Ja, unterstützen!" + "for voting you have to be logged in": "für die Abstimmung musst du angemeldet sein", + "Yes, support it!": "Ja, unterstützen!", + "LNBits settings saved successfully!": "LNBits-Einstellungen erfolgreich gespeichert!", + "LNBits": "", + "Submit paid news article": "Reiche einen bezahlten News-Artikel ein", + "Paid article": "Bezahlter Artikel", + "Paid News Article": "Bezahlter News-Artikel", + "How many sats to read this article?": "Wie viele sats für den Zugriff auf diesen Artikel?", + "Free part of the Article as Markdown": "Kostenloser Teil des Artikels als Markdown", + "Part of the article to be paid": "Zu zahlender Teil des Artikels", + "You can read the full article if you paid with Lightning": "Du kannst den vollständigen Artikel lesen, wenn du mit Lightning bezahlt hast", + "Receiver": "Empfänger", + "already paid?": "schon bezahlt?", + "Payment Hash": "Payment Hash", + "Payment hash copied!": "Payment Hash kopiert!", + "Copy payment hash": "Kopiere Payment Hash", + "Enter the data of your LNBits instance here to receive sats for articles, for example.": "Gib hier die Daten deiner LNBits-Instanz ein, um sats für zum Beispiel Artikel zu erhalten.", + "LNBits Url": "", + "Wallet ID": "", + "Invoice\/read key": "", + "paid": "zu bezahlen" } diff --git a/resources/lang/en.json b/resources/lang/en.json index bb644dbe..f96f8a08 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -818,5 +818,25 @@ "Your vote": "", "Association": "", "for voting you have to be logged in": "", - "Yes, support it!": "" + "Yes, support it!": "", + "LNBits settings saved successfully!": "", + "LNBits": "", + "Submit paid news article": "", + "Paid article": "", + "Paid News Article": "", + "Sats": "", + "How many sats to read this article?": "", + "Free part of the Article as Markdown": "", + "Part of the article to be paid": "", + "You can read the full article if you paid with Lightning": "", + "Receiver": "", + "already paid?": "", + "Payment Hash": "", + "Payment hash copied!": "", + "Copy payment hash": "", + "Enter the data of your LNBits instance here to receive sats for articles, for example.": "", + "LNBits Url": "", + "Wallet ID": "", + "Invoice\/read key": "", + "paid": "" } \ No newline at end of file diff --git a/resources/lang/es.json b/resources/lang/es.json index 2fe0d2ed..d1bbc280 100644 --- a/resources/lang/es.json +++ b/resources/lang/es.json @@ -818,5 +818,25 @@ "Your vote": "", "Association": "", "for voting you have to be logged in": "", - "Yes, support it!": "" + "Yes, support it!": "", + "LNBits settings saved successfully!": "", + "LNBits": "", + "Submit paid news article": "", + "Paid article": "", + "Paid News Article": "", + "Sats": "", + "How many sats to read this article?": "", + "Free part of the Article as Markdown": "", + "Part of the article to be paid": "", + "You can read the full article if you paid with Lightning": "", + "Receiver": "", + "already paid?": "", + "Payment Hash": "", + "Payment hash copied!": "", + "Copy payment hash": "", + "Enter the data of your LNBits instance here to receive sats for articles, for example.": "", + "LNBits Url": "", + "Wallet ID": "", + "Invoice\/read key": "", + "paid": "" } \ No newline at end of file diff --git a/resources/lang/fr.json b/resources/lang/fr.json index b73e7b4e..31284e60 100644 --- a/resources/lang/fr.json +++ b/resources/lang/fr.json @@ -819,5 +819,25 @@ "Your vote": "", "Association": "", "for voting you have to be logged in": "", - "Yes, support it!": "" + "Yes, support it!": "", + "LNBits settings saved successfully!": "", + "LNBits": "", + "Submit paid news article": "", + "Paid article": "", + "Paid News Article": "", + "Sats": "", + "How many sats to read this article?": "", + "Free part of the Article as Markdown": "", + "Part of the article to be paid": "", + "You can read the full article if you paid with Lightning": "", + "Receiver": "", + "already paid?": "", + "Payment Hash": "", + "Payment hash copied!": "", + "Copy payment hash": "", + "Enter the data of your LNBits instance here to receive sats for articles, for example.": "", + "LNBits Url": "", + "Wallet ID": "", + "Invoice\/read key": "", + "paid": "" } \ No newline at end of file diff --git a/resources/lang/hr.json b/resources/lang/hr.json index f98732f1..9da0dfb0 100644 --- a/resources/lang/hr.json +++ b/resources/lang/hr.json @@ -819,5 +819,25 @@ "Your vote": "", "Association": "", "for voting you have to be logged in": "", - "Yes, support it!": "" + "Yes, support it!": "", + "LNBits settings saved successfully!": "", + "LNBits": "", + "Submit paid news article": "", + "Paid article": "", + "Paid News Article": "", + "Sats": "", + "How many sats to read this article?": "", + "Free part of the Article as Markdown": "", + "Part of the article to be paid": "", + "You can read the full article if you paid with Lightning": "", + "Receiver": "", + "already paid?": "", + "Payment Hash": "", + "Payment hash copied!": "", + "Copy payment hash": "", + "Enter the data of your LNBits instance here to receive sats for articles, for example.": "", + "LNBits Url": "", + "Wallet ID": "", + "Invoice\/read key": "", + "paid": "" } \ No newline at end of file diff --git a/resources/lang/it.json b/resources/lang/it.json index da810ed8..b91cecbd 100644 --- a/resources/lang/it.json +++ b/resources/lang/it.json @@ -819,5 +819,25 @@ "Your vote": "", "Association": "", "for voting you have to be logged in": "", - "Yes, support it!": "" + "Yes, support it!": "", + "LNBits settings saved successfully!": "", + "LNBits": "", + "Submit paid news article": "", + "Paid article": "", + "Paid News Article": "", + "Sats": "", + "How many sats to read this article?": "", + "Free part of the Article as Markdown": "", + "Part of the article to be paid": "", + "You can read the full article if you paid with Lightning": "", + "Receiver": "", + "already paid?": "", + "Payment Hash": "", + "Payment hash copied!": "", + "Copy payment hash": "", + "Enter the data of your LNBits instance here to receive sats for articles, for example.": "", + "LNBits Url": "", + "Wallet ID": "", + "Invoice\/read key": "", + "paid": "" } \ No newline at end of file diff --git a/resources/lang/mk.json b/resources/lang/mk.json index 13b104b4..5d411b68 100644 --- a/resources/lang/mk.json +++ b/resources/lang/mk.json @@ -819,5 +819,25 @@ "Your vote": "", "Association": "", "for voting you have to be logged in": "", - "Yes, support it!": "" + "Yes, support it!": "", + "LNBits settings saved successfully!": "", + "LNBits": "", + "Submit paid news article": "", + "Paid article": "", + "Paid News Article": "", + "Sats": "", + "How many sats to read this article?": "", + "Free part of the Article as Markdown": "", + "Part of the article to be paid": "", + "You can read the full article if you paid with Lightning": "", + "Receiver": "", + "already paid?": "", + "Payment Hash": "", + "Payment hash copied!": "", + "Copy payment hash": "", + "Enter the data of your LNBits instance here to receive sats for articles, for example.": "", + "LNBits Url": "", + "Wallet ID": "", + "Invoice\/read key": "", + "paid": "" } \ No newline at end of file diff --git a/resources/lang/pl.json b/resources/lang/pl.json index f29fe2f4..16ec9757 100644 --- a/resources/lang/pl.json +++ b/resources/lang/pl.json @@ -819,5 +819,25 @@ "Your vote": "", "Association": "", "for voting you have to be logged in": "", - "Yes, support it!": "" + "Yes, support it!": "", + "LNBits settings saved successfully!": "", + "LNBits": "", + "Submit paid news article": "", + "Paid article": "", + "Paid News Article": "", + "Sats": "", + "How many sats to read this article?": "", + "Free part of the Article as Markdown": "", + "Part of the article to be paid": "", + "You can read the full article if you paid with Lightning": "", + "Receiver": "", + "already paid?": "", + "Payment Hash": "", + "Payment hash copied!": "", + "Copy payment hash": "", + "Enter the data of your LNBits instance here to receive sats for articles, for example.": "", + "LNBits Url": "", + "Wallet ID": "", + "Invoice\/read key": "", + "paid": "" } \ No newline at end of file diff --git a/resources/lang/pt.json b/resources/lang/pt.json index 56672e5a..c6a91245 100644 --- a/resources/lang/pt.json +++ b/resources/lang/pt.json @@ -819,5 +819,25 @@ "Your vote": "", "Association": "", "for voting you have to be logged in": "", - "Yes, support it!": "" + "Yes, support it!": "", + "LNBits settings saved successfully!": "", + "LNBits": "", + "Submit paid news article": "", + "Paid article": "", + "Paid News Article": "", + "Sats": "", + "How many sats to read this article?": "", + "Free part of the Article as Markdown": "", + "Part of the article to be paid": "", + "You can read the full article if you paid with Lightning": "", + "Receiver": "", + "already paid?": "", + "Payment Hash": "", + "Payment hash copied!": "", + "Copy payment hash": "", + "Enter the data of your LNBits instance here to receive sats for articles, for example.": "", + "LNBits Url": "", + "Wallet ID": "", + "Invoice\/read key": "", + "paid": "" } \ No newline at end of file diff --git a/resources/lang/sv.json b/resources/lang/sv.json index e632e56a..af316503 100644 --- a/resources/lang/sv.json +++ b/resources/lang/sv.json @@ -781,5 +781,25 @@ "Your vote": "", "Association": "", "for voting you have to be logged in": "", - "Yes, support it!": "" + "Yes, support it!": "", + "LNBits settings saved successfully!": "", + "LNBits": "", + "Submit paid news article": "", + "Paid article": "", + "Paid News Article": "", + "Sats": "", + "How many sats to read this article?": "", + "Free part of the Article as Markdown": "", + "Part of the article to be paid": "", + "You can read the full article if you paid with Lightning": "", + "Receiver": "", + "already paid?": "", + "Payment Hash": "", + "Payment hash copied!": "", + "Copy payment hash": "", + "Enter the data of your LNBits instance here to receive sats for articles, for example.": "", + "LNBits Url": "", + "Wallet ID": "", + "Invoice\/read key": "", + "paid": "" } \ No newline at end of file diff --git a/resources/lang/tr.json b/resources/lang/tr.json index 415ea063..57427915 100644 --- a/resources/lang/tr.json +++ b/resources/lang/tr.json @@ -793,5 +793,25 @@ "Your vote": "", "Association": "", "for voting you have to be logged in": "", - "Yes, support it!": "" + "Yes, support it!": "", + "LNBits settings saved successfully!": "", + "LNBits": "", + "Submit paid news article": "", + "Paid article": "", + "Paid News Article": "", + "Sats": "", + "How many sats to read this article?": "", + "Free part of the Article as Markdown": "", + "Part of the article to be paid": "", + "You can read the full article if you paid with Lightning": "", + "Receiver": "", + "already paid?": "", + "Payment Hash": "", + "Payment hash copied!": "", + "Copy payment hash": "", + "Enter the data of your LNBits instance here to receive sats for articles, for example.": "", + "LNBits Url": "", + "Wallet ID": "", + "Invoice\/read key": "", + "paid": "" } \ No newline at end of file diff --git a/resources/views/livewire/frontend/navigation/profile.blade.php b/resources/views/livewire/frontend/navigation/profile.blade.php index 11152d71..c2e49361 100644 --- a/resources/views/livewire/frontend/navigation/profile.blade.php +++ b/resources/views/livewire/frontend/navigation/profile.blade.php @@ -42,6 +42,12 @@ {{ __('My meetups') }} + + + {{ __('LNBits') }} + + diff --git a/resources/views/livewire/news/article-overview.blade.php b/resources/views/livewire/news/article-overview.blade.php index f9ed76cb..fc851439 100644 --- a/resources/views/livewire/news/article-overview.blade.php +++ b/resources/views/livewire/news/article-overview.blade.php @@ -15,11 +15,22 @@
@auth {{ __('Submit news articles') }} + @if(auth()->user()->lnbits) + + + {{ __('Submit paid news article') }} + + + @endif @endauth
@@ -28,7 +39,15 @@ @foreach($libraryItems as $libraryItem) @if($libraryItem->approved || $libraryItem->created_by === auth()->id() || auth()->user()?->hasRole('news-editor'))
+ class="relative flex flex-col overflow-hidden rounded-lg border-2 border-[#F7931A]"> + @if($libraryItem->sats) +
+
+ {{ __('paid') }} +
+
+ @endif
-

{{ __('News Article') }}

+ @if($paid) +

{{ __('Paid News Article') }}

+ @else +

{{ __('News Article') }}

+ @endif
@if($libraryItem->created_by === auth()->id()) @@ -36,6 +40,13 @@
+ @if($paid) + + + + @endif +
@@ -113,13 +124,22 @@ /> - +
{{ __('For images in Markdown, please use eg. Imgur or another provider.') }}
@error('libraryItem.value') {{ $message }} @enderror
+ @if($paid) + +
{{ __('For images in Markdown, please use eg. Imgur or another provider.') }}
+ + @error('libraryItem.value_to_be_paid') {{ $message }} @enderror +
+ @endif + diff --git a/resources/views/livewire/news/intern-article-view.blade.php b/resources/views/livewire/news/intern-article-view.blade.php index 26b56d1d..e2239226 100644 --- a/resources/views/livewire/news/intern-article-view.blade.php +++ b/resources/views/livewire/news/intern-article-view.blade.php @@ -138,7 +138,127 @@ {!! $libraryItem->value !!} @endif +
+ @if($libraryItem->sats && !$invoicePaid) +
+ @else +
+ + + {!! $libraryItem->value_to_be_paid !!} + + +
+ @endif + +
@if($libraryItem->lecturer->lightning_address || $libraryItem->lecturer->lnurl || $libraryItem->lecturer->node_id)

value-4-value

@@ -163,7 +283,14 @@ {{-- FOOTER --}} +
+
+