shugoi 0.1.9 → 0.2.0
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 +36 -26
- 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: bb399ab3d75413beea51021d09dba771d642cdeae0b6ebd08dee8cb9f43ebec9
|
|
4
|
+
data.tar.gz: 39a2adb0773270d1bf1712a2626b8875c95758dee55eaeb7d179353a32518d50
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c9cd4918e288e14437d0c5c5bc5b7068fb63b84a9d4a56989525d45dbbcce8e10d1a9fd08d4d013d6ed0ff670d12acd679133e3b4b43a9b04147bcb3f53e616
|
|
7
|
+
data.tar.gz: de83aeafd3d23b27cc4d60a5ff23325c81940c2fe8102a8d6c54e9f688c683876940bb0fbef001ddbc63b52c1c27a5af4ba3672df91bbdc6d97e767d5c6a8f7d
|
data/lib/shugoi/notice.rb
CHANGED
|
@@ -9,8 +9,10 @@ module Shugoi
|
|
|
9
9
|
# Script renforcé (parité avec guard.src.js du site Node, audit §8.5.3) :
|
|
10
10
|
# - overlay bloquant z-index max
|
|
11
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
|
|
13
|
-
#
|
|
12
|
+
# - MutationObserver anti-bypass COMPLET : ré-affiche la notice si elle est retirée
|
|
13
|
+
# du DOM, et RESTAURE intégralement son style ET son innerHTML s'ils sont modifiés
|
|
14
|
+
# (devtools / manipulation JS du style, des attributs, du texte, du contenu).
|
|
15
|
+
# L'overlay est reconstruit à partir du template si un élément clé manque.
|
|
14
16
|
# - obligation d'accepter (bouton OK) pour déverrouiller — l'ack est serveur (mid).
|
|
15
17
|
# Les placeholders `mid` et `sk` sont remplacés à l'injection.
|
|
16
18
|
SCRIPT = <<~'JS'
|
|
@@ -21,40 +23,48 @@ module Shugoi
|
|
|
21
23
|
if(!mid||!sk||window.__sg_noticeEnabled===false)return;
|
|
22
24
|
var base=window.__sg_baseUrl||'';
|
|
23
25
|
var origin=base.replace(/\/api\/v1\/?$/,'');
|
|
26
|
+
var _OVERLAY_CSS='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';
|
|
27
|
+
var _CARD_CSS='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';
|
|
28
|
+
var _CARD_HTML='<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>';
|
|
24
29
|
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){}}
|
|
25
30
|
function buildOverlay(){
|
|
26
|
-
var o=document.createElement('div');o.id='__sg_o';
|
|
27
|
-
|
|
28
|
-
|
|
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
|
+
var o=document.createElement('div');o.id='__sg_o';o.style.cssText=_OVERLAY_CSS;
|
|
32
|
+
var c=document.createElement('div');c.id='__sg_cd';c.style.cssText=_CARD_CSS;
|
|
33
|
+
c.innerHTML=_CARD_HTML;
|
|
31
34
|
o.appendChild(c);return o;
|
|
32
35
|
}
|
|
36
|
+
function okHandler(keepMo){ack();var el=document.getElementById('__sg_o');if(el&&el.parentNode)el.parentNode.removeChild(el);document.body.style.overflow='';document.documentElement.style.overflow='';if(keepMo===true){try{mo.disconnect()}catch(e){}}}
|
|
37
|
+
function rebindOk(){var b=document.getElementById('__sg_ok');if(b)b.onclick=function(){okHandler(true)};}
|
|
38
|
+
function enforce(){
|
|
39
|
+
var o=document.getElementById('__sg_o');
|
|
40
|
+
if(!o){
|
|
41
|
+
document.documentElement.appendChild(buildOverlay());
|
|
42
|
+
document.body.style.overflow='hidden';document.documentElement.style.overflow='hidden';
|
|
43
|
+
rebindOk();return;
|
|
44
|
+
}
|
|
45
|
+
if(o.style.cssText!==_OVERLAY_CSS)o.style.cssText=_OVERLAY_CSS;
|
|
46
|
+
var c=document.getElementById('__sg_cd');
|
|
47
|
+
if(!c){
|
|
48
|
+
// card supprimée → reconstruit l'overlay entier
|
|
49
|
+
var fresh=buildOverlay();o.innerHTML='';o.appendChild(fresh.childNodes[0]);
|
|
50
|
+
document.body.style.overflow='hidden';document.documentElement.style.overflow='hidden';rebindOk();return;
|
|
51
|
+
}
|
|
52
|
+
if(c.style.cssText!==_CARD_CSS)c.style.cssText=_CARD_CSS;
|
|
53
|
+
if(c.innerHTML!==_CARD_HTML){c.innerHTML=_CARD_HTML;rebindOk();}
|
|
54
|
+
if(document.body.style.overflow!=='hidden')document.body.style.overflow='hidden';
|
|
55
|
+
if(document.documentElement.style.overflow!=='hidden')document.documentElement.style.overflow='hidden';
|
|
56
|
+
}
|
|
57
|
+
var mo=null;
|
|
33
58
|
function show(){
|
|
34
|
-
|
|
35
|
-
document.documentElement.appendChild(ov);
|
|
59
|
+
document.documentElement.appendChild(buildOverlay());
|
|
36
60
|
var sp=window.scrollY||window.pageYOffset||0;
|
|
37
61
|
document.body.style.overflow='hidden';document.documentElement.style.overflow='hidden';
|
|
38
62
|
window.addEventListener('scroll',function(){window.scrollTo(0,sp)}, {passive:false});
|
|
39
63
|
window.addEventListener('touchmove',function(e){e.preventDefault()},{passive:false});
|
|
40
64
|
window.addEventListener('wheel',function(e){e.preventDefault()},{passive:false});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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']});
|
|
65
|
+
rebindOk();
|
|
66
|
+
mo=new MutationObserver(function(){enforce();});
|
|
67
|
+
mo.observe(document.documentElement,{childList:true,subtree:true,attributes:true,characterData:true,attributeFilter:['style','class','id']});
|
|
58
68
|
}
|
|
59
69
|
function init(){if(document.body)show();else if(document.addEventListener)document.addEventListener('DOMContentLoaded',show);else setTimeout(init,50)}
|
|
60
70
|
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()});
|
data/lib/shugoi/version.rb
CHANGED