mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-08-09 20:54:28 +02:00
feat: prevent launch with inconsistent geodata
This commit is contained in:
+28
-10
@@ -8,6 +8,7 @@ interface Capabilities {
|
||||
cloudBackup: boolean;
|
||||
teamCollaboration: boolean;
|
||||
cookieBot: boolean;
|
||||
remoteInteractive: boolean;
|
||||
}
|
||||
|
||||
const NONE: Entitlements = {
|
||||
@@ -17,6 +18,7 @@ const NONE: Entitlements = {
|
||||
cloudBackup: false,
|
||||
teamCollaboration: false,
|
||||
cookieBot: false,
|
||||
remoteInteractive: false,
|
||||
profileLimit: 0,
|
||||
requestsPerHour: 0,
|
||||
remoteBrowserHours: 0,
|
||||
@@ -25,12 +27,16 @@ const NONE: Entitlements = {
|
||||
// Mirror of PLAN_CAPABILITIES in apps/backend/src/plans/entitlements.ts. Keep in
|
||||
// sync — a new plan must be declared here too, or it falls back to DEFAULT_PAID.
|
||||
const PLAN_CAPABILITIES: Record<string, Capabilities> = {
|
||||
starter: {
|
||||
// The one row where cookieBot, browserAutomation and remoteInteractive all
|
||||
// disagree: solo pays for a nightly bot and nothing else that drives a
|
||||
// browser. No fingerprint editing either.
|
||||
solo: {
|
||||
browserAutomation: false,
|
||||
crossOsFingerprints: true,
|
||||
crossOsFingerprints: false,
|
||||
cloudBackup: true,
|
||||
teamCollaboration: false,
|
||||
cookieBot: false,
|
||||
cookieBot: true,
|
||||
remoteInteractive: false,
|
||||
},
|
||||
pro: {
|
||||
browserAutomation: true,
|
||||
@@ -38,6 +44,7 @@ const PLAN_CAPABILITIES: Record<string, Capabilities> = {
|
||||
cloudBackup: true,
|
||||
teamCollaboration: false,
|
||||
cookieBot: true,
|
||||
remoteInteractive: true,
|
||||
},
|
||||
team: {
|
||||
browserAutomation: true,
|
||||
@@ -45,6 +52,7 @@ const PLAN_CAPABILITIES: Record<string, Capabilities> = {
|
||||
cloudBackup: true,
|
||||
teamCollaboration: true,
|
||||
cookieBot: true,
|
||||
remoteInteractive: true,
|
||||
},
|
||||
enterprise: {
|
||||
browserAutomation: true,
|
||||
@@ -52,6 +60,7 @@ const PLAN_CAPABILITIES: Record<string, Capabilities> = {
|
||||
cloudBackup: true,
|
||||
teamCollaboration: true,
|
||||
cookieBot: true,
|
||||
remoteInteractive: true,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -62,6 +71,7 @@ const DEFAULT_PAID: Capabilities = {
|
||||
cloudBackup: true,
|
||||
teamCollaboration: false,
|
||||
cookieBot: true,
|
||||
remoteInteractive: true,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -75,16 +85,23 @@ export function getEntitlements(
|
||||
): Entitlements {
|
||||
if (user?.entitlements) {
|
||||
const server = user.entitlements;
|
||||
// A backend (or a cached login) older than the cookie-bot release omits
|
||||
// these two keys. Reading them as `undefined` would hide a paid feature
|
||||
// from a paying customer with nothing logged anywhere, so resolve them
|
||||
// here — the one place every caller already goes through. Cookie Bot is
|
||||
// remote automation on leased hardware, so it tracks `browserAutomation`
|
||||
// exactly; `remoteBrowserHours` stays 0 because the spendable figure is
|
||||
// whatever `get_remote_hours_quota` reports, never a client guess.
|
||||
// A backend (or a cached login) older than the current release omits these
|
||||
// keys. Reading them as `undefined` would hide a paid feature from a paying
|
||||
// customer with nothing logged anywhere, so resolve them here — the one
|
||||
// place every caller already goes through.
|
||||
//
|
||||
// Both absent flags fall back to `browserAutomation`, which is what they
|
||||
// were derived from before solo existed: on every plan a pre-solo backend
|
||||
// knows about, automation implied both the bot and interactive remote
|
||||
// control. A solo user never hits this branch — the backend that can put
|
||||
// them on solo is by definition new enough to send both keys.
|
||||
//
|
||||
// `remoteBrowserHours` stays 0 because the spendable figure is whatever
|
||||
// `get_remote_hours_quota` reports, never a client guess.
|
||||
return {
|
||||
...server,
|
||||
cookieBot: server.cookieBot ?? server.browserAutomation,
|
||||
remoteInteractive: server.remoteInteractive ?? server.browserAutomation,
|
||||
remoteBrowserHours: server.remoteBrowserHours ?? 0,
|
||||
};
|
||||
}
|
||||
@@ -103,6 +120,7 @@ export function getEntitlements(
|
||||
cloudBackup: caps.cloudBackup,
|
||||
teamCollaboration: caps.teamCollaboration,
|
||||
cookieBot: caps.cookieBot,
|
||||
remoteInteractive: caps.remoteInteractive,
|
||||
profileLimit: user.profileLimit,
|
||||
requestsPerHour: caps.browserAutomation ? DEFAULT_REQUESTS_PER_HOUR : 0,
|
||||
remoteBrowserHours: 0,
|
||||
|
||||
Reference in New Issue
Block a user