Skip to content

Commit

Permalink
Add support of showing nip11 relay info
Browse files Browse the repository at this point in the history
  • Loading branch information
heguro committed Apr 1, 2023
1 parent 16aa1d5 commit 4cab897
Show file tree
Hide file tree
Showing 5 changed files with 299 additions and 17 deletions.
65 changes: 62 additions & 3 deletions src/@types/nips.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NostrEvent } from './nostrTools';

interface Nip07Nostr {
export interface Nip07Nostr {
// must defined
getPublicKey(): Promise<string>;
signEvent(event: NostrEvent): Promise<NostrEvent>;
Expand All @@ -13,6 +13,65 @@ interface Nip07Nostr {
};
}

interface Nip07Relays {
[url: string]: { read: boolean; write: boolean };
export interface Nip07Relays {
[url: string]: Nip07RelayState;
}

export type Nip07RelayState = { read: boolean; write: boolean };

export interface Nip11RelayInfo {
name?: string;
description?: string;
pubkey?: string;
contact?: string;
supported_nips?: number[];
software?: string;
version?: string;

// nostream oriented?
supported_nip_extensions?: string[];

// Server Limitations
limitation?: Nip11RelayLimitations;

// Event Retention
retention?: Nip11RelayRetention[];

// Content Limitations
relay_countries?: string[];

// Community Preferences
language_tags?: string[];
tags?: string[];
posting_policy?: string;

// Pay-To-Relay
payments_url?: string;
fees?: Nip11RelayFees;
}

export interface Nip11RelayLimitations {
max_message_length?: number;
max_subscriptions?: number;
max_filters?: number;
max_limit?: number;
max_subid_length?: number;
min_prefix?: number;
max_event_tags?: number;
max_content_length?: number;
min_pow_difficulty?: number;
auth_required?: boolean;
payment_required?: boolean;
}

export interface Nip11RelayRetention {
kinds?: number[] | [number, number][];
time?: number;
count?: number;
}

export interface Nip11RelayFees {
admission?: Nip11RelayFee[];
subscription?: Nip11RelayFee[];
publication?: Nip11RelayFee[];
}
52 changes: 52 additions & 0 deletions src/components/Main/Main.css
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,58 @@
min-height: 2rem;
}

.relays-list-relay-info {
font-size: 0.8rem;
margin-bottom: 0.5rem;
opacity: 0.8;
grid-column: 1 / 5;
}

.relays-list-relay-info code {
opacity: 1;
}

.relays-list-relay-url {
display: grid;
place-content: center start;
}

.relays-list-relay-url code {
align-items: end;
}

.relays-list-relay-info summary {
font-size: 0.8rem;
margin-left: 0.5rem;
}

.relays-list-relay-software-name {
font-size: 0.6rem;
}

.relays-list-relay-info ul {
margin: 0;
padding: 0;
line-height: 1.25em;
}

.relays-list-relay-info ul li {
list-style: none;
margin: 0.4rem 0;
}

.relays-list-relay-info pre {
font-size: 0.6rem;
}

.relays-list-relay-info pre code {
font-size: 0.6rem;
}

.relays-list-relay-desc {
font-size: 0.6rem;
}

.relays-list-read,
.relays-list-write,
.relays-list-delete {
Expand Down
Loading

0 comments on commit 4cab897

Please sign in to comment.