Skip to content

Commit

Permalink
feat(gifts): replacer detection logic
Browse files Browse the repository at this point in the history
  • Loading branch information
onetdev committed Nov 27, 2024
1 parent 14cc50f commit 8454a21
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Binary file added public/ads/ad-458x80.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
10 changes: 7 additions & 3 deletions src/features/gifts/hooks/useAdblockerDetector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ import { useRuntimeStore } from '@/lib/state/runtime';
import { fetchWithTimeout } from '@/lib/utils/network';

const testFileLoader = async () => {
// In head mode without initialisation adsense should not touch cookies
// and local storage either
const url = ' https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
// const url = 'ads/ads.js'

try {
const result = await fetchWithTimeout('/ads.js', {
const result = await fetchWithTimeout(url, {
method: 'HEAD',
});

const contentLength = result.headers.get('content-length');

console.log(contentLength);
return contentLength === null || !(parseInt(contentLength) > 166);
return contentLength === null || parseInt(contentLength) > 6666;
} catch {
return false;
}
Expand Down

0 comments on commit 8454a21

Please sign in to comment.