an easy to deploy and customizable guestbook for your site
Find a file
2024-05-27 17:57:51 +02:00
src feat: add ntfy provider 2024-05-27 17:57:51 +02:00
web fix: separate description and preview 2024-01-16 20:30:43 +01:00
.editorconfig initial commit 2023-10-15 04:27:14 +02:00
.gitignore chore: version bump, fix docs, push lockfile 2024-01-03 18:25:42 +01:00
.rustfmt.toml initial commit 2023-10-15 04:27:14 +02:00
.tci ci: say what it did 2024-02-13 21:56:10 +01:00
Cargo.lock feat: add ntfy provider 2024-05-27 17:57:51 +02:00
Cargo.toml feat: add ntfy provider 2024-05-27 17:57:51 +02:00
README.md fix: change url of infinitescroll js file 2024-02-13 09:44:20 +01:00
sailfish.toml feat: integrated frontend 2024-01-03 18:16:54 +01:00

guestbook.rs

a super simple guestbook to deploy on your site: just grab the binary and run it, or configure it to your liking

try it out here with a test instance (db cleared every hour, default settings), or check out a more integrated deployment here, at the bottom

why

i love small web and i want to give a way to whoever visits my site to leave a mark. cooking something to do that is very easy, but after connecting my third bare form i decided i needed something more convenient.

deploy

all-in-one

guestbook.rs can be easily deployed without anything else: just grab (or compile) the default binary and run it:

guestbook serve

it will create a sqlite database (guestbook.db) in current directory and start serving its frontend on http://localhost:37812/ and its backend on http://localhost:37812/api

all comments will be public and will only be logged on console

simple configuration

it's possible to configure frontend style, extra notifiers and page overrides using a .toml config file

if no config file is provided, the implicit default will be used (view it with guestbook config command)

a config file must be specified with the -c / --config CLI argument

overrides

by default each user is given full control on each page (except for the date field). this can be changed with overrides.

as an example, you may want to review posts before showing them publicly.

add following section to your config.toml:

[overrides]
public = false

and each incoming page will be forced to be private (until you make it public manually, for example with guestbook review)

modular configuration

guestbook.rs just works, but can also be deeply customized

by default all supported sql drivers are included, but it's possible to only compile your desired driver by enabling only that feature (sqlite, postgres, mysql)

all notifiers are bundled, but just like db drivers it's possible to only include some (email, telegram)

the integrated frontend is not necessary, and can be excluded by disabling the web feature. serve your favorite page and just use the /api endpoint for fetching pages.

making your own frontend

the JS file used by the builtin frontend is available from here:

https://cdn.alemi.dev/web/guestbook.js

this provides a plain JS (+jsdoc! check type hints) module exporting one function to hook the automatic infinite scroll fetcher

you can also manage things with your framework of choice, just GET /api?offset=x&limit=y to receive a list of public pages

class GuestbookPage {
    id: number
    author: string
    contact: string | undefined
    url: string | undefined
    avatar: string
    body: string,
    date: Date,
}

inserting a new page can be done with either a POST (+form) or a PUT (+json) request on /api endpoint

class GuestbookInsertion {
    body: string,
    author: string | undefined,
    contact: string | undefined,
    public: boolean | undefined,
    date: Date | undefined,
}

future work

due to the modular structure of notifiers, i plan to add many more notifiers for various services, such as

  • a cool picture or logo
  • matrix
  • mastodon/pleroma
  • discord
  • ??? open to ideas (: