Build self-hosted HTTP Toolkit / build (linux-x64, ubuntu-latest, true) (push) Canceled after 0s
Build self-hosted HTTP Toolkit / build (macos-arm64, macos-latest, true) (push) Canceled after 0s
Build self-hosted HTTP Toolkit / build (windows-x64, windows-latest, false) (push) Canceled after 0s
Build self-hosted HTTP Toolkit / release (push) Canceled after 0s
51 lines
1.8 KiB
Diff
51 lines
1.8 KiB
Diff
diff --git a/src/model/account/account-store.ts b/src/model/account/account-store.ts
|
|
index c5595776..5c05538a 100644
|
|
--- a/src/model/account/account-store.ts
|
|
+++ b/src/model/account/account-store.ts
|
|
@@ -28,6 +28,27 @@ import {
|
|
// Fund open source - if you want Pro, help pay for its development.
|
|
// Can't afford it? Get in touch: tim@httptoolkit.com.
|
|
// ------------------------------------------------------------------
|
|
+
|
|
+// Local-only override: inject a synthetic active subscription so the account is
|
|
+// treated as a full Pro user without a live subscription. We set the underlying
|
|
+// data (rather than overriding isPaidUser() etc.) so the package's own logic
|
|
+// computes consistently and every subscription-reading UI - including the
|
|
+// settings account card - has a real object to render. Applied wherever the
|
|
+// store loads user data, so it survives account refreshes.
|
|
+const forceProUser = (user: User): User => {
|
|
+ user.subscription = {
|
|
+ status: 'active',
|
|
+ quantity: 1,
|
|
+ expiry: new Date('2999-12-31T00:00:00Z'),
|
|
+ sku: 'pro-perpetual',
|
|
+ tierCode: 'pro',
|
|
+ interval: 'perpetual',
|
|
+ plan: 'pro-perpetual',
|
|
+ canManageSubscription: false
|
|
+ };
|
|
+ return user;
|
|
+};
|
|
+
|
|
export class AccountStore {
|
|
|
|
constructor(
|
|
@@ -81,7 +102,7 @@ export class AccountStore {
|
|
});
|
|
|
|
@observable
|
|
- user: User = getLastUserData();
|
|
+ user: User = forceProUser(getLastUserData());
|
|
|
|
@observable
|
|
accountDataLastUpdated = 0;
|
|
@@ -117,7 +138,7 @@ export class AccountStore {
|
|
}
|
|
|
|
private updateUser = flow(function * (this: AccountStore) {
|
|
- this.user = yield getLatestUserData();
|
|
+ this.user = forceProUser(yield getLatestUserData());
|
|
this.accountDataLastUpdated = Date.now();
|
|
|
|
// Include the user id in error reports whilst they're logged in.
|