本代码仅做为electron打包格式asar的研究和探讨,请使用正版软件

将Typora降级到0.9.8版本,去掉注册弹窗.

import console;
import process
import fsys.lnk
import fsys.asar.reader
import web.json

var jsonStr = `{
"name": "Typora",
"version": "0.9.8",
"main": "main.node",
"family": "abnerworks",
"private": true,
"author": "typora.io",
"homepage": "https://typora.io",
"concat": "hi@typora.io",
"releaseId": "977ade12"
}`

var exePath = fsys.lnk.search("Typora.exe")
if(exePath){
var asarPath = fsys.joinpath( fsys.getParentDir(exePath),"resources/app.asar" )
console.log(asarPath)
//备份app.asar
fsys.copy( asarPath,fsys.joinpath( fsys.getParentDir(exePath),"resources/app.asar.bak" ))

var reader = fsys.asar.reader(asarPath)
if(reader.replace("package.json",jsonStr)){
console.log("Typora降级成功")
}else {
console.log("asar写入错误")
}
}else {
console.log("Typora未安装")
}

console.pause();

然后关闭检查更新