Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/040 #11

Draft
wants to merge 61 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
dab5b82
chore: Update sdk
Blu-J Mar 3, 2023
c39785b
chore: Update to use the latest sdk
Blu-J Mar 6, 2023
a98b90c
progress
MattDHill Mar 27, 2023
1371738
chore: Update the input spec
Blu-J Mar 31, 2023
6dae60a
merge: master
Blu-J Mar 31, 2023
0ea605d
Merge remote-tracking branch 'origin/master' into feat/new-sdk
Blu-J Mar 31, 2023
944ff28
chore: Testing new styles
Blu-J Mar 31, 2023
a5681bb
wip: Show example of something I think would make main better
Blu-J Apr 3, 2023
c8e31c2
create interface
MattDHill Apr 3, 2023
414766b
wip: Paired
Blu-J Apr 3, 2023
485237f
better interfaces
MattDHill Apr 3, 2023
ea89631
clean up config
MattDHill Apr 3, 2023
9fb30ea
wip: Horrible main 3
Blu-J Apr 4, 2023
4c15b0f
wip(chore): Add documentation for the previous wip
Blu-J Apr 4, 2023
52d6147
progress
MattDHill Apr 5, 2023
def3ffc
update sdk and union select value
MattDHill Apr 6, 2023
449d9f4
main almost there
MattDHill Apr 6, 2023
33af48d
chore: implement the sdk updates for the main.
Blu-J Apr 7, 2023
7440a0f
chore: Small update
Blu-J Apr 7, 2023
c3f7830
chore: Utilize the sdk and main
Blu-J Apr 7, 2023
09868ad
Merge branch 'feat/new-sdk' of github.com:Start9Labs/nostr-rs-relay-w…
Blu-J Apr 7, 2023
ef4c1e7
Merge branch 'feat/new-sdk' of github.com:Start9Labs/nostr-rs-relay-w…
Blu-J Apr 7, 2023
046ff83
Merge branch 'feat/new-sdk' of github.com:Start9Labs/nostr-rs-relay-w…
Blu-J Apr 7, 2023
acb73aa
chore: Update the run command to have better strings
Blu-J Apr 10, 2023
1675609
use get tor hostname
MattDHill Apr 11, 2023
eb42702
chore: Update to the new daemons
Blu-J Apr 11, 2023
6eb0099
Merge branch 'feat/new-sdk' of github.com:Start9Labs/nostr-rs-relay-w…
Blu-J Apr 11, 2023
a2c0021
chore: Update the config to the newest types
Blu-J Apr 11, 2023
73ee68f
minor
MattDHill Apr 12, 2023
1fc068e
chore: Add the types for config
Blu-J Apr 12, 2023
8119f58
chore: Update the properties to follow the new patterns
Blu-J Apr 12, 2023
8d3c827
chore: Update to use the new bound types.
Blu-J Apr 13, 2023
06297cf
main.ts
MattDHill Apr 14, 2023
29ecacf
chore: Update the init/uninit
Blu-J Apr 14, 2023
0c28813
chore: Update and fix the write
Blu-J Apr 17, 2023
c081994
chore: Update to the latest style of the configs and the dependencies.
Blu-J Apr 18, 2023
134f20a
chore: update to the newer types
Blu-J Apr 18, 2023
cfd3688
chore: UPdate nostr for latest version
Blu-J Apr 20, 2023
94044fb
refine config spec
MattDHill Apr 21, 2023
ac1a5d5
update for latest SDK changes
MattDHill Apr 25, 2023
bd8b31d
SDK RC1
MattDHill Apr 26, 2023
75275ed
update latest and prettier
MattDHill Apr 27, 2023
ac75ba4
update to RC2
MattDHill Apr 27, 2023
aee3cca
rc3
MattDHill Apr 27, 2023
cf9c7a1
array for runCommand
MattDHill Apr 30, 2023
8319446
minor
MattDHill May 1, 2023
d37f069
update to latest
MattDHill May 3, 2023
37e21b0
reverse proxy
MattDHill May 3, 2023
ff1cb4b
error free
MattDHill May 3, 2023
0dd645c
update to start9labs sdk
MattDHill May 4, 2023
dfcde85
update sdk properties gone
MattDHill May 4, 2023
2926f98
latest sdk
MattDHill May 5, 2023
f5aacaf
add migration
MattDHill May 7, 2023
b872209
rmdir instead
MattDHill May 8, 2023
7eab233
local sdk, dependencies and more
MattDHill May 11, 2023
8c7c995
export dep mounts
MattDHill May 11, 2023
74aeba8
interfaces
MattDHill May 12, 2023
6c8da0e
fix error
MattDHill May 12, 2023
5fa436b
rc4
MattDHill May 17, 2023
d169f1d
rc5 and new vault type
MattDHill May 21, 2023
99a8dd9
rc7 with store exports
MattDHill Jun 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update to the newer types
Blu-J committed Apr 18, 2023

Unverified

This user has not yet uploaded their public signing key.
commit 134f20a03251bdfd2887b30040e5fc0b066f764f
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -10,6 +10,6 @@
"typescript": "^4.9.5"
},
"dependencies": {
"start-sdk": "0.4.0-lib0.charlie26"
"start-sdk": "0.4.0-lib0.charlie30"
}
}
5 changes: 5 additions & 0 deletions procedures/config/dependencies.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { DependenciesFn } from "start-sdk/lib/config/setupConfigExports";
import { WriteReturn } from "./write";
import { ConfigType } from ".";

export const dependencies: DependenciesFn<ConfigType, WriteReturn> = async () => {};
7 changes: 4 additions & 3 deletions procedures/config/index.ts
Original file line number Diff line number Diff line change
@@ -2,12 +2,13 @@ import { InputSpec, inputSpec } from "./inputSpec";
import { write } from "./write";
import { read } from "./read";
import { setupConfigExports } from "start-sdk/lib/config";
import { utils } from "start-sdk/lib/util";
import { tomlFile } from "./file-models/config.toml";
import { dependencies } from "./dependencies";
import { Config } from "start-sdk/lib/config/builder";

export type ConfigType = typeof inputSpec extends Config<infer A> ? A : never;
export const { getConfig, setConfig } = setupConfigExports({
spec: inputSpec,
write,
read,
async dependencies() {},
dependencies,
});
77 changes: 63 additions & 14 deletions procedures/config/inputSpecRaw.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
import { InputSpecRaw } from "start-sdk/lib/config/configTypesRaw"
import { InputSpec } from "start-sdk/lib/config/configTypes";

export const spec: InputSpecRaw = {
export const spec: InputSpec = {
relayType: {
type: "union",
name: "Relay Type",
warning: "Running a public relay carries risk. Your relay can be spammed, resulting in large amounts of disk usage.",
description: "Private or public. A private relay (highly recommended) restricts write access to specific pubkeys. Anyone can write to a public relay.",
warning:
"Running a public relay carries risk. Your relay can be spammed, resulting in large amounts of disk usage.",
description:
"Private or public. A private relay (highly recommended) restricts write access to specific pubkeys. Anyone can write to a public relay.",
required: false,
default: null,
variants: {
private: {
name: "Private",
spec: {
pubkey_whitelist: {
type: "list",
name: "Pubkey Whitelist (hex)",
description: "A list of pubkeys that are permitted to publish through your relay. A minimum, you need to enter your own Nostr hex (not npub) pubkey. Go to https://damus.io/key/ to convert from npub to hex.",
description:
"A list of pubkeys that are permitted to publish through your relay. A minimum, you need to enter your own Nostr hex (not npub) pubkey. Go to https://damus.io/key/ to convert from npub to hex.",
range: "[1,*)",
default: [],
warning: null,
spec: {
type: "string",
inputmode: "text",
masked: false,
placeholder: "hex (not npub) pubkey",
pattern: "[0-9a-fA-F]{64}",
patternDescription: "Must be a valid 64-digit hexadecimal value (ie a Nostr hex pubkey, not an npub). Go to https://damus.io/key/ to convert npub to hex.",
patternDescription:
"Must be a valid 64-digit hexadecimal value (ie a Nostr hex pubkey, not an npub). Go to https://damus.io/key/ to convert npub to hex.",
},
},
}
},
},
public: {
name: "Public",
@@ -32,6 +41,7 @@ export const spec: InputSpecRaw = {
name: "Relay Info",
description: "General public info about your relay",
type: "object",
warning: null,
spec: {
name: {
type: "string",
@@ -41,6 +51,10 @@ export const spec: InputSpecRaw = {
placeholder: "Bob's Public Relay",
pattern: ".{3,32}",
patternDescription: "Must be at least 3 character and no more than 32 characters",
masked: false,
default: null,
inputmode: "text",
warning: null,
},
description: {
type: "string",
@@ -50,6 +64,10 @@ export const spec: InputSpecRaw = {
placeholder: "The best relay in town",
pattern: ".{6,256}",
patternDescription: "Must be at least 6 character and no more than 256 characters",
masked: false,
default: null,
inputmode: "text",
warning: null,
},
pubkey: {
type: "string",
@@ -58,7 +76,12 @@ export const spec: InputSpecRaw = {
required: false,
placeholder: "hex (not npub) pubkey",
pattern: "[0-9a-fA-F]{64}",
patternDescription: "Must be a valid 64-digit hexadecimal value (ie a Nostr hex pubkey, not an npub). Go to https://damus.io/key/ to convert npub to hex.",
patternDescription:
"Must be a valid 64-digit hexadecimal value (ie a Nostr hex pubkey, not an npub). Go to https://damus.io/key/ to convert npub to hex.",
masked: false,
default: null,
inputmode: "text",
warning: null,
},
contact: {
type: "string",
@@ -67,33 +90,45 @@ export const spec: InputSpecRaw = {
required: false,
pattern: "[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+",
patternDescription: "Must be a valid email address.",
masked: false,
default: null,
inputmode: "text",
warning: null,
placeholder: null,
},
},
},
limits: {
type: "object",
name: "Limits",
description: "Data limits to protect your relay from using too many resources",
warning: null,
spec: {
messages_per_sec: {
type: "number",
name: "Messages Per Second Limit",
description: "Limit events created per second, averaged over one minute. Note: this is for the server as a whole, not per connection.",
description:
"Limit events created per second, averaged over one minute. Note: this is for the server as a whole, not per connection.",
required: true,
range: "[1,*)",
integral: true,
default: 2,
units: "messages/sec",
placeholder: null,
warning: null,
},
subscriptions_per_min: {
name: "Subscriptions Per Minute Limit",
description: "Limit client subscriptions created per second, averaged over one minute. Strongly recommended to set this to a low value such as 10 to ensure fair service.",
description:
"Limit client subscriptions created per second, averaged over one minute. Strongly recommended to set this to a low value such as 10 to ensure fair service.",
type: "number",
required: true,
range: "[1,*)",
integral: true,
default: 10,
units: "subscriptions",
placeholder: null,
warning: null,
},
max_blocking_threads: {
name: "Max Blocking Threads",
@@ -104,6 +139,8 @@ export const spec: InputSpecRaw = {
integral: true,
units: "threads",
default: 16,
placeholder: null,
warning: null,
},
max_event_bytes: {
name: "Max Event Size",
@@ -114,6 +151,8 @@ export const spec: InputSpecRaw = {
integral: true,
units: "bytes",
default: 131072,
placeholder: null,
warning: null,
},
max_ws_message_bytes: {
name: "Max Websocket Message Size",
@@ -124,6 +163,8 @@ export const spec: InputSpecRaw = {
integral: true,
units: "bytes",
default: 131072,
placeholder: null,
warning: null,
},
max_ws_frame_bytes: {
name: "Max Websocket Frame Size",
@@ -134,21 +175,29 @@ export const spec: InputSpecRaw = {
integral: true,
units: "bytes",
default: 131072,
placeholder: null,
warning: null,
},
event_kind_blacklist: {
type: "list",
name: "Event Kind Blacklist",
description: "Events with these kinds will be discarded. For a list of event kinds, see here: https://github.com/nostr-protocol/nips#event-kinds",
description:
"Events with these kinds will be discarded. For a list of event kinds, see here: https://github.com/nostr-protocol/nips#event-kinds",
range: "[0,*)",
default: [],
warning: null,
spec: {
type: "number",
integral: true,
placeholder: '30023',
placeholder: "30023",
range: "[0,*)",
units: null,
},
},
},
},
}
},
},
},
},
}
};
6 changes: 4 additions & 2 deletions procedures/config/read.ts
Original file line number Diff line number Diff line change
@@ -3,8 +3,10 @@ import { tomlFile } from "./file-models/config.toml";
import { Effects } from "start-sdk/lib/types";
import { WriteReturn } from "./write";
import { utils } from "start-sdk/lib/util";
import { Read } from "start-sdk/lib/config/setupConfigExports";
import { ConfigType } from ".";

export async function read({ effects }: { effects: Effects; config: WriteReturn }): Promise<InputSpec> {
export const read: Read<ConfigType, WriteReturn> = async ({ effects }) => {
const { readFile } = utils(effects);
const data = await readFile(tomlFile);

@@ -30,4 +32,4 @@ export async function read({ effects }: { effects: Effects; config: WriteReturn
},
},
};
}
};