1// Issue #1888 -- Cloudflare Turnstile RN (React Native) istemcisi icin widget sayfasi 2// (TurnstileController.Mobile -> Views/Turnstile/Mobile.cshtml). Bu script bir RN WebView 3// icinde calisir; sonuc window.ReactNativeWebView.postMessage ile JSON string olarak RN 4// tarafina tasinir (bkz. Croone.TCGSepeti.Mobile/src/components/TurnstileGate.tsx). 5// 6// Mesaj sekli: { type: 'turnstile', token: string|null, reason?: 'error'|'expired'|'disabled' } 7// 8// MAJ-3 (#1888 review) -- ayrica { type: 'turnstile', event: 'interactive' } / 9// { type: 'turnstile', event: 'interactive-resolved' } mesajlari: Cloudflare `interaction-only` 10// gorunumde bile ARA SIRA gercek bir GORSEL/interaktif challenge (checkbox/puzzle) isteyebilir. 11// Bu olduÄunda widget'in kendisi (data-appearance) GORUNMEZ KALIR -- before/after-interactive 12// callback'leri RN'e "kullaniciya gorunur bir kutu goster/gizle" sinyalini tasir (TurnstileGate.tsx 13// bu sinyale gore hidden<->gorunur moda gecer). 14(function () { 15 function postToReactNative(payload) { 16 if (window.ReactNativeWebView && typeof window.ReactNativeWebView.postMessage === 'function') { 17 window.ReactNativeWebView.postMessage(JSON.stringify(payload)); 18 } 19 } 20 21 var root = document.getElementById('turnstileMobileRoot'); 22 var enabled = !!root && root.getAttribute('data-turnstile-enabled') === 'true'; 23 24 if (!enabled) { 25 // SiteKey bos -- anahtarlar henuz yok / widget kapali. Fail-open: token olmadan devam. 26 postToReactNative({ type: 'turnstile', token: null, reason: 'disabled' }); 27 return; 28 } 29 30 // Cloudflare'in api.js'i .cf-turnstile div'inin data-callback/data-error-callback/ 31 // data-expired-callback attribute'lariyla bu global fonksiyonlari cagirir. 32 window.onTurnstileSuccess = function (token) { 33 postToReactNative({ type: 'turnstile', token: token }); 34 }; 35 window.onTurnstileError = function () { 36 postToReactNative({ type: 'turnstile', token: null, reason: 'error' }); 37 }; 38 window.onTurnstileExpired = function () { 39 postToReactNative({ type: 'turnstile', token: null, reason: 'expired' }); 40 }; 41 // MAJ-3 (#1888 review) -- Cloudflare bu iki callback'i yalniz GERCEKTEN interaktif bir 42 // challenge gosterecegi/gosterdikten SONRA kapatacagi zaman cagirir (sessiz dogrulamalarda 43 // hic tetiklenmezler). 44 window.onTurnstileBeforeInteractive = function () { 45 postToReactNative({ type: 'turnstile', event: 'interactive' }); 46 }; 47 window.onTurnstileAfterInteractive = function () { 48 postToReactNative({ type: 'turnstile', event: 'interactive-resolved' }); 49 }; 50})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.