feat: update version and add node modules
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
10
tera/README.MD
Normal file
10
tera/README.MD
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
## Tera Windows 一键挖矿脚本
|
||||||
|
|
||||||
|
使用方式
|
||||||
|
|
||||||
|
- 下载 git[下载地址](https://git-scm.com/download/win) 并且安装完成
|
||||||
|
- 找到一个你喜欢的目录 这里将保存挖矿相关文件和运行环境
|
||||||
|
- 右键 => Git Bash
|
||||||
|
- 输入 `curl -sSL https://git.yumc.pw/cloud/script/raw/master/tera/run.sh | bash`
|
||||||
|
- 静静的等待
|
||||||
|
- 如果有问题 请反馈给 QQ 502647092
|
18
tera/init.js
18
tera/init.js
@ -15,15 +15,15 @@ console.log('开启倒序加载 => 5000');
|
|||||||
global.WATCHDOG_BADACCOUNT = 2;
|
global.WATCHDOG_BADACCOUNT = 2;
|
||||||
console.log('开启账户安全狗 => 2');
|
console.log('开启账户安全狗 => 2');
|
||||||
|
|
||||||
global.NET_WORK_MODE = {
|
//global.NET_WORK_MODE = {
|
||||||
ip: "",
|
// ip: "",
|
||||||
port: 30000,
|
// port: 30000,
|
||||||
UseDirectIP: true,
|
// UseDirectIP: true,
|
||||||
NodeWhiteList: "",
|
// NodeWhiteList: "",
|
||||||
DoRestartNode: 1
|
// DoRestartNode: 1
|
||||||
}
|
//}
|
||||||
global.LISTEN_IP = "0.0.0.0";
|
//global.LISTEN_IP = "0.0.0.0";
|
||||||
global.START_PORT_NUMBER = 30000;
|
//global.START_PORT_NUMBER = 30000;
|
||||||
|
|
||||||
SAVE_CONST(true);
|
SAVE_CONST(true);
|
||||||
console.log("保存配置文件...")
|
console.log("保存配置文件...")
|
||||||
|
84
tera/run.sh
84
tera/run.sh
@ -1,26 +1,56 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SHELL_PREFIX="[SYNC]"
|
||||||
|
# Shell Base Script
|
||||||
|
set -e
|
||||||
|
|
||||||
|
c_red="\033[38;5;1m"
|
||||||
|
c_blue="\033[38;5;4m"
|
||||||
|
c_green="\033[38;5;2m"
|
||||||
|
c_reset="\033[0m"
|
||||||
|
c_yellow="\033[38;5;3m"
|
||||||
|
|
||||||
|
c_prefix="${c_blue}${SHELL_PREFIX}>>${c_reset}"
|
||||||
|
|
||||||
|
dateStr() {
|
||||||
|
echo -e "[$(date '+%H:%M:%S')]"
|
||||||
|
}
|
||||||
|
|
||||||
|
info() {
|
||||||
|
echo -e "${c_prefix}$(dateStr) ${*}"
|
||||||
|
}
|
||||||
|
|
||||||
|
warn() {
|
||||||
|
echo -e "${c_prefix}$(dateStr) ${c_yellow}${*}${c_reset}"
|
||||||
|
}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
echo -e "${c_prefix}$(dateStr) ${c_red}${*}${c_reset}"
|
||||||
|
}
|
||||||
|
#====================
|
||||||
|
|
||||||
ROOT=$(pwd)
|
ROOT=$(pwd)
|
||||||
clear
|
clear
|
||||||
set -e
|
set -e
|
||||||
echo "=============================="
|
info "=============================="
|
||||||
echo " 欢迎使用 Tera 一键挖矿系统"
|
info " 欢迎使用 Tera 一键挖矿系统"
|
||||||
echo ""
|
info ""
|
||||||
echo " by MiaoWoo"
|
info " by MiaoWoo"
|
||||||
echo ""
|
info ""
|
||||||
echo " 版本 v1.0"
|
info " 版本 v1.1"
|
||||||
echo "=============================="
|
info "=============================="
|
||||||
if [[ ! -f "OneKeyTera.sh" || ! -f ".lock" || $(cat .lock) -lt $(($(date +%s) - 86400)) ]]; then
|
if [[ ! -f "OneKeyTera.sh" || ! -f ".lock" || $(cat .lock) -lt $(($(date +%s) - 86400)) ]]; then
|
||||||
echo "更新脚本..."
|
info "更新脚本..."
|
||||||
curl -o OneKeyTera.sh https://git.yumc.pw/cloud/script/raw/master/tera/run.sh
|
curl -o OneKeyTera.sh https://git.yumc.pw/cloud/script/raw/master/tera/run.sh
|
||||||
fi
|
fi
|
||||||
echo $(date +%s) > .lock
|
info $(date +%s) > .lock
|
||||||
echo "程序将在 3秒 后运行... Ctrl + C 取消运行..."
|
info "程序将在 3秒 后运行... Ctrl + C 取消运行..."
|
||||||
sleep 2
|
sleep 2
|
||||||
echo "开始检测安装依赖..."
|
info "开始检测安装依赖..."
|
||||||
if [[ -z "$(which node)" ]]; then
|
if [[ -z "$(which node)" ]]; then
|
||||||
if [[ ! -d node ]]; then
|
if [[ ! -d node ]]; then
|
||||||
echo "未安装NodeJS 开始下载二进制包 请稍候..."
|
warn "未安装NodeJS 开始下载二进制包 请稍候..."
|
||||||
curl -o node.zip https://nodejs.org/dist/v10.16.0/node-v10.16.0-win-x64.zip
|
curl -o node.zip https://nodejs.org/dist/v10.16.0/node-v10.16.0-win-x64.zip
|
||||||
echo "下载完成 开始解压Node环境 请稍候..."
|
info "下载完成 开始解压Node环境 请稍候..."
|
||||||
unzip -q node.zip
|
unzip -q node.zip
|
||||||
mv node-v10.16.0-win-x64 node
|
mv node-v10.16.0-win-x64 node
|
||||||
rm -rf node.zip
|
rm -rf node.zip
|
||||||
@ -28,7 +58,7 @@ if [[ -z "$(which node)" ]]; then
|
|||||||
NODE=$(pwd)/node/node.exe
|
NODE=$(pwd)/node/node.exe
|
||||||
NPM=$(pwd)/node/npm
|
NPM=$(pwd)/node/npm
|
||||||
if [[ ! -f "${NODE}" ]]; then
|
if [[ ! -f "${NODE}" ]]; then
|
||||||
echo "Node 安装检测未通过 请检查网络是否正常 或删除 node 目录 重新运行本脚本..."
|
error "Node 安装检测未通过 请检查网络是否正常 或删除 node 目录 重新运行本脚本..."
|
||||||
read
|
read
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -38,17 +68,20 @@ else
|
|||||||
fi
|
fi
|
||||||
echo "NodeJS 二进制版本: $(${NODE} -v)"
|
echo "NodeJS 二进制版本: $(${NODE} -v)"
|
||||||
if [[ ! -d tera ]]; then
|
if [[ ! -d tera ]]; then
|
||||||
echo "未找到 Tera 源代码 开始Clone项目 请稍候..."
|
warn "未找到 Tera 源代码 开始Clone项目 请稍候..."
|
||||||
git clone https://gitlab.com/terafoundation/tera.git
|
git clone https://gitlab.com/terafoundation/tera.git
|
||||||
fi
|
fi
|
||||||
TERA_ROOT=${ROOT}/tera/Source
|
TERA_ROOT=${ROOT}/tera/Source
|
||||||
cd "${TERA_ROOT}"
|
cd "${TERA_ROOT}"
|
||||||
if [[ ! -d node_modules ]]; then
|
if [[ ! -d node_modules ]]; then
|
||||||
echo "未安装依赖 开始安装 请稍候..."
|
warn "未安装依赖 开始安装 请稍候..."
|
||||||
"${NPM}" install
|
"${NPM}" install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${ROOT}/tera/Source"
|
if [[ ! -f "${TERA_ROOT}/node_modules/secp256k1/build/Release/secp256k1.node" ]]; then
|
||||||
|
warn "未检测到 secp256k1.node 模块 开始下载 Windows 版本..."
|
||||||
|
curl -o "${TERA_ROOT}/node_modules/secp256k1/build/Release/secp256k1.node" https://git.yumc.pw/cloud/script/raw/master/tera/secp256k1.node
|
||||||
|
fi
|
||||||
|
|
||||||
# # 申请公网IP端口
|
# # 申请公网IP端口
|
||||||
# echo "开始申请公网IP端口 请稍候..."
|
# echo "开始申请公网IP端口 请稍候..."
|
||||||
@ -60,22 +93,27 @@ cd "${ROOT}/tera/Source"
|
|||||||
# ${NODE} ${FRP_SCRIPT}
|
# ${NODE} ${FRP_SCRIPT}
|
||||||
|
|
||||||
# 初始化配置
|
# 初始化配置
|
||||||
echo "初始化配置参数..."
|
info "初始化配置参数..."
|
||||||
INIT_SCRIPT=${TERA_ROOT}/init.js
|
INIT_SCRIPT=${TERA_ROOT}/init.js
|
||||||
if [[ ! -f ${INIT_SCRIPT} ]]; then
|
if [[ ! -f ${INIT_SCRIPT} ]]; then
|
||||||
echo "开始下载初始化脚本 请稍候..."
|
warn "开始下载初始化脚本 请稍候..."
|
||||||
curl -o ${INIT_SCRIPT} https://git.yumc.pw/cloud/script/raw/master/tera/init.js
|
curl -o ${INIT_SCRIPT} https://git.yumc.pw/cloud/script/raw/master/tera/init.js
|
||||||
fi
|
fi
|
||||||
"${NODE}" ${INIT_SCRIPT}
|
"${NODE}" ${INIT_SCRIPT}
|
||||||
|
|
||||||
# 设置NTP服务器
|
# 设置NTP服务器
|
||||||
TERA_NTP_SERVER=${TERA_NTP_SERVER:-ntp1.aliyun.com}
|
TERA_NTP_SERVER=${TERA_NTP_SERVER:-ntp1.aliyun.com}
|
||||||
echo "设置NTP服务器为阿里云地址 ${TERA_NTP_SERVER}"
|
info "设置NTP服务器为阿里云地址 ${TERA_NTP_SERVER}"
|
||||||
sed -i s@pool.ntp.org@${TERA_NTP_SERVER}@g ${TERA_ROOT}/core/library.js
|
sed -i s@pool.ntp.org@${TERA_NTP_SERVER}@g ${TERA_ROOT}/core/library.js
|
||||||
|
|
||||||
echo "开始启动挖矿进程..."
|
info "开始启动挖矿进程..."
|
||||||
echo "setTimeout(()=>require('child_process').exec('start http://127.0.0.1'), 3000)" > temp.js
|
echo "setTimeout(()=>require('child_process').exec('start http://127.0.0.1'), 3000)" > temp.js
|
||||||
"${NODE}" temp.js && echo "启动完成 打开系统默认浏览器..." && rm -rf temp.js &
|
"${NODE}" temp.js && info "启动完成 打开系统默认浏览器..." && rm -rf temp.js &
|
||||||
|
while true; do
|
||||||
"${NODE}" run-node.js
|
"${NODE}" run-node.js
|
||||||
echo "程序运行完成 按回车继续..."
|
echo "程序已关闭 将在3秒后重启 Ctrl + C 取消运行..."
|
||||||
|
sleep 3
|
||||||
|
clear
|
||||||
|
done
|
||||||
|
info "程序运行完成 按任意键继续..."
|
||||||
read ANYKEY
|
read ANYKEY
|
||||||
|
BIN
tera/secp256k1.node
Normal file
BIN
tera/secp256k1.node
Normal file
Binary file not shown.
Reference in New Issue
Block a user