snac.1 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. .Dd $Mdocdate$
  2. .Dt SNAC 1
  3. .Os
  4. .Sh NAME
  5. .Nm snac
  6. .Nd A simple, minimalistic ActivityPub instance
  7. .Sh SYNOPSIS
  8. .Nm
  9. .Cm command
  10. .Ar basedir
  11. .Op Ar option ...
  12. .Sh DESCRIPTION
  13. The
  14. .Nm
  15. daemon processes messages from other servers in the Fediverse
  16. using the ActivityPub protocol.
  17. .Pp
  18. This is the user manual and expects an already running
  19. .Nm
  20. installation. For the administration manual, see
  21. .Xr snac 8 .
  22. For file and data formats, see
  23. .Xr snac 5 .
  24. .Ss Web Interface
  25. The web interface provided by
  26. .Nm
  27. is split in three data streams: the public timeline, the private
  28. timeline and the instance timeline. There are no other feeds like
  29. the federated firehoses provided by other similar ActivityPub
  30. implementations like Mastodon or Pleroma.
  31. .Pp
  32. The public timeline, also called the local timeline, is what an
  33. external visitor sees about the activity of a
  34. .Nm
  35. user: that is, only the list of public notes, boosts and likes
  36. the user generates or participates into. This is, obviously,
  37. read-only, and not very remarkable, unless the user publishes
  38. messages of staggering genius. A set of history links, grouped
  39. by month, will also be available at the bottom of the page.
  40. .Pp
  41. The private timeline, or simply the timeline, is the private,
  42. password-protected area of a
  43. .Nm
  44. server where the user really interacts with the rest of the
  45. Fediverse.
  46. .Pp
  47. The top area of the timeline provides a big text area to write
  48. notes for the public (i.e. for the user followers). As this is
  49. the second most important activity on the Fediverse, this is
  50. located in the most prominent area of the user page. You can
  51. enter plain text, @user@host mentions and other things. See the
  52. .Xr snac 5
  53. manual for more information on the allowed markup.
  54. .Pp
  55. Other fields immediately below the big text one allow some control
  56. about the post to be sent:
  57. .Bl -tag -offset indent
  58. .It Sensitive content
  59. If you set this checkbox, your post will be marked with a
  60. content warning. The immediately following, optional text box
  61. allows you to write a description about why your content is
  62. so sensitive.
  63. .It Visibility
  64. From these radio button set you can select the scope of the new
  65. post. The available options are: Public, Unlisted, Followers-only
  66. and Direct Message (sent only to accounts mentioned in the post body).
  67. .It Reply to (URL)
  68. If you fill this optional text field with the URL of another one's
  69. post, your text will be considered as a reply to it, not a
  70. standalone one.
  71. .It Draft
  72. If you set this checkbox, your text will not be sent when you
  73. push the Post button, but stored for later modification in
  74. the "Drafts" section.
  75. .It Language
  76. A dropdown to select which language your post will be written
  77. in. This control only appears after you configure the set of
  78. languages you expect to use in the User Settings (see below).
  79. .It Scheduled post...
  80. This dropdown menu allows setting a date and time for the
  81. post publication.
  82. .It Attachments...
  83. This dropdown menu allows uploading media attachments (images,
  84. audio, video, etc.) to your post.
  85. .It Poll...
  86. this dropdown menu gives access to the voting options, that
  87. will make your post a poll. You can set the options to be
  88. voted, if it's a multiple choice poll and the due date.
  89. .El
  90. .Pp
  91. More options are hidden under dropdown menus. They are the
  92. following:
  93. .Bl -tag -offset indent
  94. .It Follow (by URL or user@host)
  95. Fill the input area with a user 'actor' URL or a user@host
  96. Fediverse identifier to follow.
  97. .It Boost (by URL)
  98. Fill the input area with the URL of a Fediverse note to be
  99. boosted.
  100. .It Like (by URL)
  101. Fill the input area with the URL of a Fediverse note to be
  102. liked.
  103. .It User setup...
  104. This option opens the user setup dialog.
  105. .It Followed hashtags...
  106. Enter here the list of hashtags you want to follow, one
  107. per line, with or without the # symbol. Since version 2.78,
  108. URLs to RSS feeds of ActivityPub objects are also allowed
  109. (like e.g. https://mastodon.social/tags/bloomscrolling).
  110. .It Blocked hashtags...
  111. Enter here the list of hashtags you want to block, one
  112. per line, with or without the # symbol.
  113. .It Muted words...
  114. Enter here a list of words to be silenced. If a post includes
  115. any of this words, it's hidden behind a dropdown.
  116. .El
  117. .Pp
  118. The user setup dialog allows some user information to be
  119. changed, specifically:
  120. .Bl -tag -offset indent
  121. .It User name
  122. Your user name, or not really that. People like to include
  123. emojis, flags and strange symbols for some reason.
  124. .It Avatar URL
  125. The URL of a picture to be used as your avatar in timelines
  126. around the world.
  127. .It Bio
  128. Enter here a bunch of self-indulgent blurb about yourself.
  129. The same markup options available for text notes apply here.
  130. .It Always show sensitive content
  131. By default,
  132. .Nm
  133. hides content marked as sensitive by their publishers.
  134. If you check this option, sensitive content is always shown.
  135. .It Email address for notifications
  136. If this field is not empty, an email message will be sent
  137. to this address whenever a post written by you is liked,
  138. boosted or replied to.
  139. .It Telegram notifications
  140. To enable notifications via Telegram, fill the two provided
  141. fields (Bot API key and Chat id). You need to create both
  142. a Telegram channel and a bot for this; the process is rather
  143. cumbersome but it's documented everywhere. The Bot API key
  144. is a long string of alphanumeric characters and the chat id
  145. is a big, negative number.
  146. .It ntfy notifications
  147. To enable notifications via ntfy (both self-hosted or
  148. standard ntfy.sh server), fill the two provided
  149. fields (ntfy server/topic and, if protected, the token).
  150. You need to refer to the https://ntfy.sh web site for
  151. more information on this process.
  152. .It Notify webhook
  153. If this is set to an URL, an HTTP POST will be sent to it
  154. whenever a new notification happens (see the 'Webhook for
  155. notifications' section below for more information).
  156. .It Maximum days to keep posts
  157. This numeric value specifies the number of days to pass before
  158. posts (yours and others') will be purged. This value overrides
  159. what the administrator defined in the global server settings
  160. only if it's lesser (i.e. you cannot keep posts for longer
  161. than what the admin desires). A value of 0 (the default) means
  162. that the global server settings will apply to the posts in your
  163. timeline. Also, if the administrator has configured it,
  164. purged local posts generate a Delete activity that is sent
  165. everywhere.
  166. .It Drop direct messages from people you don't follow
  167. Just what it says in the tin. This is to mitigate spammers
  168. coming from Fediverse instances with lax / open registration
  169. processes. Please take note that this also avoids possibly
  170. legitimate people trying to contact you.
  171. .It This account is a bot
  172. Set this checkbox if this account behaves like a bot (i.e.
  173. posts are automatically generated).
  174. .It Auto-boost all mentions to this account
  175. If this toggle is on, all mentions to this account are boosted
  176. to all followers. This can be used to create groups.
  177. .It This account is private
  178. If this toggle is on, posts are not published via the public
  179. web interface, only via the ActivityPub protocol.
  180. .It Collapse top threads by default
  181. If this toggle is on, the private timeline will always show
  182. conversations collapsed by default. This allows easier navigation
  183. through long threads.
  184. .It Follow requests must be approved
  185. If this toggle is on, follow requests are not automatically
  186. accepted, but notified and stored for later review. Pending
  187. follow requests will be shown in the people page to be
  188. approved or discarded.
  189. .It Publish follower and following metrics
  190. If this toggle is on, the number of followers and following
  191. accounts are made public (this is only the number; the specific
  192. lists of accounts are never published).
  193. .It Show unlisted posts in the public page and RSS feed
  194. If this toggle is on, posts with a scope set as 'unlisted'
  195. are shown both in the public page and the RSS feed. Please take
  196. note that, previous to version 2.92, these posts were always
  197. shown in these channels.
  198. .It Web interface language
  199. If the administrator has installed any language file, it
  200. can be selected here.
  201. .It Time zone
  202. The time zone the user is on (default: UTC). Only
  203. used for scheduled posts.
  204. .It Languages you usually post in
  205. Fill this string with the ISO 639 Language Codes you expect to
  206. write your posts in, space-separated (example: en fr pt_BR).
  207. .It Don't show posts written in these languages
  208. A space-separated string of ISO 639 Language Codes
  209. (example: en fr de).
  210. .It Show a simpler web UI for browsers with these user agents
  211. A list of partial strings that will be matched against the current
  212. web browser user agent string. If it contains any of these strings,
  213. the private timeline is shown using simpler HTML (basically, avoiding
  214. the details / summary tags as much as possible, which are usually not
  215. rendered correctly if at all in basic or text-based browsers). If any
  216. of these lines is an asterisk, the simpler web UI is always used.
  217. .It Password
  218. Write the same string in these two fields to change your
  219. password. Don't write anything if you don't want to do this.
  220. .El
  221. .Pp
  222. The rest of the page contains your timeline in reverse
  223. chronological order (i.e., newest interactions first).
  224. .Nm
  225. shows the conversations as nested trees, unlike other Fediverse
  226. software; every time you contribute something to a conversation,
  227. the full thread is bumped up, so new interactions are shown
  228. always at the top of the page while the forgotten ones languish
  229. at the bottom.
  230. .Pp
  231. Private notes (a.k.a. direct messages) are also shown in
  232. the timeline as normal messages, but marked with a cute lock
  233. to mark them as non-public. Replies to direct messages are
  234. also private and cannot be liked nor boosted.
  235. .Pp
  236. For each entry in the timeline, a set of reasonable actions
  237. in the form of buttons will be shown. These can be:
  238. .Bl -tag -offset indent
  239. .It Reply...
  240. Unveils a text area to write your intelligent and acute comment
  241. to an uninformed fellow. This note is sent to the original
  242. author as well as to your followers. The note can include
  243. mentions in the @user@format; these people will also become
  244. recipients of the message. If you reply to a boost or like,
  245. you are really replying to the note, not to the admirer of it.
  246. .It Emoji react...
  247. Unveils a text area that allows a user to react with an emoji
  248. by typing its identifier, that should match one of the emojis
  249. defined in the
  250. .Pa emojis.json
  251. file. By now, only those emoji identifiers surrounded by colons
  252. can be used.
  253. .It Like
  254. Click this if you admire this post. The poster and your
  255. followers will be informed.
  256. .It Boost
  257. Click this if you want to propagate this post to all your
  258. followers. The original author will also be informed.
  259. .It Bookmark
  260. Click this to bookmark a post.
  261. .It Follow
  262. Click here if you want to start receiving all the shenanigans
  263. the original author of the post will write in the future.
  264. .It Unfollow
  265. Click here if you are fed up of this fellow's activities.
  266. .It Delete
  267. Click here to send this post to the bin. If it's an activity
  268. written by you, the appropriate message is sent to the rest
  269. of involved parts telling them that you no longer want your
  270. thing in their servers (not all implementations really obey
  271. this kind of requirements, though).
  272. .It MUTE
  273. This is the most important button in
  274. .Nm
  275. and the Fediverse in general. Click it if you don't want
  276. to read crap from this user again in the foreseeable future.
  277. .It Hide
  278. If a conversation is getting long and annoying but not enough
  279. to MUTE its author forever, click this button to avoid seeing
  280. the post and its children anymore.
  281. .It Limit
  282. When an account is limited, boosts from it are ignored.
  283. .It Cool
  284. When an account is marked as cool, notify me everytime they post.
  285. .It Edit
  286. Posts written by you on
  287. .Nm
  288. version 2.19 and later can be edited and resent to their
  289. recipients.
  290. .El
  291. .Ss Command-line options
  292. The command-line tool provide the following commands:
  293. .Bl -tag -offset indent
  294. .It Cm init Op basedir
  295. Initializes the data storage. This is an interactive command; necessary
  296. information will be prompted for. The
  297. .Ar basedir
  298. directory must not exist.
  299. .It Cm upgrade Ar basedir
  300. Upgrades the data storage after installing a new version.
  301. Only necessary if
  302. .Nm
  303. complains and demands it.
  304. .It Cm httpd Ar basedir
  305. Starts the daemon.
  306. .It Cm purge Ar basedir
  307. Purges old data from the timeline of all users.
  308. .It Cm adduser Ar basedir Op uid
  309. Adds a new user to the server. This is an interactive command;
  310. necessary information will be prompted for.
  311. .It Cm deluser Ar basedir Ar uid
  312. Deletes a user, unfollowing all accounts first.
  313. .It Cm resetpwd Ar basedir Ar uid
  314. Resets a user's password to a new, random one.
  315. .It Cm update Ar basedir Ar uid
  316. Sends a user's updated profile to following instances.
  317. .It Cm queue Ar basedir Ar uid
  318. Processes the output queue of the specified user, sending all
  319. enqueued messages and re-enqueing the failing ones. This command
  320. must not be executed if the server is running.
  321. .It Cm follow Ar basedir Ar uid Ar actor
  322. Sends a Follow message for the specified actor URL.
  323. .It Cm request Ar basedir Ar uid Ar url
  324. Requests an object and dumps it to stdout. This is a very low
  325. level command that is not very useful to you.
  326. .It Cm announce Ar basedir Ar uid Ar url
  327. Announces (boosts) a post via its URL.
  328. .It Cm note Ar basedir Ar uid Ar text Op file file ... Op -r inReplyTo Op -d YYYYmmddHHMMSS
  329. Enqueues a Create + Note message to all followers. If the
  330. .Ar text
  331. argument is -e, the external editor defined by the EDITOR
  332. environment variable will be invoked to prepare a message; if
  333. it's - (a lonely hyphen), the post content will be read from stdin.
  334. The rest of command line arguments are treated as media files to be
  335. attached to the post. The LANG environment variable (if defined) is used
  336. as the post language. An optional URL to a Fediverse post, prefixed by \-r,
  337. can be specified for this note to be a reply to. If a date in YYYYmmddHHMMSS
  338. format is followed by \-d, the note is scheduled for that moment instead of
  339. immediately posted (this date must be in the same timezone the user has
  340. configured in the web UI).
  341. .It Cm note_unlisted Ar basedir Ar uid Ar text Op file file ... Op -r inReplyTo Op -d YYYYmmddHHMMSS
  342. Like the previous one, but creates an "unlisted" (or "quiet public") post.
  343. .It Cm note_mention Ar basedir Ar uid Ar text Op file file ... Op -r inReplyTo Op -d YYYYmmddHHMMSS
  344. Like the previous one, but creates a post only for accounts mentioned
  345. in the post body.
  346. .It Cm block Ar basedir Ar instance_url
  347. Blocks a full instance, given its URL or domain name. All subsequent
  348. incoming activities with identifiers from that instance will be immediately
  349. blocked without further inspection.
  350. .It Cm unblock Ar basedir Ar instance_url
  351. Unblocks a previously blocked instance.
  352. .It Cm verify_links Ar basedir Ar uid
  353. Verifies all links or account handles stored as metadata for the given user.
  354. This verification is done by downloading the link content and searching for
  355. a link back to the
  356. .Nm
  357. user url that also contains a rel="me" attribute. These links are specially
  358. marked as verified in the user's public timeline and also via the Mastodon API.
  359. .It Cm export_csv Ar basedir Ar uid
  360. Exports some account data as Mastodon-compatible CSV files. After executing
  361. this command, the following files will be written to the
  362. .Pa export/
  363. subdirectory inside the user directory:
  364. .Pa bookmarks.csv ,
  365. .Pa blocked_accounts.csv ,
  366. .Pa lists.csv , and
  367. .Pa following_accounts.csv .
  368. .It Cm export_posts Ar basedir Ar uid
  369. Exports all posts written by the user to the file
  370. .Pa outbox.json
  371. inside the
  372. .Pa export/
  373. subdirectory inside the user directory. The format is compatible with the
  374. one generated by the equivalent option in Mastodon.
  375. .It Cm alias Ar basedir Ar uid Ar "@account@remotehost"
  376. Sets an account as an alias of this one. This is a necessary step to migrate
  377. an account to a remote Mastodon instance (see
  378. .Xr snac 8 ,
  379. section 'Migrating from snac to Mastodon').
  380. .It Cm migrate Ar basedir Ar uid
  381. Starts a migration from this account to the one set as an alias (see
  382. .Xr snac 8 ,
  383. section 'Migrating from snac to Mastodon').
  384. .It Cm import_csv Ar basedir Ar uid
  385. Imports CSV data files from a Mastodon export. This command expects the
  386. following files to be inside the
  387. .Pa import/
  388. subdirectory of a user's directory inside the server base directory:
  389. .Pa bookmarks.csv ,
  390. .Pa blocked_accounts.csv ,
  391. .Pa lists.csv , and
  392. .Pa following_accounts.csv .
  393. .It Cm state Ar basedir
  394. Dumps the current state of the server and its threads. For example:
  395. .Bd -literal -offset indent
  396. server: comam.es (snac/2.45-dev)
  397. uptime: 0:03:09:52
  398. job fifo size (cur): 45
  399. job fifo size (peak): 1532
  400. thread #0 state: input
  401. thread #1 state: input
  402. thread #2 state: waiting
  403. thread #3 state: waiting
  404. thread #4 state: output
  405. thread #5 state: output
  406. thread #6 state: output
  407. thread #7 state: waiting
  408. .Ed
  409. .Pp
  410. The job fifo size values show the current and peak sizes of the
  411. in-memory job queue. The thread state can be: waiting (idle waiting
  412. for a job to be assigned), input or output (processing I/O packets)
  413. or stopped (not running, only to be seen while starting or stopping
  414. the server).
  415. .It Cm import_list Ar basedir Ar uid Ar file
  416. Imports a Mastodon list in CSV format. The file must be stored inside the
  417. .Pa import/
  418. subdirectory of a user's directory inside the server base directory.
  419. This option can be used to import "Mastodon Follow Packs".
  420. .It Cm import_block_list Ar basedir Ar uid Ar file
  421. Imports a Mastodon list of accounts to be blocked in CSV format. The
  422. file must be stored inside the
  423. .Pa import/
  424. subdirectory of a user's directory inside the server base directory.
  425. .It Cm lists Ar basedir Ar uid
  426. Prints the name of the user created lists.
  427. .It Cm list_members Ar basedir Ar uid Ar name
  428. Prints the list of actors in the named list.
  429. .It Cm list_create Ar basedir Ar uid Ar name
  430. Creates a new list.
  431. .It Cm list_remove Ar basedir Ar uid Ar name
  432. Removes an existing list.
  433. .It Cm list_add Ar basedir Ar uid Ar name Ar account
  434. Adds an account (by its @name@host handle or actor URL) to a list.
  435. .It Cm list_del Ar basedir Ar uid Ar name Ar actor_url
  436. Deletes an actor (by its actor URL) from a list.
  437. .It Cm top_ten Ar basedir Ar uid Op N
  438. Returns the ids of the top ten (or top N) most popular posts (considering the
  439. sum of likes and boosts).
  440. .El
  441. .Ss Migrating an account to/from Mastodon
  442. See
  443. .Xr snac 8
  444. for details.
  445. .Ss Using Mastodon-compatible apps
  446. Since version 2.27,
  447. .Nm
  448. includes support for the Mastodon API, so you can use Mastodon-compatible
  449. mobile and desktop applications to access your account. Given a correctly
  450. configured server, the usage of these programs should be straightforward.
  451. Please take note that they will show your timeline in a 'Mastodon fashion'
  452. (i.e., as a plain list of posts), so you will lose the fancy, nested thread
  453. post display with the most active threads at the top that the web interface of
  454. .Nm
  455. provides.
  456. .Ss Implementing post bots
  457. .Nm
  458. makes very easy to post messages in a non-interactive manner. This example
  459. posts a string:
  460. .Bd -literal -offset indent
  461. uptime | snac note $SNAC_BASEDIR $SNAC_USER -
  462. .Ed
  463. .Pp
  464. You can setup a line like this from a
  465. .Xr crontab 5
  466. or similar. Take note that you need a) command-line access to the same machine
  467. that hosts the
  468. .Nm
  469. instance, and b) write permissions to the storage directories and files.
  470. .Pp
  471. You can also post non-interactively using the Mastodon API and a command-line
  472. http tool like
  473. .Xr curl 1
  474. or similar. This has the advantage that you can do it remotely from any host,
  475. anywhere; the only thing you need is an API Token. This is an example:
  476. .Bd -literal -offset indent
  477. curl -X POST https://$SNAC_HOST/api/v1/statuses \\
  478. --header "Authorization: Bearer ${TOKEN}" -d "status=$(uptime)"
  479. .Ed
  480. .Pp
  481. You can obtain an API Token by connecting to the following URL:
  482. .Bd -literal -offset indent
  483. https://$SNAC_HOST/oauth/x-snac-get-token
  484. .Ed
  485. .Pp
  486. .Ss Webhook for notifications
  487. Since version 2.78, users can set the URL to a webhook that will receive
  488. an HTTP POST with every notification (in JSON format). This can be used to
  489. implement some automation whenever a new activity happens, like autorepliers,
  490. chatbots, interactive textual games or whatever. The
  491. .Pa examples/
  492. subdirectory contains a tiny Python program that implements an auto-follower
  493. for every new follow. The JSON notification object includes the following data:
  494. .Bl -tag -offset indent
  495. .It id
  496. a unique notification identifier
  497. .It actor
  498. the origin actor id
  499. .It target
  500. the target actor id
  501. .It date
  502. the notification date
  503. .It msg
  504. the full ActivityPub action JSON object
  505. .It objid
  506. the object identifier (extracted from msg, may be null)
  507. .It type
  508. the action type (extracted from msg)
  509. .It utype
  510. the action subtype (extracted from msg, may be null)
  511. .It uid
  512. the user identifier (account name)
  513. .It basedir
  514. the server base directory
  515. .It baseurl
  516. the server base URL
  517. .It account
  518. the origin actor object
  519. .It reply
  520. the activity this post is a reply to (may not exist)
  521. .El
  522. .Pp
  523. .Sh ENVIRONMENT
  524. .Bl -tag -width Ds
  525. .It Ev SNAC_BASEDIR
  526. This optional environment variable can be set to the base directory of
  527. your installation; if set, you don't have to add the base directory as an
  528. argument to command-line operations. This may prove useful if you only
  529. have one
  530. .Nm
  531. instance in your system (which is probably your case).
  532. .It Ev DEBUG
  533. Overrides the debugging level from the server 'dbglevel' configuration
  534. variable. Set it to an integer value. The higher, the deeper in meaningless
  535. verbiage you'll find yourself into.
  536. .It Ev EDITOR
  537. The user-preferred interactive text editor to prepare notes.
  538. .It Ev LANG
  539. The language of the post when sending notes from the command line.
  540. .El
  541. .Sh SEE ALSO
  542. .Xr snac 5 ,
  543. .Xr snac 8
  544. .Sh AUTHORS
  545. .An grunfink Lk https://comam.es/snac/grunfink @grunfink@comam.es
  546. .Sh LICENSE
  547. See the LICENSE file for details.
  548. .Sh CAVEATS
  549. Use the Fediverse sparingly. Don't fear the MUTE button.
  550. .Sh BUGS
  551. Probably many. Some issues may be even documented in the TODO.md file.