Skip to content

Commit

Permalink
removed sth
Browse files Browse the repository at this point in the history
  • Loading branch information
ezshine committed Jan 26, 2021
1 parent 1c96e54 commit 538f03c
Show file tree
Hide file tree
Showing 71 changed files with 1,107 additions and 18,546 deletions.
Binary file modified .DS_Store
Binary file not shown.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
<img align="left" alt="大帅ezshine | bilibili.com" width="21px" src="https://www.bilibili.com/favicon.ico" />
</a>

> 请将能成功反编译的wxapkg文件提交到本仓库中,不能反编译的小程序提交issue并附上wxapkg的下载地址。
### changelog

~~~~
2021.01.26
removed convertToTaro
removed convertToUniapp
optimized app size
~~~~

<br />
<br />

Expand All @@ -32,6 +44,3 @@
#### src文件夹
> 此工具的源码
## 下载地址
[下载:v1.0.0版]()

Binary file modified src/app.jsc
Binary file not shown.
12 changes: 7 additions & 5 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,20 @@
</style>
<script src="js/zepto.js"></script>
<script>
const {shell} = require('electron');
const {shell,ipcRenderer} = require('electron');
const package = require("./package.json");
const bn = require('bytenode');
const app = require('./app.jsc');

const fixPath = require('fix-path')
fixPath()

function openExternal(url){
shell.openExternal(url);
}

Zepto(function($){
$("#version").text(package.version);
$("#version").click(function(){
ipcRenderer.send('openDevTools');
});
});
</script>
</head>
Expand All @@ -93,7 +93,7 @@
<div id='tips' style="-webkit-user-select: none;width: 100%;height:100%;position: absolute;z-index: 9;text-align: center;font-size: 30px;color:#fff;text-shadow: 0px 0px 3px #000;padding-top: 275px;">

</div>
<div id='version' style="-webkit-user-select: none;width: 100%;position: absolute;z-index: 8;text-align: center;font-size: 16px;color:#F8F5BD;text-shadow: 0px 0px 3px #000;bottom: 110px;"></div>
<div id='version' style="cursor: pointer;-webkit-user-select: none;width: 100%;position: absolute;z-index: 10;text-align: center;font-size: 16px;color:#F8F5BD;text-shadow: 0px 0px 3px #000;bottom: 110px;"></div>
<img src="images/front.png" class="front" style="z-index: 6;"/>
<div style="width:101px;height: 101px;position: absolute;z-index:2;left:204px;top:292px;">
<img src="images/gear_lb.png" class='rotate2 gear2 front'/>
Expand All @@ -114,5 +114,7 @@
<img src="images/back.png" class="back" style="z-index: 1;"/>
</div>
<div style="-webkit-app-region:drag;width: 100%;height: 80px;position: absolute;z-index: 99;background: rgba(0,0,0,0.01);left: 0;top:0;"></div>
<div style="-webkit-app-region:drag;width: 80px;height: 100%;position: absolute;z-index: 99;background: rgba(0,0,0,0.01);left: 0;top:0;"></div>
<div style="-webkit-app-region:drag;width: 80px;height: 100%;position: absolute;z-index: 99;background: rgba(0,0,0,0.01);right: 0;top:0;"></div>
</body>
</html>
9 changes: 8 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ ipcMain.on("showNotification",function(event,obj){
}})
})


ipcMain.on("openDevTools",openDevTools);

function showNotification(msg='',options){
if(!Notification.isSupported())return;

Expand Down Expand Up @@ -102,10 +105,14 @@ function createMainWindow(loadpath) {
})

globalShortcut.register('CommandOrControl+`', () => {
mainWindow.webContents.openDevTools({mode:'detach',activate:true})

});
}

function openDevTools(){
if(mainWindow)mainWindow.webContents.openDevTools({mode:'detach',activate:true})
}

// 限制只可以打开一个应用, 当运行第二个实例时退出第一个实例
const gotTheLock = app.requestSingleInstanceLock()
if (!gotTheLock) {
Expand Down
223 changes: 223 additions & 0 deletions src/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
const {
shell,
ipcRenderer
} = require('electron');
const exec = require('child_process').exec;
const path = require('path')
const fs = require('fs')
const axios = require('axios');
let iconv = require('iconv-lite');
let wxUnpackedPath;
let isRunning=false;
Zepto(function($){
initDragIn();

hideButtons();
showTips("拖入 .wxapkg<br><a href='javascript:openExternal(\"https://www.bilibili.com/video/BV1yz4y1C7ae\");' style='font-size:24px;color:#F8F5BD;'>查看教程</a>");
})
function showButtons(){
$("#buttons").css("display","flex");
}
function hideButtons(){
$("#buttons").css("display","none");
}
function showTips(msg){
$("#tips").html(msg);
}
function startAni(){
$(".gear1").css("animation-play-state","running");
$(".gear2").css("animation-play-state","running");
}
function stopAni(){
$(".gear1").css("animation-play-state","paused");
$(".gear2").css("animation-play-state","paused");
getNews();
}
function doUnpack(fname){
hideButtons();
showTips("反编译中");
startAni();
isRunning=true;
let cmdStr = 'node wuWxapkg.js ' + fname
// 执行cmd命令的目录
let cmdPath = path.join(__dirname)
// 子进程名称
let workerProcess
// 执行命令行,如果命令不需要路径,或就是项目根目录,则不需要cwd参数:
workerProcess = exec(cmdStr, { cwd: cmdPath })
workerProcess.stdout.on('data', function(data) {
console.log(data);
})
// 打印错误的后台可执行程序输出
workerProcess.stderr.on('data', function(data) {
console.log(data);
})
// 退出之后的输出
workerProcess.on('close', function(code) {
isRunning=false;
wxUnpackedPath = fname.substring(0,fname.length-7);
showTips("反编译成功");
stopAni();
setTimeout(function(){
showButtons();
},1000);
})
}
function initDragIn() {
window.ondragover = function(e) {
e.preventDefault();
if(isRunning)return false;
e.dataTransfer.dropEffect = 'copy';
return false;
};

window.ondrop = function(e) {
if(isRunning)return;
e.preventDefault();
wxUnpackedPath = "";
let fileName = e.dataTransfer.files[0].path;
console.log(e);
console.log(fileName);

let indexOf = fileName.lastIndexOf(".wxapkg");
if (indexOf >= 0) {
doUnpack(fileName);
}else if(fs.statSync(fileName).isDirectory){
if(fs.existsSync(path.join(fileName,"app.json"))){
wxUnpackedPath = fileName;
hideButtons();
showTips("...检测中...");
startAni();
setTimeout(function(){
showButtons();
stopAni();
},1000);
}
}

return false;
};

window.ondragleave = function() {
return false;
};
}
function openExternal(url){
shell.openExternal(url);
}
function goJuejin(){
openExternal("https://juejin.im/user/2955079655898093");
}
function convertUniapp(){
isRunning=true;
showTips("转换为 uniapp 项目");
hideButtons();
startAni();
let cmdStr = path.join(__dirname,"node_modules","miniprogram-to-uniapp","bin","wtu") +" ./";
// 执行cmd命令的目录
let cmdPath = wxUnpackedPath;
// 子进程名称
let workerProcess

console.log(cmdStr,cmdPath);
// 执行命令行,如果命令不需要路径,或就是项目根目录,则不需要cwd参数:
workerProcess = exec(cmdStr, { cwd: cmdPath })
workerProcess.stdout.on('data', function(data) {
console.log(iconv.decode(Buffer.concat([data]), 'GBK'));
})
// 打印错误的后台可执行程序输出
workerProcess.stderr.on('data', function(data) {
console.log(iconv.decode(Buffer.concat([data]), 'GBK'));
})
// 退出之后的输出
workerProcess.on('close', function(code) {
isRunning=false;
console.log("convert uniapp done");
showTips("转换完成");
stopAni();
setTimeout(function(){
showButtons();
},1000);
})
}
function convertTaro(){
isRunning=true;
showTips("转换为 taro 项目");
hideButtons();
startAni();
let cmdStr = path.join(__dirname,"node_modules","@tarojs","cli","bin","taro") +" convert";
// 执行cmd命令的目录
let cmdPath = wxUnpackedPath;
// 子进程名称
let workerProcess
// 执行命令行,如果命令不需要路径,或就是项目根目录,则不需要cwd参数:
workerProcess = exec(cmdStr, { cwd: cmdPath })
workerProcess.stdout.on('data', function(data) {
console.log(data);
})
// 打印错误的后台可执行程序输出
workerProcess.stderr.on('data', function(data) {
console.log(data);
})
// 退出之后的输出
workerProcess.on('close', function(code) {
isRunning=false;
console.log("convertTaro done");
exec("mv taroConvert/ "+wxUnpackedPath+"_taro/", { cwd: cmdPath });
showTips("转换完成");
stopAni();
setTimeout(function(){
showButtons();
},1000);
})
}

let config = [
{
name:"全栈然叔",
userid:"1978776660216136",
head:"images/head_xia.jpg"
},
{
name:"大帅搞全栈",
userid:"2955079655898093",
head:"images/head_shuai.jpg"
},
{
name:"蜗牛老湿_大圣",
userid:"1556564194370270",
head:"images/head_sheng.jpg"
},
{
name:"杨村长",
userid:"325111174926350",
head:"images/head_yang.jpg"
}
];

async function getNews(){
//https://apinew.juejin.im/content_api/v1/article/query_list
let user = config[Math.floor(Math.random()*config.length)];
let res = await axios.post(
"https://apinew.juejin.im/content_api/v1/article/query_list",
{
"cursor": "0",
"sort_type": 2,
"user_id": user.userid
}
);//https://juejin.im/post/
let aindex = Math.floor(Math.random()*res.data.data.length);

ipcRenderer.send('showNotification',{
title:user.name,
msg:res.data.data[aindex].article_info.title,
icon:user.head,
url:"https://juejin.im/post/"+res.data.data[aindex].article_info.article_id
});
}

module.exports={
convertTaro:convertTaro,
convertUniapp:convertUniapp,
goJuejin:goJuejin
}
Loading

0 comments on commit 538f03c

Please sign in to comment.