From 6136e709c76c20fa67471264ddeb316f36ed68e6 Mon Sep 17 00:00:00 2001 From: zeldaroot Date: Mon, 14 Jun 2021 08:57:44 +0800 Subject: [PATCH] Fixed domain for index --- Dockerfile | 2 +- lib/CP_cron.js | 18 +++++++++--------- lib/CP_movies.js | 19 +++++++++++++------ modules/CP_api.js | 7 ++++--- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index f929e79..7676278 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,7 +53,7 @@ RUN set -o pipefail \ && echo -e "#!/bin/bash\nsleep \$((60 + RANDOM % 60));\n/usr/bin/cinemapress container reindex save >> /home/\${CP_DOMAIN}/log/backup_\$(date '+%d_%m_%Y').log;\nsleep \$((30 + RANDOM % 60));\n/usr/bin/cinemapress container backup create >> /home/\${CP_DOMAIN}/log/backup_\$(date '+%d_%m_%Y').log;\nrm -f /home/\${CP_DOMAIN}/log/cron_movies.pid;\nfind /home/\${CP_DOMAIN}/log -mindepth 1 -mtime +14 -delete;" \ > /etc/periodic/daily/backup \ && chmod a+x /etc/periodic/daily/backup \ - && echo -e "#!/bin/bash\n/usr/bin/cinemapress container cron >> /home/\${CP_DOMAIN}/log/cron_\$(date '+%d_%m_%Y').log" \ + && echo -e "#!/bin/bash\nsleep \$((RANDOM % 300));\n/usr/bin/cinemapress container cron >> /home/\${CP_DOMAIN}/log/cron_\$(date '+%d_%m_%Y').log" \ > /etc/periodic/hourly/cron \ && chmod a+x /etc/periodic/hourly/cron EXPOSE 3000 3306 diff --git a/lib/CP_cron.js b/lib/CP_cron.js index 5325f4c..8a7341c 100644 --- a/lib/CP_cron.js +++ b/lib/CP_cron.js @@ -10,7 +10,7 @@ setTimeout(function() { setTimeout(function() { return process.exit(0); }, 1000 * 60 * 2); -}, 1000 * 60 * 54); +}, 1000 * 60 * 52); /** * Node dependencies. @@ -133,7 +133,7 @@ if ( setTimeout(function() { active.num--; active.process.scraper = false; - }, 1000 * 60 * 55); + }, 1000 * 60 * 53); async.eachOfLimit( modules.content.data.scraper.split('\n'), @@ -412,7 +412,7 @@ if ( setTimeout(function() { active.num--; active.process.content = false; - }, 1000 * 60 * 55); + }, 1000 * 60 * 53); var task_groups = {}; modules.content.data.custom.forEach(function(task) { @@ -663,7 +663,7 @@ if ( setTimeout(function() { active.num--; active.process.episode = false; - }, 1000 * 60 * 55); + }, 1000 * 60 * 53); async.eachOfLimit( modules.episode.data.index.custom, @@ -1018,7 +1018,7 @@ if ( setTimeout(function() { active.num--; active.process.publish = false; - }, 1000 * 60 * 55); + }, 1000 * 60 * 53); process.env['CP_VER'] = new Date().getTime().toString(); @@ -1403,7 +1403,7 @@ if ( setTimeout(function() { active.num--; active.process.checkdomain = false; - }, 1000 * 60 * 55); + }, 1000 * 60 * 53); setTimeout(function() { request( @@ -1682,7 +1682,7 @@ if ( setTimeout(function() { active.num--; active.process.imap = false; - }, 1000 * 60 * 55); + }, 1000 * 60 * 53); var options_imap = JSON.stringify(modules.abuse.data.imap); options_imap = JSON.parse(options_imap); @@ -2109,7 +2109,7 @@ if (hour === 1 || hour === 2 || hour === 4 || hour === 5) { setTimeout(function() { active.num--; active.process.sitemap = false; - }, 1000 * 60 * 55); + }, 1000 * 60 * 53); var year_start = new Date(timeZone).getFullYear() + 10; var year_stop = 1890; @@ -2292,7 +2292,7 @@ if (hour === 6) { setTimeout(function() { active.num--; active.process.categories = false; - }, 1000 * 60 * 55); + }, 1000 * 60 * 53); var categories = ['year', 'genre', 'country', 'actor', 'director']; diff --git a/lib/CP_movies.js b/lib/CP_movies.js index 1450bec..284121a 100644 --- a/lib/CP_movies.js +++ b/lib/CP_movies.js @@ -2170,9 +2170,14 @@ if (Math.ceil(os.freemem()) < 50) { } connection.query( 'SELECT * FROM ' + - (task.page === 'xmlpipe2' ? 'xmlpipe2' : 'rt') + - '_' + - config.domain.replace(/[^a-z0-9]/g, '_') + + (task.page === 'xmlpipe2' + ? 'xmlpipe2_' + + config.domain.replace(/[^a-z0-9]/gi, '_') + : 'rt_' + + config.database.all_movies.replace( + /[^a-z0-9]/gi, + '_' + )) + ' WHERE ' + w + ' LIMIT 0,1 OPTION max_matches = 1', @@ -2184,9 +2189,11 @@ if (Math.ceil(os.freemem()) < 50) { } connection.query( 'SELECT * FROM ' + - 'rt' + - '_' + - config.domain.replace(/[^a-z0-9]/g, '_') + + ' rt_' + + config.database.all_movies.replace( + /[^a-z0-9]/gi, + '_' + ) + ' WHERE ' + w + ' LIMIT 0,1 OPTION max_matches = 1', diff --git a/modules/CP_api.js b/modules/CP_api.js index b962489..be02ec2 100644 --- a/modules/CP_api.js +++ b/modules/CP_api.js @@ -96,8 +96,9 @@ function movieApi(query, ip, callback) { connection.query( 'SELECT * ' + (as && as.length ? ', ' + as.join(',') : '') + - ' FROM rt_' + - config.domain.replace(/[^a-z0-9]/g, '_') + + ' FROM ' + + ' rt_' + + config.database.all_movies.replace(/[^a-z0-9]/gi, '_') + ' WHERE ' + Object.keys(query) .map(function(key) { @@ -176,7 +177,7 @@ function moviesApi(query, ip, callback) { } connection.query( 'SELECT *, 1 AS movie, custom.lastmod AS lastmod FROM rt_' + - config.domain.replace(/[^a-z0-9]/g, '_') + + config.database.all_movies.replace(/[^a-z0-9]/gi, '_') + ' WHERE ' + Object.keys(Object.assign(query, { movie: '1' })) .map(function(key) {