好吧,虽然标题看上去没啥邪恶的,但是其实这就是个破解 StarUML 的教程,因为看不爽时不时就给我弹出个确认框,虽然我本来是想找个序列号就行了,但是没想到居然有简单可行的处理方式,所以就随手记录一番。根据我的实验,2.5 和 3.0 版本的都可以用,不过不通用,这是两种不同的解决方式,3.0 的麻烦一些,2.5 的简单。

StarUML 2.5 破解

  1. 将下面的文件保存为 LicenseManagerDomain.js
  2. sudo cp /Applications/StarUML.app/Contents/www/license/node/LicenseManagerDomain.js LicenseManagerDomain.js.backup
  3. cp LicenseManagerDomain.js /Applications/StarUML.app/Contents/www/license/node/LicenseManagerDomain.js
  4. Open StarUML and go to Help > Enter License.
  5. Enter the name and the License Key in the LicenseManagerDomain.js.
/**
 * File name: LicenseManagerDomain.js
 * Mac OS: /Applications/StarUML.app/Contents/www/license/node/
 * Linux: /opt/staruml/www/license/node/
 */

(function () {
    "use strict";

    var NodeRSA = require('node-rsa');

    function validate(PK, name, product, licenseKey) {
        return{
           name: "liqiang",
           product: "StarUML",
           licenseType: "vip",
           quantity: "unlimited",
           licenseKey: "https://liqiang.io"
        };
    }

    function init(domainManager) {
        if (!domainManager.hasDomain("LicenseManager")) {
            domainManager.registerDomain("LicenseManager", {major: 0, minor: 1});
        }
        domainManager.registerCommand(
            "LicenseManager", // domain name
            "validate",       // command name
            validate,         // command handler function
            false,            // this command is synchronous in Node ("false" means synchronous")
            "Validate License",
            [
                {
                    name: "PK",
                    type: "string",
                    description: "PK"
                },
                {
                    name: "name",
                    type: "string",
                    description: "name of license owner"
                },
                {
                    name: "product",
                    type: "string",
                    description: "product name"
                },
                {
                    name: "licenseKey",
                    type: "string",
                    description: "license key"
                }
            ],
            [
                {
                    name: "result", // return values
                    type: "object",
                    description: "result"
                }
            ]
        );
    }

    exports.init = init;

}());

StarUML 3.0.1 破解

升级到 3.0.1 之后,验证文件不再放在本地的目录中了,而是放在了打包文件里面了,所以需要先解压出应用,然后替换文件之后,再打包回去。

  1. 安装asar

     # npm install -g asar
  2. 解压app.asar

  3. 修改验证文件

     # vim app/src/engine/license-manager.js

    将第 124 行修改成以下形式:

  4. 打包 app

     # asar pack app app.asar
  5. 重启 StarUML 即可。

Reference

  1. StarUML
  2. StarUML 3.0 破解方法