shugoi 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/shugoi/notice.rb +43 -6
- data/lib/shugoi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 57af2589f751921668ed5444bed4c38fd230e4d2b97346629aa28ab85313c8e9
|
|
4
|
+
data.tar.gz: b34cfb5c8b185259261fb33f2e798782cd61c06cacc21bf3a1c915fe477608a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 51d6629d86a0a08bef6df1a16ee184da3794490612288e4538edb05a3be819c4ce21d39c1be5ec6613ad167faecfe42620f88aa26e150fe693dbc121c0771aa5
|
|
7
|
+
data.tar.gz: 229d20994bf9cd834675c800ebc13e9b5bd974083b72811073b396939dd8d3e9b377fe369f1e1c97417c87782e209f9dfbe9811c52adff8468317c979ad1cdb9
|
data/lib/shugoi/notice.rb
CHANGED
|
@@ -6,9 +6,13 @@ module Shugoi
|
|
|
6
6
|
# dans le HTML APRÈS le split-render (elle ne disparaît pas quand le render remplace
|
|
7
7
|
# le document). L'ack est décidé côté SERVEUR via /notice (machineId), pas de cookie.
|
|
8
8
|
class Notice
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
9
|
+
# Script renforcé (parité avec guard.src.js du site Node, audit §8.5.3) :
|
|
10
|
+
# - overlay bloquant z-index max
|
|
11
|
+
# - verrouillage scroll/wheel/touchmove tant que la notice est affichée
|
|
12
|
+
# - MutationObserver anti-bypass : ré-affiche la notice si elle est retirée du DOM,
|
|
13
|
+
# cachée (display/visibility/opacity), et re-verrouille le scroll.
|
|
14
|
+
# - obligation d'accepter (bouton OK) pour déverrouiller — l'ack est serveur (mid).
|
|
15
|
+
# Les placeholders `mid` et `sk` sont remplacés à l'injection.
|
|
12
16
|
SCRIPT = <<~'JS'
|
|
13
17
|
<script>
|
|
14
18
|
(function(){
|
|
@@ -18,9 +22,42 @@ module Shugoi
|
|
|
18
22
|
var base=window.__sg_baseUrl||'';
|
|
19
23
|
var origin=base.replace(/\/api\/v1\/?$/,'');
|
|
20
24
|
function ack(){try{fetch(base+'/notice',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({machineId:mid,siteKey:sk}),keepalive:true,signal:AbortSignal.timeout(4000)}).catch(function(){})}catch(e){}}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
function buildOverlay(){
|
|
26
|
+
var o=document.createElement('div');o.id='__sg_o';
|
|
27
|
+
o.style.cssText='position:fixed!important;inset:0!important;z-index:2147483647!important;background:rgba(0,0,0,.6)!important;display:flex!important;align-items:center!important;justify-content:center!important;padding:1.2rem!important';
|
|
28
|
+
var c=document.createElement('div');c.id='__sg_cd';
|
|
29
|
+
c.style.cssText='background:#fff!important;border:4px solid #000!important;border-radius:28px 6px 32px 10px!important;box-shadow:14px 14px 0 #000!important;padding:0!important;max-width:720px!important;width:100%!important;text-align:center!important;font-family:Arial,sans-serif!important;display:flex!important;overflow:hidden!important';
|
|
30
|
+
c.innerHTML='<div style="flex:0 0 320px;display:flex;align-items:center;justify-content:center;padding:1.5rem 1rem 1.5rem 3rem;overflow:hidden"><img src="'+origin+'/favicon.png" alt="" style="width:100%;height:auto;max-width:220px;pointer-events:none"></div><div style="flex:1;padding:1.6rem 1.8rem;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center"><img src="'+origin+'/brand-block.png" alt="Shugoi" style="display:block;margin:0 0 .3rem;pointer-events:none;max-width:100%;height:auto;max-height:40px"><div style="border:2px solid #000;display:inline-block;border-radius:8px 2px 12px 4px;padding:.2rem .6rem;font-size:.5rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:#E87090;margin-bottom:.6rem">Protection anti-abus</div><p style="font-size:.8rem;color:#555;line-height:1.7;margin:0 .4rem .6rem;max-width:280px">Ce site utilise Shugoi pour se protéger contre les abus et la fraude. Des caractéristiques techniques de votre navigateur sont analysées pour détecter les scripts automatisés, Tor, les VPN et les environnements virtuels. Aucune donnée personnelle n\\'est collectée.</p><button id="__sg_ok" style="background:#E87090;color:#fff;border:3px solid #000;border-radius:12px 3px 14px 5px;padding:.35rem 1.4rem;font-size:.8rem;font-weight:700;cursor:pointer">OK</button><div style="margin-top:.5rem;font-size:.5rem;color:#ccc"><a href="'+origin+'/legal/shugoi-notice" target="_blank" style="color:#E87090;text-decoration:underline">En savoir plus · shugoi.com</a></div></div>';
|
|
31
|
+
o.appendChild(c);return o;
|
|
32
|
+
}
|
|
33
|
+
function show(){
|
|
34
|
+
var ov=buildOverlay();
|
|
35
|
+
document.documentElement.appendChild(ov);
|
|
36
|
+
var sp=window.scrollY||window.pageYOffset||0;
|
|
37
|
+
document.body.style.overflow='hidden';document.documentElement.style.overflow='hidden';
|
|
38
|
+
window.addEventListener('scroll',function(){window.scrollTo(0,sp)}, {passive:false});
|
|
39
|
+
window.addEventListener('touchmove',function(e){e.preventDefault()},{passive:false});
|
|
40
|
+
window.addEventListener('wheel',function(e){e.preventDefault()},{passive:false});
|
|
41
|
+
function okHandler(){ack();var el=document.getElementById('__sg_o');if(el&&el.parentNode)el.parentNode.removeChild(el);document.body.style.overflow='';document.documentElement.style.overflow='';try{mo.disconnect()}catch(e){}}
|
|
42
|
+
var _sgOk=document.getElementById('__sg_ok');if(_sgOk)_sgOk.onclick=okHandler;
|
|
43
|
+
var mo=new MutationObserver(function(){
|
|
44
|
+
var o=document.getElementById('__sg_o');
|
|
45
|
+
if(!o){
|
|
46
|
+
document.documentElement.appendChild(buildOverlay());
|
|
47
|
+
document.body.style.overflow='hidden';document.documentElement.style.overflow='hidden';
|
|
48
|
+
var _ok2=document.getElementById('__sg_ok');if(_ok2)_ok2.onclick=okHandler;
|
|
49
|
+
}else{
|
|
50
|
+
if(o.style.display==='none')o.style.display='flex';
|
|
51
|
+
if(o.style.visibility==='hidden')o.style.visibility='visible';
|
|
52
|
+
if(parseFloat(o.style.opacity||'1')<0.5)o.style.opacity='1';
|
|
53
|
+
if(document.body.style.overflow!=='hidden')document.body.style.overflow='hidden';
|
|
54
|
+
if(document.documentElement.style.overflow!=='hidden')document.documentElement.style.overflow='hidden';
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
mo.observe(document.documentElement,{childList:true,subtree:true,attributes:true,attributeFilter:['style','class','id']});
|
|
58
|
+
}
|
|
59
|
+
function init(){if(document.body)show();else if(document.addEventListener)document.addEventListener('DOMContentLoaded',show);else setTimeout(init,50)}
|
|
60
|
+
fetch(base+'/notice?machineId='+encodeURIComponent(mid)+'&siteKey='+encodeURIComponent(sk),{signal:AbortSignal.timeout(4000)}).then(function(r){return r.json()}).then(function(d){if(!d.acknowledged)init()}).catch(function(){init()});
|
|
24
61
|
})();
|
|
25
62
|
</script>
|
|
26
63
|
JS
|
data/lib/shugoi/version.rb
CHANGED