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:
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire\Profile;
|
namespace App\Http\Livewire\Profile;
|
||||||
|
|
||||||
|
use App\Traits\LNBitsTrait;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use WireUi\Traits\Actions;
|
use WireUi\Traits\Actions;
|
||||||
|
|
||||||
class LNBits extends Component
|
class LNBits extends Component
|
||||||
{
|
{
|
||||||
use Actions;
|
use Actions;
|
||||||
|
use LNBitsTrait;
|
||||||
|
|
||||||
public array $settings = [
|
public array $settings = [
|
||||||
'url' => 'https://legend.lnbits.com',
|
'url' => 'https://legend.lnbits.com',
|
||||||
@@ -34,6 +36,12 @@ class LNBits extends Component
|
|||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
$this->validate();
|
$this->validate();
|
||||||
|
if ($this->checkLnbitsSettings($this->settings['read_key'], $this->settings['url'], $this->settings['wallet_id']) === false) {
|
||||||
|
$this->notification()
|
||||||
|
->error(__('LNBits settings are not valid!'));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$user->lnbits = $this->settings;
|
$user->lnbits = $this->settings;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|||||||
@@ -6,6 +6,16 @@ use Illuminate\Support\Facades\Http;
|
|||||||
|
|
||||||
trait LNBitsTrait
|
trait LNBitsTrait
|
||||||
{
|
{
|
||||||
|
public function checkLnbitsSettings($read_key, $uri, $id)
|
||||||
|
{
|
||||||
|
$response = Http::withHeaders([
|
||||||
|
'X-Api-Key' => $read_key,
|
||||||
|
])
|
||||||
|
->get($uri.'/api/v1/wallet');
|
||||||
|
|
||||||
|
return $response->status() === 200;
|
||||||
|
}
|
||||||
|
|
||||||
public function createInvoice($sats, $memo)
|
public function createInvoice($sats, $memo)
|
||||||
{
|
{
|
||||||
$lnbits = auth()->user()->lnbits;
|
$lnbits = auth()->user()->lnbits;
|
||||||
|
|||||||
@@ -837,8 +837,11 @@
|
|||||||
"Payment hash copied!": "Payment Hash kopiert!",
|
"Payment hash copied!": "Payment Hash kopiert!",
|
||||||
"Copy payment hash": "Kopiere Payment Hash",
|
"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.",
|
"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": "",
|
"LNBits Url": "LNBits Url",
|
||||||
"Wallet ID": "",
|
"Wallet ID": "Wallet ID",
|
||||||
"Invoice\/read key": "",
|
"Invoice\/read key": "Invoice\/read key",
|
||||||
"paid": "zu bezahlen"
|
"paid": "zu bezahlen",
|
||||||
|
"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",
|
||||||
|
"LNBits settings are not valid!": "LNBits-Einstellungen sind nicht gültig!"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -838,5 +838,8 @@
|
|||||||
"LNBits Url": "",
|
"LNBits Url": "",
|
||||||
"Wallet ID": "",
|
"Wallet ID": "",
|
||||||
"Invoice\/read key": "",
|
"Invoice\/read key": "",
|
||||||
"paid": ""
|
"paid": "",
|
||||||
|
"Setup LNBits for paid articles": "",
|
||||||
|
"Click QR-Code to open your wallet": "",
|
||||||
|
"LNBits settings are not valid!": ""
|
||||||
}
|
}
|
||||||
@@ -838,5 +838,8 @@
|
|||||||
"LNBits Url": "",
|
"LNBits Url": "",
|
||||||
"Wallet ID": "",
|
"Wallet ID": "",
|
||||||
"Invoice\/read key": "",
|
"Invoice\/read key": "",
|
||||||
"paid": ""
|
"paid": "",
|
||||||
|
"Setup LNBits for paid articles": "",
|
||||||
|
"Click QR-Code to open your wallet": "",
|
||||||
|
"LNBits settings are not valid!": ""
|
||||||
}
|
}
|
||||||
@@ -839,5 +839,8 @@
|
|||||||
"LNBits Url": "",
|
"LNBits Url": "",
|
||||||
"Wallet ID": "",
|
"Wallet ID": "",
|
||||||
"Invoice\/read key": "",
|
"Invoice\/read key": "",
|
||||||
"paid": ""
|
"paid": "",
|
||||||
|
"Setup LNBits for paid articles": "",
|
||||||
|
"Click QR-Code to open your wallet": "",
|
||||||
|
"LNBits settings are not valid!": ""
|
||||||
}
|
}
|
||||||
@@ -839,5 +839,8 @@
|
|||||||
"LNBits Url": "",
|
"LNBits Url": "",
|
||||||
"Wallet ID": "",
|
"Wallet ID": "",
|
||||||
"Invoice\/read key": "",
|
"Invoice\/read key": "",
|
||||||
"paid": ""
|
"paid": "",
|
||||||
|
"Setup LNBits for paid articles": "",
|
||||||
|
"Click QR-Code to open your wallet": "",
|
||||||
|
"LNBits settings are not valid!": ""
|
||||||
}
|
}
|
||||||
@@ -839,5 +839,8 @@
|
|||||||
"LNBits Url": "",
|
"LNBits Url": "",
|
||||||
"Wallet ID": "",
|
"Wallet ID": "",
|
||||||
"Invoice\/read key": "",
|
"Invoice\/read key": "",
|
||||||
"paid": ""
|
"paid": "",
|
||||||
|
"Setup LNBits for paid articles": "",
|
||||||
|
"Click QR-Code to open your wallet": "",
|
||||||
|
"LNBits settings are not valid!": ""
|
||||||
}
|
}
|
||||||
@@ -839,5 +839,8 @@
|
|||||||
"LNBits Url": "",
|
"LNBits Url": "",
|
||||||
"Wallet ID": "",
|
"Wallet ID": "",
|
||||||
"Invoice\/read key": "",
|
"Invoice\/read key": "",
|
||||||
"paid": ""
|
"paid": "",
|
||||||
|
"Setup LNBits for paid articles": "",
|
||||||
|
"Click QR-Code to open your wallet": "",
|
||||||
|
"LNBits settings are not valid!": ""
|
||||||
}
|
}
|
||||||
@@ -839,5 +839,8 @@
|
|||||||
"LNBits Url": "",
|
"LNBits Url": "",
|
||||||
"Wallet ID": "",
|
"Wallet ID": "",
|
||||||
"Invoice\/read key": "",
|
"Invoice\/read key": "",
|
||||||
"paid": ""
|
"paid": "",
|
||||||
|
"Setup LNBits for paid articles": "",
|
||||||
|
"Click QR-Code to open your wallet": "",
|
||||||
|
"LNBits settings are not valid!": ""
|
||||||
}
|
}
|
||||||
@@ -839,5 +839,8 @@
|
|||||||
"LNBits Url": "",
|
"LNBits Url": "",
|
||||||
"Wallet ID": "",
|
"Wallet ID": "",
|
||||||
"Invoice\/read key": "",
|
"Invoice\/read key": "",
|
||||||
"paid": ""
|
"paid": "",
|
||||||
|
"Setup LNBits for paid articles": "",
|
||||||
|
"Click QR-Code to open your wallet": "",
|
||||||
|
"LNBits settings are not valid!": ""
|
||||||
}
|
}
|
||||||
@@ -801,5 +801,8 @@
|
|||||||
"LNBits Url": "",
|
"LNBits Url": "",
|
||||||
"Wallet ID": "",
|
"Wallet ID": "",
|
||||||
"Invoice\/read key": "",
|
"Invoice\/read key": "",
|
||||||
"paid": ""
|
"paid": "",
|
||||||
|
"Setup LNBits for paid articles": "",
|
||||||
|
"Click QR-Code to open your wallet": "",
|
||||||
|
"LNBits settings are not valid!": ""
|
||||||
}
|
}
|
||||||
@@ -813,5 +813,8 @@
|
|||||||
"LNBits Url": "",
|
"LNBits Url": "",
|
||||||
"Wallet ID": "",
|
"Wallet ID": "",
|
||||||
"Invoice\/read key": "",
|
"Invoice\/read key": "",
|
||||||
"paid": ""
|
"paid": "",
|
||||||
|
"Setup LNBits for paid articles": "",
|
||||||
|
"Click QR-Code to open your wallet": "",
|
||||||
|
"LNBits settings are not valid!": ""
|
||||||
}
|
}
|
||||||
@@ -30,6 +30,15 @@
|
|||||||
{{ __('Submit paid news article') }}
|
{{ __('Submit paid news article') }}
|
||||||
<i class="fa fa-thin fa-coins"></i>
|
<i class="fa fa-thin fa-coins"></i>
|
||||||
</x-button>
|
</x-button>
|
||||||
|
@else
|
||||||
|
<x-button
|
||||||
|
class="whitespace-nowrap"
|
||||||
|
:href="route('profile.lnbits')"
|
||||||
|
black>
|
||||||
|
<i class="fa fa-thin fa-gear"></i>
|
||||||
|
{{ __('Setup LNBits for paid articles') }}
|
||||||
|
<i class="fa fa-thin fa-coins"></i>
|
||||||
|
</x-button>
|
||||||
@endif
|
@endif
|
||||||
@endauth
|
@endauth
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-3">
|
<div class="ml-3">
|
||||||
<p class="text-sm font-medium text-gray-200">
|
<div class="text-sm font-medium text-gray-200">
|
||||||
<div class="text-gray-200">{{ $libraryItem->lecturer->name }}</div>
|
<div class="text-gray-200">{{ $libraryItem->lecturer->name }}</div>
|
||||||
</p>
|
</div>
|
||||||
<div class="flex space-x-1 text-sm text-gray-500">
|
<div class="flex space-x-1 text-sm text-gray-500">
|
||||||
<time datetime="2020-03-16">{{ $libraryItem->created_at->asDateTime() }}</time>
|
<time datetime="2020-03-16">{{ $libraryItem->created_at->asDateTime() }}</time>
|
||||||
@if($libraryItem->read_time)
|
@if($libraryItem->read_time)
|
||||||
|
|||||||
Reference in New Issue
Block a user