@astronox/core 0.5.1 → 0.5.2
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.
package/package.json
CHANGED
|
@@ -54,27 +54,18 @@ const adBlockingStorageKey = adBlockingRecovery?.storageKey ?? '';
|
|
|
54
54
|
storageAvailable = false;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
let cooldownActive =
|
|
58
58
|
storedTimestamp !== undefined &&
|
|
59
59
|
now - storedTimestamp < adBlockingRedisplayIntervalMs;
|
|
60
|
-
let adBlockingAuthorized = false;
|
|
61
|
-
let blockerConfirmed = false;
|
|
62
|
-
let timestampPersisted = false;
|
|
63
60
|
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
!blockerConfirmed ||
|
|
70
|
-
timestampPersisted
|
|
71
|
-
) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
61
|
+
const startCooldown = () => {
|
|
62
|
+
if (cooldownActive) return;
|
|
63
|
+
|
|
64
|
+
cooldownActive = true;
|
|
65
|
+
if (!storageAvailable) return;
|
|
74
66
|
|
|
75
67
|
try {
|
|
76
68
|
window.localStorage.setItem(adBlockingStorageKey, String(Date.now()));
|
|
77
|
-
timestampPersisted = true;
|
|
78
69
|
} catch {
|
|
79
70
|
storageAvailable = false;
|
|
80
71
|
}
|
|
@@ -94,40 +85,9 @@ const adBlockingStorageKey = adBlockingRecovery?.storageKey ?? '';
|
|
|
94
85
|
return;
|
|
95
86
|
}
|
|
96
87
|
|
|
97
|
-
|
|
88
|
+
startCooldown();
|
|
98
89
|
message.proceed(true);
|
|
99
|
-
persistAuthorizationTimestamp();
|
|
100
90
|
};
|
|
101
|
-
|
|
102
|
-
googlefc.callbackQueue.push({
|
|
103
|
-
AD_BLOCK_DATA_READY: () => {
|
|
104
|
-
if (
|
|
105
|
-
typeof googlefc.getAdBlockerStatus !== 'function' ||
|
|
106
|
-
!googlefc.AdBlockerStatusEnum
|
|
107
|
-
) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const status = googlefc.getAdBlockerStatus();
|
|
112
|
-
if (typeof status !== 'number' || !Number.isFinite(status)) return;
|
|
113
|
-
|
|
114
|
-
const statusEnum = googlefc.AdBlockerStatusEnum;
|
|
115
|
-
const blockerStatuses = new Set(
|
|
116
|
-
[
|
|
117
|
-
statusEnum.EXTENSION_AD_BLOCKER,
|
|
118
|
-
statusEnum.EXTENSION_LEVEL_AD_BLOCKER,
|
|
119
|
-
statusEnum.NETWORK_LEVEL_AD_BLOCKER,
|
|
120
|
-
].filter(
|
|
121
|
-
(value) => typeof value === 'number' && Number.isFinite(value),
|
|
122
|
-
),
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
if (!blockerStatuses.has(status)) return;
|
|
126
|
-
|
|
127
|
-
blockerConfirmed = true;
|
|
128
|
-
persistAuthorizationTimestamp();
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
91
|
}
|
|
132
92
|
|
|
133
93
|
if (!publisherLauncher) return;
|