~aleteoryx/tclfeed-bsky

ref: 45b4726bb4064d001f09b40b8ecf6a82b6c55ec1 tclfeed-bsky/README.md -rw-r--r-- 2.9 KiB
45b4726bAleteoryx more heuristic tweaks 25 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# A `bsky.app` feed for Tcl/Tk posts

Written in Tcl, using Jetstream.

You could probably base your own feeds on this. I've tried to make the source code for
this relatively straightforward.

Deployed @ <https://bsky.app/profile/aleteoryx.me/feed/tclposting>.

Makes heavy use of `tcllib` and `tcltls`, both need to be installed for it to work.
Run `main.tcl` with a configured config as the argument.
All paths are resolved relative to the install directory.

This implementation doesn't support `did:plc:` feedGenerator IDs because im too lazy.

`bin/up.tcl` is a rough carbon copy of the `scripts/publishFeedGen.ts` present in
the official example repo.

## Directory Structure

- `/bin` - misc scripts
- `/lib` - code used only by `/bin`
- `/src` - application code
- `/src/algos` - algorithms, `*.tcl` is autoloaded, see `src/algos.tcl` for details.

## Moderation

`src/jetstream.tcl` blocks any repos that appear in the `blocked_repos` table.
the following tools exist for moderation:

- `bin/rmrepo.tcl` will delete all posts by the specified user(s). if `-feed` is specified,
  only from the passed feed(s). if no feeds are specified, it will also block them.
  the `-pds` option is used to resolve handles to DIDs. it defaults to bsky.social.
- `bin/rmpost.tcl` will delete all passed posts from the specified feed
- `bin/importlist.tcl` works like `rmrepo`, but it pulls from passed moderation lists. flags work the same.
- `bin/updatelists.tcl` calls `bin/importlist.tcl` with a hardcoded set of lists.
  currently includes ones by [@rahaeli.bsky.social][rahaeli], [@aleteoryx.me][selfbsky] (yours truly), and
  [@skysentry.bsky.social][skysentry].
- `bin/addposts.tcl` manually adds a post to a list. it takes args of the form `URI ORD ?URI ORD ...?`.
  passing `-ts` for the `ORD` will pull `record.createdAt` from the post and use that instead.

[rahaeli]: https://bsky.app/profile/rahaeli.bsky.social
[selfbsky]: https://bsky.app/profile/aleteoryx.me
[skysentry]: https://bsky.app/profile/skysentry.bsky.social

## Potential Improvements

- there's something up with the websocket implementation (`src/ws.tcl`)?
  we get disconnected frequently.
    - `src/jetstream.tcl` solves this with reconnection code, but it doesn't
      send a cursor, so posts may get missed.
        - said reconnection code is god-awful, and would benefit from a refactor
- there's probably not a foolproof way to deal with the fact that TCL is
  a brand, but it would be nice
- `src/httpd.tcl` is just enough webserver to handle requests, and very
  little else. it's unfit for exposure to the public internet. this is
  low-prio cause it works fine behind mod_proxy.
- the API for `lib/atpagent.tcl` could be nicer, but I don't feel like
  doing codegen.
- `src/httpd.tcl`'s API should probably be subcommand-based instead of
  token-based, to fit `lib/atpagent.tcl`
- a way to check against labellers when intaking posts maybe