mirror of
https://github.com/HeyPuter/puter.git
synced 2025-12-30 17:50:00 -06:00
fix: metering typos (#1754)
This commit is contained in:
@@ -13,8 +13,8 @@ extension.on('metering:registerAvailablePolicies', async (
|
||||
console.warn('WARNING!!! unlimitedUsage is enabled, this is not recommended for production use');
|
||||
event.availablePolicies.push({
|
||||
id: 'unlimited',
|
||||
monthUsageAllowence: 500_000_000 * 100_000_000, // unless you're like, jeff's, mark's and elon's illegitamate son, you probably won't hit $5m a month
|
||||
monthlyStorageAllowence: 100_000 * 1024 * 1024, // 100MiB
|
||||
monthUsageAllowance: 500_000_000 * 100_000_000, // unless you're like, jeff's, mark's and elon's illegitamate son, you probably won't hit $5m a month
|
||||
monthlyStorageAllowance: 100_000 * 1024 * 1024, // 100MiB
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -10,10 +10,10 @@ extension.get('/meteringAndBilling/usage', { subdomain: 'api' }, async (req, res
|
||||
throw Error('actor not found in context');
|
||||
}
|
||||
const actorUsagePromise = meteringAndBillingService.getActorCurrentMonthUsageDetails(actor);
|
||||
const actorAllowenceInfoPromise = meteringAndBillingService.getAllowedUsage(actor);
|
||||
const actorAllowanceInfoPromise = meteringAndBillingService.getAllowedUsage(actor);
|
||||
|
||||
const [actorUsage, allowenceInfo] = await Promise.all([actorUsagePromise, actorAllowenceInfoPromise]);
|
||||
res.status(200).json({ ...actorUsage, allowenceInfo });
|
||||
const [actorUsage, alowanceInfo] = await Promise.all([actorUsagePromise, actorAllowanceInfoPromise]);
|
||||
res.status(200).json({ ...actorUsage, alowanceInfo });
|
||||
return;
|
||||
});
|
||||
|
||||
|
||||
@@ -220,8 +220,8 @@ export class MeteringAndBillingService {
|
||||
|
||||
const [userSubscription, userPolicyAddons, currentMonthUsage] = await Promise.all([userSubscriptionPromise, userPolicyAddonsPromise, currentUsagePromise]);
|
||||
return {
|
||||
remaining: Math.max(0, userSubscription.monthUsageAllowence + (userPolicyAddons?.purchasedCredits || 0) - currentMonthUsage.usage.total),
|
||||
monthUsageAllowence: userSubscription?.monthUsageAllowence,
|
||||
remaining: Math.max(0, userSubscription.monthUsageAllowance + (userPolicyAddons?.purchasedCredits || 0) - currentMonthUsage.usage.total),
|
||||
monthUsageAllowance: userSubscription?.monthUsageAllowance,
|
||||
userPolicyAddons,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@ import { toMicroCents } from "../utils";
|
||||
|
||||
export const REGISTERED_USER_FREE = {
|
||||
id: 'user_free',
|
||||
monthUsageAllowence: toMicroCents(0.50),
|
||||
monthlyStorageAllowence: 100 * 1024 * 1024, // 100MiB
|
||||
monthUsageAllowance: toMicroCents(0.50),
|
||||
monthlyStorageAllowance: 100 * 1024 * 1024, // 100MiB
|
||||
};
|
||||
@@ -2,6 +2,6 @@ import { toMicroCents } from "../utils";
|
||||
|
||||
export const TEMP_USER_FREE = {
|
||||
id: 'temp_free',
|
||||
monthUsageAllowence: toMicroCents(0.25),
|
||||
monthlyStorageAllowence: 100 * 1024 * 1024, // 100MiB
|
||||
monthUsageAllowance: toMicroCents(0.25),
|
||||
monthlyStorageAllowance: 100 * 1024 * 1024, // 100MiB
|
||||
};
|
||||
Reference in New Issue
Block a user