mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
tweak: usage endpoint
This commit is contained in:
parent
85020109b3
commit
fc0cb2dde4
@ -87,6 +87,9 @@ module.exports = eggspress('/drivers/usage', {
|
|||||||
if ( ! identifying_fields.service['driver.implementation'] ) {
|
if ( ! identifying_fields.service['driver.implementation'] ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ( identifying_fields.service['driver.interface'] === 'puter-es' ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const svc_driverUsage = req.services.get('driver-usage-policy');
|
const svc_driverUsage = req.services.get('driver-usage-policy');
|
||||||
const policy = await svc_driverUsage.get_effective_policy({
|
const policy = await svc_driverUsage.get_effective_policy({
|
||||||
@ -104,7 +107,13 @@ module.exports = eggspress('/drivers/usage', {
|
|||||||
...identifying_fields,
|
...identifying_fields,
|
||||||
policy,
|
policy,
|
||||||
};
|
};
|
||||||
usages.user[user_usage_key].monthly_limit = policy?.['monthy-limit'] ?? null;
|
usages.user[user_usage_key].monthly_limit =
|
||||||
|
policy?.['monthly-limit'] ??
|
||||||
|
policy?.['monthy-limit'] ??
|
||||||
|
null;
|
||||||
|
if ( ! policy ) {
|
||||||
|
usages.user[user_usage_key].monthly_limit = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
usages.user[user_usage_key].monthly_usage =
|
usages.user[user_usage_key].monthly_usage =
|
||||||
|
Loading…
Reference in New Issue
Block a user