-
+
Storage cost:
-
+
sats per
@@ -56,6 +103,7 @@
-
-
-
sats
+
-
Buy storage space
+
+ Buy storage space
+
+
+ Free storage
+
+
- This is a free relay
+
+ This is a free Nostr Relay
+
@@ -118,77 +177,6 @@
-
-
-
-
-
-
-
-
-
-
- GET
- /lnurlp/api/v1/links
- Headers
- {"X-Api-Key": <invoice_key>}
-
- Body (application/json)
-
-
- Returns 200 OK (application/json)
-
- [<pay_link_object>, ...]
- Curl example
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -211,11 +199,20 @@
storageCost: function () {
if (!this.relay || !this.relay.config.storageCostValue) return 0
return this.unitsToBuy * this.relay.config.storageCostValue
+ },
+ wssLink: function () {
+ this.relay.config.domain =
+ this.relay.config.domain || window.location.hostname
+ return (
+ 'wss://' + this.relay.config.domain + '/nostrrelay/' + this.relay.id
+ )
}
},
methods: {
createInvoice: async function (action) {
+ console.log('### action', action)
if (!action) return
+ this.invoice = ''
if (!this.pubkey) {
this.$q.notify({
timeout: 5000,
diff --git a/views_api.py b/views_api.py
index 61f361f..347b197 100644
--- a/views_api.py
+++ b/views_api.py
@@ -283,11 +283,13 @@ async def api_pay_to_join(data: BuyOrder):
detail="Relay not found",
)
- if data.action == "join" and relay.is_free_to_join:
- raise ValueError("Relay is free to join")
-
+ amount = 0
storage_to_buy = 0
- if data.action == "storage":
+ if data.action == "join":
+ if relay.is_free_to_join:
+ raise ValueError("Relay is free to join")
+ amount = int(relay.config.cost_to_join)
+ elif data.action == "storage":
if relay.config.storage_cost_value == 0:
raise ValueError("Relay storage cost is zero. Cannot buy!")
if data.units_to_buy == 0:
@@ -295,10 +297,13 @@ async def api_pay_to_join(data: BuyOrder):
storage_to_buy = data.units_to_buy * relay.config.storage_cost_value * 1024
if relay.config.storage_cost_unit == "MB":
storage_to_buy *= 1024
+ amount = data.units_to_buy * relay.config.storage_cost_value
+ else:
+ raise ValueError(f"Unknown action: '{data.action}'")
_, payment_request = await create_invoice(
wallet_id=relay.config.wallet,
- amount=int(relay.config.cost_to_join),
+ amount=amount,
memo=f"Pubkey '{data.pubkey}' wants to join {relay.id}",
extra={
"tag": "nostrrely",