1
- const { LexActivator, LexStatusCodes, LexActivatorException, PermissionFlags } = require ( '@cryptlex/lexactivator' ) ;
1
+ const { LexActivator, LexStatusCodes, LexActivatorException, PermissionFlags, ReleaseFlags } = require ( '@cryptlex/lexactivator' ) ;
2
2
3
3
function init ( ) {
4
- // LexActivator.SetProductFile("ABSOLUTE_PATH_OF_PRODUCT.DAT_FILE");
5
4
LexActivator . SetProductData ( 'PASTE_CONTENT_OF_PRODUCT.DAT_FILE' ) ;
6
5
LexActivator . SetProductId ( 'PASTE_PRODUCT_ID' , PermissionFlags . LA_USER ) ;
6
+ LexActivator . SetReleasePlatform ( 'RELEASE_PLATFORM' ) ; // set the actual platform of the release e.g windows
7
+ LexActivator . SetReleaseChannel ( 'RELEASE_CHANNEL' ) ; // set the actual channel of the release e.g stable
7
8
LexActivator . SetReleaseVersion ( '1.0.0' ) ; // Set this to the release version of your app
8
9
}
9
10
@@ -46,6 +47,28 @@ function licenseCallback(status) {
46
47
}
47
48
}
48
49
50
+ function softwareReleaseUpdateCallback ( status , release , userData ) {
51
+ try {
52
+ switch ( status ) {
53
+ case LexStatusCodes . LA_RELEASE_UPDATE_AVAILABLE :
54
+ console . log ( 'Release update available!' ) ;
55
+ console . log ( "Release:" , release . notes ) ;
56
+ break ;
57
+ case LexStatusCodes . LA_RELEASE_UPDATE_AVAILABLE_NOT_ALLOWED :
58
+ console . log ( 'Release update available but not allowed!' ) ;
59
+ console . log ( "Release:" , release . notes ) ;
60
+ break ;
61
+ case LexStatusCodes . LA_RELEASE_UPDATE_NOT_AVAILABLE :
62
+ console . log ( 'Release update not available!' ) ;
63
+ break ;
64
+ default :
65
+ throw new LexActivatorException ( status ) ;
66
+ }
67
+ } catch ( error ) {
68
+ console . log ( error . code , error . message ) ;
69
+ }
70
+ }
71
+
49
72
function main ( ) {
50
73
try {
51
74
init ( ) ;
@@ -63,9 +86,7 @@ function main() {
63
86
console . log ( 'License user name: %s\n' , userName ) ;
64
87
65
88
// console.log('Checking for software release update...');
66
- // LexActivator.CheckForReleaseUpdate('windows', '1.0.0', 'stable', function (status) {
67
- // console.log('Release status:', status);
68
- // });
89
+ // LexActivator.CheckReleaseUpdate(softwareReleaseUpdateCallback, ReleaseFlags.LA_RELEASES_ALL, null);
69
90
} else if ( LexStatusCodes . LA_EXPIRED == status ) {
70
91
console . log ( 'License is genuinely activated but has expired!' ) ;
71
92
} else if ( LexStatusCodes . LA_SUSPENDED == status ) {
0 commit comments