@abdarrahmanabdelnasir/relay-node 0.1.21 → 0.1.23
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 +6 -2
- package/dist-cjs/configCache.js +6 -2
- package/package.json +1 -1
package/dist/configCache.js
CHANGED
|
@@ -138,8 +138,11 @@ 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;
|
|
144
|
+
// Diagnostic: log list size and match (no raw IDs)
|
|
145
|
+
console.log(`[commandless] premium_only check: premiumUserIds.length=${premiumIds.length}, isPremiumUser=${isPremiumUser}, isPremiumRole=${isPremiumRole}, allowed=${isPremium}`);
|
|
143
146
|
if (!isPremium) {
|
|
144
147
|
return { allowed: false, reason: 'Premium only' };
|
|
145
148
|
}
|
|
@@ -175,7 +178,8 @@ export class ConfigCache {
|
|
|
175
178
|
const now = Date.now();
|
|
176
179
|
const roles = memberRoles || [];
|
|
177
180
|
const isPremiumRole = roles.some(roleId => this.config.premiumRoleIds.includes(roleId));
|
|
178
|
-
const
|
|
181
|
+
const premiumIds = (this.config.premiumUserIds || []).map(String);
|
|
182
|
+
const isPremiumUser = premiumIds.includes(String(userId));
|
|
179
183
|
const isPremium = isPremiumRole || isPremiumUser;
|
|
180
184
|
// User rate limit
|
|
181
185
|
const userLimit = isPremium ? this.config.premiumRateLimit : this.config.freeRateLimit;
|
package/dist-cjs/configCache.js
CHANGED
|
@@ -141,8 +141,11 @@ 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;
|
|
147
|
+
// Diagnostic: log list size and match (no raw IDs)
|
|
148
|
+
console.log(`[commandless] premium_only check: premiumUserIds.length=${premiumIds.length}, isPremiumUser=${isPremiumUser}, isPremiumRole=${isPremiumRole}, allowed=${isPremium}`);
|
|
146
149
|
if (!isPremium) {
|
|
147
150
|
return { allowed: false, reason: 'Premium only' };
|
|
148
151
|
}
|
|
@@ -178,7 +181,8 @@ class ConfigCache {
|
|
|
178
181
|
const now = Date.now();
|
|
179
182
|
const roles = memberRoles || [];
|
|
180
183
|
const isPremiumRole = roles.some(roleId => this.config.premiumRoleIds.includes(roleId));
|
|
181
|
-
const
|
|
184
|
+
const premiumIds = (this.config.premiumUserIds || []).map(String);
|
|
185
|
+
const isPremiumUser = premiumIds.includes(String(userId));
|
|
182
186
|
const isPremium = isPremiumRole || isPremiumUser;
|
|
183
187
|
// User rate limit
|
|
184
188
|
const userLimit = isPremium ? this.config.premiumRateLimit : this.config.freeRateLimit;
|