mirror of
https://github.com/msojocs/wechat-web-devtools-linux.git
synced 2025-07-22 00:00:04 +08:00
fix: cli使用异常 #147
This commit is contained in:
parent
8c9eeed51f
commit
322de01a35
@ -1,3 +1,6 @@
|
|||||||
|
# 1.06.2504010-2 / 2025-07-15
|
||||||
|
- fix: cli使用异常。#147
|
||||||
|
|
||||||
# 1.06.2504010-1 / 2025-07-05
|
# 1.06.2504010-1 / 2025-07-05
|
||||||
- fix: 更新弹窗无法关闭。
|
- fix: 更新弹窗无法关闭。
|
||||||
- update: devtools to v1.06.2504010
|
- update: devtools to v1.06.2504010
|
||||||
|
@ -8,7 +8,7 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
|
|||||||
done
|
done
|
||||||
root_dir="$( cd -P "$( dirname "$SOURCE" )"/.. >/dev/null 2>&1 && pwd )"
|
root_dir="$( cd -P "$( dirname "$SOURCE" )"/.. >/dev/null 2>&1 && pwd )"
|
||||||
|
|
||||||
cd $root_dir
|
cd $root_dir/bin
|
||||||
|
|
||||||
export WECHAT_DEVTOOLS_DIR="$root_dir/nwjs"
|
export WECHAT_DEVTOOLS_DIR="$root_dir/nwjs"
|
||||||
export APPDATA="$root_dir/nwjs"
|
export APPDATA="$root_dir/nwjs"
|
||||||
|
29
res/scripts/cli.js
Normal file
29
res/scripts/cli.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
(() => {
|
||||||
|
process.argv[0] = 'wechat-devtools-cli'
|
||||||
|
process.env.USERPROFILE = require('os').homedir()
|
||||||
|
Object.defineProperty(global, 'userDirPath', {
|
||||||
|
set: function(value) {
|
||||||
|
if (value.includes('AppData/Local')) {
|
||||||
|
value = value.replace('AppData/Local', '.config')
|
||||||
|
value = value.replace(/User Data\/.*?\//, '')
|
||||||
|
// value = value.replace('~', require('os').homedir())
|
||||||
|
}
|
||||||
|
this._userDirPath = value
|
||||||
|
},
|
||||||
|
get: function() {
|
||||||
|
return this._userDirPath
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// appPath
|
||||||
|
Object.defineProperty(global, 'appPath', {
|
||||||
|
set: function(value) {
|
||||||
|
if (value.includes('.exe')) {
|
||||||
|
value = value.replace('.exe', '')
|
||||||
|
}
|
||||||
|
this._appPath = value
|
||||||
|
},
|
||||||
|
get: function() {
|
||||||
|
return this._appPath
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})();
|
@ -1,11 +1,11 @@
|
|||||||
(() => {
|
(() => {
|
||||||
const http = require('http')
|
const http = require('http')
|
||||||
const originaleListen = http.Server.prototype.listen
|
const originaleListen = http.Server.prototype.listen
|
||||||
http.Server.prototype.listen = function(port) {
|
http.Server.prototype.listen = function(...args) {
|
||||||
if (port == 33233) {
|
if (args[0] == 33233) {
|
||||||
console.warn('block port of http server:', port)
|
console.warn('block port of http server:', args[0])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return originaleListen.apply(this, [port])
|
return originaleListen.apply(this, args)
|
||||||
}
|
}
|
||||||
})();
|
})();
|
@ -11,7 +11,8 @@ fi
|
|||||||
|
|
||||||
cd "$NW_PACKAGE_DIR"
|
cd "$NW_PACKAGE_DIR"
|
||||||
|
|
||||||
sed -i 's#AppData/Local/\${global.userDirName}/User Data/\${global.productHash}/Default#.config/\${global.userDirName}/Default#g' js/common/cli/index.js
|
cd $root_dir/package.nw/js/common/cli
|
||||||
sed -i 's#USERPROFILE#HOME#g' js/common/cli/index.js
|
cat $root_dir/res/scripts/cli.js > temp.js
|
||||||
sed -i 's#`./\${global.appname}.exe`#`./bin/\${global.appname}`#g' js/common/cli/index.js
|
cat index.js >> temp.js
|
||||||
sed -i 's#,""));const T#,""));_.$0="wechat-devtools-cli";const T#' js/common/cli/index.js
|
rm index.js
|
||||||
|
mv temp.js index.js
|
Loading…
x
Reference in New Issue
Block a user