snac.1 19 KB

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