-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6c9150
commit 3305281
Showing
21 changed files
with
1,114 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["*"] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
timeout-minutes: 1 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
deno-version: [1.41.0] | ||
|
||
steps: | ||
- name: Setup repo | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
|
||
- name: Setup Deno | ||
uses: denoland/setup-deno@v1 | ||
|
||
- name: Run tests | ||
run: deno task test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# npm dependencies | ||
node_modules/ | ||
.DS_Store | ||
deploy/default.ts | ||
*cov_profile* | ||
coverage | ||
test.sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "nostr.ts"] | ||
path = nostr.ts | ||
url = https://github.com/BlowaterNostr/nostr.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"deno.enable": true, | ||
"deno.lint": false | ||
"editor.indentSize": "tabSize" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Relayed | ||
|
||
## Local Development | ||
|
||
To begin, install Deno by following the instructions at https://deno.land/manual/getting_started/installation. | ||
|
||
Next, create a file named `deploy/default.ts`: | ||
|
||
```bash | ||
cp deploy/default.example.ts deploy/defalut.ts | ||
``` | ||
|
||
After that, launch the project with the command: | ||
|
||
```bash | ||
deno task start | ||
``` | ||
|
||
Finally, open your browser and go to `http://localhost:8000/api` to access the GraphQL playground. | ||
|
||
### Use GraphQL Playground | ||
|
||
To begin, click the `Re-fetch GraphQL schema` button to retrieve the schema. | ||
|
||
In the Headers section, include `{"password":"123456"}` for identity verification. | ||
|
||
You can now utilize the GraphQL Playground to communicate with the server. | ||
|
||
### Client Connection | ||
|
||
Relay url is `ws://localhost:8000`. | ||
|
||
### Database | ||
|
||
If you are using MacOS, the directory might be `~/Library/Caches/deno/location_data`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,44 @@ | ||
{ | ||
"tasks": { | ||
"run": "deno run --allow-net --allow-env --unstable deploy/default.ts", | ||
"test": "deno test --allow-net --unstable --allow-read --allow-write --coverage test.ts" | ||
}, | ||
"lint": { | ||
"rules": { | ||
"tags": [ | ||
"fresh", | ||
"recommended" | ||
], | ||
"exclude": ["require-await", "require-yield", "no-unused-vars"] | ||
} | ||
}, | ||
"exclude": [ | ||
"**/_fresh/*" | ||
], | ||
"imports": { | ||
"$fresh/": "https://deno.land/x/[email protected]/", | ||
"preact": "https://esm.sh/[email protected]", | ||
"preact/": "https://esm.sh/[email protected]/", | ||
"@preact/signals": "https://esm.sh/*@preact/[email protected]", | ||
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]", | ||
"tailwindcss": "npm:[email protected]", | ||
"tailwindcss/": "npm:/[email protected]/", | ||
"tailwindcss/plugin": "npm:/[email protected]/plugin.js", | ||
"$std/": "https://deno.land/[email protected]/" | ||
}, | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "preact", | ||
"lib": [ | ||
"deno.unstable" | ||
], | ||
"noImplicitAny": false | ||
}, | ||
"nodeModulesDir": true, | ||
"fmt": { | ||
"indentWidth": 4 | ||
} | ||
"indentWidth": 4, | ||
"lineWidth": 110, | ||
"exclude": ["cov_profile", "coverage"] | ||
}, | ||
"lock": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { run } from "../main.tsx"; | ||
|
||
run({ | ||
port: 8080, | ||
default_policy: { | ||
allowed_kinds: "all", // or none, | ||
}, | ||
password: Deno.env.get("relayed_pw"), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { gql } from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
export const typeDefs = gql` | ||
type Query { | ||
events(pubkey: String, offset: Int, limit: Int): Events | ||
event(id: String): Event | ||
policies: [Policy] | ||
} | ||
type Mutation { | ||
add_block(kind: Int, pubkey: String, ): Policy! | ||
remove_block(kind: Int, pubkey: String, ): Policy! | ||
add_allow(kind: Int, pubkey: String, ): Policy! | ||
remove_allow(kind: Int, pubkey: String, ): Policy! | ||
set_policy(kind: Int, read: Boolean, write: Boolean): Policy! | ||
} | ||
type Events { | ||
count: Int! | ||
data: [Event] | ||
} | ||
type Event { | ||
id: String! | ||
content: String! | ||
pubkey: PublicKey! | ||
kind: Int! | ||
created_at: Int! | ||
sig: String! | ||
tags: [String!]! | ||
} | ||
type PublicKey { | ||
hex: String! | ||
bech32: String! | ||
events: [Event!]! | ||
} | ||
type Policy { | ||
kind: Int! | ||
read: Boolean! | ||
write: Boolean! | ||
allow: [String!]! | ||
block: [String!]! | ||
} | ||
`; |
Oops, something went wrong.