Skip to content

Commit d8daccf

Browse files
Make license key expiry date optional & add required id field to key payload
1 parent 7eaaea5 commit d8daccf

File tree

1 file changed

+5
-3
lines changed
  • packages/web/src/features/entitlements

1 file changed

+5
-3
lines changed

packages/web/src/features/entitlements/server.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { SOURCEBOT_SUPPORT_EMAIL } from "@/lib/constants";
77
const eeLicenseKeyPrefix = "sourcebot_ee_";
88

99
const eeLicenseKeyPayloadSchema = z.object({
10+
id: z.string(),
1011
// ISO 8601 date string
11-
expiryDate: z.string().datetime(),
12+
expiryDate: z.string().datetime().optional(),
1213
});
1314

1415
const decodeLicenseKeyPayload = (payload: string) => {
@@ -29,14 +30,15 @@ export const getPlan = (): Plan => {
2930
try {
3031
const { expiryDate } = decodeLicenseKeyPayload(payload);
3132

32-
if (new Date(expiryDate).getTime() < new Date().getTime()) {
33+
if (expiryDate && new Date(expiryDate).getTime() < new Date().getTime()) {
3334
console.error(`The provided license key has expired. Falling back to oss plan. Please contact ${SOURCEBOT_SUPPORT_EMAIL} for support.`);
3435
return "oss";
3536
}
3637

3738
return "self-hosted:enterprise";
3839
} catch (error) {
39-
console.error(`Failed to decode license key payload: ${error}`);
40+
console.error(`Failed to decode license key payload with error: ${error}`);
41+
console.info('Falling back to oss plan.');
4042
return "oss";
4143
}
4244
}

0 commit comments

Comments
 (0)