Skip to content

Instantly share code, notes, and snippets.

@MakRatanakKh
Forked from DrYazid/starulm.md
Last active October 16, 2019 15:41
Show Gist options
  • Save MakRatanakKh/da9a2f170f41e2472a37849ab2b4f002 to your computer and use it in GitHub Desktop.
Save MakRatanakKh/da9a2f170f41e2472a37849ab2b4f002 to your computer and use it in GitHub Desktop.
StarUml 3.0 or 3.1 full version
**StarUML 3.0 or 3.1**
- 1- install staruml. : [staruml](http://staruml.io/)
- 2- install node.js : [node.js](https://nodejs.org/en/download/)
- 3- go to ...\AppData\Local\Programs\StarUML\resources
- 4- open CMD As admin
- 5- execute
`npm install -g asar`
`npm install -g asar`
`asar extract app.asar app`
- 6- go to app\src\engine\license-manager.js
- 7- update file with Notepad
```
validate () {
return new Promise((resolve, reject) => {
try {
// Local check
var file = this.findLicense()
if (!file) {
reject('License key not found')
} else {
var data = fs.readFileSync(file, 'utf8')
licenseInfo = JSON.parse(data)
var base = SK + licenseInfo.name +
SK + licenseInfo.product + '-' + licenseInfo.licenseType +
SK + licenseInfo.quantity +
SK + licenseInfo.timestamp + SK
var _key = crypto.createHash('sha1').update(base).digest('hex').toUpperCase()
if (_key !== licenseInfo.licenseKey) {
reject('Invalid license key')
} else {
// Server check
$.post(app.config.validation_url, {licenseKey: licenseInfo.licenseKey})
.done(data => {
resolve(data)
})
.fail(err => {
if (err && err.status === 499) { /* License key not exists */
reject(err)
} else {
// If server is not available, assume that license key is valid
resolve(licenseInfo)
}
})
}
}
} catch (err) {
reject(err)
}
})
}
```
- 8- and
```
checkLicenseValidity () {
this.validate().then(() => {
setStatus(this, true)
}, () => {
setStatus(this, true)
})
}
```
- 9- go back to CMD and execute
`asar pack app app.asar`
its done enjoy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment