mirror of
https://github.com/msojocs/wechat-web-devtools-linux.git
synced 2025-07-22 00:00:04 +08:00
fix: Can`t open terminal in git manage
This commit is contained in:
parent
1f61b3512e
commit
3c0ac9faa5
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
- [x] 打开
|
- [x] 打开
|
||||||
- [x] 代码管理可点击
|
- [x] 代码管理可点击
|
||||||
- [ ] 终端打开(不通过)
|
- [x] 终端打开
|
||||||
|
|
||||||
## 自动化测试
|
## 自动化测试
|
||||||
|
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
node tools/wxvpkg/pack package.nw/core.wxvpkg.ext package.nw/core.wxvpkg
|
set -e
|
||||||
rm -rf /home/msojocs/.config/wechat_devtools/WeappCache
|
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||||
bin/wechat-devtools
|
a=$1
|
||||||
|
if [ "$a" == '1' ];then
|
||||||
|
rm -rf "$root_dir/package.nw/core.wxvpkg.ext"
|
||||||
|
node tools/wxvpkg/unpack "$root_dir/package.nw/core.wxvpkg" "$root_dir/package.nw/core.wxvpkg.ext"
|
||||||
|
else
|
||||||
|
node tools/wxvpkg/pack package.nw/core.wxvpkg.ext package.nw/core.wxvpkg
|
||||||
|
rm -rf ~/.config/wechat_devtools/WeappCache
|
||||||
|
bin/wechat-devtools
|
||||||
|
fi
|
15
test/wxvpkg-test
Normal file
15
test/wxvpkg-test
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||||
|
tmp_dir="$root_dir/tmp"
|
||||||
|
|
||||||
|
# unpack 文件 到 路径
|
||||||
|
node "$root_dir/tools/wxvpkg/unpack" "$tmp_dir/core.wxvpkg" "$tmp_dir/core.wxvpkg.ext"
|
||||||
|
|
||||||
|
# pack 路径 到 文件
|
||||||
|
node "$root_dir/tools/wxvpkg/pack" "$tmp_dir/core.wxvpkg.ext" "$tmp_dir/core.wxvpkg.test"
|
||||||
|
|
||||||
|
# unpack 文件 到 路径
|
||||||
|
rm -rf "$tmp_dir/core.wxvpkg.ext1"
|
||||||
|
node "$root_dir/tools/wxvpkg/unpack" "$tmp_dir/core.wxvpkg.test" "$tmp_dir/core.wxvpkg.ext1"
|
||||||
|
|
@ -1,29 +1,45 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "Fix Cloud Console"
|
echo "Fix Core"
|
||||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||||
|
|
||||||
package_dir="$root_dir/package.nw"
|
package_dir="$root_dir/package.nw"
|
||||||
tmp_dir="$root_dir/tmp"
|
tmp_dir="$root_dir/tmp/core"
|
||||||
|
|
||||||
|
mkdir -p $tmp_dir
|
||||||
# unpack 文件 到 路径
|
# unpack 文件 到 路径
|
||||||
node "$root_dir/tools/wxvpkg/unpack" "$package_dir/core.wxvpkg" "$tmp_dir/core.wxvpkg"
|
node "$root_dir/tools/wxvpkg/unpack" "$package_dir/core.wxvpkg" "$tmp_dir/core.wxvpkg"
|
||||||
|
|
||||||
|
# ____ _____ ____ _ _ ____ _____ ____ ___ ____ _____
|
||||||
|
# | _ \| ____| _ \| | / \ / ___| ____| / ___/ _ \| _ \| ____|
|
||||||
|
# | |_) | _| | |_) | | / _ \| | | _| | | | | | | |_) | _|
|
||||||
|
# | _ <| |___| __/| |___ / ___ \ |___| |___ | |__| |_| | _ <| |___
|
||||||
|
# |_| \_\_____|_| |_____/_/ \_\____|_____| \____\___/|_| \_\_____|
|
||||||
|
#
|
||||||
|
|
||||||
# find
|
# find
|
||||||
open_find_result=$( grep -lr "this.props.onWindowOpenFail());" "$root_dir/tmp/core.wxvpkg" )
|
open_find_result=$( grep -lr "this.props.onWindowOpenFail());" "$root_dir/tmp/core.wxvpkg" )
|
||||||
token_find_result=$( grep -lr "constructor(){this._sessionToken=\"\",this._tokenMap={}}" "$tmp_dir/core.wxvpkg" )
|
|
||||||
echo "云开发控制台启动点: $open_find_result"
|
echo "云开发控制台启动点: $open_find_result"
|
||||||
echo "WebSocket token存储对象位置: $token_find_result"
|
|
||||||
|
|
||||||
|
|
||||||
# replace
|
# replace
|
||||||
new_cb_handle="this.props.onWindowOpenFail());Object.keys(window).forEach(key=>{if(!e.window[key]){try{e.window[key]=window[key];}catch(e){console.error(e);}}});"
|
new_cb_handle="this.props.onWindowOpenFail());Object.keys(window).forEach(key=>{if(!e.window[key]){try{e.window[key]=window[key];}catch(e){console.error(e);}}});"
|
||||||
sed -i "s/this.props.onWindowOpenFail());/$new_cb_handle/g" $open_find_result
|
sed -i "s/this.props.onWindowOpenFail());/$new_cb_handle/g" $open_find_result
|
||||||
|
|
||||||
|
token_find_result=$( grep -lr "constructor(){this._sessionToken=\"\",this._tokenMap={}}" "$tmp_dir/core.wxvpkg" )
|
||||||
|
echo "WebSocket token存储对象位置: $token_find_result"
|
||||||
new_constructor="constructor(){if(window.tokenData){/*有就直接用*/this._sessionToken=window.tokenData._sessionToken;this._tokenMap=window.tokenData._tokenMap;}else{/*没有就新建*/this._sessionToken=\"\",this._tokenMap={};window.tokenData=this;/*新建完要给中间人*/}}"
|
new_constructor="constructor(){if(window.tokenData){/*有就直接用*/this._sessionToken=window.tokenData._sessionToken;this._tokenMap=window.tokenData._tokenMap;}else{/*没有就新建*/this._sessionToken=\"\",this._tokenMap={};window.tokenData=this;/*新建完要给中间人*/}}"
|
||||||
sed -i "s#constructor(){this._sessionToken=\"\",this._tokenMap={}}#$new_constructor#g" "$token_find_result"
|
sed -i "s#constructor(){this._sessionToken=\"\",this._tokenMap={}}#$new_constructor#g" "$token_find_result"
|
||||||
|
|
||||||
|
# open -a Terminal "`pwd`" --> gnome-terminal
|
||||||
|
find_result=$( grep -lr 'open -a Terminal "`pwd`"' "$tmp_dir/core.wxvpkg" )
|
||||||
|
echo "Terminal启动位置: $find_result"
|
||||||
|
new_str="gnome-terminal"
|
||||||
|
sed -i "s#open -a Terminal \"\`pwd\`\"#$new_str#g" "$find_result"
|
||||||
|
|
||||||
|
|
||||||
# pack 路径 到 文件
|
# pack 路径 到 文件
|
||||||
node "$root_dir/tools/wxvpkg/pack" "$tmp_dir/core.wxvpkg" "$package_dir/core.wxvpkg"
|
node "$root_dir/tools/wxvpkg/pack" "$tmp_dir/core.wxvpkg" "$package_dir/core.wxvpkg"
|
||||||
rm -rf "$tmp_dir/core.wxvpkg"
|
rm -rf "$tmp_dir/core.wxvpkg"
|
||||||
|
|
||||||
|
if [ -d ~/.config/wechat_devtools/WeappCache ];then
|
||||||
|
echo "删除缓存"
|
||||||
|
rm -rf ~/.config/wechat_devtools/WeappCache
|
||||||
|
fi
|
@ -2,7 +2,6 @@
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const { execSync, spawn } = require("child_process");
|
const { execSync, spawn } = require("child_process");
|
||||||
const util = require("util");
|
|
||||||
|
|
||||||
const nodeConfig = require("../conf/node.json");
|
const nodeConfig = require("../conf/node.json");
|
||||||
const { exit } = require("process");
|
const { exit } = require("process");
|
||||||
|
@ -232,10 +232,10 @@ const patch_wechat_devtools_CLI = function () {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
const patch_wechat_devtools_core = function () {
|
const patch_wechat_devtools_core = function () {
|
||||||
info("Patching wechat-devtools cloud console supports");
|
info("Patching wechat-devtools core.wxvpkg");
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
spawn(path.resolve(__dirname, "fix-cloudconsole"), [], {
|
spawn(path.resolve(__dirname, "fix-core"), [], {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
}).on("close", (code) => {
|
}).on("close", (code) => {
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -29,10 +29,13 @@ function writeInt32(number, start) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let files = fs.readdirSync(dest)
|
let files = fs.readdirSync(dest)
|
||||||
|
// 文件数
|
||||||
let totalCount = files.length
|
let totalCount = files.length
|
||||||
|
|
||||||
let buf = Buffer.alloc(4)
|
let buf = Buffer.alloc(4)
|
||||||
buf.writeInt32BE(totalCount, 0)
|
buf.writeInt32BE(totalCount, 0)
|
||||||
writeSync(buf, 14)
|
writeSync(buf, 14)
|
||||||
|
|
||||||
let start = 18
|
let start = 18
|
||||||
// 12 + /name.length
|
// 12 + /name.length
|
||||||
let dataOffset = start
|
let dataOffset = start
|
||||||
|
@ -19,6 +19,7 @@ function readSync(start, length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const totalCount = readSync(14, 4).readInt32BE(0)
|
const totalCount = readSync(14, 4).readInt32BE(0)
|
||||||
|
console.log('totalCount', totalCount)
|
||||||
const map = {};
|
const map = {};
|
||||||
let n = 18;
|
let n = 18;
|
||||||
for (let i = 0; i < totalCount; i++) {
|
for (let i = 0; i < totalCount; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user