Skip to content

Commit

Permalink
+
Browse files Browse the repository at this point in the history
  • Loading branch information
BlowaterNostr committed May 1, 2024
1 parent 762f938 commit 0d4d790
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const root_handler = (
} & EventReadWriter,
) =>
async (req: Request, info: Deno.ServeHandlerInfo) => {
console.log(req)
console.log(req);
const { pathname, protocol } = new URL(req.url);
if (pathname === "/api/auth/login") {
const body = await req.json();
Expand Down
12 changes: 7 additions & 5 deletions ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,13 @@ async function handle_cmd_req(
const sub_id = nostr_ws_msg[1];
const filters = nostr_ws_msg.slice(2) as NostrFilter[];

const subscriptions = args.connections.get(this_socket)
if(subscriptions) {
if(subscriptions.size > 10) {
send(this_socket, JSON.stringify(respond_notice(`${sub_id}:only accept at most 10 subscriptions`)));
const subscriptions = args.connections.get(this_socket);
if (subscriptions) {
if (subscriptions.size > 10) {
send(
this_socket,
JSON.stringify(respond_notice(`${sub_id}:only accept at most 10 subscriptions`)),
);
return;
}
subscriptions.set(
Expand Down Expand Up @@ -273,7 +276,6 @@ async function handle_filter(
}
if (filter.authors) {
if (event_candidates.size > 0) {

} else {
const events = args.get_events_by_authors(new Set(filter.authors));
for await (const event of events) {
Expand Down

0 comments on commit 0d4d790

Please sign in to comment.