Compare commits

...

10 Commits

Author SHA1 Message Date
towards-a-new-leftypol 1eace91823 Change font back to Courier, monospace 2025-01-10 07:21:48 +00:00
towards-a-new-leftypol fc00ae8037 Remove link to Telegram 2025-01-06 17:22:08 -05:00
towards-a-new-leftypol 4e0a549469 more accurate noticer timing 2025-01-01 22:45:26 -05:00
towards-a-new-leftypol 5bb6df8221 dns_system = true 2025-01-01 22:35:32 -05:00
towards-a-new-leftypol 36cbf4e6e5 profiling: add times around dnsbl and ban checks 2025-01-01 21:48:54 -05:00
towards-a-new-leftypol cb33251f7c fix variable name 2024-12-31 12:13:40 +00:00
towards-a-new-leftypol 977b23afe3 Add more time cost centers in handle_post to $debug['post'] 2024-12-31 07:08:14 -05:00
towards-a-new-leftypol 7cfe5cc0e3 handle_post: set $debug after opening board
- so it doesn't overwrite the global debug variable.
- global variables are dumb.
2024-12-31 07:07:36 -05:00
towards-a-new-leftypol 8ebe1aa560 Fix cleanup function placement
- registering cleanup should go after the potential error call
2024-12-31 08:22:48 +00:00
towards-a-new-leftypol e21a01dba6 Fix bug - function syntax 2024-12-31 02:29:13 -05:00
4 changed files with 47 additions and 24 deletions

View File

@ -96,6 +96,7 @@ $config['db']['password'] = '';
$config['cookies']['mod'] = 'mod';
$config['cookies']['salt'] = 'MGYwNjhlNjU5Y2QxNWU3YjQ3MzQ1Yj';
$config['dns_system'] = true;
$config['search']['enable'] = true;
$config['flood_cache'] = 60 * 15; // 15 minutes. The oldest a post can be in the flood table
$config['flood_time_any'] = 120; // time between thread creation
@ -597,5 +598,5 @@ $config['filters'][] = array(
'message' => 'New threads are being created too quickly. Wait [at most] 10 minutes'
);
$config['global_message'] = '<span><a href="https://talk.leftychan.net/#/room/#welcome:matrix.leftychan.net">Matrix</a></span> &nbsp; <span><a href="ircs://irc.leftychan.net:6697/#leftychan">IRC Chat</a></span> &nbsp; <span><a href="mumble://leftychan.net">Mumble</a></span> &nbsp; <span><a href="https://t.me/+RegtyzzrE0M1NDMx">Telegram</a></span> &nbsp; <span><a href="https://discord.gg/AcZeFKXPmZ">Discord</a></span>';
$config['global_message'] = '<span><a href="https://talk.leftychan.net/#/room/#welcome:matrix.leftychan.net">Matrix</a></span> &nbsp; <span><a href="ircs://irc.leftychan.net:6697/#leftychan">IRC Chat</a></span> &nbsp; <span><a href="mumble://leftychan.net">Mumble</a></span> &nbsp; <span><a href="https://discord.gg/AcZeFKXPmZ">Discord</a></span>';
$config['debug'] = false;

View File

@ -296,6 +296,8 @@ function checkWithSpamNoticer($config, $post, $boardname) {
print_err($body);
$reasons_bitmap = json_decode($body)->reason;
$result->reason = renderReasons($reasons_bitmap);
} else if ($config['debug']) {
print_err((string) $response->getBody());
}
} else {
print_err("spamnoticer status code: " . $status_code);

View File

@ -458,7 +458,6 @@ function handle_post(){
global $config, $dropped_post, $board, $mod, $pdo, $debug;
$time_1 = microtime(true);
$debug['time']['post'] = array();
init_global_post_cleanup();
@ -472,6 +471,8 @@ function handle_post(){
if (!openBoard($post['board']))
error($config['error']['noboard']);
$debug['time']['post'] = array();
$board_locked_check = (!isset($_POST['mod']) || !$_POST['mod'])
&& ($config['board_locked']===true
|| (is_array($config['board_locked']) && in_array(strtolower($_POST['board']), $config['board_locked'])));
@ -553,10 +554,14 @@ function handle_post(){
error($config['error']['referer']);
}
$time_dnsbl = microtime(true);
checkDNSBL();
$debug['time']['post']['dnsbl'] = round((microtime(true) - $time_dnsbl) * 1000, 2) . 'ms';
$time_ban = microtime(true);
// Check if banned
checkBan($board['uri']);
$debug['time']['post']['check_ban'] = round((microtime(true) - $time_ban) * 1000, 2) . 'ms';
if ($post['mod'] = isset($_POST['mod']) && $_POST['mod']) {
check_login(false);
@ -596,6 +601,10 @@ function handle_post(){
else {
$mod = $post['mod'] = false;
}
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer1'] = round(($time_rolling2 - $time_1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
//Check if thread exists
if (!$post['op']) {
@ -612,6 +621,9 @@ function handle_post(){
$thread = false;
}
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer2'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
// Check for an embed field
if ($config['enable_embedding'] && isset($_POST['embed']) && !empty($_POST['embed'])) {
@ -712,6 +724,10 @@ function handle_post(){
}
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer3'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
$post['name'] = $_POST['name'] != '' ? $_POST['name'] : $config['anonymous'];
$post['subject'] = $_POST['subject'];
$post['email'] = str_replace(' ', '%20', htmlspecialchars($_POST['email']));
@ -755,6 +771,10 @@ function handle_post(){
}
}
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer4'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
if ($post['has_file']) {
// Determine size sanity
$size = 0;
@ -790,6 +810,10 @@ function handle_post(){
$post['filesize'] = $size;
}
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer5'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
$post['capcode'] = false;
if ($mod && preg_match('/^((.+) )?## (.+)$/', $post['name'], $matches)) {
@ -873,6 +897,10 @@ function handle_post(){
}
}
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer6'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
if ($config['strip_combining_chars']) {
$post['name'] = strip_combining_chars($post['name']);
$post['email'] = strip_combining_chars($post['email']);
@ -1032,8 +1060,12 @@ function handle_post(){
validate_images($post);
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer7'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
$time_2 = microtime(true);
$debug['time']['post']['pre_noticer'] = round(($time_2 - $time_1) * 1000, 2) . 'ms';
$debug['time']['post']['pre_noticer_total'] = round(($time_2 - $time_1) * 1000, 2) . 'ms';
if ($config['spam_noticer']['enabled']) {
require_once 'inc/spamnoticer.php';
@ -1044,6 +1076,10 @@ function handle_post(){
$spam_noticer_result = checkWithSpamNoticer($config, $post, $board['uri']);
if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) {
error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
}
/*
* If we have an error with posting this later, send back the
* delete token to spamnoticer to remove the post from the recent
@ -1055,11 +1091,7 @@ function handle_post(){
push_global_post_cleanup($f_spamnoticer_cleanup_on_err);
if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) {
error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
}
$debug['time']['post']['spam_noticer'] = round(($microtime(true) - $time_1) * 1000, 2) . 'ms';
$debug['time']['post']['spam_noticer'] = round((microtime(true) - $time_2) * 1000, 2) . 'ms';
}
$time_3 = microtime(true);

View File

@ -9,34 +9,21 @@ body {
font-size: 15px;
}
.theme-catalog .replies {
font-family: serif;
}
div.post div.body {
font-family: serif;
}
span.heading {
font-size: 15px;
}
.theme-catalog .replies .meta,
.theme-catalog .replies .intro,
div.post div.body a,
div.post div.body .toolong {
font-family: Courier, monospace;
}
/* LINKS */
a, a:link, a:visited, .intro a.email span.name {
color: #FFB300;
text-decoration: none;
}
a:link:hover, a:visited:hover {
color: #FFB300;
text-shadow: 0px 0px 5px #117743;
}
div.pages a.selected {
color: #FFB300;
}
@ -44,13 +31,14 @@ div.pages a.selected {
/* INTRO */
h1, div.title, header div.subtitle {
color: #FFB300;
font-family: Courier, monospace;
}
h1 {
font-size: 18pt;
font-weight: bold;
letter-spacing: 0px;
}
header div.subtitle {
font-size: 10pt;
}