handle annoyances
This commit is contained in:
parent
e48a0ce5a6
commit
82443b8d32
|
@ -69,4 +69,12 @@ trait StringHelper { self: NumberHelper =>
|
|||
}
|
||||
}
|
||||
def splitNumber(s: Html)(implicit ctx: UserContext): Html = splitNumber(s.body)
|
||||
|
||||
def base64encode(str: String) = {
|
||||
import java.util.Base64
|
||||
import java.nio.charset.StandardCharsets
|
||||
Base64.getEncoder.encodeToString(str getBytes StandardCharsets.UTF_8)
|
||||
}
|
||||
|
||||
def encodeFen(fen: String) = base64encode(fen).reverse
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
<div
|
||||
class="mini_board parse_fen is2d"
|
||||
data-playable="1"
|
||||
data-moves="@Json.stringify(Json.toJson(captcha.moves))"
|
||||
data-color="@captcha.white.fold("white", "black")"
|
||||
data-fen="@captcha.fen">@miniBoardContent</div>
|
||||
data-x="@encodeFen(Json.stringify(Json.toJson(captcha.moves)))"
|
||||
data-y="@encodeFen(captcha.white.fold("white", "black"))"
|
||||
data-z="@encodeFen(captcha.fen)">@miniBoardContent</div>
|
||||
</div>
|
||||
<div class="checkmateSection">
|
||||
<label>
|
||||
|
|
|
@ -26,9 +26,9 @@ object HTTPRequest {
|
|||
def sid(req: RequestHeader): Option[String] = req.session get "sid"
|
||||
|
||||
private val isBotPattern = {
|
||||
"""(?i).*(googlebot|googlebot-mobile|googlebot-image|mediapartners-google|bingbot|slurp|java|wget|curl|commons-httpclient|python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|adidxbot|blekkobot|teoma|ia_archiver|gingercrawler|webmon|httrack|webcrawler|fast-webcrawler|fastenterprisecrawler|convera|biglotron|grub.org|usinenouvellecrawler|antibot|netresearchserver|speedy|fluffy|jyxobot|bibnum.bnf|findlink|exabot|gigabot|msrbot|seekbot|ngbot|panscient|yacybot|aisearchbot|ioi|ips-agent|tagoobot|mj12bot|dotbot|woriobot|yanga|buzzbot|mlbot|purebot|lingueebot|""" +
|
||||
"""voyager|cyberpatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|ezooms|dotbot|mail.ru|discobot|heritrix|findthatfile|europarchive.org|nerdbynature.bot|sistrixcrawler|ahrefsbot|aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|yeti|retrevopageanalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|duckduckbot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnamgnamspider|web-archive-net.com.bot|backlinkcrawler|""" +
|
||||
"""coccoc|integromedb|contentcrawlerspider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|wesee:search|niki-bot|crystalsemanticsbot|rogerbot|360spider|psbot|interfaxscanbot|lipperheyseoservice|ccmetadatascaper|g00g1e.net|grapeshotcrawler|urlappendbot|brainobot|fr-crawler|binlar|simplecrawler|simplecrawler|livelapbot|twitterbot|cxensebot|smtbot|facebookexternalhit).*"""
|
||||
"""(?i).*(googlebot|googlebot-mobile|googlebot-image|mediapartners-google|bingbot|slurp|java|wget|curl|commons-httpclient|python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|adidxbot|blekkobot|teoma|ia_archiver|gingercrawler|webmon|httrack|webcrawler|fast-webcrawler|fastenterprisecrawler|convera|biglotron|grub\.org|usinenouvellecrawler|antibot|netresearchserver|speedy|fluffy|jyxobot|bibnum\.bnf|findlink|exabot|gigabot|msrbot|seekbot|ngbot|panscient|yacybot|aisearchbot|ioi|ips-agent|tagoobot|mj12bot|dotbot|woriobot|yanga|buzzbot|mlbot|purebot|lingueebot|""" +
|
||||
"""voyager|cyberpatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|ezooms|dotbot|mail\.ru|discobot|zombie\.js|heritrix|findthatfile|europarchive\.org|nerdbynature\.bot|sistrixcrawler|ahrefsbot|aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|yeti|retrevopageanalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|duckduckbot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnamgnamspider|web-archive-net\.com\.bot|backlinkcrawler|""" +
|
||||
"""coccoc|integromedb|contentcrawlerspider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler\.com|siteexplorer\.info|elisabot|proximic|changedetection|blexbot|arabot|wesee:search|niki-bot|crystalsemanticsbot|rogerbot|360spider|psbot|interfaxscanbot|lipperheyseoservice|ccmetadatascaper|g00g1e\.net|grapeshotcrawler|urlappendbot|brainobot|fr-crawler|binlar|simplecrawler|simplecrawler|livelapbot|twitterbot|cxensebot|smtbot|facebookexternalhit).*"""
|
||||
}.r.pattern
|
||||
|
||||
def isBot(req: RequestHeader): Boolean = userAgent(req) ?? { ua =>
|
||||
|
|
|
@ -508,6 +508,10 @@ lichess.storage = {
|
|||
location.reload();
|
||||
};
|
||||
|
||||
lichess.readServerFen = function(t) {
|
||||
return atob(t.split("").reverse().join(""));
|
||||
};
|
||||
|
||||
lichess.parseFen = function($elem) {
|
||||
if (!$elem || !$elem.jquery) {
|
||||
$elem = $('.parse_fen');
|
||||
|
@ -516,14 +520,14 @@ lichess.storage = {
|
|||
var $this = $(this).removeClass('parse_fen');
|
||||
var lm = $this.data('lastmove');
|
||||
var lastMove = lm ? [lm[0] + lm[1], lm[2] + lm[3]] : [];
|
||||
var color = $this.data('color');
|
||||
var color = $this.data('color') || lichess.readServerFen($(this).data('y'));
|
||||
var ground = $this.data('chessground');
|
||||
var playable = $this.data('playable');
|
||||
var config = {
|
||||
coordinates: false,
|
||||
viewOnly: !playable,
|
||||
minimalDom: !playable,
|
||||
fen: $this.data('fen'),
|
||||
fen: $this.data('fen') || lichess.readServerFen($this.data('z')),
|
||||
lastMove: lastMove
|
||||
};
|
||||
if (color) config.orientation = color;
|
||||
|
@ -1439,15 +1443,14 @@ lichess.storage = {
|
|||
var $captcha = $(this);
|
||||
var $board = $captcha.find('.mini_board');
|
||||
var $input = $captcha.find('input').val('');
|
||||
var color = $board.data('color');
|
||||
var cg = $board.data('chessground');
|
||||
|
||||
$board.data('chessground').set({
|
||||
orientation: color,
|
||||
turnColor: color,
|
||||
cg.set({
|
||||
turnColor: cg.getOrientation(),
|
||||
movable: {
|
||||
free: false,
|
||||
dests: $board.data('moves'),
|
||||
color: color,
|
||||
dests: JSON.parse(lichess.readServerFen($board.data('x'))),
|
||||
color: cg.getOrientation(),
|
||||
coordinates: false,
|
||||
events: {
|
||||
after: function(orig, dest) {
|
||||
|
@ -2035,7 +2038,11 @@ lichess.storage = {
|
|||
$('#refreshAssessment').click(function() {
|
||||
$.post('/mod/refreshAssess', {
|
||||
assess: data.game.id,
|
||||
success: function(){ setTimeout(function(){ location.reload(); }, 500) }
|
||||
success: function() {
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 500)
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue