This commit is contained in:
poiuty 2022-07-27 11:48:27 +03:00
commit eabb01cfef
21 changed files with 921 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.DS_Store
/app/chaturbate/chaturbate
/app/bongacams/bongacams

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 poiuty
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.

45
README.md Normal file
View file

@ -0,0 +1,45 @@
<p align="center">
<img src="https://raw.githubusercontent.com/poiuty/statbate/master/www/img/github.jpg">
</p>
```
apt-get update
apt-get upgrade
apt-get install htop bwm-ng strace lsof iotop git build-essential screen
adduser --disabled-login stat
```
```
git clone https://github.com/poiuty/statbate.git
mkdir /home/stat/go
mkdir /home/stat/php
mkdir /home/stat/python
mkdir /var/www/statbate
cp -r /statbate/app /home/stat/go
cp -r /statbate/cli/*.php /home/stat/php
cp -r /statbate/cli/*.py /home/stat/python
cp -r /statbate/html/* /var/www/statbate
chown -R stat:stat /home/stat
chown -R www-data:www-data /var/www/statbate
```
1. <a href="https://github.com/poiuty/statbate/blob/master/install/mariadb.md">Mariadb</a><br/>
2. <a href="https://github.com/poiuty/statbate/blob/master/install/clickhouse.md">ClickHouse</a><br/>
3. <a href="https://github.com/poiuty/statbate/blob/master/install/nginx.md">Nginx</a><br/>
4. <a href="https://github.com/poiuty/statbate/blob/master/install/php.md">PHP</a><br/>
5. <a href="https://github.com/poiuty/statbate/blob/master/install/python.md">Python</a><br/>
6. <a href="https://github.com/poiuty/statbate/blob/master/install/redis.md">Redis</a><br/>
7. <a href="https://github.com/poiuty/statbate/blob/master/install/app.md">App</a>
8. Add <a href="https://github.com/poiuty/statbate/blob/master/install/conf/cron">cron</a>
```
# nano /etc/cron.d/php
*/10 * * * * stat php /home/stat/php/start2.php > /home/stat/php/log.txt 2>&1
* * * * * www-data php /var/www/statbate/root/index.php >/dev/null 2>&1
# systemctl restart cron
# systemctl status cron
```

52
install/app.md Normal file
View file

@ -0,0 +1,52 @@
Install Golang (https://golang.org/dl/).
```
wget https://dl.google.com/go/go1.14.1.linux-amd64.tar.gz
tar -xf go1.14.1.linux-amd64.tar.gz
ln -s /usr/local/go/bin/go /usr/local/bin/
ln -s /usr/local/go/bin/gofmt /usr/local/bin/
go version
```
Add user and service.
```
# adduser --disabled-login stat
# nano /etc/systemd/system/app.service
[Unit]
Description=Stat Daemon
After=network.target manticore.service
[Service]
LimitNOFILE=65535
Type=simple
GuessMainPID=no
ExecStart=/home/stat/go/app/app
Restart=always
User=stat
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# systemctl enable app
```
Build app.
```
su stat
mkdir ~/go
cd ~/go
go get github.com/gorilla/websocket
go get github.com/go-sql-driver/mysql
go get github.com/jmoiron/sqlx
cd app
go build -ldflags "-s -w"
```
Start service.
```
exit
systemctl start app
systemctl status app
```

View file

@ -0,0 +1,19 @@
#!/usr/bin/env python3
import cloudscraper
import sys
scraper = cloudscraper.create_scraper(
delay=15,
interpreter='nodejs',
captcha={
'provider': '2captcha',
'api_key': ''
}
)
if len(sys.argv) < 2:
print('no url');
exit(0)
print(scraper.get(sys.argv[1]).text)

View file

@ -0,0 +1,36 @@
<?php
if(php_sapi_name() != "cli"){
die;
}
require_once('/var/www/statbate/root/func.php');
$query = $db->query("select min(id) as min, max(id) as max from `stat`");
if($query->rowCount() == 0){
die("no data\n");
}
$row = $query->fetch();
$min = $row['min'];
$max = $row['max'];
$query = $clickhouse->query("SELECT max(id) as max FROM stat");
if($query->rowCount() != 0){
$min = $query->fetch()['max']+1;
}
$step = 2048;
for($i = $min; $i < $max; $i+=$step){
$sql = '';
$start = $i;
$end = $start+$step;
$query = $db->query("SELECT * FROM `stat` WHERE `id` >= $start AND `id` < $end");
if($query->rowCount() == 0){
continue;
}
while($row = $query->fetch()){
$sql .= "({$row['id']}, {$row['did']}, {$row['rid']}, {$row['token']}, {$row['time']}),";
}
$sql = rtrim($sql, ',');
$clickhouse->query("INSERT INTO stat VALUES $sql");
}

260
install/cli/start.php Normal file
View file

@ -0,0 +1,260 @@
#!/usr/bin/env php
<?php
require_once('/var/www/statbate/root/private/init.php');
function isJson($string) {
json_decode($string);
return (json_last_error() == JSON_ERROR_NONE);
}
function getPage($url){
$command = escapeshellcmd("/home/stat/python/cloudscraper.py $url");
return shell_exec($command);
}
function stopBot($name){
if(empty($name)){
echo "empty name\n";
return false;
}
echo "[".date('H:i:s', time())."] stop $name\n";
echo "https://statbate.com/cmd/?exit=$name\n";
file_get_contents("https://statbate.com/cmd/?exit=$name");
}
function startBot($name, $server){
if(empty($name) || empty($server)){
echo "empty name or server\n";
return false;
}
echo "[".date('H:i:s', time())."] start $name $server\n";
echo "https://statbate.com/cmd/?room=$name&server=$server\n";
file_get_contents("https://statbate.com/cmd/?room=$name&server=$server");
}
function getRoomParams($room){
/*
$content = getPage('https://chaturbate.com/'.$room);
$doc = new DOMDocument();
$doc->loadHTML($content, LIBXML_NOERROR | LIBXML_ERR_NONE);
$sxml = simplexml_import_dom($doc);
foreach ($sxml->xpath('//script') as $script) {
$text = (string)$script;
if(strpos($text, 'window.initial')) {
preg_match('/window.initialRoomDossier = \"(.*?)\"/', $text, $matches);
$str = preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function ($match) {
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
}, $matches[1]);
$params = json_decode($str, true);
if(!is_array($params)){
var_dump($params);
return false;
}
return $params;
}
}
file_put_contents('/home/stat/php/page.html', $content);
*/
$json = getPage("https://chaturbate.com/api/chatvideocontext/$room/");
$params = json_decode($json, true);
if(!is_array($params)){
var_dump($params);
return false;
}
return $params;
}
function getServerWS($params){
$host = $params['wschat_host'];
if(empty($host)){
echo "server empty 1\n";
return false;
}
$host = str_replace("https://", "", $host);
$host = str_replace("/ws", "", $host);
$server = explode('.', $host);
if(empty($server['0'])){
echo "server empty 2\n";
return false;
}
return $server['0'];
}
function updateGender($id, $params){
global $db;
$arr = ['male', 'female', 'trans', 'couple'];
$gender = array_search($params['broadcaster_gender'], $arr);
if(empty($gender)){
var_dump($params['broadcaster_gender']);
return;
}
$query = $db->prepare("UPDATE `room` SET `gender` = :gender WHERE `id` = :id");
$query->bindParam(':id', $id);
$query->bindParam(':gender', $gender);
$query->execute();
}
function updateFollowers($name, $num){
global $db;
if(empty($num)){
return false;
}
$query = $db->prepare("UPDATE `room` SET `fans` = :fans WHERE `name` = :name");
$query->bindParam(':name', $name);
$query->bindParam(':fans', $num);
$query->execute();
}
function getAPIList(){
global $redis;
$stat = [];
$json = getPage('https://chaturbate.com/affiliates/api/onlinerooms/?format=json&wm=50xHQ');
randSleep();
if(!isJson($json)){
return false;
}
$arr = json_decode($json, true);
if(!is_array($arr) || empty($arr)){
return false;
}
$redis->setex('chaturbateList', 86400, $json);
usort($arr, function($a, $b){
return $a['num_users'] < $b['num_users'];
});
$viewers = 0;
foreach($arr as $val){
cacheResult('getRoomInfo', ['name' => $val['username']], 3600, true);
updateFollowers($val['username'], $val['num_followers']);
$viewers += $val['num_users'];
if($val['num_users'] < 10){
continue;
}
$stat[] = $val['username'];
}
if(empty($stat) || !is_array($stat)){
return false;
}
return $stat;
}
function randSleep(){
$t = mt_rand(10,15);
echo "wait $t seconds...\n";
sleep($t);
}
function getFromPages(){
$pages = 3;
echo "get list from pages";
for($i=1; $i<=$pages; $i++){
$html = getPage("https://chaturbate.com/?page=$i");
preg_match_all('/alt="(.*)\'s/', $html, $tmp);
foreach($tmp[1] as $k => $v){
$pos = stripos($v, ' ');
if($pos === false){
$rooms[] = $v;
}
}
echo " $i";
sleep(mt_rand(10,15));
}
echo "\n";
if(empty($rooms) || !is_array($rooms)){
return false;
}
return $rooms;
}
function sendStart($room){
global $onlineList, $timeEnd;
if(time() > $timeEnd){
die("Stop task\n");
}
if(array_key_exists($room, $onlineList)){
echo $room." already online\n";
return true;
}
echo "start add $room\n";
randSleep();
$info = cacheResult('getRoomInfo', ['name' => $room], 3600, true);
if(!$info){
echo "cant getRoomInfo\n";
return false;
}
$params = getRoomParams($room);
if(!$params){
echo "cant getRoomParams\n";
return false;
}
updateGender($info['id'], $params);
$server = getServerWS($params);
if(!$server){
echo "cant getServerWS\n";
return false;
}
startBot($room, $server);
//die;
}
function importList(){
global $redis, $onlineList;
$online = file_get_contents('https://statbate.com/list/');
if(isJson($online)){
$onlineList = json_decode($online, true);
if(!empty($onlineList) && count($onlineList) > 100){
$redis->setex('importList', 3600, $online);
return;
}
}
$online = $redis->get('importList');
if($online !== false && isJson($online)){
$onlineList = json_decode($online, true);
foreach($onlineList as $key => $val){
echo "import from importList $key {$val['server']}\n";
startBot($key, $val['server']);
}
}
}
$timeEnd = time() + 590;
$onlineList = [];
importList();
$arr100 = cacheResult('getTop', [], 600, true);
$arrPagesList = getFromPages();
$arrApiList = getAPIList();
if(!empty($arrApiList) && !empty($arrPagesList)){ // Stop offline rooms
foreach($onlineList as $key => $val){
if(!in_array($key, $arrApiList) && $val['last'] < time()+60*15){
if(in_array($key, $arrPagesList)){
continue;
}
stopBot($key);
}
}
}
echo "Top100 \n";
foreach($arr100 as $val){ // Start top 100
if(in_array($val['name'], $arrPagesList) || in_array($val['name'], $arrApiList)){
sendStart($val['name']);
}
}
echo "PagesList \n";
foreach($arrPagesList as $val){ // Start hiden rooms
if(!in_array($val, $arrApiList)){
sendStart($val);
}
}
echo "ApiList \n";
foreach($arrApiList as $val){ // Start api list by num_users
sendStart($val);
}

35
install/clickhouse.md Normal file
View file

@ -0,0 +1,35 @@
https://clickhouse.com/docs/en/getting-started/install/
```
apt-get install -y apt-transport-https ca-certificates dirmngr
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754
echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \
/etc/apt/sources.list.d/clickhouse.list
apt-get update
apt-get install -y clickhouse-server clickhouse-client
systemctl start clickhouse-server
```
Disable logs.
```
# nano /etc/clickhouse-server/config.d/z_log_disable.xml
<?xml version="1.0"?>
<yandex>
<asynchronous_metric_log remove="1"/>
<metric_log remove="1"/>
<query_thread_log remove="1" />
<query_log remove="1" />
<query_views_log remove="1" />
<part_log remove="1"/>
<session_log remove="1"/>
<text_log remove="1" />
<trace_log remove="1"/>
</yandex>
```
```
# nano /etc/clickhouse-server/config.xml
<level>warning</level>
```

16
install/conf/app.service Normal file
View file

@ -0,0 +1,16 @@
[Unit]
Description=Stat Daemon
After=network.target manticore.service
[Service]
LimitNOFILE=65535
Type=simple
GuessMainPID=no
ExecStart=/home/stat/go/app/app
Restart=always
User=stat
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target

4
install/conf/cron Normal file
View file

@ -0,0 +1,4 @@
*/5 * * * * stat php /home/stat/php/start.php > /home/stat/php/log.txt 2>&1
0 12 1 * * stat php /home/stat/php/telegram.php >/dev/null 2>&1
0 12 15 */3 * stat php /home/stat/php/telegram2.php >/dev/null 2>&1
* * * * * www-data curl --silent https://chaturbate100.com/index.php >/dev/null 2>&1

45
install/conf/default Normal file
View file

@ -0,0 +1,45 @@
server {
listen 80;
listen [::]:80;
server_name _;
location ^~ /.well-known/ {
root /var/www/html;
default_type "text/plain";
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name chaturbate100.com;
ssl_certificate /etc/letsencrypt/live/chaturbate100.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/chaturbate100.com/privkey.pem;
index index.php index.html index.htm;
root /var/www/chaturbate100.com;
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|ico|bmp|woff)$ {
expires 30d;
access_log off;
}
location ~ \.php$ {
try_files $uri $uri/ =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
location /ws/ {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location ~ ^/(cmd|list)/ {
access_log off;
allow 127.0.0.1;
deny all;
proxy_pass http://localhost:8080;
}
}

View file

@ -0,0 +1,19 @@
index stat {
type = rt
rt_mem_limit = 1024M
rt_attr_uint = did
rt_attr_uint = rid
rt_attr_uint = token
rt_attr_timestamp = time
rt_field = tmp
path = /var/lib/manticore/data/stat
}
searchd {
listen = 127.0.0.1:9312
listen = 127.0.0.1:9306:mysql41
log = /var/log/manticore/searchd.log
query_log = /var/log/manticore/query.log
pid_file = /var/run/manticore/searchd.pid
binlog_path = /var/lib/manticore/data
}

60
install/conf/nginx.conf Normal file
View file

@ -0,0 +1,60 @@
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
worker_rlimit_nofile 65535;
events {
worker_connections 32768;
# multi_accept on;
use epoll;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

View file

@ -0,0 +1,36 @@
https://manticoresearch.com/downloads/
```
wget https://github.com/manticoresoftware/manticoresearch/releases/download/3.4.0/manticore_3.4.0-200326-0686d9f0-release.buster_amd64-bin.deb
dpkg -i manticore_3.4.0-200326-0686d9f0-release.buster_amd64-bin.deb
```
```
# nano /etc/
index stat {
type = rt
rt_mem_limit = 1024M
rt_attr_uint = did
rt_attr_uint = rid
rt_attr_uint = token
rt_attr_timestamp = time
rt_field = tmp
path = /var/lib/manticore/data/stat
}
searchd {
listen = 127.0.0.1:9312
listen = 127.0.0.1:9306:mysql41
log = /var/log/manticore/searchd.log
query_log = /var/log/manticore/query.log
pid_file = /var/run/manticore/searchd.pid
binlog_path = /var/lib/manticore/data
}
```
```
systemctl enable manticore.service
systemctl start manticore.service
systemctl status manticore.service
```

106
install/mariadb.md Normal file
View file

@ -0,0 +1,106 @@
List of repositories https://downloads.mariadb.org/mariadb/repositories/
```
apt-get install software-properties-common dirmngr
apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
add-apt-repository 'deb [arch=amd64] http://mirror.rackspace.com/mariadb/repo/10.4/debian buster main'
apt-get update
apt-get install mariadb-server
mysql_secure_installation
mysql -uroot -p
```
MariaDB config
```
# nano /etc/mysql/my.cnf
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set = utf8mb4
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
malloc-lib = /usr/lib/x86_64-linux-gnu/libjemalloc.so.1
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
skip-networking
skip-name-resolve
# Other
default-storage-engine = INNODB
character-set-server = utf8mb4
max_connections = 100
wait_timeout = 7200
max_allowed_packet = 16M
skip-external-locking
open_files_limit = 16000
# MyISAM settings
key_buffer_size = 128M
# InnoDB settings
innodb_buffer_pool_size = 32G
innodb_buffer_pool_instances = 32
innodb_log_file_size = 1G
innodb_flush_log_at_trx_commit = 0
innodb_log_buffer_size = 16M
innodb_log_files_in_group = 2
innodb_flush_method = O_DIRECT
innodb_thread_concurrency = 16
# Buffer settings
join_buffer_size = 2M
# TMP & memory settings
tmp_table_size = 32M
max_heap_table_size = 32M
# Try off https://community.centminmod.com/threads/mysqltuner.6779/
query_cache_type = 0 # for OFF
query_cache_size = 0 # to ensure QC is NOT USED
# Slowlog settings
slow_query_log = 1
long_query_time = 5
slow_query_log_file = /var/log/mysql/mariadb-slow.log
#Set General Log
#general_log = on
#general_log_file = /var/log/mysql/full.log
[mysqldump]
# Do not buffer the whole result set in memory before writing it to
# file. Required for dumping very large tables
quick
max_allowed_packet = 32M
default-character-set = utf8mb4
[mysql]
no-auto-rehash
default-character-set = utf8mb4
[isamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 8M
write_buffer = 8M
default-character-set = utf8mb4
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!include /etc/mysql/mariadb.cnf
!includedir /etc/mysql/conf.d/
```

23
install/nginx.md Normal file
View file

@ -0,0 +1,23 @@
```
apt-get install nginx certbot
mkdir /etc/nginx/ssl/
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
chown www-data:www-data /etc/nginx/ssl/dhparam.pem
chmod 400 /etc/nginx/ssl/dhparam.pem
```
Create SSL certificate.
```
certbot certonly --webroot -w /var/www/html -d chaturbate100.com -m test@test.com --agree-tos
```
Update config files.
```
wget -O /etc/nginx/nginx.conf https://raw.githubusercontent.com/poiuty/chaturbate100.com/master/conf/nginx.conf
wget -O /etc/nginx/sites-available/default https://raw.githubusercontent.com/poiuty/chaturbate100.com/master/conf/default
```
```
systemctl restart nginx
systemctl status nginx
```

55
install/php.md Normal file
View file

@ -0,0 +1,55 @@
```
apt-get install php-cli php-fpm
apt-get install php-redis php-mysql php-xml php-json php-gd php-igbinary php-curl php-mbstring php-xml
```
```
# nano /etc/php/7.3/fpm/pool.d/www.conf
[www]
listen = /run/php/php7.3-fpm.sock
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
pm = static
pm.max_children = 50
pm.max_requests = 10000
chdir = /
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = On
php_admin_flag[report_memleaks] = On
php_admin_value[memory_limit] = 128M
php_admin_value[max_execution_time] = 30
php_admin_value[date.timezone] = "Europe/Moscow"
php_admin_value[upload_max_filesize] = 4M
php_admin_value[post_max_size] = 4M
php_admin_flag[display_errors] = Off
php_admin_flag[expose_php] = Off
php_admin_value[upload_tmp_dir] = "/tmp"
php_admin_value[opcache.enable] = 1
php_admin_value[opcache.interned_strings_buffer] = 8
php_admin_value[opcache.max_accelerated_files] = 4000
php_admin_value[session.gc_probability] = 1
php_admin_value[session.gc_divisor] = 1000
php_admin_value[session.gc_maxlifetime] = 2592000
php_admin_value[session.use_only_cookies] = 1
php_admin_value[session.save_handler] = redis
php_admin_value[session.serialize_handler] = igbinary
php_admin_value[session.save_path] = "unix:///var/run/redis/redis-server.sock?persistent=1&weight=1&database=0"
php_admin_value[disable_functions] = "apache_setenv, chown, chgrp, closelog, define_syslog_variables, dl, exec, ftp_exec, openlog, passthru, pcntl_exec, popen, posix_getegid, posix_geteuid, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, syslog, system, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority, shell_exec"
```
```
systemctl restart php7.3-fpm
systemctl status php7.3-fpm
```

16
install/python.md Normal file
View file

@ -0,0 +1,16 @@
Chaturbate.com use Cloudflare. Sometime get problem with human check.<br/>
Solution: https://github.com/VeNoMouS/cloudscraper
```
start cloudscraper => get cookie => use it when send requests.
```
Install.
```
apt-get install python-pip
pip install cloudscraper
```
Update.
```
pip install cloudscraper -U
```

12
install/redis.md Normal file
View file

@ -0,0 +1,12 @@
```
apt-get install redis-server
```
```
# nano /etc/redis/redis.conf
...
unixsocket /var/run/redis/redis-server.sock
unixsocketperm 777
...
```

View file

@ -0,0 +1,32 @@
CREATE DATABASE statbate;
USE statbate;
CREATE TABLE room
(
id Int32,
gender UInt8
) ENGINE = MySQL('127.0.0.1:3306', 'base', 'room', 'user', 'passwd');
CREATE TABLE stat
(
did UInt32,
rid UInt32,
token UInt32,
time Date,
INDEX a did TYPE bloom_filter() GRANULARITY 1,
INDEX b rid TYPE bloom_filter() GRANULARITY 1
)
ENGINE = MergeTree()
PARTITION BY toYYYYMMDD(time)
ORDER BY (time, rid, did)
PRIMARY KEY (time)
SETTINGS index_granularity = 8192;
#CREATE TABLE stat_buffer (
# did UInt32,
# rid UInt32,
# token UInt32,
# time Date
#)
#ENGINE = Buffer('statbate', 'stat', 16, 5, 30, 1000, 10000, 1000000, 10000000);

26
install/sql/stat.sql Normal file
View file

@ -0,0 +1,26 @@
CREATE TABLE `donator` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varbinary(30) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=binary ROW_FORMAT=DYNAMIC;
CREATE TABLE `room` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varbinary(30) NOT NULL,
`gender` tinyint(1) NOT NULL DEFAULT 0,
`fans` int(11) NOT NULL DEFAULT 0,
`last` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `gender` (`gender`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=binary ROW_FORMAT=DYNAMIC;
CREATE TABLE `stat` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`did` int(11) NOT NULL,
`rid` int(11) NOT NULL,
`token` int(11) NOT NULL,
`time` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=binary ROW_FORMAT=DYNAMIC;