commit 0e3b24a6416e1b32caecf4e0f7e1934fd83a28af Author: Avril Date: Thu Jun 13 20:09:50 2019 +0100 fork from production diff --git a/.Trash-1000/files/.file b/.Trash-1000/files/.file new file mode 100644 index 0000000..e69de29 diff --git a/.Trash-1000/files/bg (copy).png b/.Trash-1000/files/bg (copy).png new file mode 100755 index 0000000..5ab9e97 Binary files /dev/null and b/.Trash-1000/files/bg (copy).png differ diff --git a/.Trash-1000/files/bg.png b/.Trash-1000/files/bg.png new file mode 100755 index 0000000..5ab9e97 Binary files /dev/null and b/.Trash-1000/files/bg.png differ diff --git a/.Trash-1000/files/ctl.js b/.Trash-1000/files/ctl.js new file mode 100644 index 0000000..e69de29 diff --git a/.Trash-1000/files/old/base85.php b/.Trash-1000/files/old/base85.php new file mode 100644 index 0000000..a4ea867 --- /dev/null +++ b/.Trash-1000/files/old/base85.php @@ -0,0 +1,103 @@ +
\n",strlen($str),$padding); + } + + // If we don't have a four byte chunk, append \0s + $str .= str_repeat("\0", $padding); + + foreach (unpack('N*',$str) as $chunk) { + // If there is an all zero chunk, it has a shortcut of 'z' + if ($chunk == "\0") { + $ret .= "z"; + continue; + } + + // Four spaces has a shortcut of 'y' + if ($chunk == 538976288) { + $ret .= "y"; + continue; + } + + if ($debug) { + var_dump($chunk); print "
\n"; + } + + // Convert the integer into 5 "quintet" chunks + for ($a = 0; $a < 5; $a++) { + $b = intval($chunk / (pow(85,4 - $a))); + $ret .= chr($b + 33); + + if ($debug) { + printf("%03d = %s
\n",$b,chr($b+33)); + } + + $chunk -= $b * pow(85,4 - $a); + } + } + + // If we added some null bytes, we remove them from the final string + if ($padding) { + $ret = preg_replace("/z$/",'!!!!!',$ret); + $ret = substr($ret,0,strlen($ret) - $padding); + } + + return $ret; + } + +} // End of base85 class \ No newline at end of file diff --git a/.Trash-1000/files/old/encryption.php b/.Trash-1000/files/old/encryption.php new file mode 100644 index 0000000..a59afd1 --- /dev/null +++ b/.Trash-1000/files/old/encryption.php @@ -0,0 +1,152 @@ + "sha512", + "private_key_bits" => 4096, + "private_key_type"=> OPENSSL_KEYTYPE_RSA, + ); + private function generateNewSymmetricKey() + { + return openssl_random_pseudo_bytes(self::$sklen); + } + private function _begin($prec) + { + $this->res = openssl_pkey_new(self::$config); + openssl_pkey_export($this->res, $this->publicKey); + $this->dt=openssl_pkey_get_details($this->res); + $this->publicKey=$this->dt["key"]; + + if($prec) + { + $this->upsk = true; + $this->psk = generateNewSymmetricKey(); + } + } + public function __construct() + { + $this->_begin(false); + } + public function __construct1($p) + { + $this->_begin($p); + } + private function s_decrypt($data, $key) + { + return s_encrypt($data, $key); //same; + } + private function s_encrypt($data, $key) + { + $j=0; + $out = ""; + for($i=0;$i=strlen($key)) $j=0; + $out .= ($data[$i] ^ $key[$j]); + $j+=1; + } + return $out; + } + + public function encrypt($data) + { + $skey = ($this->upsk?$this->psk:$this->generateNewSymmetricKey()); + $e_skey = null; + openssl_public_encrypt($skey, $e_skey, $this->publicKey); + + $e_data = $this->s_encrypt($data, $skey); + + return CreateFromEncryption(array("ekey"=>$e_skey, "edata"=>$e_data)); + } + public function decrypt(EncryptedData $ed) + { + $ekey = $ed->e_symmetricKey(); + $edata = $ed->e_data(); + + $skey = null; + openssl_private_decrypt($ekey, $skey, $this->privateKey); + return $this->s_decrypt($edata, $skey); + } + public function encdata_create($data) + { + return EncryptedData::CreateFromData($data); + } +} +class EncryptedData +{ + private $ekey=null; + private $edata=null; + private function __construct(Array $data) + { + $this->ekey = $data["ekey"]; + $this->edata = $data["edata"]; + } + public function __construct1($ek, $ed) + { + $this->ekey = $ek; + $this->edata = $ed; + } + private function __construct2() + { + + } + public function binaryData($set=null) + { + if($set==null) { + return "{".strlen($this->ekey).", ".strlen($this->edata)."}".$this->ekey.$this->edata; + } + else + { + $kvals = explode(", ", substr(substr($set, 0, strpos($set, "}")), 1)); + $klen = intval($kvals[0]); + $dlen = intval($kvals[1]); + + $this->ekey = substr($set, strpos($set, "}")+1, $klen); + $this->edata = substr($set, strpos($set, "}")+1+$klen, $dlen); + } + } + public function e_symmetricKey($val=null) + { + if($val==null) { + return $this->ekey; + } + else + { + $this->ekey = $val; + } + } + public function e_data($val=null) + { + if($val==null) { + return $this->edata; + } + else + { + $this->edata = $val; + } + } + public static function CreateFromData($data) + { + $val = new EncryptedData(); + $val->binaryData($data); + return $val; + } + public static function CreateFromEncryption(Array $data) + { + return new EncryptedData($data); + } +} + +?> \ No newline at end of file diff --git a/.Trash-1000/files/old/functions.php b/.Trash-1000/files/old/functions.php new file mode 100644 index 0000000..6478714 --- /dev/null +++ b/.Trash-1000/files/old/functions.php @@ -0,0 +1,651 @@ +"; + $vr+=1; + $col=""; + $level-=1; + } + else + $level+=1; + } + elseif($level==1) + { + $col.=$str[$i]; + } + else { + $out.=$str[$i]; + } + } + return $out.str_repeat("", $vr); +} +function phplib($nm) +{ + require_once "/phplib/$nm"; +} +function jtostring($val) +{ + $out = "{"; + $keys = array_keys($val); + for($i=0;$i= 0 && strpos($haystack, $needle, $temp) !== FALSE); +} +function checkTempNotify() +{ + if(tempNotifyExists()) + { + $vl = readTempNotify(); + js("setNotifyBar('#__temp_message', '".addslashes($vl)."', 3000);"); + } + +} +function notifyBar($id) +{ + echo("
"); +} +function getifexists($ar, $vl) +{ + if(isset($ar[$vl])) return $ar[$vl]; + else return null; +} +function jserialise($ar) {return jsserialise($ar);} +function jsserialise($ar) +{ + $keys = array_keys($ar); + $values = array_values($ar); + $out = ""; + for($i=0;$i0) + { + return substr($str, 0, $pos-1); + } + else return $str; +} +function junserialise($ar) {return jsunserialise($ar);} +function jsunserialise($ar) +{ + $ars= array(); + foreach(explode("\r\n", $ar) as $line) + { + if($line!="") { + $ur = explode("-", $line); + + $key = startsWith($ur[0], "array_")?junserialise(base64_decode(substr($ur[0], 6))):base64_decode($ur[0]); + $value = startsWith($ur[1], "array_")?junserialise(base64_decode(substr($ur[1], 6))):base64_decode($ur[1]); + + $ars[$key] = $value; + } + } + return $ars; +} +function formatDateTime($dt) +{ + if($dt"); +} +function jslib($name) +{ + jss("/jslib/$name"); +} +function isBanned($ip) +{ + $sql = beginSQL("server"); + $res = mysql_query_return_assoc("SELECT banned FROM sessionInfo WHERE `ip`='$ip'"); + $ret = $res[0]["banned"]; + @mysql_free_result_array($res); + endSQL($sql); + return $ret; +} +function redirect($page,$wtime=0) +{ + echo ''; +} +function getAdminLevel($ip) +{ + $sql = beginSQL("server"); + $res = mysql_query_return_assoc("SELECT `level` FROM admins WHERE `ip`='$ip'"); + $ret=false; + if($res != array()) + { + $ret = $res[0]["level"]; + } + @mysql_free_result_array($res); + endSQL($sql); + return $ret; +} +function banUser($ip) +{ + $sql = beginSQL("server"); + mysql_query("UPDATE sessionInfo SET + `banned`=1 + WHERE `ip`='$ip'"); + endSQL($sql); +} +function unbanUser($ip) +{ + $sql = beginSQL("server"); + mysql_query("UPDATE sessionInfo SET + `banned`=0 + WHERE `ip`='$ip'"); + endSQL($sql); +} +function jquery() +{ + jslib("jquery-1.8.2.js"); + jslib("jquery.base64.js"); +} +function js($str) +{ + echo(""); +} +function issetmultiple($ar, $vls) +{ + $val = true; + foreach($vls as $r) $val = $val && isset($ar[$r]); + return $val; +} +function pageinit_n($sql=null) +{ + pageinit($sql); + jquery(); + jslib("notify.js"); + enableBanCheck(); + doActiveCheck(); +} +function pathfix($str) +{ + return str_replace("\\", "/", $str); +} +function sqldate($stamp=null) +{ + return date("y.m.d H.i.s", $stamp==null?time():$stamp); +} +function enableBanCheck() +{ + jslib("check.js"); + js("banCheck();"); + if(isBanned(getip())) doBan(); +} +function activeNotifyBar($id, $val) +{ + echo("
$val
"); +} +function doActiveCheck() +{ + if(!isActive()) { + if(getAdminLevel(getip())!==false) + { + echo("
WEBSITE OFFLINE
"); + } + else + die("website offline"); + } +} +function doBan() +{ + redirect("/banned.php"); + die(); +} +function pageinit($vsql=null) +{ + $sql = $vsql==null?beginSQL("server"):$vsql; + if($vsql!=null) + { + mysql_select_db("server",$sql); + } + $res = mysql_query_return_assoc("SELECT * FROM `sessionInfo` WHERE `ip`='".getip()."'"); + echo(mysql_error()); + if($res==array()) + { + mysql_query("INSERT INTO sessionInfo ( + ip, url, sessionid, last + ) VALUES ( + '".getip()."', + '".geturl()."', + ".(sessionid()==null||streq(sessionid(),"")?"NULL":"'".$_REQUEST["PHPSESSID"]."'").", + '".date("y.m.d H:i:s")."' + )"); + echo(mysql_error()); + } + else + { + mysql_query("UPDATE sessionInfo SET + url='".geturl()."', + sessionid=".(sessionid()==null||streq(sessionid(),"")?"NULL":"'".$_REQUEST["PHPSESSID"]."'").", + + last='".date("y.m.d H:i:s")."', + views=views+1 + WHERE + `ip`='".getip()."' + "); + + echo(mysql_error()); + } + @mysql_free_result_array($res); + doLogger(); + + if($vsql==null) endSQL($sql); +} +function doLoggerOnce() +{ + $sql = beginSQL("server"); + doLogger(); + endSQL($sql); +} +function setLogAll($l) +{ + file_put_contents("/logall", $l?"true":"false"); +} +function isLogAll() +{ + return streq(file_get_contents("/logall"), "true")?true:false; +} +function js_onKeyPress($id, $func, $key) +{ +js('$(document).ready(function() + { + $("'.$id.'").keypress(function (e){ + if(e.keyCode=='.$key.') + '.$func.'; + }); + });'); +} +function js_onEnterPress($id, $func) +{ + js_onKeyPress($id, $func, 13); +} +function doLogger() +{ + $r = mysql_query_return_assoc("SELECT * FROM logInfo WHERE `ip`='".getip()."'"); + if(($r!=array())||isLogAll()) + { + mysql_query("INSERT INTO logs ( + ip, url, session, time + ) VALUES ( + '".getip()."', + '".geturl()."', + ".(sessionid()==null||streq(sessionid(),"")?"NULL":"'".$_REQUEST["PHPSESSID"]."'").", + '".sqldate()."' + )"); + } + else @mysql_free_result_array($r); +} +function writeAllText($fn, $txt) +{ + $p = fopen($fn, "w"); + fwrite($p, $txt); + fclose($p); +} +function sessionid() +{ + return $_REQUEST["PHPSESSID"]; +} +function geturl() { + $actual_link = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]; + return $actual_link; +} +function getmsg() +{ + $txt = @readalltext("\message"); + if(streq($txt,"")) return NULL; + return $txt; +} +function button($value, $onclick=null,$other="") +{ + echo(""); +} +function sessionActive() +{ + return sessionid() !== ''; +} +function setTempNotify($msg) +{ + $_SESSION["msg"]=$msg; +} +function tempNotifyExists() +{ + return isset($_SESSION["msg"]); +} +function readTempNotify() +{ + $msg=null; + if(isset($_SESSION["msg"])) { + $msg = $_SESSION["msg"]; + unset($_SESSION["msg"]); + } + return $msg; +} +function index($ar, $i) +{ + return $ar[$i]; +} +function mysql_query_return_assoc($q) +{ + $res = (mysql_query($q)); + $ret=array(); + $i=0; + + if(!$res) echo(mysql_error()); + else + while($cur = mysql_fetch_assoc($res)) + { + $ret[$i++] = $cur; + } + //mysql_free_result($q); + return $ret; + +} +function readAllText($fn) +{ + $fp = fopen($fn,"r"); + $data = fread($fp, filesize($fn)); + fclose($fp); + return $data; +} +function beginSQL($db) +{ + $con = mysql_connect(SQL_DEFAULT_HOST_NAME, SQL_DEFAULT_USER, SQL_DEFAULT_PASSWORD); + mysql_select_db($db, $con); + return $con; +} +function endSQL($con) +{ + mysql_close($con); +} +function css($css) +{ + echo ''; +} +function css_main($dir="/") +{ + echo ''; +} +function title($title, $others="",$id=null) +{ + echo "

$title

\n"; + echo "$title"; +} +function mysql_free_result_array($res) +{ + foreach($res as $re) + mysql_free_result($re); +} +function lb() +{ + echo("
"); +} +function para() +{ + echo("

"); +} +function validip($ip) +{ + return preg_match("~([0-9]{1,3}[.]){3,3}[0-9]{1,3}~",$ip); +} +function getip() +{ + if (validip($_SERVER["HTTP_CLIENT_IP"])) { + return $_SERVER["HTTP_CLIENT_IP"]; + } + foreach (explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"]) as $ip) { + if (validip(trim($ip))) { + return $ip; + } + } + if (validip($_SERVER["HTTP_X_FORWARDED"])) { + return $_SERVER["HTTP_X_FORWARDED"]; + } elseif (validip($_SERVER["HTTP_FORWARDED_FOR"])) { + return $_SERVER["HTTP_FORWARDED_FOR"]; + } elseif (validip($_SERVER["HTTP_FORWARDED"])) { + return $_SERVER["HTTP_FORWARDED"]; + } elseif (validip($_SERVER["HTTP_X_FORWARDED"])) { + return $_SERVER["HTTP_X_FORWARDED"]; + } else { + return $_SERVER["REMOTE_ADDR"]; + } +} +function link_tab($res, $txt, $other="") +{ + link($res, $txt, "target='_black' ".$other); +} +function link($res, $txt, $other="") +{ + echo("$txt"); +} +function streq($str,$str2) +{ + return strcmp($str,$str2)==0; +} +function echoline($ln) +{ + echo($ln); lb(); +} +function echopara($pa) +{ + echo($pa); para(); +} +class Session { + public static function unserialize($session_data) { + $method = ini_get("session.serialize_handler"); + switch ($method) { + case "php": + return self::unserialize_php($session_data); + break; + case "php_binary": + return self::unserialize_phpbinary($session_data); + break; + default: + throw new Exception("Unsupported session.serialize_handler: " . $method . ". Supported: php, php_binary"); + } + } + + private static function unserialize_php($session_data) { + $return_data = array(); + $offset = 0; + while ($offset < strlen($session_data)) { + if (!strstr(substr($session_data, $offset), "|")) { + throw new Exception("invalid data, remaining: " . substr($session_data, $offset)); + } + $pos = strpos($session_data, "|", $offset); + $num = $pos - $offset; + $varname = substr($session_data, $offset, $num); + $offset += $num + 1; + $data = unserialize(substr($session_data, $offset)); + $return_data[$varname] = $data; + $offset += strlen(serialize($data)); + } + return $return_data; + } + + private static function unserialize_phpbinary($session_data) { + $return_data = array(); + $offset = 0; + while ($offset < strlen($session_data)) { + $num = ord($session_data[$offset]); + $offset += 1; + $varname = substr($session_data, $offset, $num); + $offset += $num; + $data = unserialize(substr($session_data, $offset)); + $return_data[$varname] = $data; + $offset += strlen(serialize($data)); + } + return $return_data; + } + public static function serialize( $array, $safe = true ) { + + // the session is passed as refernece, even if you dont want it to + if( $safe ) + $array = unserialize(serialize( $array )) ; + + //var_dump($array); + $raw = '' ; + $line = 0 ; + $keys = array_keys( $array ) ; + foreach( $keys as $key ) { + $value = $array[ $key ] ; + $line ++ ; + + $raw .= $key .'|' ; + + if( is_array( $value ) && isset( $value['huge_recursion_blocker_we_hope'] )) { + $raw .= 'R:'. $value['huge_recursion_blocker_we_hope'] . ';' ; + } else { + $raw .= serialize( $value ) ; + } + $array[$key] = Array( 'huge_recursion_blocker_we_hope' => $line ) ; + } + + return $raw ; + + } +} +?> \ No newline at end of file diff --git a/.Trash-1000/files/old/imagefunctions.php b/.Trash-1000/files/old/imagefunctions.php new file mode 100644 index 0000000..3e0d6cb --- /dev/null +++ b/.Trash-1000/files/old/imagefunctions.php @@ -0,0 +1,71 @@ +source=$image; + $this->seed = $rndr; + + srand($rndr); + } + private function getAreas() + { + $v = imagexy($this->source); + $xv = $v[0] % CHUNKSIZE; + $yv = $v[1] % CHUNKSIZE; + $ret = array(); + $i=0; + for($y=0;$i<$yv;$y++) + { + for($x=0;$x<$xv;$x++) + { + $ret[$i++] = array($x*CHUNKSIZE, $y*CHUNKSIZE,CHUNKSIZE,CHUNKSIZE); + } + } + return $ret; + } + private function _swap($ar,$i,$j) + { + $cp = $ar[$i]; + $ar[$i] = $ar[$j]; + $ar[$j] = $cp; + } + private function scrambleArea($ar) + { + for($i=count($ar)-1;$i>=0;$i--) + { + $this->_swap($ar, $i, rand(0, $i)); + } + return $ar; + } + + public function scramble() + { + $area = $this->getAreas(); + $sarea = $this->scrambleArea($area); + $nw = imagecreate(imagesx($this->source), imagesy($this->source)); + for($i=0;count($area);$i+=2) + { + imagecopy($nw, $this->source, $sarea[$i+1][0], $sarea[$i+1][1], $sarea[$i][0], $sarea[$i][1],CHUNKSIZE,CHUNKSIZE); + } + imagedestroy($this->source); + $this->source=$nw; + return $sarea; + } + public function destroy() + { + imagedestroy($this->$source); + } +} +?> \ No newline at end of file diff --git a/.Trash-1000/files/old/list.php b/.Trash-1000/files/old/list.php new file mode 100644 index 0000000..fe29670 --- /dev/null +++ b/.Trash-1000/files/old/list.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/.Trash-1000/files/old/video.php b/.Trash-1000/files/old/video.php new file mode 100644 index 0000000..e4898eb --- /dev/null +++ b/.Trash-1000/files/old/video.php @@ -0,0 +1,119 @@ + $end) ? $end : $c_end; + if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) { + header('HTTP/1.1 416 Requested Range Not Satisfiable'); + header("Content-Range: bytes $start-$end/$size"); + exit; + } + $start = $c_start; + $end = $c_end; + $length = $end - $start + 1; + fseek($fp, $start); + header('HTTP/1.1 206 Partial Content'); + } + header("Content-Range: bytes $start-$end/$size"); + header("Content-Length: ".$length); + + $buffer = 1024 * 8; + while(!feof($fp) && ($p = ftell($fp)) <= $end) { + + if ($p + $buffer > $end) { + $buffer = $end - $p + 1; + } + set_time_limit(0); + echo fread($fp, $buffer); + flush(); + } + + fclose($fp); + exit(); +} +function webmvideo($file) { + $fp = @fopen($file, 'rb'); + + $size = filesize($file); // File size + $length = $size; // Content length + $start = 0; // Start byte + $end = $size - 1; // End byte + + header('Content-type: video/webm'); + //header("Accept-Ranges: 0-$length"); + header("Accept-Ranges: bytes"); + if (isset($_SERVER['HTTP_RANGE'])) { + + $c_start = $start; + $c_end = $end; + + list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2); + if (strpos($range, ',') !== false) { + header('HTTP/1.1 416 Requested Range Not Satisfiable'); + header("Content-Range: bytes $start-$end/$size"); + exit; + } + if ($range == '-') { + $c_start = $size - substr($range, 1); + }else{ + $range = explode('-', $range); + $c_start = $range[0]; + $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size; + } + $c_end = ($c_end > $end) ? $end : $c_end; + if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) { + header('HTTP/1.1 416 Requested Range Not Satisfiable'); + header("Content-Range: bytes $start-$end/$size"); + exit; + } + $start = $c_start; + $end = $c_end; + $length = $end - $start + 1; + fseek($fp, $start); + header('HTTP/1.1 206 Partial Content'); + } + header("Content-Range: bytes $start-$end/$size"); + header("Content-Length: ".$length); + + $buffer = 1024 * 8; + while(!feof($fp) && ($p = ftell($fp)) <= $end) { + + if ($p + $buffer > $end) { + $buffer = $end - $p + 1; + } + set_time_limit(0); + echo fread($fp, $buffer); + flush(); + } + + fclose($fp); + exit(); +} +?> \ No newline at end of file diff --git a/.Trash-1000/info/.file.trashinfo b/.Trash-1000/info/.file.trashinfo new file mode 100644 index 0000000..7562f7e --- /dev/null +++ b/.Trash-1000/info/.file.trashinfo @@ -0,0 +1,3 @@ +[Trash Info] +Path=static/www/.file +DeletionDate=2018-07-07T16:06:51 diff --git a/.Trash-1000/info/Untitled Folder.2.trashinfo b/.Trash-1000/info/Untitled Folder.2.trashinfo new file mode 100644 index 0000000..28752d0 --- /dev/null +++ b/.Trash-1000/info/Untitled Folder.2.trashinfo @@ -0,0 +1,3 @@ +[Trash Info] +Path=rtbw/Untitled%20Folder +DeletionDate=2018-08-29T14:14:52 diff --git a/.Trash-1000/info/Untitled Folder.trashinfo b/.Trash-1000/info/Untitled Folder.trashinfo new file mode 100644 index 0000000..fb4cfc6 --- /dev/null +++ b/.Trash-1000/info/Untitled Folder.trashinfo @@ -0,0 +1,3 @@ +[Trash Info] +Path=rtbw/Untitled%20Folder +DeletionDate=2018-08-13T18:01:21 diff --git a/.Trash-1000/info/bg (copy).png.trashinfo b/.Trash-1000/info/bg (copy).png.trashinfo new file mode 100644 index 0000000..196eca8 --- /dev/null +++ b/.Trash-1000/info/bg (copy).png.trashinfo @@ -0,0 +1,3 @@ +[Trash Info] +Path=static/www/i/bg%20%28copy%29.png +DeletionDate=2018-05-11T11:36:18 diff --git a/.Trash-1000/info/bg.png.trashinfo b/.Trash-1000/info/bg.png.trashinfo new file mode 100644 index 0000000..242e396 --- /dev/null +++ b/.Trash-1000/info/bg.png.trashinfo @@ -0,0 +1,3 @@ +[Trash Info] +Path=static/www/i/bg.png +DeletionDate=2018-05-11T11:36:13 diff --git a/.Trash-1000/info/ctl.js.trashinfo b/.Trash-1000/info/ctl.js.trashinfo new file mode 100644 index 0000000..2be3720 --- /dev/null +++ b/.Trash-1000/info/ctl.js.trashinfo @@ -0,0 +1,3 @@ +[Trash Info] +Path=rtbw/maintain/ctl.js +DeletionDate=2018-08-29T14:15:18 diff --git a/.Trash-1000/info/old.trashinfo b/.Trash-1000/info/old.trashinfo new file mode 100644 index 0000000..453031e --- /dev/null +++ b/.Trash-1000/info/old.trashinfo @@ -0,0 +1,3 @@ +[Trash Info] +Path=static/old +DeletionDate=2018-05-11T10:07:58 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7c52658 --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +static/ +git/ +rtbw/ +www.old/ +www/.*/ +api/ +www/favicon.ico + +*.node +*.pid +*.swp +.build +.lock* +.DS_Store +authdump +config.js +graveyard +error.log +findapng +hot.js +jsmin +node_modules/ +package-lock.json +perceptual +imager/tmp +state +tripcode/.build +tripcode/build +upkeep/credentials.json +voice/*.mp3 +www/archive +www/js/client*.js +www/js/vendor*.js +www/src +www/thumb +www/mid +www/vint diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d5f48e3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2010-2017 Lal'C Mellk Mal + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3579725 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +all: + $(MAKE) -C imager + $(MAKE) -C tripcode + +client: + @echo 'make client' is no longer necessary + @false + +.PHONY: all clean client + +clean: + rm -rf -- .build state www/js/{client,vendor}{.,-}*.js + $(MAKE) -C imager -w clean + $(MAKE) -C tripcode -w clean diff --git a/README.md b/README.md new file mode 100644 index 0000000..6694537 --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +Real-time imageboard. +MIT licensed. + +Setup: + +* Install dependencies listed below +* Sign up for reCAPTCHA +* Create a GitHub Application (callback URL = site URL + /login) +* Copy config.js.example to config.js and configure +* Copy hot.js.example to hot.js and configure +* Copy imager/config.js.example to imager/config.js and configure +* Copy report/config.js.example to report/config.js and configure +* You might need to run `npm install -g node-gyp` +* Run `npm install` to install npm deps and compile a few helpers +* Run `node builder.js` to run an auto-reloading development server + +Production: + +* Have your webserver serve www/ (or wherever you've moved src, thumb, etc.) + - Configure `imager.config.MEDIA_URL` appropriately + - Then turn off `SERVE_STATIC_FILES` and `SERVE_IMAGES` +* If you're behind Cloudflare turn on `CLOUDFLARE` + - Or if you're behind any reverse proxy (nginx etc) turn on `TRUST_X_FORWARDED_FOR` +* Run `node server/server.js` for just the server +* You can update client code & hot.js on-the-fly with `node server/kill.js` +* For nginx hosting/reverse proxying, refer to docs/nginx.conf.example +* For a sample init script, refer to docs/doushio.initscript.example +* config.DAEMON support is old and broken, PRs welcome + +Dependencies: + +* ImageMagick +* libpng +* node.js + npm +* redis +* ffmpeg 2.2+ if supporting WebM +* jhead and jpegtran optionally, for EXIF autorotation + +Optional npm deps for various features: + +* ~~daemon~~ (broken currently) +* icecast now-playing banners: node-expat +* [send](https://github.com/visionmedia/send) (if you want to serve static files directly from the node.js process; useful in debug mode also) + +Standalone upkeep scripts: + +* archive/daemon.js - moves old threads to the archive +* upkeep/backup.js - uploads rdb to S3 +* upkeep/clean.js - deletes archived images +* upkeep/radio.js - icecast2 server integration diff --git a/TODO b/TODO new file mode 100644 index 0000000..b5bfbda --- /dev/null +++ b/TODO @@ -0,0 +1,5 @@ +* Update `syncs` in client when on /live +* Actually tell user when a particular thread failed to sync +* Tokenize text instead of multiple levels of regexps +* Should retrieve live body and hctr in one transaction +* Consolidate or disambiguate the (three!) different hook/trigger mechanisms diff --git a/admin/client.js b/admin/client.js new file mode 100644 index 0000000..d6525a4 --- /dev/null +++ b/admin/client.js @@ -0,0 +1,473 @@ +/* NOTE: This file is processed by server/state.js + and served by server/server.js (to auth'd users only) */ + +$('', {rel: 'stylesheet', type: 'text/css', href: mediaURL+'css/mod.css'}).appendTo('head'); + +var $selectButton, $controls; +window.loggedInUser = IDENT.user; +window.x_csrf = IDENT.csrf; + +function show_toolbox() { + var specs = [ + {name: 'Lewd', kind: 7}, + {name: 'Porn', kind: 8}, + {name: 'Delete', kind: 9}, + {name: 'Lock', kind: 11}, + ]; + if (IDENT.auth == 'Admin') + specs.push({name: 'Panel', kind: 'panel'}); + var $toolbox = $('

', {id: 'toolbox', "class": 'mod'}); + + $selectButton = $('', { + type: 'button', val: 'Select', + click: function (e) { toggle_multi_selecting(); }, + }); + $toolbox.append($selectButton, ' '); + + $controls = $('').hide(); + _.each(specs, function (spec) { + $controls.append($('', { + type: 'button', + val: spec.name, + data: {kind: spec.kind}, + }), ' '); + }); + $controls.on('click', 'input[type=button]', tool_action); + + _.each(delayNames, function (when, i) { + var id = 'delay-' + when; + var $label = $('