Support comments using mastodon #30

Merged
mycrobe merged 18 commits from mastodon into main 2023-07-19 16:24:49 +00:00
Owner

If you put a file called metadata.json into an entry folder, and it looks like this:

{
  "rootToot": "109297792745210844",
  "tootSource": "curious.simio.us"
}

Then the tree of replies to that toot will be used as the comments for the journal entry. This PR only supports HTML, but it does support HTML comments both inline (with javascript) and in a separate page (without javascript).

So far it has been tested in modern browsers, and lynx. The client-side javascript is written such that it should work on older browsers but this has not been tested.

If you put a file called `metadata.json` into an entry folder, and it looks like this: ``` { "rootToot": "109297792745210844", "tootSource": "curious.simio.us" } ``` Then the tree of replies to that toot will be used as the comments for the journal entry. This PR only supports HTML, but it does support HTML comments both inline (with javascript) and in a separate page (without javascript). So far it has been tested in modern browsers, and lynx. The client-side javascript is written such that it *should* work on older browsers but this has not been tested.
mycrobe added 17 commits 2023-07-19 16:16:15 +00:00
mycrobe reviewed 2023-07-19 16:17:24 +00:00
@ -0,0 +14,4 @@
const args = { ...defaults, ...query }
const commentsHtml = execSync(`node /home/mycrobe/cms/src/mastodonComments.js --fragment ${args.fragment} --rootToot ${args.rootToot} --tootSource ${args.tootSource} --title "${args.title}" --backlink "${args.backlink}"`).toString()
Author
Owner

the cgi script operates without the benefit of node_modules, so the easiest thing to do is just invoke the script from a shell. I'm sure this is very efficient.

the cgi script operates without the benefit of node_modules, so the easiest thing to do is just invoke the script from a shell. I'm sure this is very efficient.
mycrobe reviewed 2023-07-19 16:18:32 +00:00
@ -0,0 +1,19 @@
#!/usr/bin/env node
Author
Owner

cgi script that takes arguments from a query string, and calls the mastodonComment.js script to get the html for the comment thread

cgi script that takes arguments from a query string, and calls the `mastodonComment.js` script to get the html for the comment thread
mycrobe reviewed 2023-07-19 16:18:57 +00:00
@ -0,0 +1,29 @@
window.MYCROBE = {
Author
Owner

client-side javascript code that calls the CGI script

client-side javascript code that calls the CGI script
mycrobe reviewed 2023-07-19 16:20:54 +00:00
@ -39,4 +55,2 @@
${content}
</div>
<pre class="metadata-raw">
${JSON.stringify(data, null, ' ')}
Author
Owner

note i removed the hidden dump of raw metadata

note i removed the hidden dump of raw metadata
mycrobe reviewed 2023-07-19 16:22:16 +00:00
@ -0,0 +1,77 @@
const args = require('minimist')(process.argv.slice(2), {string: 'rootToot', boolean: 'fragment'})
Author
Owner

no html-specific logic here. need to make gemini templates still

no html-specific logic here. need to make gemini templates still
mycrobe added 1 commit 2023-07-19 16:24:17 +00:00
mycrobe merged commit a12f6c0e20 into main 2023-07-19 16:24:49 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mycrobe/cmsetlbbq#30
No description provided.