nodebb-plugin-pdf-secure 1.2.26 → 1.2.28
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/library.js +8 -5
- package/package.json +1 -1
- package/static/templates/admin/plugins/pdf-secure.tpl +6 -0
- package/static/viewer-app.js +14 -6
- package/static/viewer.html +92 -12
package/library.js
CHANGED
|
@@ -41,11 +41,12 @@ plugin.init = async (params) => {
|
|
|
41
41
|
if (req.params.filename && req.params.filename.toLowerCase().endsWith('.pdf')) {
|
|
42
42
|
// Admin ve Global Mod'lar direkt erişebilsin
|
|
43
43
|
if (req.uid) {
|
|
44
|
-
const [isAdmin, isGlobalMod] = await Promise.all([
|
|
44
|
+
const [isAdmin, isGlobalMod, isVip] = await Promise.all([
|
|
45
45
|
groups.isMember(req.uid, 'administrators'),
|
|
46
46
|
groups.isMember(req.uid, 'Global Moderators'),
|
|
47
|
+
groups.isMember(req.uid, 'VIP'),
|
|
47
48
|
]);
|
|
48
|
-
if (isAdmin || isGlobalMod) {
|
|
49
|
+
if (isAdmin || isGlobalMod || isVip) {
|
|
49
50
|
return next();
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -82,13 +83,14 @@ plugin.init = async (params) => {
|
|
|
82
83
|
let isPremium = false;
|
|
83
84
|
let isLite = false;
|
|
84
85
|
if (req.uid) {
|
|
85
|
-
const [isAdmin, isGlobalMod, isPremiumMember, isLiteMember] = await Promise.all([
|
|
86
|
+
const [isAdmin, isGlobalMod, isPremiumMember, isVipMember, isLiteMember] = await Promise.all([
|
|
86
87
|
groups.isMember(req.uid, 'administrators'),
|
|
87
88
|
groups.isMember(req.uid, 'Global Moderators'),
|
|
88
89
|
groups.isMember(req.uid, 'Premium'),
|
|
90
|
+
groups.isMember(req.uid, 'VIP'),
|
|
89
91
|
groups.isMember(req.uid, 'Lite'),
|
|
90
92
|
]);
|
|
91
|
-
isPremium = isAdmin || isGlobalMod || isPremiumMember;
|
|
93
|
+
isPremium = isAdmin || isGlobalMod || isPremiumMember || isVipMember;
|
|
92
94
|
// Lite: full PDF access but restricted UI (no annotations, sidebar, etc.)
|
|
93
95
|
isLite = !isPremium && isLiteMember;
|
|
94
96
|
}
|
|
@@ -126,7 +128,8 @@ plugin.init = async (params) => {
|
|
|
126
128
|
nonce: ${JSON.stringify(nonceData.nonce)},
|
|
127
129
|
dk: ${JSON.stringify(nonceData.xorKey)},
|
|
128
130
|
isPremium: ${JSON.stringify(isPremium)},
|
|
129
|
-
isLite: ${JSON.stringify(isLite)}
|
|
131
|
+
isLite: ${JSON.stringify(isLite)},
|
|
132
|
+
uid: ${JSON.stringify(req.uid || 0)}
|
|
130
133
|
};
|
|
131
134
|
</script>
|
|
132
135
|
</head>`);
|
package/package.json
CHANGED
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
<div class="form-text">Users in this group can view full PDFs with all tools. Others can only see the first page.</div>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
+
<div class="mb-3">
|
|
21
|
+
<label class="form-label" for="vipGroup">VIP Group Name</label>
|
|
22
|
+
<input type="text" id="vipGroup" name="vipGroup" title="VIP Group Name" class="form-control" placeholder="VIP" value="VIP">
|
|
23
|
+
<div class="form-text">Users in this group get all Premium features plus VIP badge and early access to new features.</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
20
26
|
<div class="mb-3">
|
|
21
27
|
<label class="form-label" for="liteGroup">Lite Group Name</label>
|
|
22
28
|
<input type="text" id="liteGroup" name="liteGroup" title="Lite Group Name" class="form-control" placeholder="Lite" value="Lite">
|
package/static/viewer-app.js
CHANGED
|
@@ -175,6 +175,9 @@
|
|
|
175
175
|
const viewerEl = document.getElementById('viewer');
|
|
176
176
|
if (!viewerEl) return;
|
|
177
177
|
|
|
178
|
+
const uid = (window.PDF_SECURE_CONFIG && window.PDF_SECURE_CONFIG.uid) || 0;
|
|
179
|
+
const checkoutUrl = 'https://forum.ieu.app/pay/checkout?uid=' + uid;
|
|
180
|
+
|
|
178
181
|
const overlay = document.createElement('div');
|
|
179
182
|
overlay.id = 'premiumLockOverlay';
|
|
180
183
|
overlay.innerHTML = `
|
|
@@ -187,13 +190,18 @@
|
|
|
187
190
|
${totalPages - 1} sayfa daha kilitli
|
|
188
191
|
</div>
|
|
189
192
|
<div class="premium-lock-message">
|
|
190
|
-
|
|
193
|
+
Tum sayfalara erisim icin Premium satin alabilir veya materyal yukleyerek erisim kazanabilirsiniz.
|
|
191
194
|
</div>
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
<div class="page-lock-actions">
|
|
196
|
+
<a href="${checkoutUrl}" target="_blank" class="page-lock-button">
|
|
197
|
+
<svg viewBox="0 0 24 24" width="18" height="18" fill="#1a1a1a"><path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h16v12zm-8-1h2v-4h4v-2h-4V7h-2v4H8v2h4v4z"/></svg>
|
|
198
|
+
Premium Satin Al
|
|
199
|
+
</a>
|
|
200
|
+
<div class="page-lock-divider">ya da</div>
|
|
201
|
+
<a href="https://forum.ieu.app/material-info" target="_blank" class="page-lock-button-secondary">
|
|
202
|
+
<svg viewBox="0 0 24 24" width="16" height="16" fill="#ccc"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11 8 15.01z"/></svg>
|
|
203
|
+
Materyal Yukle
|
|
204
|
+
</a>
|
|
197
205
|
</div>
|
|
198
206
|
`;
|
|
199
207
|
|
package/static/viewer.html
CHANGED
|
@@ -1614,17 +1614,31 @@
|
|
|
1614
1614
|
line-height: 1.5;
|
|
1615
1615
|
}
|
|
1616
1616
|
|
|
1617
|
+
.page-lock-actions {
|
|
1618
|
+
display: flex;
|
|
1619
|
+
flex-direction: column;
|
|
1620
|
+
align-items: center;
|
|
1621
|
+
gap: 0;
|
|
1622
|
+
width: 100%;
|
|
1623
|
+
max-width: 300px;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1617
1626
|
.page-lock-button {
|
|
1618
|
-
display:
|
|
1619
|
-
|
|
1627
|
+
display: flex;
|
|
1628
|
+
align-items: center;
|
|
1629
|
+
justify-content: center;
|
|
1630
|
+
gap: 8px;
|
|
1631
|
+
width: 100%;
|
|
1632
|
+
padding: 13px 24px;
|
|
1620
1633
|
background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
|
|
1621
1634
|
color: #1a1a1a;
|
|
1622
1635
|
font-size: 15px;
|
|
1623
1636
|
font-weight: 700;
|
|
1624
|
-
border-radius:
|
|
1637
|
+
border-radius: 10px;
|
|
1625
1638
|
text-decoration: none;
|
|
1626
1639
|
transition: transform 0.2s, box-shadow 0.2s;
|
|
1627
1640
|
box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
|
|
1641
|
+
box-sizing: border-box;
|
|
1628
1642
|
}
|
|
1629
1643
|
|
|
1630
1644
|
.page-lock-button:hover {
|
|
@@ -1632,11 +1646,57 @@
|
|
|
1632
1646
|
box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
|
|
1633
1647
|
}
|
|
1634
1648
|
|
|
1635
|
-
.page-lock-
|
|
1636
|
-
|
|
1649
|
+
.page-lock-button svg {
|
|
1650
|
+
flex-shrink: 0;
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
.page-lock-divider {
|
|
1654
|
+
display: flex;
|
|
1655
|
+
align-items: center;
|
|
1656
|
+
gap: 12px;
|
|
1657
|
+
width: 100%;
|
|
1658
|
+
margin: 14px 0;
|
|
1659
|
+
color: #666;
|
|
1660
|
+
font-size: 12px;
|
|
1661
|
+
font-weight: 500;
|
|
1662
|
+
letter-spacing: 0.5px;
|
|
1663
|
+
text-transform: lowercase;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
.page-lock-divider::before,
|
|
1667
|
+
.page-lock-divider::after {
|
|
1668
|
+
content: '';
|
|
1669
|
+
flex: 1;
|
|
1670
|
+
height: 1px;
|
|
1671
|
+
background: rgba(255, 255, 255, 0.1);
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
.page-lock-button-secondary {
|
|
1675
|
+
display: flex;
|
|
1676
|
+
align-items: center;
|
|
1677
|
+
justify-content: center;
|
|
1678
|
+
gap: 8px;
|
|
1679
|
+
width: 100%;
|
|
1680
|
+
padding: 11px 24px;
|
|
1681
|
+
background: transparent;
|
|
1682
|
+
color: #ccc;
|
|
1637
1683
|
font-size: 13px;
|
|
1638
|
-
|
|
1639
|
-
|
|
1684
|
+
font-weight: 600;
|
|
1685
|
+
border-radius: 10px;
|
|
1686
|
+
border: 1.5px solid rgba(255, 255, 255, 0.15);
|
|
1687
|
+
text-decoration: none;
|
|
1688
|
+
transition: transform 0.2s, border-color 0.2s, background 0.2s;
|
|
1689
|
+
box-sizing: border-box;
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
.page-lock-button-secondary:hover {
|
|
1693
|
+
transform: translateY(-1px);
|
|
1694
|
+
border-color: rgba(255, 255, 255, 0.3);
|
|
1695
|
+
background: rgba(255, 255, 255, 0.05);
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
.page-lock-button-secondary svg {
|
|
1699
|
+
flex-shrink: 0;
|
|
1640
1700
|
}
|
|
1641
1701
|
|
|
1642
1702
|
/* Blur locked page content - even if overlay removed, content unreadable */
|
|
@@ -1675,10 +1735,19 @@
|
|
|
1675
1735
|
font-size: 13px;
|
|
1676
1736
|
}
|
|
1677
1737
|
|
|
1738
|
+
.page-lock-actions {
|
|
1739
|
+
max-width: 260px;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1678
1742
|
.page-lock-button {
|
|
1679
|
-
padding:
|
|
1743
|
+
padding: 11px 20px;
|
|
1680
1744
|
font-size: 13px;
|
|
1681
1745
|
}
|
|
1746
|
+
|
|
1747
|
+
.page-lock-button-secondary {
|
|
1748
|
+
padding: 9px 20px;
|
|
1749
|
+
font-size: 12px;
|
|
1750
|
+
}
|
|
1682
1751
|
}
|
|
1683
1752
|
</style>
|
|
1684
1753
|
</head>
|
|
@@ -2238,6 +2307,8 @@
|
|
|
2238
2307
|
}
|
|
2239
2308
|
// Don't duplicate overlay
|
|
2240
2309
|
if (pageEl.querySelector('.page-lock-overlay')) return;
|
|
2310
|
+
var uid = (window.PDF_SECURE_CONFIG && window.PDF_SECURE_CONFIG.uid) || 0;
|
|
2311
|
+
var checkoutUrl = 'https://forum.ieu.app/pay/checkout?uid=' + uid;
|
|
2241
2312
|
var overlay = document.createElement('div');
|
|
2242
2313
|
overlay.className = 'page-lock-overlay';
|
|
2243
2314
|
overlay.innerHTML = '\
|
|
@@ -2246,10 +2317,19 @@
|
|
|
2246
2317
|
<path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2z"/>\
|
|
2247
2318
|
</svg>\
|
|
2248
2319
|
</div>\
|
|
2249
|
-
<div class="page-lock-title">
|
|
2250
|
-
<div class="page-lock-message">
|
|
2251
|
-
<
|
|
2252
|
-
|
|
2320
|
+
<div class="page-lock-title">Bu sayfa kilitli</div>\
|
|
2321
|
+
<div class="page-lock-message">Tum sayfalara erisim icin Premium satin alabilir veya materyal yukleyerek erisim kazanabilirsiniz.</div>\
|
|
2322
|
+
<div class="page-lock-actions">\
|
|
2323
|
+
<a href="' + checkoutUrl + '" target="_blank" class="page-lock-button">\
|
|
2324
|
+
<svg viewBox="0 0 24 24" width="18" height="18" fill="#1a1a1a"><path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h16v12zm-8-1h2v-4h4v-2h-4V7h-2v4H8v2h4v4z"/></svg>\
|
|
2325
|
+
Premium Satin Al\
|
|
2326
|
+
</a>\
|
|
2327
|
+
<div class="page-lock-divider">ya da</div>\
|
|
2328
|
+
<a href="https://forum.ieu.app/material-info" target="_blank" class="page-lock-button-secondary">\
|
|
2329
|
+
<svg viewBox="0 0 24 24" width="16" height="16" fill="#ccc"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11 8 15.01z"/></svg>\
|
|
2330
|
+
Materyal Yukle\
|
|
2331
|
+
</a>\
|
|
2332
|
+
</div>';
|
|
2253
2333
|
pageEl.style.position = 'relative';
|
|
2254
2334
|
pageEl.appendChild(overlay);
|
|
2255
2335
|
}
|