-
Notifications
You must be signed in to change notification settings - Fork 0
feat: create initial implementation for DP CLI #1
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
Conversation
…e sites and posts
RangerMauve
left a comment
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 like the structure so far. Before merging lets make sure the APIs being called are correct.
… the user's keypair
RangerMauve
left a comment
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.
Also, we should have the following:
dp-cli publish ./folder_here and dp-cli patch ./folder_here for taking a folder or maybe a glob pattern, turning the data into a tarball, and publishing the new site content.
Also, we should have a way to create a trial account and a dp-cli clone to trigger a wget site clone via the new APIs
README.md
Outdated
|
|
||
| ### Send a Post to Followers | ||
|
|
||
| Publish a post to your followers: |
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.
Does this publish a message to the DP site and register it in the outbox? Or ist it sending out an activity without an ID? Should test whether messages sent like this are actually visible on mastodon. We should explain how this works.
src/commands/sendPost.js
Outdated
| return | ||
| } | ||
|
|
||
| const activityId = `${config.socialInboxUrl}/${encodeURIComponent(actorUsername)}/outbox/${uuidv4()}` |
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.
Instead of generating a new activity we should have users pass a path to the activity that's published in the site via the DP API.
Alternately we should save both the Activity and Note to the DP published site as well as update the outbox. This would bring the functionality closer to the jekyll plugin.
|
Getting SSL mismatch error for cloning the site:
|
RangerMauve
left a comment
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.
Great! Lets add all these docs to docs.distributed.press as well. Make a new section called SDK and have separate pages for the CLI and the template
src/commands/cloneSite.js
Outdated
| console.log(chalk.blue(`Downloading site content from ${siteUrl} to ${outputDirectory}...`)) | ||
|
|
||
| // Dynamically load `website-scraper` | ||
| const { default: scrape } = await loadWebsiteScraper() |
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.
We shouldn't be doing a scrape/download, that's what the clone HTTP API does already. IT's enough to trigger the clone and just output the site URLs
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.
hyphacoop/api.distributed.press#94
dp-cli clone ranger.mauve.moe
Cloning site with ID: ranger.mauve.moe
Server-side cloning initiated successfully!
Cloned Site Info:
{
"id": "ranger.mauve.moe",
"domain": "ranger.mauve.moe",
"protocols": {
"http": true,
"hyper": true,
"ipfs": true
},
"links": {
"http": {
"enabled": true,
"link": "https://ranger.mauve.moe"
},
"hyper": {
"gateway": "https://ranger-mauve-moe.hyper.hypha.coop/",
"raw": "hyper://xxsog44z58458te7gkxgrggmxwastm94om6d9n1hjsjtsi7rt9wo/",
"dnslink": "/hyper/xxsog44z58458te7gkxgrggmxwastm94om6d9n1hjsjtsi7rt9wo/",
"enabled": true,
"link": "hyper://ranger.mauve.moe"
},
"ipfs": {
"gateway": "https://ranger-mauve-moe.ipns.ipfs.hypha.coop",
"cid": "bafybeibwjxk563q3lw226qdlptwzvjk7skyfsbblqa4jc4ulhuftcevqsi",
"pubKey": "ipns://k51qzi5uqu5dkyebpkw5k4kkecddn0bnd9zch18g9bpb4htoulp439uyb4gugc/",
"dnslink": "/ipns/k51qzi5uqu5dkyebpkw5k4kkecddn0bnd9zch18g9bpb4htoulp439uyb4gugc/",
"enabled": true,
"link": "ipns://ranger.mauve.moe/"
}
},
"public": true
}
|
e116f29 Registering your actor with the Social Inbox...
? Enter your actor username (e.g., @username@domain.com): @dp@staticpub.distributed.press
? Enter your actor URL: https://staticpub.distributed.press/about.jsonld
? Enter your public key ID (e.g., https://domain.com/actor#main-key): https://staticpub.distributed.press/about.jsonld#main-key
Actor registered with Social Inbox successfully!
Response: {
"actorUrl": "https://staticpub.distributed.press/about.jsonld",
"publicKeyId": "https://staticpub.distributed.press/about.jsonld#main-key",
"keypair": {
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtZSfTeCr1Wv5NO9inU2O\nk7yI+PHdBrpKrrsxQTXPfz1vWq6myObDKT+SKpxy86LBoY8Ow5/DfEW07vSQpeyq\nYS6PhNzRTKFLe64YhQVMG9CFFnKt804pMe+DcGm4XZsPfaBWgPOkSw14vgLCusvE\nMSa19+uUu4hW1zhFuHPfS2/HacANT3gXo9Qd3nyGd1Pap7zba9bBBbp2/V7ZJloC\nLPO/2fvB0B9bcYebFN7AWsOnDDMwus2LKo5eTqiWAy8C9AissPzo9zGPseOhvBxP\nz7MRJVOON5FZexFjv5b6UjUEqHBT+6Qb8H3WUo3RIrmfbX6rsLWJW5Lm+TJyV9kk\nF0k/5nFIfYa5+DxbzvEFTRvaUEoxK2H4I+jA3an8sTb7uHCWQ5LeYzMEOwosfoL8\ngtEuqQ47K+0fazPS87EfGYv7IAariDsV/9wQyPKODebkfsdJtdc9lyJT9a5uncqt\nTg9V30Z9rcwbRcA/YhRa45ZqB8N7Py6BBcHW/tpQ/AJeDc0UNoZn9rJBN3Lz3OTg\n14aBwLme9ctaZ2MJR7o9np4qMJYBIyUP173eBOtUjXYENWmsfs2kt5lSGAbSSdRf\nAdJmi2Hsbbk54T5BgkBsYZEDIUOPu9o/jxFKCW31nOIx1Kgi9b4i/hC3S/9PYx1T\nWILtVslgUpWj+CXmhYES2mUCAwEAAQ==\n-----END PUBLIC KEY-----\n",
"privateKeyPem": "-----BEGIN PRIVATE KEY-----\nBLAH-BLAH\n-----END PRIVATE KEY-----\n"
},
"announce": false,
"manuallyApprovesFollowers": false
} |
|
Getting 500 for https://github.com/RangerMauve/staticpub.mauve.moe/blob/default/helloworld.jsonld Sending a post to followers...
Sending to URL: https://social.distributed.press/v1/%40dp%40staticpub.distributed.press/outbox
Activity Payload: {
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://staticpub.distributed.press/posts/helloworld.jsonld",
"url": "https://staticpub.distributed.press/helloworld",
"type": "Note",
"summary": null,
"published": "2023-06-29T17:29:45Z",
"attributedTo": "https://staticpub.distributed.press/about.jsonld",
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"cc": [],
"sensitive": false,
"atomUri": "https://staticpub.distributed.press/helloworld",
"inReplyToAtomUri": null,
"conversation": "tag:staticpub.distributed.press,2023-06-29:objectId=294618:objectType=Conversation",
"content": "Hello, Fediverse! This is my first post.",
"contentMap": {
"en": "Hello, Fediverse! This is my first post."
},
"attachment": [],
"tag": [],
"replies": "https://staticpub.distributed.press/helloworld-replies.jsonld",
"actor": "https://staticpub.distributed.press/about.jsonld"
}
Keypair being used: {
publicKeyPem: '-----BEGIN PUBLIC KEY-----\n' +
'MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtZSfTeCr1Wv5NO9inU2O\n' +
'k7yI+PHdBrpKrrsxQTXPfz1vWq6myObDKT+SKpxy86LBoY8Ow5/DfEW07vSQpeyq\n' +
'YS6PhNzRTKFLe64YhQVMG9CFFnKt804pMe+DcGm4XZsPfaBWgPOkSw14vgLCusvE\n' +
'MSa19+uUu4hW1zhFuHPfS2/HacANT3gXo9Qd3nyGd1Pap7zba9bBBbp2/V7ZJloC\n' +
'LPO/2fvB0B9bcYebFN7AWsOnDDMwus2LKo5eTqiWAy8C9AissPzo9zGPseOhvBxP\n' +
'z7MRJVOON5FZexFjv5b6UjUEqHBT+6Qb8H3WUo3RIrmfbX6rsLWJW5Lm+TJyV9kk\n' +
'F0k/5nFIfYa5+DxbzvEFTRvaUEoxK2H4I+jA3an8sTb7uHCWQ5LeYzMEOwosfoL8\n' +
'gtEuqQ47K+0fazPS87EfGYv7IAariDsV/9wQyPKODebkfsdJtdc9lyJT9a5uncqt\n' +
'Tg9V30Z9rcwbRcA/YhRa45ZqB8N7Py6BBcHW/tpQ/AJeDc0UNoZn9rJBN3Lz3OTg\n' +
'14aBwLme9ctaZ2MJR7o9np4qMJYBIyUP173eBOtUjXYENWmsfs2kt5lSGAbSSdRf\n' +
'AdJmi2Hsbbk54T5BgkBsYZEDIUOPu9o/jxFKCW31nOIx1Kgi9b4i/hC3S/9PYx1T\n' +
'WILtVslgUpWj+CXmhYES2mUCAwEAAQ==\n' +
'-----END PUBLIC KEY-----\n',
privateKeyPem: '-----BEGIN PRIVATE KEY-----\nBLAH-BLAH\n-----END PRIVATE KEY-----\n'
}
PublicKeyId being used: https://staticpub.distributed.press/about.jsonld#main-key
Social Inbox API Error: HTTP error! status: 500, message: {"statusCode":500,"error":"Internal Server Error","message":"fetch failed"}
Error sending post: HTTP error! status: 500, message: {"statusCode":500,"error":"Internal Server Error","message":"fetch failed"} |
src/api/socialInboxApi.js
Outdated
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/ld+json', | ||
| date: new Date().toUTCString(), |
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.
| date: new Date().toUTCString(), | |
| date: new Date().toUTCString(), |
Date and host are set by signed fetch. Just have the Content Type here.
Distributed Press Organizing (view)
hyphacoop/distributed-press-organizing#194