-
Notifications
You must be signed in to change notification settings - Fork 9
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
Enable usage of FDQN and PROTO to customize external endpoint address #2
Conversation
const object = req.params.actor; | ||
const uri = `https://${HOSTNAME}/@${crypto.randomUUID()}`; | ||
await send(actor, object, { | ||
admin.post("/follow/:actor/:hostname/:port/:proto", async (req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to change this endpoint, it was 404ing every time for me without this change :/
3999fc0
to
69219d2
Compare
} | ||
|
||
return res.sendStatus(204); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This handler is currently a duplicate of /admin/create
.
$ ssh -R 80:localhost:8000 [email protected] & 8c0fe6b82d8db0.lhr.life tunneled with tls termination, https://8c0fe6b82d8db0.lhr.life $ openssl genrsa -out keypair.pem 4096 && openssl rsa -in keypair.pem -pubout -out publickey.crt && openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in keypair.pem -out pkcs8.key $ FDQN=8c0fe6b82d8db0.lhr.life PORT=8000 ADMIN_USERNAME=alice ADMIN_PASSWORD=alice PUBLIC_KEY=$(cat publickey.crt) PRIVATE_KEY=$(cat pkcs8.key) npm run dev $ curl -u alice:alice -X POST -v https://8c0fe6b82d8db0.lhr.life/admin/follow/alice/8c0fe6b82d8db0.lhr.life/443/https $ curl -u alice:alice -X POST --header "Content-Type: application/json" --data @post.json -v https://8c0fe6b82d8db0.lhr.life/admin/create Signed-off-by: John Andersen <[email protected]>
69219d2
to
4b960c6
Compare
$ head -n 10000 /dev/urandom | sha384sum | awk '{print $1}' | tee ../password $ head -n 10000 /dev/urandom | sha384sum | awk '{print $1}' | tee ../webhook $ openssl genrsa -out keypair.pem 4096 && openssl rsa -in keypair.pem -pubout -out publickey.crt && openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in keypair.pem -out pkcs8.key $ cat .env <<'EOF' NODE_ENV="production" SCHEMA_PATH="db/schema.sql" DATABASE_PATH="db/database.sqlite3" HOSTNAME="localhost" ACCOUNT="alice" EOF $ gh webhook forward --repo=owner/repo_name --events=discussion_comment --url=http://localhost:8000/webhook/$(cat ../webhook) & Forwarding Webhook events from GitHub... $ rm -f db/database.sqlite3 $ PROTO=http FDQN=localhost:8000 WEBHOOK_PATH=$(cat ../webhook) NODE_ENV=production PORT=8000 ACCOUNT=alice ADMIN_USERNAME=alice ADMIN_PASSWORD=$(cat ../password) PUBLIC_KEY=$(cat publickey.crt) PRIVATE_KEY=$(cat pkcs8.key) npm run dev & Dumbo listening on port 8000… POST /webhook/b7ad8661a006195b317985d922b2ff37ebe8beac9a8f9cfe4ba0a177848c5e96e75ff926de82e87943ea79dca533cdc7 204 - - 13.781 ms GET /alice/outbox 200 40582 - 2.251 ms $ curl -s http://localhost:8000/alice/outbox | python -c 'import yaml, json, sys; print(yaml.dump(json.load(sys.stdin)))' Signed-off-by: John Andersen <[email protected]>
$ head -n 10000 /dev/urandom | sha384sum | awk '{print $1}' | tee ../password $ head -n 10000 /dev/urandom | sha384sum | awk '{print $1}' | tee ../webhook $ openssl genrsa -out keypair.pem 4096 && openssl rsa -in keypair.pem -pubout -out publickey.crt && openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in keypair.pem -out pkcs8.key $ cat .env <<'EOF' NODE_ENV="production" SCHEMA_PATH="db/schema.sql" DATABASE_PATH="db/database.sqlite3" HOSTNAME="localhost" ACCOUNT="alice" EOF $ rm -f db/database.sqlite3 $ PROTO=http HOSTNAME=localhost WEBHOOK_PATH=$(cat ../webhook) NODE_ENV=production PORT=8000 ACCOUNT=alice ADMIN_USERNAME=alice ADMIN_PASSWORD=$(cat ../password) PUBLIC_KEY=$(cat publickey.crt) PRIVATE_KEY=$(cat pkcs8.key) npm run dev & $ curl -fLo websocat https://github.com/vi/websocat/releases/download/v1.11.0/websocat.x86_64-unknown-linux-musl $ chmod 755 websocat $ mv websocat ~/.bin/ $ websocat --exit-on-eof ws://localhost:8000/listen/websocket websocat: WebSocketError: WebSocketError: Received unexpected status code (401 Unauthorized) websocat: error running $ websocat --exit-on-eof --basic-auth alice:alice ws://localhost:8000/listen/websocket websocat: WebSocketError: WebSocketError: Received unexpected status code (401 Unauthorized) websocat: error running $ websocat --exit-on-eof --basic-auth alice:$(cat ../password) ws://localhost:8000/listen/websocket & {"@context":"https://www.w3.org/ns/activitystreams","id":"http://localhost:8000/a0265dc0-e781-4f5b-89dd-0e1c36454a37","type":"Accept","actor":"http://localhost:8000/alice","object":{"@context":"https://www.w3.org/ns/activitystreams","id":"http://localhost:8000/@914e5adf-e47d-4c2a-a4be-48546081b6be","type":"Follow","actor":"http://localhost:8000/alice","object":"http://localhost:8000/alice"}} {"@context":"https://www.w3.org/ns/activitystreams","id":"http://localhost:8000/@914e5adf-e47d-4c2a-a4be-48546081b6be","type":"Follow","actor":"http://localhost:8000/alice","object":"http://localhost:8000/alice"} {"@context":"https://www.w3.org/ns/activitystreams","type":"Create","published":"2023-01-28T00:52:56.799Z","actor":"http://localhost:8000/alice","to":["https://www.w3.org/ns/activitystreams#Public"],"cc":["http://localhost:8000/alice"],"object":{"attributedTo":"http://localhost:8000/alice","published":"2023-01-28T00:52:56.799Z","to":["https://www.w3.org/ns/activitystreams#Public"],"cc":["http://localhost:8000/alice/followers"],"type":"Note","content":"Alice is Here!","id":"http://localhost:8000/alice/post/3479f6f3-5d8c-48e0-96ea-626760fb6388"},"id":"http://localhost:8000/alice/post/2afd800d-07a6-402e-8585-873e3989ba5e"} $ curl -u alice:$(cat ../password) -X POST -v http://localhost:8000/admin/follow/alice/localhost/8000/http $ curl -u alice:$(cat ../password) -X POST --header "Content-Type: application/json" --data @post.json -v http://localhost:8000/admin/create Signed-off-by: John Andersen <[email protected]>
Related: https://www.w3.org/TR/activitypub/ Signed-off-by: John Andersen <[email protected]>
4b960c6
to
129b827
Compare
I appreciate the PR, but could you tell me a bit more about what this is meant to do? There are a lot of changes and it's not clear how they relate to the project. For example, the ActivityPub spec doesn't mention anything about websockets, so unless I'm missing something that part doesn't seem like a good fit. I am curious about the 404 issue you're experiencing — if there's a bug, I'd definitely like to fix it. |
Enable usage of FDQN and PROTO to customize external endpoint address