chore: code format

This commit is contained in:
Vlad Stan 2023-02-21 10:32:08 +02:00
parent d66184c077
commit ffb0177003
5 changed files with 623 additions and 642 deletions

View file

@ -1,7 +1,9 @@
# Nostr Relay # Nostr Relay
### One click and spin up your own Nostr relay. Share with the world, or use privately. ### One click and spin up your own Nostr relay. Share with the world, or use privately.
**Configure**: **Configure**:
- Free Plan: with limitted storage (limit can be changed) - Free Plan: with limitted storage (limit can be changed)
- Paid Plan: `pay to join` and `pay for storage` - Paid Plan: `pay to join` and `pay for storage`
- Storage Limit (can buy more) - Storage Limit (can buy more)
@ -11,57 +13,61 @@
- Optional Auth for `Events` and `Filters` - Optional Auth for `Events` and `Filters`
## Supported NIPs ## Supported NIPs
- [x] **NIP-01**: Basic protocol flow
- [x] **NIP-02**: Contact List and Petnames - [x] **NIP-01**: Basic protocol flow
- [x] **NIP-02**: Contact List and Petnames
- `kind: 3`: delete past contact lists as soon as the relay receives a new one - `kind: 3`: delete past contact lists as soon as the relay receives a new one
- [x] **NIP-04**: Encrypted Direct Message - [x] **NIP-04**: Encrypted Direct Message
- if `AUTH` enabled: send only to the intended target - if `AUTH` enabled: send only to the intended target
- [x] **NIP-09**: Event Deletion - [x] **NIP-09**: Event Deletion
- [x] **NIP-11**: Relay Information Document - [x] **NIP-11**: Relay Information Document
- >**Note**: the endpoint is NOT on the root level of the domain. It also includes a path (eg https://lnbits.link/nostrrelay/) - > **Note**: the endpoint is NOT on the root level of the domain. It also includes a path (eg https://lnbits.link/nostrrelay/)
- [ ] **NIP-12**: Generic Tag Queries - [ ] **NIP-12**: Generic Tag Queries
- todo - todo
- [x] **NIP-15**: End of Stored Events Notice - [x] **NIP-15**: End of Stored Events Notice
- [x] **NIP-16**: Event Treatment - [x] **NIP-16**: Event Treatment
- [x] Regular Events - [x] Regular Events
- [x] Replaceable Events - [x] Replaceable Events
- [x] Ephemeral Events - [x] Ephemeral Events
- [x] **NIP-20**: Command Results - [x] **NIP-20**: Command Results
- todo: use correct prefixes - todo: use correct prefixes
- [x] **NIP-22**: Event created_at Limits - [x] **NIP-22**: Event created_at Limits
- [ ] **NIP-26**: Delegated Event Signing - [ ] **NIP-26**: Delegated Event Signing
- not planned - not planned
- [x] **NIP-28** Public Chat - [x] **NIP-28** Public Chat
- `kind: 41`: handled similar to `kind 0` metadata events - `kind: 41`: handled similar to `kind 0` metadata events
- [ ] **NIP-33**: Parameterized Replaceable Events - [ ] **NIP-33**: Parameterized Replaceable Events
- todo - todo
- [ ] **NIP-40**: Expiration Timestamp - [ ] **NIP-40**: Expiration Timestamp
- todo - todo
- [x] **NIP-42**: Authentication of clients to relays - [x] **NIP-42**: Authentication of clients to relays
- todo: use correct prefix - todo: use correct prefix
- [ ] **NIP-50**: Search Capability - [ ] **NIP-50**: Search Capability
- todo - todo
## Create Relay ## Create Relay
Creating a new relay is straightforward. Just click `New Relay` then enter the Relay Info. Creating a new relay is straightforward. Just click `New Relay` then enter the Relay Info.
> **Note**: admin users can select a relay id. Regular users will be assigned a generated relay id. > **Note**: admin users can select a relay id. Regular users will be assigned a generated relay id.
The relay can be activated/deactivated. > The relay can be activated/deactivated.
- **New Relay Dialog** - **New Relay Dialog**
- ![image](https://user-images.githubusercontent.com/2951406/219601417-9292d5b9-d96c-4ff6-a6fd-6c8b37b9872d.png) - ![image](https://user-images.githubusercontent.com/2951406/219601417-9292d5b9-d96c-4ff6-a6fd-6c8b37b9872d.png)
## Configure Relay ## Configure Relay
Find your Relay in the list and click the expand button (`+`) to configure it. Find your Relay in the list and click the expand button (`+`) to configure it.
### Relay Info ### Relay Info
This tab contains data according to `NIP-11` (Relay Information Document). This tab contains data according to `NIP-11` (Relay Information Document).
> **Note**: the `domain` is added automatically and shoud be corrected manually if needed. This value is used for `NIP-42` (Authentication of clients to relays) > **Note**: the `domain` is added automatically and shoud be corrected manually if needed. This value is used for `NIP-42` (Authentication of clients to relays)
- **Relay Info Tab** - **Relay Info Tab**
- ![image](https://user-images.githubusercontent.com/2951406/219601945-f3987de0-ed0c-48d5-b31e-44d8356cfa9a.png) - ![image](https://user-images.githubusercontent.com/2951406/219601945-f3987de0-ed0c-48d5-b31e-44d8356cfa9a.png)
### Payment ### Payment
By default the relay is free to access, but it can be configured to ask for payments. By default the relay is free to access, but it can be configured to ask for payments.
@ -78,7 +84,6 @@ Here the entry and storage fees can be paid.
- **Relay Public Page** - **Relay Public Page**
- ![image](https://user-images.githubusercontent.com/2951406/219610594-ec2984ca-2c09-4187-91c3-96a25e8b5722.png) - ![image](https://user-images.githubusercontent.com/2951406/219610594-ec2984ca-2c09-4187-91c3-96a25e8b5722.png)
### Config ### Config
Configure `NIP-22` (_Event `created_at` Limits_), `NIP-42` (_Authentication of clients to relays_) and other Relay parameters. Configure `NIP-22` (_Event `created_at` Limits_), `NIP-42` (_Authentication of clients to relays_) and other Relay parameters.
@ -90,7 +95,6 @@ Some configurations are not standard (`NIPs`) but they help control what clients
- **Config Tab** - **Config Tab**
- ![image](https://user-images.githubusercontent.com/2951406/219611794-57066899-5bc3-4439-ad98-af6fd4130ee9.png) - ![image](https://user-images.githubusercontent.com/2951406/219611794-57066899-5bc3-4439-ad98-af6fd4130ee9.png)
### Accounts ### Accounts
Allows the Relay operator to `Block` or `Allow` certain accounts. Allows the Relay operator to `Block` or `Allow` certain accounts.
@ -105,6 +109,7 @@ When an account is `blocked` it does not matter if it `paid to join` or if it i
## Development ## Development
Create Symbolic Link: Create Symbolic Link:
``` ```
ln -s /Users/my-user/git-repos/nostr-relay-extension/ /Users/my-user/git-repos/lnbits/lnbits/extensions/nostrrelay ln -s /Users/my-user/git-repos/nostr-relay-extension/ /Users/my-user/git-repos/lnbits/lnbits/extensions/nostrrelay
``` ```

View file

@ -82,12 +82,7 @@
"REQ", "REQ",
"notifications:0b29ecc73ba400e5b4bd1e4cb0d8f524e9958345", "notifications:0b29ecc73ba400e5b4bd1e4cb0d8f524e9958345",
{ {
"kinds": [ "kinds": [1, 7, 6, 4],
1,
7,
6,
4
],
"#p": [ "#p": [
"0b29ecc73ba400e5b4bd1e4cb0d8f524e9958345749197ca21c8da38d0622816" "0b29ecc73ba400e5b4bd1e4cb0d8f524e9958345749197ca21c8da38d0622816"
], ],
@ -127,11 +122,7 @@
"e", "e",
"05741bda9079cdf66f3be977a4d31287366470d1337b1aeb09506da4fbf7cd85" "05741bda9079cdf66f3be977a4d31287366470d1337b1aeb09506da4fbf7cd85"
], ],
[ ["e", "mock-id", ""],
"e",
"mock-id",
""
],
[ [
"e", "e",
"bb34749ffd3eb0e393e54cc90b61a7dd5f34108d4931467861d20281c0b7daea" "bb34749ffd3eb0e393e54cc90b61a7dd5f34108d4931467861d20281c0b7daea"
@ -153,9 +144,7 @@
"REQ", "REQ",
"contact", "contact",
{ {
"kinds": [ "kinds": [3],
3
],
"authors": [ "authors": [
"d685447c43c7c18dbbea61923cf0b63e1ab46bed69b153a48279a95c40bd414a" "d685447c43c7c18dbbea61923cf0b63e1ab46bed69b153a48279a95c40bd414a"
] ]
@ -185,9 +174,7 @@
"REQ", "REQ",
"profile", "profile",
{ {
"kinds": [ "kinds": [0],
0
],
"authors": [ "authors": [
"0b29ecc73ba400e5b4bd1e4cb0d8f524e9958345749197ca21c8da38d0622816" "0b29ecc73ba400e5b4bd1e4cb0d8f524e9958345749197ca21c8da38d0622816"
] ]
@ -197,9 +184,7 @@
"REQ", "REQ",
"sub0", "sub0",
{ {
"kinds": [ "kinds": [1],
1
],
"authors": [ "authors": [
"0b29ecc73ba400e5b4bd1e4cb0d8f524e9958345749197ca21c8da38d0622816" "0b29ecc73ba400e5b4bd1e4cb0d8f524e9958345749197ca21c8da38d0622816"
], ],
@ -308,9 +293,7 @@
"REQ", "REQ",
"notifications:d685447c43c7c18dbbea61923cf0b63e1ab46bed", "notifications:d685447c43c7c18dbbea61923cf0b63e1ab46bed",
{ {
"kinds": [ "kinds": [4],
4
],
"#p": [ "#p": [
"d685447c43c7c18dbbea61923cf0b63e1ab46bed69b153a48279a95c40bd414a" "d685447c43c7c18dbbea61923cf0b63e1ab46bed69b153a48279a95c40bd414a"
], ],
@ -321,9 +304,7 @@
"REQ", "REQ",
"notifications:delete", "notifications:delete",
{ {
"kinds": [ "kinds": [5],
5
],
"authors": [ "authors": [
"0b29ecc73ba400e5b4bd1e4cb0d8f524e9958345749197ca21c8da38d0622816" "0b29ecc73ba400e5b4bd1e4cb0d8f524e9958345749197ca21c8da38d0622816"
], ],

View file

@ -175,12 +175,7 @@
"name": "kind 30,000, replaceable events, 'd' tag", "name": "kind 30,000, replaceable events, 'd' tag",
"data": { "data": {
"kind": 30000, "kind": 30000,
"tags": [ "tags": [["d", "chats/null/lastOpened"]],
[
"d",
"chats/null/lastOpened"
]
],
"content": "1675242945", "content": "1675242945",
"created_at": 1675242945, "created_at": 1675242945,
"pubkey": "a24496bca5dd73300f4e5d5d346c73132b7354c597fcbb6509891747b4689211", "pubkey": "a24496bca5dd73300f4e5d5d346c73132b7354c597fcbb6509891747b4689211",