1 <img src="raw/screenshot.png" alt="screenshot of the site in action" style="float: right;">
2
3 # Famsite
4
5 A minimal social website for families (and friends).
6
7 JavaScript and PHP. SQLite database.
8
9 Very small. It's neat how much functionality you get with just modern HTML,
10 JavaScript, and CSS.
11
12 This uses my little RetroV JavaScript rendering library to draw
13 the interface and posts to the DOM:
14
15 [https://ratfactor.com/retrov/](https://ratfactor.com/retrov/)
16
17 And my little emoji picker library:
18
19 [https://ratfactor.com/faceclick/](https://ratfactor.com/faceclick/)
20
21
22 ## Features
23
24 * Post text and images
25 * Image uploads with progress and thumbnail creation
26 * Special display grouping for daily word games
27 * Emoji picker with keyword search
28 * Emoji "reactions" to posts with optional small note
29 * Hidden spoilers and markdown-lite formatting
30 * 5-second polling to show new posts/edits/reaction
31
32 Not implemented:
33
34 * No admin or account management
35
36 If you need any additional functionality, feel free to add it and I might take
37 your pull request. :-)
38
39 ## Install/Setup
40
41 You'll need a SQLite database, directories for avatars,
42 and image uploads.
43
44 ### SQLite database setup
45
46 The top of `fam.php` has the path to the DB file:
47
48 $GLOBALS['db'] = new PDO('sqlite:/data/famsite.db');
49
50 Run the `newdb.sql` script to make the two tables:
51
52 $ sqlite3 ../data/famsite.db
53 sqlite> .read newdb.sql
54
55 For now, you'll need to manually create your users!
56
57 sqlite> insert into users (id, name, login)
58 values (1, 'dave', '<rather long string>');
59
60 That's the only thing that's _really_ required. Visit the site in a browser and
61 it should prompt you to log in with the "login" code you entered in the DB for
62 your user account.
63
64 ### Avatar images and image upload path
65
66 And put avatar images in an `/avatars/` directory with a naming scheme `1.png`
67 for user with id `1` and so forth.
68
69 (There is currently no way to upload an avatar image. I haven't needed it, so
70 it doesn't exist. Yes, that's nuts!)
71
72 The top of `fam.php` has the path to the upload directory:
73
74 $GLOBALS['uploads_dir'] = '/htdocs/famsite/uploads/';
75
76 NOTE that the paths above are for my OpenBSD httpd setup, which runs the
77 application in a chroot, so the absolute paths are actually relative to a
78 common web application root.
79
80 You'll need to set appropriate file permissions before uploads will work.
81
82 ### Upload file size limit
83
84 Note: The concept applies to many web servers, but these exact settings/paths
85 are specific to OpenBSD!
86
87 # /etc/httpd.conf
88 server "..." {
89 connection max request body 8388608
90 }
91
92 # /etc/php-8.3.ini
93 post_max_size = 8M
94 upload_max_filesize = 8M
95
96 Restart each with (again, OpenBSD/my setup):
97
98 $ doas httpd -n # test it
99 $ doas rcctl reload httpd
100 $ doas rcctl restart php83_fpm
101
102 ### Header include
103
104 If you want to include additional info in the header area of
105 the website, write any PHP (or HTML) you would like to include
106 in a file named:
107
108 myheader.php
109
110 Anything you put in there will show up in the header of the site.
111
112
113 ## License
114
115 GPL, probably. I dunno, I'm getting kind of burnt out on licensing
116 debates lately. Contact me if you think you need a license for this.