随笔 - 94  文章 - 0  评论 - 3  阅读 - 16万

GoJs 去水印

此下方法主要是修改了go.js 2.2.9版本的Pa这个函数,通过下面的方式针对水印部分做特殊处理

注意:2.2.9版本是有效的,其他版本未测试,如果不行的话,请按照此方法针对性的做调整即可

在项目跟目录新建文件:removeWatermarkForGoJs.js

 

 

 

内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const fs = require("fs");
const path = require("path");
const filePaths = [
  "./node_modules/gojs/release/go.js",
  "./node_modules/gojs/release/go-module.js",
]
filePaths.map(filePath => {
  const file = path.join(__dirname, filePath);
  fs.readFile(file, "utf8", function (err, data) {
    if (err) throw err;
    let content = data.replace("String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);return f",
      `String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);
   
      if (
        /GoJS \d\.\d evaluation/.test(f) ||
        /© 1998-\d{4} Northwoods Software/.test(f) ||
        "Not for distribution or production use" === f ||
        "gojs.net" === f
      ) {
        return "";
      } else {
        return f;
      }
      `
    );
 
    fs.writeFile(file, content, "utf8", (err) => {
      if (err) throw err;
      console.log('remove gojs watermark success done!!');
    });
  });
})

修改package.json文件,主要修改scripts部分,代码如下:

1
2
3
4
5
6
7
"scripts": {
  "serve": "node removeWatermarkForGoJs && vue-cli-service serve --copy --port 8088",
  "build": "node removeWatermarkForGoJs && vue-cli-service build",
  "test:unit": "vue-cli-service test:unit",
  "test:e2e": "vue-cli-service test:e2e",
  "lint": "vue-cli-service lint"
}

重新启动项目,或者重新打包水印就没有了,效果如下:

 

 

 

 

 
posted on   一花一四季,一梦一世界  阅读(1640)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示