dev_endboard/etc/config.php

171 lines
17 KiB
PHP

<?php
// This is all the config that there is for endboard. You want more, you'll need to hack the source code (found in index.php, mob/index.php and opt/endboard/*.php),
// to which your are welcome, of course.
// If this file is not in /etc/opt/endboard/config.php, you'll need to update line 49 in index.php and line 51 in mob/index.php, so that it can be found.
// If you can, I advise to stay with the standard paths.
// The minimum you have to edit in this file is the line saying "admin" and the line saying "web_address".
// An individual title and landing page make it "your own page". If you want to change the look, you'll have to hack the stylesheets,
// with the standard paths they are found at /srv/endboard/css/.
// The default settings are pretty strict, you might want to make them less so if your usecase demands it.
$settings = array(
"admin" => 'change-me', // the account name of the admin. Change to something else to create an admin account (for first use or
// if you lost your password). Capped to 50 characters.
"web_address" => 'http://change.me', // the address of your page
"RSS_message" => 'my RSS feed', // the message that is displayed in the rss feed
"site_name" => 'mysite', // the name of the site, used in the RSS feed to namespace the custom tags
"default_css" => 'flowersmono', // skull,kali,santamuerte,dirtpath,forest,unstyled,flowersmono,trip,flowers. Leave out the file extension.
"enable_admin_panel" => TRUE, // set to true to enable access to the admin panel. Set to false if you are paranoid.
"enable_mod_panel" => TRUE, // set to true to enable access to the moderators panel. Set to false if you are really paranoid
// (but than you cannot moderate the board).
"title" => 'Endboard rules', // title of page shown on the tab when the overboard is displayed
"hover_title_overboard" => 'This is the overboard. It displays the collected messages from the subs in order of the posting time.',
// the description of the overbpoard that is displayed when the users hovers on the link for the overboard
"hover_title_main" => 'This is the main sub. Use to post important stuff and to create other subs.',
// the description of the sub main that is displayed when the users hovers on the link.
"enable_search" => TRUE, // whether or not to allow fulltext searches
"enable_link_bot" => TRUE, // use a bot to detect links to clearnet, and post corresponding ones to an i2p frontend
"enable_haiku_bot" => TRUE, // use a bot to detect if the post is a haiku, if so, make a post with three lines and the text
"enable_unknown_words_bot" => TRUE, // check if all words of a post are known, or not. Make a post if not.
"unknown_words_bot_sub" => 'acme', // the sub to which the post should be made.
"enable_blocklist_bot" => TRUE, // check if all words of a post are known, or not. Make a post if not.
"blocklist_bot_sub" => 'acme', // the sub to which the post should be made.
"enable_sub_main" => TRUE, // enable users to create subs by posting in main
"enable_sub_navigation" => TRUE, // enable users to create subs by posting in main
"enable_b32_bot" => TRUE, // enable a bot looking for b32 links and translating them to hostnames
"enable_menu" => TRUE, // show a menu on overboard and subs
"enable_logging" => TRUE, // set to FALSE to disable all logs of endboard. This will provide stricter privacy, however, it will also
// disable the features: max_post_*, bot_block, portal, max_requests_* and fail2ban.
"enable_sage" => TRUE, // show the option to not bump a thread
"auto_sage" => 20, // don't bump threads after x replies. Set to zero to disable.
"enable_timestamps" => TRUE, // should timestamps be offered to be generated (and displayed if present)
"precision_timestamps" => 'low', // low = Q1/2025, middle = Jan/2025, high = 8.1.2025, insane = 8.1.2025/13:59:48
"enable_tripcodes" => TRUE, // enable the automatic generation of secure tripcodes with each message, and optionally the use of
// custom tripkeys. Display tripcodes if present.
"prefix_autogen" => '_', // the prefix that will be used to autogenerate the name part for secure tripcodes
"enable_edit" => TRUE, // enable the editing of posts with valid name/tripkey combination. Display editing history.
"enable_portal" => TRUE, // show a portal page to first time visitors that they have to click away
"enable_portal_mobile" => TRUE, // show a portal page to first time visitors that they have to click away, for the mobile site
"enable_portal_tor" => TRUE, // require the portal from tor users as well. On tor this will offer less protection, obviously.
"portal_lifetime" => 120, // how long the click is valid before it has to be repeated, in minutes.
"auto_prolong_portal" => TRUE, // each click on the site prolongs the life by resetting the starting time.
"cap_logs" => 200000, // the maximum number of log entries before older entries are deleted. Set to zero to disable.
"enable_bumping" => TRUE, // if a reply is received, put the original post on top of the sub
"enable_bbcode" => TRUE, // use some simple bbcode dialect. Also used to generate clickable links from some strings (ex: >> 129, s/main/200)
"max_applications" => 10, // set to zero in order to not allow users to apply for mod accounts.
"use_captcha" => FALSE, // whether or not to require a captcha for posting. Default is off, as it's not really needed, and it
// offers low protection anyway (like almost all captcha systems).
"lifetime_captcha" => 2, // the lifetime of a captcha combination in hours. After its lifetime it's not regarded valid any longer.
// if the captcha is off, this is the lifetime of the postform (after which it needs to be reloaded to post).
"board_file" => 'board.db', // the basename of the sqlite3 database file in which all posts, logs, credentials and captchas are stored.
// For first use, just give some name, it will be created. Copy this file later to make backups of your board.
"import_file" => 'board.json', // the basename of the file to import messages from if needed
"work_dir" => '/var/opt/endboard/', // the directory where the two files above are kept. Also where you will find the admin token to set the password.
// this dir should be owned by the webserver (usually www-data), and it should not be in the webroot.
"server_dir" => '/srv/endboard/', // the directory where the server files are
"max_post_global" => 1000, // Maximum posts that the board will take in the defined timeframe. Set to 0 to disable.
"max_post_ip" => 400, // Maximum posts per ip that the board will take in the defined timeframe. Set to 0 to disable.
// If you run your service on tor only, you can set it to zero as well, and only use global.
"max_post_bot" => 20000, // Maximum posts for bots that the board will take in the defined timeframe. Set to 0 to disable.
"max_post_timeframe" => 100, // The time in minutes that is checked to determine max posts
"max_requests_ip" => 1000, // the maximum number of requests, before blocking more with a 429, per ip. Set to zero to disable.
"max_requests_timeframe" => 100, // the timeframe in minutes that is regarded for the requests, in minutes.
"max_requests_tor" => 10000, // the maximum number of requests from 127.0.0.1 (=all tor users). Set to zero to disable.
"max_requests_tor_timeframe" => 100, // the timeframe in minutes for tor.
"enable_bot_trap" => TRUE, // put garbage links in the page only visible to bots. Feed ever more garbage links if they follow (bot tarpit).
"enable_bot_block" => TRUE, // block ips that follow invisible links (=bots) by sending 429 - too many requests. bot_trap must be enabled for this to work.
"superstrict_block" => TRUE, // count blocked requests as bot visits. This setting will prolong the effective ban time if someone is hammering the server.
"enable_tor_block" => FALSE, // enable the block also for 127.0.0.1, meaning local and tor connections (_all_ tor connections).
// if enabled, one misbehaving bot can block the site for all tor users, as well as for connections from your own box.
// this is quite drastic, but in some situations might be the lesser of two evils. This setting is only effective if the bot
// trap and the bot block are both enabled. The default setting is off.
"max_trap_visits" => 1, // the maximum number of bot trap visits before the block takes effect.
"max_landing" => 10, // the maximum number the landing page can be visited with a not recognized URI, before the block takes effect. Set 0 to disable.
"block_time" => 5, // the time intervall in minutes that is checked, equals the time a bot is blocked
"enable_fail2ban" => TRUE, // block authentication for admin/mods after too many unsuccessful requests. Note: this a not specific per ip, but global.
"superstrict" => TRUE, // if true, the fail2ban event itself is counted as a failed login, prolonging the ban time.
"auth_max" => 3, // max failed auth tries in that timeframe, the lower the value the stricter
"auth_time_frame" => 5, // time in minutes, the higher the value, the longer the ban
//"bot_keys" => array('testme', // bots can use these keys to post messages to any sub. Empty the array to disable (like below).
// 'testme2'),
"bot_keys" => array(), // disable bot keys.
"no_overboard" => array('test'), // messages from these subs will not be displayed on the overboard (use comma separation when adding new)
"anonymous_bot_subs" => array('test'), // bots can post without key to these subs. Empty the array to disable.
//"anonymous_bot_subs" => array(), // anonymous bots disabled.
"max_char" => 10000, // Maximum post length permitted in characters
"min_char" => 2, // Minimum post length permitted in characters
"min_space" => 200, // the minimum free space on the file system in Mb, if not available, no new posts will be taken
"pagination" => 10, // number of messages per page to show for main, other subs and overboard. Threads and individual feeds show all messages.
"max_name_sub" => 20, // the maximum number of characters allowed for the name of a sub, exceeding input will be cut
"lifetime_token" => 5, // the lifetime of an access token for an admin or mod in minutes. After that a new login is needed.
"original_content_thread" => FALSE, // do not allow the same text to be posted twice in the same thread
"original_content_sub" => TRUE, // do not allow the same text to be posted twice in the same sub, including all threads on the sub (overrides previous if TRUE)
"original_content_global" => FALSE, // do not allow the same text to be posted twice on the board, including all subs and all threads (overrides both before if TRUE)
"show_settings" => TRUE, // show some of the settings on the navigation page
"show_faq" => TRUE, // show the faq defined below
"debug" => FALSE // if true, collect all data from each request (from $_SERVER) in the file /var/opt/endboard/debug_server.txt
);
// For easy editing, the landinpage is here in the config file
// Notice that this text includes the html elements (h1, post, br,...).
function show_landing_page($css){
echo "<title>Landing...</title>";
echo "<div class=\"header id=\"topheader\"><h1><br>";
echo "Hi.There you are.";
echo "<br><br></h1></div>";
echo "<div class='landing'>";
echo "<br><br>Some random text.";
echo "<br><br>Some random text.";
echo "<br><br>Some random text.";
echo "<br><br>Some random text.";
echo "<br><br>See a list with links to the available subs below. "
. "Users can create their own subs by posting in main.";
echo "<br><br>Some random text.";
echo "<br><br>Some random text.";
echo "<br><br>Some random text.";
echo "<br><br><br>Styles:";
echo "<br><br><a href=/css=santamuerte>Santa Muerte</a>|"
. "<a href=/css=forest>Forest</a>|<a href=/css=skull>Skull</a>"
. "|<a href=/css=kali>Kali</a>|<a href=/css=dirtpath>Dirt-path</a>";
echo "|<a href=/css=flowers>Flowers</a>|"
. "<a href=/css=flowersmono>Flowers with mono font</a>|"
. "<a href=/css=trip>Trip</a>|<a href=/css=flicker>Flicker</a>"
. "|<a href=/css=unstyled>Unstyled</a>"
. "|<a href=/css=simple>Simple</a>";
echo "<br><br>Mobile <a href=/mob/s/overboard>site</a>.";
echo "<br><br><br>This board uses no javascript, cookies, webbugs or"
. " any other invasive stuff.</div><br><br>";
echo "<h1><br>Available subs:<br><br></h1><br>";
}
// show the faq
function show_faq($settings){
if ( $settings['show_faq'] != TRUE ) {
return;
}
echo "<details><summary>Faq</summary>";
echo "<div class='landing'>";
echo "<h1>FAQ</h1>";
echo "These here are some questions that pop off from time to time:<br>";
echo "<br>Q: how do I create a new sub ?";
echo "<br>A: make a new post in \"main\", with a new name.<br>";
echo "<br>Q: what means \"unauthorized post attempt\" ?";
echo "<br>A: this error message is displayed when you attempt to post"
. " without using the postform (for example from curl), or if the"
. " postform is outdated (older than 2 hours, by default). <br>";
echo "<br>Q: what's with the portal ?";
echo "<br>A: it's meant to keep out scrapers, spiders and the like.<br>";
echo "<br>Q: how do the tripkeys work ?";
echo "<br>A: the combination of \$name#\$tripkey can be used like an"
. " identity. also, you can edit your postings later, if you want"
. ", and if you saved it. you can stick with the ones that are"
. " autogenerated with each post, or you can insert your own.<br>";
echo "</div><br><br></details>";
}
// EOF