mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
lnbits paid articles added
This commit is contained in:
@@ -33,9 +33,6 @@ class InternArticleView extends Component
|
|||||||
->count() > 0 && !auth()->check()) {
|
->count() > 0 && !auth()->check()) {
|
||||||
abort(403, __('Sorry! You are not authorized to perform this action.'));
|
abort(403, __('Sorry! You are not authorized to perform this action.'));
|
||||||
}
|
}
|
||||||
if ($this->libraryItem->sats && !auth()->check()) {
|
|
||||||
return to_route('article.overview');
|
|
||||||
}
|
|
||||||
if (auth()->check() && auth()
|
if (auth()->check() && auth()
|
||||||
->user()
|
->user()
|
||||||
->paidArticles()
|
->paidArticles()
|
||||||
@@ -77,10 +74,12 @@ class InternArticleView extends Component
|
|||||||
$invoice = $this->check($this->checkid ?? $this->checkThisPaymentHash, $this->libraryItem->createdBy->lnbits);
|
$invoice = $this->check($this->checkid ?? $this->checkThisPaymentHash, $this->libraryItem->createdBy->lnbits);
|
||||||
if (isset($invoice['paid']) && $invoice['paid']) {
|
if (isset($invoice['paid']) && $invoice['paid']) {
|
||||||
$this->invoicePaid = true;
|
$this->invoicePaid = true;
|
||||||
auth()
|
if (auth()->check()) {
|
||||||
->user()
|
auth()
|
||||||
->paidArticles()
|
->user()
|
||||||
->syncWithoutDetaching($this->libraryItem->id);
|
->paidArticles()
|
||||||
|
->syncWithoutDetaching($this->libraryItem->id);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log::error(json_encode($invoice, JSON_THROW_ON_ERROR));
|
Log::error(json_encode($invoice, JSON_THROW_ON_ERROR));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -843,5 +843,6 @@
|
|||||||
"paid": "zu bezahlen",
|
"paid": "zu bezahlen",
|
||||||
"Setup LNBits for paid articles": "Setze LNBits für bezahlte Artikel ein",
|
"Setup LNBits for paid articles": "Setze LNBits für bezahlte Artikel ein",
|
||||||
"Click QR-Code to open your wallet": "Klicke auf den QR-Code, um deine Wallet zu öffnen",
|
"Click QR-Code to open your wallet": "Klicke auf den QR-Code, um deine Wallet zu öffnen",
|
||||||
"LNBits settings are not valid!": "LNBits-Einstellungen sind nicht gültig!"
|
"LNBits settings are not valid!": "LNBits-Einstellungen sind nicht gültig!",
|
||||||
|
"As a guest, please save your payment hash so that you can unlock this article later. Unfortunately, we cannot save your purchase status permanently for guests. Please log in to use this feature.": "Bitte speichere als Gast deinen Payment Hash, damit du diesen Artikel später entsperren kannst. Leider können wir deinen Kaufstatus nicht dauerhaft speichern. Bitte melde dich an, um diese Funktion zu nutzen."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,11 +47,6 @@
|
|||||||
|
|
||||||
@foreach($libraryItems as $libraryItem)
|
@foreach($libraryItems as $libraryItem)
|
||||||
@if($libraryItem->approved || $libraryItem->created_by === auth()->id() || auth()->user()?->hasRole('news-editor'))
|
@if($libraryItem->approved || $libraryItem->created_by === auth()->id() || auth()->user()?->hasRole('news-editor'))
|
||||||
@php
|
|
||||||
if($libraryItem->sats && !auth()->check()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
@endphp
|
|
||||||
<div wire:key="library_item_{{ $libraryItem->id }}" wire:loading.class="opacity-25"
|
<div wire:key="library_item_{{ $libraryItem->id }}" wire:loading.class="opacity-25"
|
||||||
class="relative flex flex-col overflow-hidden rounded-lg border-2 border-[#F7931A]">
|
class="relative flex flex-col overflow-hidden rounded-lg border-2 border-[#F7931A]">
|
||||||
@if($libraryItem->sats)
|
@if($libraryItem->sats)
|
||||||
|
|||||||
@@ -174,12 +174,13 @@
|
|||||||
</div>
|
</div>
|
||||||
@if(!$invoice)
|
@if(!$invoice)
|
||||||
<div class="mt-10 flex items-center justify-center gap-x-6">
|
<div class="mt-10 flex items-center justify-center gap-x-6">
|
||||||
<div
|
<x-button
|
||||||
wire:click="pay"
|
wire.loading.attr="disabled"
|
||||||
class="cursor-pointer rounded-md bg-white px-3.5 py-2.5 text-sm font-semibold text-gray-900 shadow-sm hover:bg-gray-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white">
|
primary
|
||||||
|
wire:click="pay">
|
||||||
<i class="fa-thin fa-bolt"></i>
|
<i class="fa-thin fa-bolt"></i>
|
||||||
Pay with lightning
|
Pay with lightning
|
||||||
</div>
|
</x-button>
|
||||||
<div wire:click="$set('alreadyPaid', true)" class="cursor-pointer text-sm font-semibold leading-6 text-white">{{ __('already paid?') }} <span aria-hidden="true">→</span></div>
|
<div wire:click="$set('alreadyPaid', true)" class="cursor-pointer text-sm font-semibold leading-6 text-white">{{ __('already paid?') }} <span aria-hidden="true">→</span></div>
|
||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
@@ -244,6 +245,9 @@
|
|||||||
{{ __('Copy payment hash') }}
|
{{ __('Copy payment hash') }}
|
||||||
</x-button>
|
</x-button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="w-full my-2 flex justify-center font-mono font-bold p-4">
|
||||||
|
<p class="text-amber-500">{{ __('As a guest, please save your payment hash so that you can unlock this article later. Unfortunately, we cannot save your purchase status permanently for guests. Please log in to use this feature.') }}</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div wire:poll.keep-alive="checkPaymentHash" wire:key="checkPaymentHash"></div>
|
<div wire:poll.keep-alive="checkPaymentHash" wire:key="checkPaymentHash"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user