chore: misc

This commit is contained in:
Kieran 2023-02-20 14:18:41 +00:00
parent 0545a07ea6
commit b23b1764e5
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
4 changed files with 19 additions and 7 deletions

View File

@ -47,3 +47,15 @@ To build the application and nostr package, use
```
$ yarn build
```
### Translations
Translations are managed on [Crowdin](https://crowdin.com/project/snort)
To extract translations run:
```bash
yarn workspace @snort/app intl-extract
yarn workspace @snort/app intl-compile
```
This will create the source file `packages/app/src/translations/en.json`

View File

@ -60,18 +60,18 @@ export default function Text({ content, tags, creator, users }: TextProps) {
if (ref) {
switch (ref.Key) {
case "p": {
return <Mention key={`ref-${ref.PubKey}-${idx}`} pubkey={ref.PubKey ?? ""} />;
return <Mention pubkey={ref.PubKey ?? ""} />;
}
case "e": {
const eText = hexToBech32("note", ref.Event).substring(0, 12);
return (
<Link key={ref.Event} to={eventLink(ref.Event ?? "")} onClick={e => e.stopPropagation()}>
<Link to={eventLink(ref.Event ?? "")} onClick={e => e.stopPropagation()}>
#{eText}
</Link>
);
}
case "t": {
return <Hashtag key={ref.Hashtag} tag={ref.Hashtag ?? ""} />;
return <Hashtag tag={ref.Hashtag ?? ""} />;
}
}
}
@ -92,7 +92,7 @@ export default function Text({ content, tags, creator, users }: TextProps) {
if (typeof f === "string") {
return f.split(InvoiceRegex).map(i => {
if (i.toLowerCase().startsWith("lnbc")) {
return <Invoice key={i} invoice={i} />;
return <Invoice invoice={i} />;
} else {
return i;
}
@ -109,7 +109,7 @@ export default function Text({ content, tags, creator, users }: TextProps) {
if (typeof f === "string") {
return f.split(HashtagRegex).map(i => {
if (i.toLowerCase().startsWith("#")) {
return <Hashtag key={i} tag={i.substring(1)} />;
return <Hashtag tag={i.substring(1)} />;
} else {
return i;
}

View File

@ -82,7 +82,6 @@ export default class Connection {
this.EventsCallback = new Map();
this.AwaitingAuth = new Map();
this.Authed = false;
this.Connect();
}
async Connect() {

View File

@ -82,10 +82,11 @@ export class NostrSystem {
/**
* Connect to a NOSTR relay if not already connected
*/
ConnectToRelay(address: string, options: RelaySettings) {
async ConnectToRelay(address: string, options: RelaySettings) {
try {
if (!this.Sockets.has(address)) {
const c = new Connection(address, options);
await c.Connect();
this.Sockets.set(address, c);
for (const [, s] of this.Subscriptions) {
c.AddSubscription(s);