Fixed empty domain, fixed publish max id

This commit is contained in:
zeldaroot 2021-03-24 01:47:32 +02:00
parent ef9abb6724
commit 7649179b15
7 changed files with 123 additions and 46 deletions

View file

@ -1193,7 +1193,7 @@ option() {
printf "${C}---- ${G}2)${NC} update ${S}------------------- Upgrade CinemaPress System ${C}----\n"
printf "${C}---- ${G}3)${NC} backup ${S}-------------------- Backup System Master Data ${C}----\n"
printf "${C}---- ${G}4)${NC} theme ${S}------------- Install / Update Website Template ${C}----\n"
printf "${C}---- ${G}5)${NC} database ${S}------------- Import All Movies In The World ${C}----\n"
# printf "${C}---- ${G}5)${NC} database ${S}------------- Import All Movies In The World ${C}----\n"
printf "${C}---- ${G}6)${NC} https ${S}-------------- Getting Wildcard SSL Certificate ${C}----\n"
printf "${C}---- ${G}7)${NC} mirror ${S}------------------------- Moving To New Domain ${C}----\n"
printf "${C}---- ${G}8)${NC} remove ${S}---------------------------- Uninstall Website ${C}----\n"

View file

@ -348,6 +348,7 @@ function getAPI(url, callback) {
GM_xmlhttpRequest({
method: 'GET',
url: url,
timeout: 5000,
onload: function(response) {
if (response.readyState === 4 && response.status === 200) {
var result = {};

View file

@ -926,6 +926,12 @@ if (
config.publish.start = 298;
config.publish.stop = 10000000;
} else {
if (config.publish.start === 298) {
ids.start_id = 298;
}
if (config.publish.stop === 10000000) {
ids.stop_id = 10000000;
}
log = '[publish] New IDs: ' + ids.start_id + ' - ' + ids.stop_id;
config.publish.start = ids.start_id;
config.publish.stop = ids.stop_id;
@ -1450,9 +1456,15 @@ if (
}
if (danger) {
if (lang === 'ru') {
config.ru.botdomain = domains.bot.second + domains.bot.main;
config.ru.subdomain = domains.sub.second + domains.sub.main;
config.ru.bomain = domains.bot.domain;
config.ru.botdomain = config.ru.botdomain
? domains.bot.second + domains.bot.main
: config.ru.botdomain;
config.ru.subdomain = config.ru.subdomain
? domains.sub.second + domains.sub.main
: config.ru.subdomain;
config.ru.bomain = config.ru.bomain
? domains.bot.domain
: config.ru.bomain;
console.log(
'NEW RU SUBDOMAIN:',
@ -1463,9 +1475,15 @@ if (
config.ru.botdomain + domains.bot.domain
);
} else {
config.botdomain = domains.bot.second + domains.bot.main;
config.subdomain = domains.sub.second + domains.sub.main;
config.bomain = domains.bot.domain;
config.botdomain = config.botdomain
? domains.bot.second + domains.bot.main
: config.botdomain;
config.subdomain = config.subdomain
? domains.sub.second + domains.sub.main
: config.subdomain;
config.bomain = config.bomain
? domains.bot.domain
: config.bomain;
console.log(
'NEW SUBDOMAIN:',

View file

@ -178,7 +178,8 @@ if (Math.ceil(os.freemem()) < 50) {
task.page === 'realtime' ||
task.page === 'rt' ||
task.page === 'database' ||
task.page === 'db'
task.page === 'db' ||
task.page === 'xmlpipe2'
) {
CP_get.movies(
{ certainly: true },
@ -741,7 +742,8 @@ if (Math.ceil(os.freemem()) < 50) {
task.page === 'realtime' ||
task.page === 'rt' ||
task.page === 'database' ||
task.page === 'db'
task.page === 'db' ||
task.page === 'xmlpipe2'
)
) {
return callback();
@ -1060,8 +1062,24 @@ if (Math.ceil(os.freemem()) < 50) {
movie['title_ru'] = '';
}
}
if (movie['title_ru']) {
movie['title_ru'] = decodeEntities(movie['title_ru'] + '')
.replace(/\n\r/g, ' ')
.replace(/\n/g, ' ')
.replace(/\r/g, ' ')
.replace(/\s+/g, ' ')
.replace(/(^\s*)|(\s*)$/g, '');
}
if (movie['title_en']) {
movie['title_en'] = decodeEntities(movie['title_en'] + '')
.replace(/\n\r/g, ' ')
.replace(/\n/g, ' ')
.replace(/\r/g, ' ')
.replace(/\s+/g, ' ')
.replace(/(^\s*)|(\s*)$/g, '');
}
if (movie['description']) {
movie['description'] = (movie['description'] + '')
movie['description'] = decodeEntities(movie['description'] + '')
.replace(/\n\r/g, ' ')
.replace(/\n/g, ' ')
.replace(/\r/g, ' ')
@ -1492,7 +1510,9 @@ if (Math.ceil(os.freemem()) < 50) {
return callback();
}
connection.query(
'SELECT * FROM rt_' +
'SELECT * FROM ' +
(task.page === 'xmlpipe2' ? 'xmlpipe2' : 'rt') +
'_' +
config.domain.replace(/[^a-z0-9]/g, '_') +
' WHERE ' +
w +
@ -1704,15 +1724,45 @@ if (Math.ceil(os.freemem()) < 50) {
current_movie
);
[
'year',
'rating',
'vote',
'kp_rating',
'kp_vote',
'imdb_rating',
'imdb_vote',
'premiere'
['rating', 'vote'],
['kp_rating', 'kp_vote'],
['imdb_rating', 'imdb_vote']
].forEach(function(attr_uint) {
var parse_rating =
(typeof parse_movie[attr_uint[0]] !== 'undefined' &&
parse_movie[attr_uint[0]] &&
parseFloat(parse_movie[attr_uint[0]])) ||
0;
var current_vote =
(typeof current_movie[attr_uint[1]] !== 'undefined' &&
current_movie[attr_uint[1]] &&
parseFloat(current_movie[attr_uint[1]])) ||
0;
var parse_vote =
(typeof parse_movie[attr_uint[1]] !== 'undefined' &&
parse_movie[attr_uint[1]] &&
parseFloat(parse_movie[attr_uint[1]])) ||
0;
if (
!parse_vote ||
!current_vote ||
current_vote > parse_vote
) {
return;
}
if (parse_rating && parse_rating > 100) {
parse_rating = 0;
}
if (!parse_rating) {
return;
}
if (parse_rating < 10) {
parse_rating = parseInt(parse_rating * 10 + '');
}
update_movie[attr_uint[0]] = parse_rating;
update_movie[attr_uint[1]] = parse_vote;
});
['year', 'premiere'].forEach(function(attr_uint) {
var current =
(typeof current_movie[attr_uint] !== 'undefined' &&
current_movie[attr_uint] &&
@ -1723,30 +1773,7 @@ if (Math.ceil(os.freemem()) < 50) {
parse_movie[attr_uint] &&
parseFloat(parse_movie[attr_uint])) ||
0;
if (
attr_uint === 'rating' ||
attr_uint === 'kp_rating' ||
attr_uint === 'imdb_rating'
) {
if (parse && parse > 100) {
parse = 0;
}
if (!parse) {
return;
}
if (parse < 10) {
parse = parseInt(parse * 10 + '');
}
update_movie[attr_uint] = parse;
return;
}
if (
attr_uint === 'year' ||
attr_uint === 'premiere' ||
attr_uint === 'vote' ||
attr_uint === 'kp_vote' ||
attr_uint === 'imdb_vote'
) {
if (attr_uint === 'year' || attr_uint === 'premiere') {
parse = parseInt(parse + '');
}
if (parse > current) {
@ -1909,3 +1936,27 @@ function tryParseJSON(jsonString) {
} catch (e) {}
return null;
}
/**
* Decode entities.
*
*/
function decodeEntities(encodedString) {
var translate_re = /&(nbsp|amp|quot|lt|gt);/g;
var translate = {
nbsp: ' ',
amp: '&',
quot: '"',
lt: '<',
gt: '>'
};
return encodedString
.replace(translate_re, function(match, entity) {
return translate[entity];
})
.replace(/&#(\d+);/gi, function(match, numStr) {
var num = parseInt(numStr, 10);
return String.fromCharCode(num);
});
}

View file

@ -538,6 +538,10 @@ router.get('/:level1?/:level2?/:level3?/:level4?', function(req, res, next) {
});
}
if (req.userinfo.bot.main) {
res.header('X-Robots-Tag', 'noarchive');
}
if (typeof render === 'object') {
if (
config.theme === 'default' ||

View file

@ -632,6 +632,9 @@
<% } %>
</select>
</div>
<div class="col-sm-1 text-center">
<i class="fas fa-eye" style="vertical-align: bottom;"></i>
</div>
<div class="col-sm-4">
<select name="modules.episode.data.index.count"
class="form-control without">
@ -660,8 +663,8 @@
<% } %>
</select>
</div>
<div class="col-sm-2 text-center">
/
<div class="col-sm-1 text-center">
<i class="fas fa-eye-slash" style="vertical-align: bottom;"></i>
</div>
<div class="col-sm-4">
<select name="modules.episode.data.index.max"

View file

@ -873,7 +873,7 @@
<tbody>
<% config.movies.cron.forEach(function(data, num) { %>
<% var d = data.replace(/\s*~\s*/g, '~').split('~'); %>
<% if (d.length < 6) return; %>
<% if (d.length < 5) return; %>
<% if (data.charAt(0) === '#') {
var custom_div = 'no-active';
} %>