shi/README.md

122 lines
3.5 KiB
Markdown
Raw Permalink Normal View History

2019-10-17 05:17:39 +00:00
# shi
2018-12-30 00:32:48 +00:00
**SH**ell **I**mageboard
2019-10-17 05:17:39 +00:00
(second edition)
2018-12-30 00:32:48 +00:00
2019-11-30 00:46:18 +00:00
actually pretty decent
2018-12-30 00:32:48 +00:00
### features
2019-10-17 05:17:39 +00:00
- its all POSIX sh
- seriously
2018-12-30 00:32:48 +00:00
- posting
- replies
- images
- timestamps
- more
2019-10-17 05:17:39 +00:00
### how to set up
- clone this repo
- cd to this repo
- `. ./console.sh` to start the shi console
2019-10-17 05:29:15 +00:00
- `start_listener` to start listening for posts
2019-10-17 05:17:39 +00:00
- you might want to do `tail -f log.txt` in another terminal to see whats going on
2019-10-17 05:26:06 +00:00
2019-10-17 05:17:39 +00:00
### how backends work
2019-10-17 05:29:15 +00:00
- shi has a builtin framework for swappable backends both for post receiving and storage,
2019-10-17 05:17:39 +00:00
currently there is:
- tar backend
- like the old version of shi
2019-10-17 05:29:15 +00:00
- receives tar files through nc and generates posts
2019-10-17 05:17:39 +00:00
- bad
2019-10-17 05:29:15 +00:00
- don't use it
2019-10-17 05:17:39 +00:00
- http backend
- listens for an http POST request with form data
- allows user-friendly html post form
- cool
- good
- file db backend
- stores posts as a series of text files in folders
- unchanged from old shi
- ok
- **how backends work**
- **listening**
- a backend is a shell script with a `listen` function
2019-10-18 04:48:14 +00:00
- this function is expected to continuously output post data it receives
- as long as the backend has a listen function that continuously outputs data to stdout in the proper format,
2019-10-17 05:17:39 +00:00
shi doesn't care where it comes from.
- **db**
2019-10-17 05:29:15 +00:00
- a db backend is simply a shell script providing the following functions:
2019-10-17 05:17:39 +00:00
- `path_to_post <post id>`
- `create post <board> <parent> <user> <title> <content> <image_name> <image_content> <post_id> <post_type>`
2019-10-18 04:46:21 +00:00
- `get_post_data <post_data_path> <item>`
2019-10-17 05:17:39 +00:00
- note that since these functions are both in the same file, `post_data_path` can be in any format you desire
- again, shi doesn't care how this is done, only that it follows this format
### anatomy of a post
- user
- name of user who posted the post
- title
- title of post
- this will be ignored for replies
- content
- the text content of a post
- thumb_path
- optional, filesystem path to the thumbnail of the post's image
- image_path
- optional, filesystem path to the image
- html_path
- path to where the html of the post is stored
- post_id
- unique numerical id of the post
- post_type
- type of post, specifies what template to use
- currently there is 'oppost' and 'reply' supported
- replies
- newline separated list of post_id's for all the replies to the op post
- a trailing /. is added to prevent `find` from seeing `post_data_path` itself
### defining new post templates
- edit your template of choice in the 'templates' folder,
- {{{ TRIPLE BRACES }}} will be replaced with their respective variables
### style notes
- if it can be done in a single line, you can set a variable to it,
otherwise declare the variable as empty and then set it to your operation
- follow shellcheck
2019-10-17 05:26:06 +00:00
### files n folders
2019-10-17 05:17:39 +00:00
- boards
- where all the html for the boards is stored
- console.sh
2019-10-17 05:29:15 +00:00
- source this to allow you to control shi
2019-10-17 05:17:39 +00:00
- globals.sh
- global variables (really just settings)
- inbox
- where posts data is cached before being processed
- latest
- the id of the latest post
- very important!!
- LICENSE
- free software, free society
- log.txt
- log
- problems.txt
- current issues with shi
- README.md
- this file
- reset.sh
2019-10-17 05:29:15 +00:00
- debug script that nukes all boards and completely resets shi
2019-10-17 05:17:39 +00:00
- don't use this unless you've really screwed up
- shi.sh
- memories
- templates
- templates
- util.sh
- utility functions employed by console.sh
this whole rewrite started because of a feature request by desvox. Unfortunately, due to the complexity of responding to http requests with sh, this feature was not added.
Sorry desvox :(