diff --git a/app/Http/Livewire/Profile/LNBits.php b/app/Http/Livewire/Profile/LNBits.php
index 846cc6d0..16359be0 100644
--- a/app/Http/Livewire/Profile/LNBits.php
+++ b/app/Http/Livewire/Profile/LNBits.php
@@ -2,12 +2,14 @@
namespace App\Http\Livewire\Profile;
+use App\Traits\LNBitsTrait;
use Livewire\Component;
use WireUi\Traits\Actions;
class LNBits extends Component
{
use Actions;
+ use LNBitsTrait;
public array $settings = [
'url' => 'https://legend.lnbits.com',
@@ -34,6 +36,12 @@ class LNBits extends Component
public function save()
{
$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->lnbits = $this->settings;
$user->save();
diff --git a/app/Traits/LNBitsTrait.php b/app/Traits/LNBitsTrait.php
index 77013934..96eae941 100644
--- a/app/Traits/LNBitsTrait.php
+++ b/app/Traits/LNBitsTrait.php
@@ -6,6 +6,16 @@ use Illuminate\Support\Facades\Http;
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)
{
$lnbits = auth()->user()->lnbits;
diff --git a/resources/lang/de.json b/resources/lang/de.json
index 04a4329b..98134a98 100644
--- a/resources/lang/de.json
+++ b/resources/lang/de.json
@@ -837,8 +837,11 @@
"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"
+ "LNBits Url": "LNBits Url",
+ "Wallet ID": "Wallet ID",
+ "Invoice\/read key": "Invoice\/read key",
+ "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!"
}
diff --git a/resources/lang/en.json b/resources/lang/en.json
index f96f8a08..15639298 100644
--- a/resources/lang/en.json
+++ b/resources/lang/en.json
@@ -838,5 +838,8 @@
"LNBits Url": "",
"Wallet ID": "",
"Invoice\/read key": "",
- "paid": ""
+ "paid": "",
+ "Setup LNBits for paid articles": "",
+ "Click QR-Code to open your wallet": "",
+ "LNBits settings are not valid!": ""
}
\ No newline at end of file
diff --git a/resources/lang/es.json b/resources/lang/es.json
index d1bbc280..a14b8246 100644
--- a/resources/lang/es.json
+++ b/resources/lang/es.json
@@ -838,5 +838,8 @@
"LNBits Url": "",
"Wallet ID": "",
"Invoice\/read key": "",
- "paid": ""
+ "paid": "",
+ "Setup LNBits for paid articles": "",
+ "Click QR-Code to open your wallet": "",
+ "LNBits settings are not valid!": ""
}
\ No newline at end of file
diff --git a/resources/lang/fr.json b/resources/lang/fr.json
index 31284e60..b20f5881 100644
--- a/resources/lang/fr.json
+++ b/resources/lang/fr.json
@@ -839,5 +839,8 @@
"LNBits Url": "",
"Wallet ID": "",
"Invoice\/read key": "",
- "paid": ""
+ "paid": "",
+ "Setup LNBits for paid articles": "",
+ "Click QR-Code to open your wallet": "",
+ "LNBits settings are not valid!": ""
}
\ No newline at end of file
diff --git a/resources/lang/hr.json b/resources/lang/hr.json
index 9da0dfb0..ad74792d 100644
--- a/resources/lang/hr.json
+++ b/resources/lang/hr.json
@@ -839,5 +839,8 @@
"LNBits Url": "",
"Wallet ID": "",
"Invoice\/read key": "",
- "paid": ""
+ "paid": "",
+ "Setup LNBits for paid articles": "",
+ "Click QR-Code to open your wallet": "",
+ "LNBits settings are not valid!": ""
}
\ No newline at end of file
diff --git a/resources/lang/it.json b/resources/lang/it.json
index b91cecbd..3be32f4b 100644
--- a/resources/lang/it.json
+++ b/resources/lang/it.json
@@ -839,5 +839,8 @@
"LNBits Url": "",
"Wallet ID": "",
"Invoice\/read key": "",
- "paid": ""
+ "paid": "",
+ "Setup LNBits for paid articles": "",
+ "Click QR-Code to open your wallet": "",
+ "LNBits settings are not valid!": ""
}
\ No newline at end of file
diff --git a/resources/lang/mk.json b/resources/lang/mk.json
index 5d411b68..9ae008a9 100644
--- a/resources/lang/mk.json
+++ b/resources/lang/mk.json
@@ -839,5 +839,8 @@
"LNBits Url": "",
"Wallet ID": "",
"Invoice\/read key": "",
- "paid": ""
+ "paid": "",
+ "Setup LNBits for paid articles": "",
+ "Click QR-Code to open your wallet": "",
+ "LNBits settings are not valid!": ""
}
\ No newline at end of file
diff --git a/resources/lang/pl.json b/resources/lang/pl.json
index 16ec9757..51e3e319 100644
--- a/resources/lang/pl.json
+++ b/resources/lang/pl.json
@@ -839,5 +839,8 @@
"LNBits Url": "",
"Wallet ID": "",
"Invoice\/read key": "",
- "paid": ""
+ "paid": "",
+ "Setup LNBits for paid articles": "",
+ "Click QR-Code to open your wallet": "",
+ "LNBits settings are not valid!": ""
}
\ No newline at end of file
diff --git a/resources/lang/pt.json b/resources/lang/pt.json
index c6a91245..fdd45cd4 100644
--- a/resources/lang/pt.json
+++ b/resources/lang/pt.json
@@ -839,5 +839,8 @@
"LNBits Url": "",
"Wallet ID": "",
"Invoice\/read key": "",
- "paid": ""
+ "paid": "",
+ "Setup LNBits for paid articles": "",
+ "Click QR-Code to open your wallet": "",
+ "LNBits settings are not valid!": ""
}
\ No newline at end of file
diff --git a/resources/lang/sv.json b/resources/lang/sv.json
index af316503..5fe3d4e1 100644
--- a/resources/lang/sv.json
+++ b/resources/lang/sv.json
@@ -801,5 +801,8 @@
"LNBits Url": "",
"Wallet ID": "",
"Invoice\/read key": "",
- "paid": ""
+ "paid": "",
+ "Setup LNBits for paid articles": "",
+ "Click QR-Code to open your wallet": "",
+ "LNBits settings are not valid!": ""
}
\ No newline at end of file
diff --git a/resources/lang/tr.json b/resources/lang/tr.json
index 57427915..890d208c 100644
--- a/resources/lang/tr.json
+++ b/resources/lang/tr.json
@@ -813,5 +813,8 @@
"LNBits Url": "",
"Wallet ID": "",
"Invoice\/read key": "",
- "paid": ""
+ "paid": "",
+ "Setup LNBits for paid articles": "",
+ "Click QR-Code to open your wallet": "",
+ "LNBits settings are not valid!": ""
}
\ No newline at end of file
diff --git a/resources/views/livewire/news/article-overview.blade.php b/resources/views/livewire/news/article-overview.blade.php
index 298faf9e..34745fa7 100644
--- a/resources/views/livewire/news/article-overview.blade.php
+++ b/resources/views/livewire/news/article-overview.blade.php
@@ -30,6 +30,15 @@
{{ __('Submit paid news article') }}
+ @else
+
-