FChannel0 / FChannel-Server

GNU Affero General Public License v3.0
106 stars 14 forks source link

[API] List boards and thread information. #70

Closed trueauracoral closed 2 years ago

trueauracoral commented 2 years ago

In issue #11 it is mentioned how to get board posts and other information by adding /outbox. Are there similar API's available to list boards on a FChannel instance and also get information about a thread?

ghost commented 2 years ago

Boards can be listed on an FChannel instance by looking at /following. This does not necessarily list all boards on an instance, but it lists all of the ones that would normally be listed. /meta/ on fchan.xyz is a hidden board and would normally not be listed, so it doesn't show up. In some cases instances may follow other instances, so you may see just an instance's domain in the output.

As for threads and posts, use the Accept header with the value application/ld+json in each request to a post's ID, whether it be a thread or just a single post.

$ curl --header 'Accept: application/ld+json' https://usagi.reisen/prog/HBB7L95M
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "actor": {
    "id": "https://usagi.reisen/prog",
    "publicKey": {},
    "restricted": false
  },
  "orderedItems": [
    {
      "type": "Note",
      "id": "https://usagi.reisen/prog/HBB7L95M",
...
trueauracoral commented 2 years ago

Thank you very much for this information. I made a while back a terminal viewer thing for 4chan and now I am trying to convert it for fchan. This will help a lot in that. The API's are kind of seperate because I can't get the name of the thread in the /outbox so I need to make another request to the thread with that special header to get that small piece of info. Like this parameter: image

ghost commented 2 years ago

You don't need another request, it is still in the outbox. attributedTo is the name, and name is the subject. Both are omitted if they are blank, and in attributedTo's case this means when the value is Anonymous.

trueauracoral commented 2 years ago

https://codeberg.org/zortazert/Python-Projects/src/branch/main/api/fchan.py I succeeded in making this script with your help. Thank you very much.

image