Skip to content

Commit 19727ed

Browse files
committed
feat: 兼容高版本nw
1 parent 70d679f commit 19727ed

9 files changed

Lines changed: 111 additions & 31 deletions

File tree

CHANGELOG.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 2.01.2510280-2 / 2026-02-
1+
# 2.01.2510280-2 / 2026-02-16
22
- fix: 终端无法使用
33

44
# 2.01.2510280-1 / 2026-02-01

conf/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"urls": {
44
"x64": {
55
"version": "0.55.0",
6-
"template": "https://oss.npmmirror.com/dist/nwjs/v${version}/nwjs-sdk-v${version}-linux-x64.tar.gz"
6+
"template": "https://dl.nwjs.io/v${version}/nwjs-sdk-v${version}-linux-x64.tar.gz"
77
},
88
"loongarch64": {
99
"version": "0.65.1",

docker/Dockerfile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
1-
FROM ubuntu:16.04
1+
FROM docker.1ms.run/ubuntu:18.04
22

33
WORKDIR /workspace
44

5-
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
6-
sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
7-
sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
8-
sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
5+
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
6+
sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
7+
sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \
8+
sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \
99
mkdir -p /build_temp/python36 /build_temp/nodejs && \
1010
apt update && \
11-
apt install -y binutils software-properties-common \
11+
apt install -y binutils software-properties-common lld \
1212
gconf2 libxkbfile-dev p7zip-full make libssh2-1-dev libkrb5-dev wget curl \
1313
openssl pkg-config build-essential && \
14-
add-apt-repository ppa:ubuntu-toolchain-r/test && \
14+
apt install -y aptitude &&\
15+
apt install -y nodejs &&\
16+
apt install -y gosu unzip python && \
17+
apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
18+
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && \
1519
apt update && \
1620
apt install -y gcc-9 g++-9 lld && \
1721
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 && \
18-
cd /build_temp/python36 && \
19-
apt-get install -y aptitude &&\
20-
aptitude -y install gcc make zlib1g-dev libffi-dev libssl-dev &&\
22+
aptitude -y install gcc make zlib1g-dev libffi-dev libssl-dev && \
23+
apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
24+
RUN cd /build_temp/python36 && \
2125
mkdir -p test && cd test &&\
2226
wget http://npmmirror.com/mirrors/python/3.8.10/Python-3.8.10.tgz &&\
2327
tar -xvf Python-3.8.10.tgz &&\
2428
chmod -R +x Python-3.8.10 &&\
2529
cd Python-3.8.10/ &&\
2630
./configure &&\
27-
aptitude -y install libffi-dev libssl-dev &&\
2831
make && make install &&\
2932
cd /build_temp/nodejs &&\
3033
wget https://deb.nodesource.com/setup_16.x &&\
3134
chmod +x setup_16.x &&\
3235
./setup_16.x &&\
33-
apt-get install -y nodejs &&\
3436
rm -rf /build_temp && \
35-
apt install -y gosu unzip python && \
3637
gosu nobody true && \
3738
useradd -s /bin/bash -m user
3839

docs/NW升级记录.MD

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
## 0.56.1
2+
启动进入开发窗口会崩溃
3+
### 详情
4+
`--mixed-context` 情况下,在任意iframe加载后,执行db创建逻辑,必定崩溃。
5+
6+
### 复现样本:
7+
```json
8+
{
9+
"name": "sqlite3-test",
10+
"version": "1.0.0",
11+
"description": "",
12+
"main": "html/index.html",
13+
"chromium-args": "--mixed-context",
14+
15+
"author": "",
16+
"license": "ISC",
17+
"dependencies": {
18+
"@vscode/sqlite3": "^5.1.12-vscode"
19+
}
20+
}
21+
22+
```
23+
```html
24+
25+
<html>
26+
<head></head>
27+
<body>
28+
<h1>Test Page</h1>
29+
<iframe src="./sub.html" style="width:600px; height:400px;"></iframe>
30+
<script>
31+
setTimeout(() => {
32+
const sqlite3 = require('@vscode/sqlite3');
33+
try {
34+
const db = new sqlite3.Database(':memory:', e => {});
35+
console.warn('db:', db);
36+
} catch (err) {
37+
console.error('sqlite init err', err, err.stack);
38+
}
39+
}, 1000);
40+
</script>
41+
</body>
42+
</html>
43+
```
44+
45+
### 处理方法
46+
47+
~~移除`--mixed-context`,但是此操作的子脚本会读不到window,需要做一些曲线救国。~~
48+
49+
找nwjs的iframe文档,加个`nwdisable`解决。
50+
51+
## 0.62.0
52+
Check failed: current_ != end_

res/scripts/core_index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"use strict";
2+
{
3+
const createElement = document.createElement
4+
document.createElement = function (tagName) {
5+
const instance = createElement.call(document, tagName)
6+
if (tagName === 'iframe') {
7+
instance.setAttribute('nwdisable', 'true')
8+
}
9+
return instance
10+
}
11+
}

res/scripts/hackrequire.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,20 @@
8282

8383
}
8484

85-
return new originMenuItem(options);
85+
const instance = new originMenuItem(options);
86+
Object.defineProperties(instance, {
87+
key: {
88+
set(value) {
89+
console.warn('Ignore setting key:', value);
90+
}
91+
},
92+
modifiers: {
93+
set(value) {
94+
console.warn('Ignore setting modifiers:', value);
95+
}
96+
}
97+
});
98+
return instance;
8699

87100
};
88101

tools/fix-other.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ cat "${srcdir}/res/scripts/entrance.js" > "${package_dir}/js/core/entrance.js"
8989
cat "${package_dir}/js/core/entrance.js.bak" >> "${package_dir}/js/core/entrance.js"
9090
rm "${package_dir}/js/core/entrance.js.bak"
9191

92+
# 修复iframe导致的崩溃
93+
sed -i 's#"use strict";##' "${package_dir}/js/core/index.js"
94+
mv "${package_dir}/js/core/index.js" "${package_dir}/js/core/index.js.bak"
95+
cat "${srcdir}/res/scripts/core_index.js" > "${package_dir}/js/core/index.js"
96+
cat "${package_dir}/js/core/index.js.bak" >> "${package_dir}/js/core/index.js"
97+
rm "${package_dir}/js/core/index.js.bak"
98+
9299
# 修复编辑器不能覆盖粘贴
93100
sed -i 's#if(super(),l.isLinux){let#if(super(),l.isLinux){return;let#' "${package_dir}/js/libs/vseditor/bundled/editor.bundled.js"
94101

tools/fix-package-name.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ const parseFile = function (path) {
1212

1313
content.name = "wechat-devtools";
1414
// 开启调试,更新参数
15-
content['chromium-args'] = content['chromium-args'].replace('--disable-devtools', '--mixed-context').replace('--ignore-gpu-blacklist', '--ignore-gpu-blocklist')
16-
// fix worker #145
17-
.replace('--js-flags=--harmony-weak-refs', '--enable-features=SharedArrayBuffer')
15+
content['chromium-args'] = content['chromium-args']
16+
.replace('--disable-devtools', '--mixed-context')
17+
.replace('--ignore-gpu-blacklist', '--ignore-gpu-blocklist')
18+
// fix worker, issue #145
19+
.replace('--js-flags=--harmony-weak-refs', '--enable-features=SharedArrayBuffer')
1820
content.window.height = content.window.width = 1000
1921
fs.writeFileSync(path, JSON.stringify(content));
2022

tools/rebuild-node-modules.sh

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export JOBS=$max_thread
112112
node-pty@1.0.0 \
113113
native-watchdog \
114114
oniguruma \
115-
spdlog@0.11.1 \
115+
@vscode/spdlog@0.13.11 \
116116
nodegit \
117117
@vscode/sqlite3 \
118118
--ignore-scripts \
@@ -158,7 +158,7 @@ cd ..
158158
cd native-watchdog
159159
# 不需要node的版本
160160
notice "build native-watchdog"
161-
nw-gyp rebuild --arch=$arch "--target=$NW_VERSION" --dist-url=https://registry.npmmirror.com/-/binary/nwjs
161+
nw-gyp rebuild --arch=$arch "--target=$NW_VERSION"
162162
cd ..
163163

164164
cp -fr "oniguruma" "oniguruma-node"
@@ -173,25 +173,19 @@ node-gyp configure "${configure_args[@]}"
173173
node-gyp build
174174
cd ../oniguruma
175175
notice "rebuild oniguruma"
176-
nw-gyp rebuild --arch=$arch "--target=$NW_VERSION" --dist-url=https://registry.npmmirror.com/-/binary/nwjs
176+
nw-gyp rebuild --arch=$arch "--target=$NW_VERSION"
177177
if [ "$arch" == "loongarch64" ] && [ "$(uname -m)" == "x86_64" ];then
178178
export CFLAGS="$BAK_CFLAGS"
179179
export CXXFLAGS="$BAK_CXXFLAGS"
180180
fi
181181

182182
cd ..
183183

184-
cp -fr "spdlog" "spdlog-node"
185-
cd spdlog-node
184+
cp -fr "@vscode/spdlog" "@vscode/spdlog18"
185+
cd @vscode/spdlog18
186186
node-gyp configure "${configure_args[@]}"
187187
node-gyp build
188-
cd ..
189-
mkdir -p @vscode
190-
cp -fr "spdlog-node" "@vscode/spdlog18"
191-
cd spdlog
192-
notice "rebuild spdlog"
193-
nw-gyp rebuild --arch=$arch "--target=$NW_VERSION" --dist-url=https://registry.npmmirror.com/-/binary/nwjs
194-
cd ..
188+
cd ../..
195189

196190
cd @vscode/sqlite3
197191
notice "Build @vscode/sqlite3"

0 commit comments

Comments
 (0)