summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2022-10-03 20:14:20 +0200
committerGravatar default2022-10-03 20:14:20 +0200
commit99c43fbc41074dd9bf0170823f2a247aeebb1fad (patch)
treee93e152b86650d2db030f5974fe47002513aadbb
parentVersion 2.01 RELEASED. (diff)
downloadpenes-snac2-99c43fbc41074dd9bf0170823f2a247aeebb1fad.tar.gz
penes-snac2-99c43fbc41074dd9bf0170823f2a247aeebb1fad.tar.xz
penes-snac2-99c43fbc41074dd9bf0170823f2a247aeebb1fad.zip
Imported documentation from snac 1.x.
-rw-r--r--doc/snac.1208
-rw-r--r--doc/snac.5131
-rw-r--r--doc/snac.8326
-rw-r--r--doc/susie.pngbin0 -> 116 bytes
-rw-r--r--doc/susie.txt3
-rw-r--r--doc/susie32.pngbin0 -> 134 bytes
-rw-r--r--doc/susie64.pngbin0 -> 138 bytes
7 files changed, 668 insertions, 0 deletions
diff --git a/doc/snac.1 b/doc/snac.1
new file mode 100644
index 0000000..f2ed24d
--- /dev/null
+++ b/doc/snac.1
@@ -0,0 +1,208 @@
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
13The
14.Nm
15daemon processes messages from other servers in the Fediverse
16using the ActivityPub protocol.
17.Pp
18This is the user manual and expects an already running
19.Nm
20installation. For the administration manual, see
21.Xr snac 8 .
22For file and data formats, see
23.Xr snac 5 .
24.Ss Web Interface
25The web interface provided by
26.Nm
27is split in two data streams: the public timeline and the
28private timeline. There are no other feeds like the server-scoped
29or the federated firehoses provided by other similar ActivityPub
30implementations like Mastodon or Pleroma.
31.Pp
32The public timeline, also called the local timeline, is what an
33external visitor sees about the activity of a
34.Nm
35user: that is, only the list of public notes, boosts and likes
36the user generates or participates into. This is, obviously,
37read-only, and not very remarkable, unless the user publishes
38messages of staggering genious. A set of history links, grouped
39by month, will also be available at the bottom of the page.
40.Pp
41The private timeline, or simply the timeline, is the private,
42password-protected area of a
43.Nm
44server where the user really interacts with the rest of the
45Fediverse.
46.Pp
47The top area of the timeline provides a big text area to write
48notes for the public (i.e. for the user followers). As this is
49the second most important activity on the Fediverse, this is
50located in the most prominent area of the user page. You can
51enter plain text, @user@host mentions and other things. See the
52.Xr snac 5
53manual for more information on the allowed markup.
54.Pp
55More options are hidden under a toggle control. They are the
56following:
57.Bl -tag -offset indent
58.It Follow (by URL or user@host)
59Fill the input area with a user 'actor' URL or a user@host
60Fediverse identifier to follow.
61.It Boost (by URL)
62Fill the input area with the URL of a Fediverse note to be
63boosted.
64.It User setup...
65This option opens the user setup dialog.
66.El
67.Pp
68The user setup dialog allows some user information to be
69changed, specifically:
70.Bl -tag -offset indent
71.It User name
72Your user name, or not really that. People like to include
73emojis, flags and strange symbols for some reason.
74.It Avatar URL
75The URL of a picture to be used as your avatar in timelines
76around the world.
77.It Bio
78Enter here a bunch of self-indulgent blurb about yourself.
79The same markup options available for text notes apply here.
80.It Password
81Write the same string in these two fields to change your
82password. Don't write anything if you don't want to do this.
83.El
84.Pp
85The rest of the page contains your timeline in reverse
86chronological order (i.e., newest interactions first).
87.Nm
88shows the conversations as nested trees, unlike other Fediverse
89software; everytime something new is added to a conversation,
90the full thread is bumped up, so new interactions are shown
91always at the top of the page while the forgotten ones languish
92at the bottom.
93.Pp
94Private notes (a.k.a. direct messages) are also shown in
95the timeline as normal messages, but marked with a cute lock
96to mark them as non-public. Replies to direct messages are
97also private and cannot be liked nor boosted.
98.Pp
99For each entry in the timeline, a set of reasonable actions
100in the form of buttons will be shown. These can be:
101.Bl -tag -offset indent
102.It Reply
103Unveils a text area to write your intelligent and acute comment
104to an uninformed fellow. This note is sent to the original
105author as well as to your followers. The note can include
106mentions in the @user@format; these people will also become
107recipients of the message. If you reply to a boost or like,
108you are really replying to the note, not to the admirer of it.
109.It Like
110Click this if you admire this post. The poster and your
111followers will be informed.
112.It Boost
113Click this if you want to propagate this post to all your
114followers. The original author will also be informed.
115.It Follow
116Click here if you want to start receiving all the shenanigans
117the original author of the post will write in the future.
118.It Unfollow
119Click here if you are fed up of this fellow's activities.
120.It Delete
121Click here to send this post to the bin. If it's an activity
122written by you, the appropriate message is sent to the rest
123of involved parts telling them that you no longer want your
124thing in their servers (not all implementations really obey
125this kind of requirements, though).
126.It MUTE
127This is the most important button in
128.Nm
129and the Fediverse in general. Click it if you don't want
130to read crap from this user again in the forseeable future.
131.El
132.Ss Command-line options
133The command-line tool provide the following commands:
134.Bl -tag -offset indent
135.It Cm init Op basedir
136Initializes the database. This is an interactive command; necessary
137information will be prompted for. The
138.Ar basedir
139directory must not exist.
140.It Cm check Ar basedir Op uid
141Does a minimal health check to the database and its users. If a
142user id is provided, only this user will be checked.
143.It Cm purge Ar basedir Op uid
144Purges old data from the timeline of all users. If a user id is
145provided, only this user's timeline will be purged.
146.It Cm adduser Ar basedir Op uid
147Adds a new user to the server. This is an interactive command;
148necessary information will be prompted for. Also, a copy of
149the server
150.Pa style.css
151is installed in the user's
152.Pa static/
153directory.
154.It Cm httpd Ar basedir
155Starts the daemon.
156.It Cm queue Ar basedir Ar uid
157Processes the output queue of the specied user, sending all
158enqueued messages and re-enqueing the failing ones. This command
159must not be executed if the server is running.
160.It Cm update Ar basedir Ar uid
161Enqueues a user information Update message to all followers.
162.It Cm passwd Ar basedir Ar uid
163Changes the password for a user (interactive).
164.It Cm follow Ar basedir Ar uid Ar actor
165Sends a Follow message for the specified actor URL.
166.It Cm unfollow Ar basedir Ar uid Ar actor
167Sends an Unfollow message for the specified actor URL.
168.It Cm mute Ar basedir Ar uid Ar actor
169Mutes an actor for the specified user. This is the most important
170command for the Fediverse. The user will no longer receive nor
171read another activity from the specified moron.
172.It Cm unmute Ar basedir Ar uid Ar actor
173In case a muted moron is no longer a moron, it can be unmuted
174this way. This is the least used command ever.
175.It Cm like Ar basedir Ar uid Ar url
176Enqueues a Like message for a post given its url.
177.It Cm announce Ar basedir Ar uid Ar url
178Enqueues an Announce (boost) message for a message post its url.
179.It Cm request Ar basedir Ar uid Ar url
180Requests an object and dumps it to stdout. This is a very low
181level command that is not very useful to you.
182.It Cm note Ar basedir Ar uid Ar text
183Enqueues a Create + Note message to all followers. If the
184.Ar text
185argument is - (a lonely hyphen), the external editor defined
186by the EDITOR environment variable will be invoked to prepare
187a message.
188.El
189.Sh ENVIRONMENT
190.Bl -tag -width Ds
191.It Ev DEBUG
192Overrides the debugging level from the server 'dbglevel' configuration
193variable. Set it to an integer value. The higher, the deeper in meaningless
194verbiage you'll find yourself into.
195.It Ev EDITOR
196The user-preferred interactive text editor to prepare messages.
197.El
198.Sh SEE ALSO
199.Xr snac 5 ,
200.Xr snac 8
201.Sh AUTHORS
202.An grunfink
203.Sh LICENSE
204See the LICENSE file for details.
205.Sh CAVEATS
206Use the Fediverse sparingly. Don't fear the mute button.
207.Sh BUGS
208Plenty. Some issues may be documented in the TODO.md file.
diff --git a/doc/snac.5 b/doc/snac.5
new file mode 100644
index 0000000..a5311e4
--- /dev/null
+++ b/doc/snac.5
@@ -0,0 +1,131 @@
1.Dd $Mdocdate$
2.Dt SNAC 5
3.Os
4.Sh NAME
5.Nm snac
6.Nd message formatting and file format documentation
7.Sh DESCRIPTION
8The
9.Nm
10daemon processes messages from other servers in the Fediverse
11using the ActivityPub protocol.
12.Pp
13This manual describes the allowed formatting of note messages
14and the disk storage layout of
15.Nm
16server and user data. For the operation manual, see
17.Xr snac 1 .
18For the administration manual, see
19.Xr snac 8 .
20.Ss Message Formatting
21Message notes respect the entered new line breaks rigurously.
22A special subset of Markdown is allowed, including:
23.Bl -tag -width tenletters
24.It bold
25**text between two pairs of asterisks**
26.It italic
27*text between a pair of asterisks*
28.It code
29Text `between backticks` is formatted as code.
30.Bd -literal
31```
32/* text between lines with only three backticks is preformatted */
33int main(int argc, char *argv[])
34{
35 return 0;
36}
37
38```
39.Ed
40.It links
41Standalone URLs.
42.It quoted text
43Lines starting with >.
44.It User Mentions
45Strings in the format @user@host are requested using the Webfinger
46protocol and converted to links and mentions if something reasonable
47is found.
48.El
49.Pp
50HTML tags are left untouched. This is probably a bad idea that may
51change in future versions.
52.Pp
53.Ss Disk Layout
54This section documents version 1 of the disk storage layout. It's still
55subject to change.
56.Pp
57The base directory contains the following files and folders:
58.Bl -tag -width tenletters
59.It Pa server.json
60Server configuration.
61.It Pa user/
62Directory holding user subdirectories.
63.El
64.Pp
65Each user directory is a subdirectory of
66.Pa BASEDIR/user/ ,
67has the user id as name and contains the following subdirectories and files:
68.Bl -tag -width tenletters
69.It Pa user.json
70User configuration file.
71.It Pa key.json
72SHA-1 secret/public key PEM data.
73.It Pa actors/
74This subdirectory stores cached 'Person' ActivityPub messages as JSON files. Each
75file name is an MD5 hash of the actor URL.
76.It Pa timeline/
77This subdirectory stores the user's timeline. Everytime a valid message arrives,
78it's stored in this directory as a JSON object. The file name spec is: a Unix
79timestamp followed by a hyphen followed by an MD5 of the message Id. Additionally,
80metadata for each message parent and children is stored under the '_snac' field;
81parent messages with new children are renamed with an updated timestamp so that
82the more recently updated thread is shown at the top. This directory is presented
83in the web interface in reverse file name order up to a maximum, hardcoded limit.
84These files are purged when they are considered old (this time can be changed by
85tweaking the server configuration).
86.It Pa local/
87This subdirectory stores all activities generated by this user as hardlinks to
88their analogue entries in the
89.Pa timeline/
90subdirectory. These files are never deleted.
91.It Pa followers/
92This subdirectory stores the 'Follow' ActivityPub message from each
93Fediverse user that is following this user as a JSON file. Each file name is
94an MD5 hash of the actor that is a follower of this user.
95.It Pa following/
96This subdirectory stores the 'Follow' (not yet confirmed) or the 'Accept'
97(confirmed) ActivityPub message for each actor that is being followed. Each file
98name is an MD5 hash of the actor.
99.It Pa muted/
100This directory contains files which names are MD5 hashes of muted actors. The
101content is a line containing the actor URL.
102Messages from these actors will be ignored on input and not shown in any timeline.
103.It Pa queue/
104This directory contains the output queue of messages generated by the user as
105JSON files. File names contain timestamps that indicate when the message will
106be sent. Messages not accepted by their respective servers will be re-enqueued
107for later retransmission until a maximum number of retries is reached,
108then discarded.
109.It Pa static/
110Files in this directory are served as-is when requested from the
111.Pa https://HOST/s/...
112URL path. A special file named
113.Pa style.css
114can contain user-specific CSS code to be inserted into the HTML of the
115web interface.
116.It Pa history/
117This directory contains generated HTML files. They may be snapshots of the
118local timeline in previous months or other cached data.
119.It Pa archive/
120This directory stores all input/output traffic of ActivityPub messages. There
121is a different file for each day. This information is only stored if
122.Nm
123is run with a debug level >= 1.
124.El
125.Sh SEE ALSO
126.Xr snac 1 ,
127.Xr snac 8
128.Sh AUTHORS
129.An grunfink
130.Sh LICENSE
131See the LICENSE file for details.
diff --git a/doc/snac.8 b/doc/snac.8
new file mode 100644
index 0000000..94afe71
--- /dev/null
+++ b/doc/snac.8
@@ -0,0 +1,326 @@
1.Dd $Mdocdate$
2.Dt SNAC 8
3.Os
4.Sh NAME
5.Nm snac
6.Nd snac administration
7.Sh DESCRIPTION
8The
9.Nm
10daemon processes messages from other servers in the Fediverse
11using the ActivityPub protocol.
12.Pp
13This is the admin manual. For user operation, see
14.Xr snac 1 .
15For file and data formats, see
16.Xr snac 5 .
17.Ss Installation
18Install the OpenSSL and urllib3 Python3 external packages, and run as root
19.Bd -literal -offset indent
20make install
21.Ed
22.Ss Database Initialization
23Once
24.Nm
25is properly installed on the system, designate a directory where
26the server and user data are to be stored. This directory
27must not exist yet.
28.Nm
29must always be run as a regular user; you can create one for
30it or use your own. To initialize the database, execute
31.Bd -literal -offset indent
32snac init $HOME/snac-data
33.Ed
34.Pp
35A small set of questions will be asked regarding the installation,
36specially the host name it will run under, the local network address
37and port
38.Nm
39will listen to, the optional path prefix and possibly other things.
40.Pp
41You can launch the
42.Nm
43process by running
44.Bd -literal -offset indent
45snac httpd $HOME/snac-data
46.Ed
47.Pp
48Use a web browser to connect to the specified address and port. You
49should see a greeting page.
50.Pp
51Log messages are sent to the standard error stream. By default, only
52relevant information is written there. You can increase the debugging
53level by editing the 'dbglevel' field in the
54.Pa server.json
55file or by setting a numeric value between 0 and 3 to the DEBUG
56environment variable, see below.
57.Pp
58If you run
59.Nm
60in an OS controlled by
61.Xr systemd 1 ,
62you can prepare a user service to start/stop the daemon. Following the
63previous example, create the file
64.Pa ~/.config/systemd/user/snac.service
65with the following content:
66.Bd -literal -offset indent
67[Unit]
68Description=snac daemon
69
70[Service]
71Type=simple
72Restart=always
73RestartSec=5
74ExecStart=/usr/local/bin/snac httpd /path/to/snac-data
75
76[Install]
77WantedBy=default.target
78.Ed
79.Pp
80And activate it by running
81.Bd -literal -offset indent
82systemctl --user enable snac.service
83systemctl --user start snac.service
84.Ed
85.Pp
86For other operating systems, please read the appropriate documentation
87on how to install a daemon as a non-root service.
88.Ss Server Setup
89.Pp
90An http server with TLS and proxying support must already be
91installed and configured.
92.Nm
93runs as a daemon and listens on a TCP/IP socket, preferrably
94on a local interface. It can serve the full domain or only
95a directory. The http server must be configured to route to the
96.Nm
97socket all related traffic and also the webfinger standard
98address. The Host header must be propagated.
99See the examples below.
100.Ss Adding Users
101.Pp
102Users must be created from the command line.
103You can do it by running
104.Bd -literal -offset indent
105snac adduser $HOME/snac-data
106.Ed
107.Pp
108All needed data will be prompted for. There is no artificial limit
109on the number of users that can be created.
110.Ss Customization
111The
112.Pa server.json
113configuration file allows some behaviour tuning:
114.Bl -tag -width tenletters
115.It Ic host
116The host name.
117.It Ic prefix
118The URL path prefix.
119.It Ic address
120The listen network address.
121.It Ic port
122The list network port.
123.It Ic dbglevel
124The debug level. An integer value, being 0 the less verbose (the default).
125.It Ic layout
126The disk storage layout version. Never touch this.
127.It Ic queue_retry_max
128Messages sent out are stored in a queue. If the posting of a messages fails,
129it's re-enqueued for later. This integer configures the maximum count of
130times the sending will be retried.
131.It Ic queue_retry_minutes
132The number of minutes to wait before the failed posting of a message is
133retried. This is not linear, but multipled by the number of retries
134already done.
135.It Ic max_timeline_entries
136This is the maximum timeline entries shown in the web interface.
137.It Ic timeline_purge_days
138Entries in the timeline older that this number of days are purged.
139.It Ic css_urls
140This is a list of URLs to CSS files that will be inserted, in this order,
141in the HTML before the user CSS. Use these files to configure the global
142site layout.
143.El
144.Pp
145You must restart the server to make effective these changes.
146.Pp
147If a file named
148.Pa greeting.html
149is present in the server base directory, it will be returned whenever
150the base URL of the server is requested. Fill it with whatever
151information about the instance you want to supply to people
152visiting the server, like sign up requirements, site policies
153and such. The special %userlist% mark in the file will cause
154the list of users in this instance to be inserted.
155.Pp
156Users can change a bit of information about themselves from the
157web interface. See
158.Xr snac 1
159for details. Further, every user has a private CSS file in their
160.Pa static/style.css
161that can be modified to suit their needs. This file contains
162a copy of the
163.Pa style.css
164file in the server root and it's inserted into the HTML output.
165It's not easily accesible from the web interface to avoid users
166shooting themselves in the foot by destroying everything.
167.Ss Old Data Purging
168The Fediverse generates big loads of data that get old and
169stale very quickly. By default,
170.Nm
171does not delete anything; you must do it explicitly by issuing a
172.Ar purge
173command periodically. A cron entry will suffice. You can add the
174following to the
175.Nm
176user's crontab:
177.Bd -literal -offset indent
178# execute a data purge on Sundays at 4 am
1790 4 * * 0 /usr/local/bin/snac purge /path/to/snac-data
180.Ed
181.Pp
182Other directories, like
183.Pa archive/ ,
184can grow very quickly if the debug level is greater than 0. These
185files must be deleted manually.
186.Pp
187The user-generated data (the local timeline) is never deleted.
188.Ss ActivityPub Support
189These are the following activities and objects that
190.Nm
191supports:
192.Bl -tag -width tenletters
193.It Vt Follow
194Complete support, on input and output.
195.It Vt Undo
196For
197.Vt Follow ,
198.Vt Like
199and
200.Vt Announce
201objects, on input and output.
202.It Vt Create
203For
204.Vt Note
205objects, on input and output.
206.It Vt Accept
207For
208.Vt Follow
209objects, on input and output.
210.It Vt Like
211For
212.Vt Note
213objects, on input and output.
214.It Vt Announce
215For
216.Vt Note
217objects, on input and output.
218.It Vt Update
219For
220.Vt Person
221objects, on input and output. Support for updating
222.Vt Note
223objects will probably be added in the future.
224.It Vt Delete
225Supported for
226.Vt Note
227and
228.Vt Tomsbtone
229objects on input, and for
230.Vt Note
231objects on output.
232.El
233.Pp
234The rest of activities and objects are dropped on input.
235.Pp
236There is partial support for
237.Vt OrderedCollection
238objects in the
239.Pa /outbox
240(with the last 20 entries of the local timeline shown). No pagination
241is supported. Intentionally, the
242.Pa /followers
243and
244.Pa /following
245paths return empty lists.
246.Ss Other Considerations
247.Nm
248stores all the messages it receives as JSON files, which are usually
249bloated and filled with redundant information. Using a filesystem with
250file compression enabled (like btrfs or zfs) will probably be a good
251choice to store the
252.Nm
253database into.
254.Sh ENVIRONMENT
255.Bl -tag -width Ds
256.It Ev DEBUG
257Overrides the debugging level from the server 'dbglevel' configuration
258variable. Set it to an integer value. The higher, the deeper in meaningless
259verbiage you'll find yourself into.
260.El
261.Sh EXAMPLES
262You want to install the
263.Nm
264Fediverse daemon in the host example.com, that is correctly configured
265with a valid TLS certificate and running the nginx httpd server.
266The service will be installed under the
267.Pa fedi
268location. Two users, walter and jessie, will be hosted in the system.
269Their Fediverse presence addresses will be https://example.com/fedi/walter
270and https://example.com/fedi/jesse, respectively. They will be known
271in the Fediverse as @walter@example.com and @jesse@example.com. The
272.Nm
273daemon will run as the user snacusr in the system and listen to the
274localhost:8001 network socket. All data will be stored in the
275.Pa /home/snacusr/fedidata
276directory.
277.Pp
278Log into the system as snacusr and execute:
279.Bd -literal -offset indent
280snac init /home/snacusr/fedidata
281.Ed
282.Pp
283Answer "example.com" to the host name question, "/fedi" to the path
284prefix question, "localhost" to the address and "8001" to the port.
285.Pp
286Create the users
287.Bd -literal -offset indent
288snac adduser /home/snacusr/fedidata walter
289snac adduser /home/snacusr/fedidata jesse
290.Ed
291.Pp
292Answer the questions with reasonable values.
293.Pp
294Execute the server:
295.Bd -literal -offset indent
296snac httpd /home/snacusr/fedidata
297.Ed
298.Pp
299Edit the nginx configuration and add the following snippet to the
300example.com server section:
301.Bd -literal -offset indent
302location /.well-known/webfinger {
303 proxy_pass http://localhost:8001;
304 proxy_set_header Host $http_host;
305}
306
307location /fedi {
308 proxy_pass http://localhost:8001;
309 proxy_set_header Host $http_host;
310}
311.Ed
312.Pp
313Restart the nginx daemon and connect to https://example.com/fedi/walter.
314The empty, default screen will be shown. Enter the admin section with the
315credentials defined for this user. Search people, start following
316them, engage in arid discussions and generally enjoy the frustrating
317experience of Social Media.
318.Sh SEE ALSO
319.Xr snac 1 ,
320.Xr snac 5
321.Sh AUTHORS
322.An grunfink
323.Sh LICENSE
324See the LICENSE file for details.
325.Sh CAVEATS
326JSON files are fragile when modified by hand. Take care.
diff --git a/doc/susie.png b/doc/susie.png
new file mode 100644
index 0000000..99f19bc
--- /dev/null
+++ b/doc/susie.png
Binary files differ
diff --git a/doc/susie.txt b/doc/susie.txt
new file mode 100644
index 0000000..e361642
--- /dev/null
+++ b/doc/susie.txt
@@ -0,0 +1,3 @@
1data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQAAAA
2A3iMLMAAAAO0lEQVQI1wEwAM//AAZgAAcwAA/4AAPkAB3cAAPgAKXIAKfIAH/
38AD/8ADw8AB56AA/2AEPtAMwfAO+/UlQP2C3B0yEAAAAASUVORK5CYII=
diff --git a/doc/susie32.png b/doc/susie32.png
new file mode 100644
index 0000000..0269607
--- /dev/null
+++ b/doc/susie32.png
Binary files differ
diff --git a/doc/susie64.png b/doc/susie64.png
new file mode 100644
index 0000000..739d154
--- /dev/null
+++ b/doc/susie64.png
Binary files differ