fix: 更新弹窗无法关闭

This commit is contained in:
msojocs 2025-07-05 10:03:14 +08:00
parent bf2fbd90ed
commit 940cd4a12d
4 changed files with 26 additions and 4 deletions

View File

@ -1,3 +1,6 @@
# 1.06.2503290-4 / 2025-07-
- fix: 更新弹窗无法关闭。
# 1.06.2503290-3 / 2025-05-23
- update: compiler(Linux) v0.1.5
- fix: worker无法使用 #145

View File

@ -53,7 +53,7 @@ else
fi;
EXTENSION1="--load-extension=$root_dir/nwjs/package.nw/js/ideplugin"
EXTENSION2=--load-extension=$APPDATA/WeappPlugin
EXTENSION2="--load-extension=$APPDATA/WeappPlugin"
INSPECTOR1="--custom-devtools-frontend=file://$root_dir/package.nw/js/ideplugin/inspector" # 要加file://指明为本地文件路径
INSPECTOR2="--custom-devtools-frontend=file://$APPDATA/WeappPlugin/inspector/"
USERDATADIR="$APPDATA"

View File

@ -128,9 +128,6 @@ fi
# fix update check
notice "fix update check"
sed -i 's#</body><script src=../js/core#</body><script src="../js/unpack/hackrequire/index.js"></script><script src=../js/core#' "$package_dir/html/whatsnew.html"
find_result=$( grep -lr "whatsnew.html" "$tmp_dir/core.wxvpkg" )
grep -lr "t=>{R(\"new_version_hint" "$find_result"
sed -i 's#t=>{R("new_version_hint#t=>{const keys = ["shareData", "windowMap", "isSimple","masterProxyPort", "proxyPort", "masterH2ProxyPort", "h2ProxyPort"];for(let k of keys)t.window.global[k] = global[k];R("new_version_hint#' $find_result
# pack 路径 到 文件
notice "pack"

View File

@ -120,6 +120,28 @@ cat > "$tmp_file" <<EOF
item.parentMenu = this;
return originInsert.call(this, item, index);
};
const originalOpen = nw.Window.open
nw.Window.open = function (url, options, callback) {
console.warn('[wechat-devtools] nw.Window.open is called, url:', url, 'options:', options);
let cb = callback
if (options.title === '版本更新提示') {
cb = (...args) => {
const keys = [
"shareData",
"windowMap",
"isSimple",
"masterProxyPort",
"proxyPort",
"masterH2ProxyPort",
"h2ProxyPort"
];
for(let k of keys)
args[0].window.global[k] = global[k];
callback(...args)
}
}
return originalOpen.apply(this, [url, options, cb])
}
} catch (error) {
process.stderr.write(error.message);
process.stderr.write(error.stack);