From ea8fda63b8aad6cdeead47fb8968d0a5f5b776d5 Mon Sep 17 00:00:00 2001 From: 7185 <7185@users.noreply.github.com> Date: Tue, 11 Nov 2014 02:55:54 +0100 Subject: [PATCH 1/9] Sync tomorrow.css (fix colors in catalog) --- stylesheets/tomorrow.css | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/stylesheets/tomorrow.css b/stylesheets/tomorrow.css index 1ddfcd3b..6397e612 100644 --- a/stylesheets/tomorrow.css +++ b/stylesheets/tomorrow.css @@ -47,9 +47,9 @@ div.post-hover { border:1px solid #000!important; box-shadow:none!important } -div.thread:hover { +.theme-catalog div.thread:hover { background-color:#1d1f21; - border-color:#000 + border-color:#111 } p.intro span.subject { color:#b294bb @@ -106,13 +106,13 @@ div#options_div { background-color:#282a2e } div.options_tab_icon { - color: #AAA + color:#AAA } div.options_tab_icon:hover { - background-color: #111 + background-color:#111 } div.options_tab_icon.active { - color: #F20 + color:#F20 } div.blotter { color:#F20 @@ -120,7 +120,7 @@ div.blotter { span.omitted { color:#707070 } -p.intro a, span.omitted a { +p.intro a,span.omitted a { text-decoration:none } form#quick-reply { @@ -132,9 +132,9 @@ span.capcode { padding:2px 5px; border-radius: 10px } -div#watchlist { - border:1px solid #111; - background-color:#282a2e +div#watchlist,div#alert_div { + border:1px solid #111; + background-color:#282a2e } div#watchlist a,a.watchThread { color:#81a2be; @@ -143,10 +143,20 @@ div#watchlist a,a.watchThread { div#watchlist a:hover,a.watchThread:hover { color:#5F89AC } -/* Keep small thumbnails */ -a:not([data-expanded="true"]) .post-image{ + +/* Remove the following parts if those annoy you */ +/* Youtube borders */ +div.video-container img.post-image { + background-color:#000; + border-color:#fff; + border-width:2px; + border-style:none dotted none; + padding:0 +} +/* Keep small thumbnails in replies */ +.post.reply a:not([data-expanded="true"]) .post-image{ width:auto!important; height:auto!important; - max-height:200px!important; - max-width:200px!important -} + max-height:160px; + max-width:160px +} \ No newline at end of file From 21107d7f353b321c52f7508fe088b7c74d343bd1 Mon Sep 17 00:00:00 2001 From: 7185 <7185@users.noreply.github.com> Date: Mon, 22 Dec 2014 01:27:27 +0100 Subject: [PATCH 2/9] Clean Tomorrow theme --- stylesheets/tomorrow.css | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/stylesheets/tomorrow.css b/stylesheets/tomorrow.css index 6397e612..29b2a68d 100644 --- a/stylesheets/tomorrow.css +++ b/stylesheets/tomorrow.css @@ -145,18 +145,10 @@ div#watchlist a:hover,a.watchThread:hover { } /* Remove the following parts if those annoy you */ -/* Youtube borders */ -div.video-container img.post-image { - background-color:#000; - border-color:#fff; - border-width:2px; - border-style:none dotted none; - padding:0 -} /* Keep small thumbnails in replies */ .post.reply a:not([data-expanded="true"]) .post-image{ width:auto!important; height:auto!important; max-height:160px; max-width:160px -} \ No newline at end of file +} From 42a05397a532e05533eead261efcbdc1b66f403e Mon Sep 17 00:00:00 2001 From: anonfagola Date: Sun, 28 Dec 2014 13:06:36 -0800 Subject: [PATCH 3/9] Changed 8chan's to infinity's i havent worked on this github in a long time and i'm pretty sure that was for the best --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4d0383e5..d1c1ae31 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ infinity About ------------ -infinity is a fork of vichan, with the difference that 8chan is geared towards allowing users to create their own boards. A running instance is at https://8chan.co. +infinity is a fork of vichan, with the difference that infinity is geared towards allowing users to create their own boards. A running instance is at https://8chan.co. Most things (other than installation) that apply to upstream vichan also apply to infinity. See their readme for a detailed FAQ: https://github.com/vichan-devel/vichan/blob/master/README.md @@ -12,8 +12,8 @@ If you are not interested in letting your users make their own boards, install v Because I cannot be bothered to maintain `install.php`, the install process is as such: ``` -mysql -uroot 8chan < install.sql -echo '8chan' > .installed +mysql -uroot infinity < install.sql +echo 'infinity' > .installed ``` Here's my install script as of 11/14/2014 for the 8chan servers which run Ubuntu 14.04: From 69cd484038c9744211704cc03f51c29c7d75f95d Mon Sep 17 00:00:00 2001 From: cmdrk Date: Thu, 1 Jan 2015 00:09:58 -0600 Subject: [PATCH 4/9] Updated dnsbl to only block exit nodes --- inc/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index 1769ed6a..2cd05f18 100644 --- a/inc/config.php +++ b/inc/config.php @@ -184,7 +184,7 @@ // Prevents most Tor exit nodes from making posts. Recommended, as a lot of abuse comes from Tor because // of the strong anonymity associated with it. - $config['dnsbl'][] = array('tor.dnsbl.sectoor.de', 1); + $config['dnsbl'][] = array('exitnodes.tor.dnsbl.sectoor.de', 1); // http://www.sorbs.net/using.shtml // $config['dnsbl'][] = array('dnsbl.sorbs.net', array(2, 3, 4, 5, 6, 7, 8, 9)); From aa71065dac700f923ebe2da0ac920c6c53a4fd6f Mon Sep 17 00:00:00 2001 From: Pashe Date: Fri, 2 Jan 2015 21:09:22 -0600 Subject: [PATCH 5/9] 8chan-mod-pages.php: Add 8chan.co and fonts.gstatic.com to the CSS whitelist --- inc/8chan-mod-pages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index b704567d..176baf39 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -520,7 +520,7 @@ EOT; preg_match_all("#$match_urls#im", $clean_css, $matched); - $allowed_urls = array('https://i.imgur.com/', 'https://media.8chan.co/', 'https://a.pomf.se/', 'https://fonts.googleapis.com/', 'http://8ch.net/'); + $allowed_urls = array('https://i.imgur.com/', 'https://media.8chan.co/', 'https://a.pomf.se/', 'https://fonts.googleapis.com/', 'https://fonts.gstatic.com/', 'http://8ch.net/', 'https://8chan.co/'); $error = false; if (isset($matched[0])) { From dbc4fbc5fe0d8ddd0f1807d013929364aac4a8fb Mon Sep 17 00:00:00 2001 From: Pashe Date: Fri, 2 Jan 2015 22:56:55 -0600 Subject: [PATCH 6/9] 8chan-mod-pages.php: Fix CSS URL filter ignoring all but the last URL on a line --- inc/8chan-mod-pages.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index 176baf39..1854a77d 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -521,24 +521,21 @@ EOT; preg_match_all("#$match_urls#im", $clean_css, $matched); $allowed_urls = array('https://i.imgur.com/', 'https://media.8chan.co/', 'https://a.pomf.se/', 'https://fonts.googleapis.com/', 'https://fonts.gstatic.com/', 'http://8ch.net/', 'https://8chan.co/'); - $error = false; if (isset($matched[0])) { - foreach ($matched[0] as $i => $v) { - $error = true; - foreach ($allowed_urls as $ii => $url) { - if (strpos($v, $url) === 0) { - $error = false; - break; + foreach ($matched[0] as $match) { + $match_okay = false; + foreach ($allowed_urls as $allowed_url) { + if (strpos($match, $allowed_url) !== false) { + $match_okay = true; } } + if ($match_okay !== true) { + error(sprintf(_("Off-site link \"%s\" is not allowed!"), $match)); + } } } - if ($error) { - error(_('Off-site links are not allowed in board stylesheets!')); - } - $query = query('SELECT `uri`, `title`, `subtitle` FROM ``boards`` WHERE `8archive` = TRUE'); file_write('8archive.json', json_encode($query->fetchAll(PDO::FETCH_ASSOC))); file_write($b.'/config.php', $config_file); From fe8b02442a2f09c7da0a215b9dc5eaff1a979507 Mon Sep 17 00:00:00 2001 From: Pashe Date: Sat, 3 Jan 2015 16:16:55 -0600 Subject: [PATCH 7/9] 8chan-mod-pages.php: Make the CSS URL filter error message less vague --- inc/8chan-mod-pages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index 1854a77d..d45bfff7 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -531,7 +531,7 @@ EOT; } } if ($match_okay !== true) { - error(sprintf(_("Off-site link \"%s\" is not allowed!"), $match)); + error(sprintf(_("Off-site link \"%s\" is not allowed in the board stylesheet"), $match)); } } } From e95a147e3ee03ef9e78aa2ab03e95c1145428b90 Mon Sep 17 00:00:00 2001 From: Pashe Date: Sat, 3 Jan 2015 16:35:03 -0600 Subject: [PATCH 8/9] 8chan-mod-pages.php: Filter CSS imports from sites with potentially unsafe content (pomf.se) --- inc/8chan-mod-pages.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index d45bfff7..0b636137 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -535,6 +535,28 @@ EOT; } } } + + //Filter out imports from sites with potentially unsafe content + $css_no_comments = preg_replace('|\/\*.*\*\/|', '', $clean_css); //I can't figure out how to ignore comments in the match + $match_imports = '@import[^;]*'; + $matched = array(); + preg_match_all("#$match_imports#im", $css_no_comments, $matched); + + $unsafe_import_urls = array('https://a.pomf.se/'); + + if (isset($matched[0])) { + foreach ($matched[0] as $match) { + $match_okay = true; + foreach ($unsafe_import_urls as $unsafe_import_url) { + if (strpos($match, $unsafe_import_url) !== false) { + $match_okay = false; + } + } + if ($match_okay !== true) { + error(sprintf(_("Potentially unsafe import \"%s\" is not allowed in the board stylesheet"), $match)); + } + } + } $query = query('SELECT `uri`, `title`, `subtitle` FROM ``boards`` WHERE `8archive` = TRUE'); file_write('8archive.json', json_encode($query->fetchAll(PDO::FETCH_ASSOC))); From 916cb4c997d82e95fee1cfe17faa2cbe50cd60da Mon Sep 17 00:00:00 2001 From: Pashe Date: Sat, 3 Jan 2015 23:34:27 -0600 Subject: [PATCH 9/9] inc/functions.php: Tabs in code tags (fixes #328) --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index d2417f74..2d5da1f6 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -1964,7 +1964,7 @@ function markup(&$body, $track_cites = false, $op = false) { } // replace tabs with 8 spaces - $body = str_replace("\t", ' ', $body); + $body = str_replace("\t", ' ', $body); return $tracked_cites; }