-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17edb50
commit 7dac4e1
Showing
13 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,11 +17,16 @@ const hardcodedLicences: HardcodedLicence[] = [ | |
encryptedOwner: 'U2FsdGVkX18/e8sfZ3bpjz3pLQkCxloH8nuniFdU+vo=', | ||
}, | ||
{ | ||
// Pear | ||
// Parson | ||
hash: '$2a$10$33O/3uuETs0hKNIRWQzH5uQ8LgvZKhZumDcfy.izLLIzwqXmHRFu2', | ||
encryptedOwner: | ||
'U2FsdGVkX1/weIyFN+TJEPkM0YF08D5CSD0vgrDOnouEveyXG2K/TurX63pBrhuR', | ||
}, | ||
{ | ||
// Retrospected.com | ||
hash: '$2a$10$hLlxhJ8yDp1lQJtTLePJr.SDuWFHSX4Kat8NHUgqPoKgRGLbZWy26', | ||
encryptedOwner: 'U2FsdGVkX19b7JIgy/QrMncC1JjoVmBJ5EUo4AcGIkA=', | ||
}, | ||
]; | ||
|
||
export function isSelfHostedAndLicenced() { | ||
|
@@ -57,6 +62,9 @@ async function checkHardcodedLicence( | |
async function isLicencedBase(): Promise<LicenceMetadata | null> { | ||
const licenceKey = config.LICENCE_KEY; | ||
|
||
// Checking hardcoded licence as a last resort | ||
const hardcodedLicence = await checkHardcodedLicence(licenceKey); | ||
|
||
const payload: SelfHostedCheckPayload = { key: licenceKey }; | ||
try { | ||
const response = await fetch( | ||
|
@@ -73,6 +81,9 @@ async function isLicencedBase(): Promise<LicenceMetadata | null> { | |
const result = (await response.json()) as LicenceMetadata; | ||
return result; | ||
} else { | ||
if (hardcodedLicence) { | ||
return hardcodedLicence; | ||
} | ||
if (response.status === 403) { | ||
console.error( | ||
'The licence key is not recognised. If you have a valid licence, please contact [email protected] for support.' | ||
|
@@ -85,16 +96,17 @@ async function isLicencedBase(): Promise<LicenceMetadata | null> { | |
} | ||
} | ||
} catch (err) { | ||
if (hardcodedLicence) { | ||
return hardcodedLicence; | ||
} | ||
console.error( | ||
'Could not contact the licence server. If you have a valid licence, please contact [email protected] for support.' | ||
); | ||
console.log(err); | ||
} | ||
|
||
// Checking hardcoded licence as a last resort | ||
const hardcoded = await checkHardcodedLicence(licenceKey); | ||
if (hardcoded) { | ||
return hardcoded; | ||
if (hardcodedLicence) { | ||
return hardcodedLicence; | ||
} | ||
|
||
return null; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ services: | |
REDIS_HOST: redis # Must be the name of the Redis service above | ||
SENTRY_URL: '' # Optional, Sentry URL (https://[email protected]/1234567) | ||
BASE_URL: http://localhost:80 # This must be the URL of the frontend app once deployed. Only useful if you need OAuth, SendGrid or Stripe | ||
SECURE_COOKIES: 'false' # You can set this to true if you are using HTTPS. This is more secure. | ||
|
||
# -- OAuth: Set these to enable OAuth authentication for one or more provider. This is optional. -- | ||
TWITTER_KEY: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ services: | |
REDIS_HOST: redis # Must be the name of the Redis service above | ||
SENTRY_URL: '' # Optional, Sentry URL (https://[email protected]/1234567) | ||
BASE_URL: http://localhost:80 # This must be the URL of the frontend app once deployed. Only useful if you need OAuth, SendGrid or Stripe | ||
SECURE_COOKIES: 'false' # You can set this to true if you are using HTTPS. This is more secure. | ||
|
||
# -- OAuth: Set these to enable OAuth authentication for one or more provider. This is optional. -- | ||
TWITTER_KEY: | ||
|