nodebb-plugin-pdf-secure 1.2.1 → 1.2.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 +1 -1
- package/static/viewer.html +6 -62
package/package.json
CHANGED
package/static/viewer.html
CHANGED
|
@@ -3143,14 +3143,10 @@
|
|
|
3143
3143
|
}
|
|
3144
3144
|
}, true);
|
|
3145
3145
|
|
|
3146
|
-
// 2. Block context menu (right-click)
|
|
3146
|
+
// 2. Block context menu (right-click) - EVERYWHERE
|
|
3147
3147
|
document.addEventListener('contextmenu', function (e) {
|
|
3148
|
-
// Allow our custom context menu for annotations
|
|
3149
|
-
if (e.target.closest('.annotationLayer') || e.target.closest('.pdfViewer')) {
|
|
3150
|
-
// Keep custom context menu behavior
|
|
3151
|
-
return;
|
|
3152
|
-
}
|
|
3153
3148
|
e.preventDefault();
|
|
3149
|
+
e.stopPropagation();
|
|
3154
3150
|
return false;
|
|
3155
3151
|
}, true);
|
|
3156
3152
|
|
|
@@ -3172,41 +3168,14 @@
|
|
|
3172
3168
|
return false;
|
|
3173
3169
|
}, true);
|
|
3174
3170
|
|
|
3175
|
-
// 5.
|
|
3176
|
-
let devToolsOpen = false;
|
|
3177
|
-
const threshold = 160;
|
|
3178
|
-
|
|
3179
|
-
function checkDevTools() {
|
|
3180
|
-
const widthThreshold = window.outerWidth - window.innerWidth > threshold;
|
|
3181
|
-
const heightThreshold = window.outerHeight - window.innerHeight > threshold;
|
|
3182
|
-
|
|
3183
|
-
if (widthThreshold || heightThreshold) {
|
|
3184
|
-
if (!devToolsOpen) {
|
|
3185
|
-
devToolsOpen = true;
|
|
3186
|
-
console.log('[Security] DevTools detected');
|
|
3187
|
-
// Optional: blur content when devtools open
|
|
3188
|
-
document.body.classList.add('devtools-open');
|
|
3189
|
-
}
|
|
3190
|
-
} else {
|
|
3191
|
-
if (devToolsOpen) {
|
|
3192
|
-
devToolsOpen = false;
|
|
3193
|
-
document.body.classList.remove('devtools-open');
|
|
3194
|
-
}
|
|
3195
|
-
}
|
|
3196
|
-
}
|
|
3197
|
-
|
|
3198
|
-
// Check periodically
|
|
3199
|
-
setInterval(checkDevTools, 1000);
|
|
3200
|
-
window.addEventListener('resize', checkDevTools);
|
|
3201
|
-
|
|
3202
|
-
// 6. Block Print via window.print override
|
|
3171
|
+
// 5. Block Print via window.print override
|
|
3203
3172
|
window.print = function () {
|
|
3204
3173
|
console.log('[Security] Print function blocked');
|
|
3205
3174
|
alert('Yazdırma bu belgede engellenmiştir.');
|
|
3206
3175
|
return false;
|
|
3207
3176
|
};
|
|
3208
3177
|
|
|
3209
|
-
//
|
|
3178
|
+
// 6. Disable beforeprint event
|
|
3210
3179
|
window.addEventListener('beforeprint', function (e) {
|
|
3211
3180
|
e.preventDefault();
|
|
3212
3181
|
document.body.style.display = 'none';
|
|
@@ -3216,7 +3185,7 @@
|
|
|
3216
3185
|
document.body.style.display = '';
|
|
3217
3186
|
});
|
|
3218
3187
|
|
|
3219
|
-
//
|
|
3188
|
+
// 7. Block screenshot keyboard shortcuts
|
|
3220
3189
|
document.addEventListener('keyup', function (e) {
|
|
3221
3190
|
// PrintScreen key
|
|
3222
3191
|
if (e.key === 'PrintScreen') {
|
|
@@ -3225,10 +3194,9 @@
|
|
|
3225
3194
|
}
|
|
3226
3195
|
}, true);
|
|
3227
3196
|
|
|
3228
|
-
//
|
|
3197
|
+
// 8. Visibility change detection (tab switching for screenshots)
|
|
3229
3198
|
document.addEventListener('visibilitychange', function () {
|
|
3230
3199
|
if (document.hidden) {
|
|
3231
|
-
// User switched tabs - could be for screenshot tools
|
|
3232
3200
|
console.log('[Security] Tab hidden');
|
|
3233
3201
|
}
|
|
3234
3202
|
});
|
|
@@ -3236,30 +3204,6 @@
|
|
|
3236
3204
|
console.log('[Security] All protection features initialized');
|
|
3237
3205
|
})();
|
|
3238
3206
|
</script>
|
|
3239
|
-
|
|
3240
|
-
<!-- Security CSS for DevTools detection -->
|
|
3241
|
-
<style>
|
|
3242
|
-
.devtools-open #viewerContainer,
|
|
3243
|
-
.devtools-open #viewer,
|
|
3244
|
-
.devtools-open .pdfViewer {
|
|
3245
|
-
filter: blur(20px) !important;
|
|
3246
|
-
pointer-events: none !important;
|
|
3247
|
-
}
|
|
3248
|
-
|
|
3249
|
-
.devtools-open::after {
|
|
3250
|
-
content: 'Geliştirici araçları açıkken içerik görüntülenemez.';
|
|
3251
|
-
position: fixed;
|
|
3252
|
-
top: 50%;
|
|
3253
|
-
left: 50%;
|
|
3254
|
-
transform: translate(-50%, -50%);
|
|
3255
|
-
background: rgba(0, 0, 0, 0.9);
|
|
3256
|
-
color: #fff;
|
|
3257
|
-
padding: 30px 50px;
|
|
3258
|
-
border-radius: 10px;
|
|
3259
|
-
font-size: 18px;
|
|
3260
|
-
z-index: 99999;
|
|
3261
|
-
}
|
|
3262
|
-
</style>
|
|
3263
3207
|
</body>
|
|
3264
3208
|
|
|
3265
3209
|
</html>
|