@abdarrahmanabdelnasir/relay-node 0.1.21 → 0.1.22
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/dist/configCache.js +4 -2
- package/dist-cjs/configCache.js +4 -2
- package/package.json +1 -1
package/dist/configCache.js
CHANGED
|
@@ -138,7 +138,8 @@ export class ConfigCache {
|
|
|
138
138
|
switch (this.config.permissionMode) {
|
|
139
139
|
case 'premium_only': {
|
|
140
140
|
const isPremiumRole = roles.some(roleId => this.config.premiumRoleIds.includes(roleId));
|
|
141
|
-
const
|
|
141
|
+
const premiumIds = (this.config.premiumUserIds || []).map(String);
|
|
142
|
+
const isPremiumUser = premiumIds.includes(String(userId));
|
|
142
143
|
const isPremium = isPremiumRole || isPremiumUser;
|
|
143
144
|
if (!isPremium) {
|
|
144
145
|
return { allowed: false, reason: 'Premium only' };
|
|
@@ -175,7 +176,8 @@ export class ConfigCache {
|
|
|
175
176
|
const now = Date.now();
|
|
176
177
|
const roles = memberRoles || [];
|
|
177
178
|
const isPremiumRole = roles.some(roleId => this.config.premiumRoleIds.includes(roleId));
|
|
178
|
-
const
|
|
179
|
+
const premiumIds = (this.config.premiumUserIds || []).map(String);
|
|
180
|
+
const isPremiumUser = premiumIds.includes(String(userId));
|
|
179
181
|
const isPremium = isPremiumRole || isPremiumUser;
|
|
180
182
|
// User rate limit
|
|
181
183
|
const userLimit = isPremium ? this.config.premiumRateLimit : this.config.freeRateLimit;
|
package/dist-cjs/configCache.js
CHANGED
|
@@ -141,7 +141,8 @@ class ConfigCache {
|
|
|
141
141
|
switch (this.config.permissionMode) {
|
|
142
142
|
case 'premium_only': {
|
|
143
143
|
const isPremiumRole = roles.some(roleId => this.config.premiumRoleIds.includes(roleId));
|
|
144
|
-
const
|
|
144
|
+
const premiumIds = (this.config.premiumUserIds || []).map(String);
|
|
145
|
+
const isPremiumUser = premiumIds.includes(String(userId));
|
|
145
146
|
const isPremium = isPremiumRole || isPremiumUser;
|
|
146
147
|
if (!isPremium) {
|
|
147
148
|
return { allowed: false, reason: 'Premium only' };
|
|
@@ -178,7 +179,8 @@ class ConfigCache {
|
|
|
178
179
|
const now = Date.now();
|
|
179
180
|
const roles = memberRoles || [];
|
|
180
181
|
const isPremiumRole = roles.some(roleId => this.config.premiumRoleIds.includes(roleId));
|
|
181
|
-
const
|
|
182
|
+
const premiumIds = (this.config.premiumUserIds || []).map(String);
|
|
183
|
+
const isPremiumUser = premiumIds.includes(String(userId));
|
|
182
184
|
const isPremium = isPremiumRole || isPremiumUser;
|
|
183
185
|
// User rate limit
|
|
184
186
|
const userLimit = isPremium ? this.config.premiumRateLimit : this.config.freeRateLimit;
|