luci-app-jd-dailybonus: add package

This commit is contained in:
CN_SZTL 2020-07-16 20:48:22 +08:00
parent 4bcf971105
commit 875dbc62e9
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
19 changed files with 3316 additions and 1 deletions

View File

@ -40,7 +40,9 @@ r8168 source: [BROBIRD/openwrt-r8168](https://github.com/BROBIRD/openwrt-r8168).
MentoHUST source: [KyleRicardo/MentoHUST-OpenWrt-ipk](https://github.com/KyleRicardo/MentoHUST-OpenWrt-ipk).<br/>
scutclient source: [scutclient/scutclient](https://github.com/scutclient/scutclient).<br/>
luci-app-scutclient source: [scutclient/luci-app-scutclient](https://github.com/scutclient/luci-app-scutclient).<br/>
MT-Wifi 5.0.4.0: [MeIsReallyBa/mt7615-dbdc-linux5.4](https://github.com/MeIsReallyBa/mt7615-dbdc-linux5.4).
MT-Wifi 5.0.4.0: [MeIsReallyBa/mt7615-dbdc-linux5.4](https://github.com/MeIsReallyBa/mt7615-dbdc-linux5.4).<br/>
node-request source: [jerrykuku/node-request](https://github.com/jerrykuku/node-request).<br/>
luci-app-jd-dailybonus source: [jerrykuku/luci-app-jd-dailybonus](https://github.com/jerrykuku/luci-app-jd-dailybonus).
## License
### Depending on their own License.

View File

@ -0,0 +1,67 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-jd-dailybonus
LUCI_PKGARCH:=all
PKG_VERSION:=0.8
PKG_RELEASE:=20200715
include $(INCLUDE_DIR)/package.mk
define Package/luci-app-jd-dailybonus
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=Luci for JD dailybonus Script
PKGARCH:=all
DEPENDS:=+node +node-request +coreutils +coreutils-nohup +wget
endef
define Build/Prepare
endef
define Build/Compile
endef
define Package/luci-app-define Package/jd-dailybonus/conffiles
endef
define Package/luci-app-jd-dailybonus/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci
$(INSTALL_DIR) $(1)/
cp -pR ./root/* $(1)/
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
po2lmo ./po/zh-cn/jd-dailybonus.po $(1)/usr/lib/lua/luci/i18n/jd-dailybonus.zh-cn.lmo
endef
define Package/luci-app-jd-dailybonus/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
( . /etc/uci-defaults/luci-jd-dailybonus ) && rm -f /etc/uci-defaults/luci-jd-dailybonus
rm -rf /tmp/luci-indexcache
rm -rf /tmp/luci-modulecache/*
chmod +x /etc/init.d/jd-dailybonus >/dev/null 2>&1
chmod +x /usr/share/jd-dailybonus/newapp.sh >/dev/null 2>&1
/etc/init.d/jd-dailybonus enable >/dev/null 2>&1
fi
exit 0
endef
define Package/luci-app-jd-dailybonus/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
/etc/init.d/jd-dailybonus disable
/etc/init.d/jd-dailybonus stop
fi
exit 0
endef
$(eval $(call BuildPackage,luci-app-jd-dailybonus))
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,82 @@
-- Copyright (C) 2020 jerrykuku <jerrykuku@gmail.com>
-- Licensed to the public under the GNU General Public License v3.
module("luci.controller.jd-dailybonus", package.seeall)
function index()
if not nixio.fs.access("/etc/config/jd-dailybonus") then
return
end
entry({"admin", "services", "jd-dailybonus"}, alias("admin", "services", "jd-dailybonus", "client"), _("JD-DailyBonus"), 10).dependent = true -- 首页
entry({"admin", "services", "jd-dailybonus", "client"}, cbi("jd-dailybonus/client"),_("Client"), 10).leaf = true -- 基本设置
entry({"admin", "services", "jd-dailybonus", "log"},form("jd-dailybonus/log"),_("Log"), 30).leaf = true -- 日志页面
entry({"admin", "services", "jd-dailybonus", "script"},form("jd-dailybonus/script"),_("Script"), 20).leaf = true -- 直接配置脚本
entry({"admin", "services", "jd-dailybonus", "run"}, call("run")) -- 执行程序
entry({"admin", "services", "jd-dailybonus", "update"}, call("update")) -- 执行更新
entry({"admin", "services", "jd-dailybonus", "check_update"}, call("check_update")) -- 检查更新
end
-- 执行程序
function run()
local e = {}
local uci = luci.model.uci.cursor()
local cookie = luci.http.formvalue("cookies")
local cookie2 = luci.http.formvalue("cookies2")
local auto_update = luci.http.formvalue("auto_update")
local auto_update_time = luci.http.formvalue("auto_update_time")
local auto_run = luci.http.formvalue("auto_run")
local auto_run_time = luci.http.formvalue("auto_run_time")
local stop = luci.http.formvalue("stop")
local serverchan = luci.http.formvalue("serverchan")
local failed = luci.http.formvalue("failed")
local name = ""
uci:foreach("vssr", "global", function(s) name = s[".name"] end)
if cookie ~= " " then
uci:set("jd-dailybonus", '@global[0]', 'auto_update', auto_update)
uci:set("jd-dailybonus", '@global[0]', 'auto_update_time', auto_update_time)
uci:set("jd-dailybonus", '@global[0]', 'auto_run', auto_run)
uci:set("jd-dailybonus", '@global[0]', 'auto_run_time', auto_run_time)
uci:set("jd-dailybonus", '@global[0]', 'stop', stop)
uci:set("jd-dailybonus", '@global[0]', 'cookie', cookie)
uci:set("jd-dailybonus", '@global[0]', 'cookie2', cookie2)
uci:set("jd-dailybonus", '@global[0]', 'serverchan', serverchan)
uci:set("jd-dailybonus", '@global[0]', 'failed', failed)
uci:save("jd-dailybonus")
uci:commit("jd-dailybonus")
luci.sys.call("/usr/share/jd-dailybonus/newapp.sh -r")
luci.sys.call("/usr/share/jd-dailybonus/newapp.sh -a")
e.error = 0
else
e.error = 1
end
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
--检查更新
function check_update()
local jd = "jd-dailybonus"
local e = {}
local new_version = luci.sys.exec("/usr/share/jd-dailybonus/newapp.sh -n")
e.new_version = new_version
e.error = 0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
--执行更新
function update()
local jd = "jd-dailybonus"
local e = {}
local uci = luci.model.uci.cursor()
local version = luci.http.formvalue("version")
--下载脚本
local code = luci.sys.exec("/usr/share/jd-dailybonus/newapp.sh -u")
e.error = code
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -0,0 +1,61 @@
local jd = "jd-dailybonus"
local uci = luci.model.uci.cursor()
local sys = require "luci.sys"
m = Map(jd)
-- [[ 基本设置 ]]--
s = m:section(TypedSection, "global",
translate("Base Config"))
s.anonymous = true
o = s:option(DummyValue, "", "")
o.rawhtml = true
o.template = "jd-dailybonus/cookie_tools"
o = s:option(Value, "cookie", translate("First Cookie"))
o.rmempty = false
o = s:option(Value, "cookie2", translate("Second Cookie"))
o.rmempty = true
o.description = translate('双账号用户抓取"账号1"Cookie后, 请勿点击退出账号(可能会导致Cookie失效), 需清除浏览器资料或更换浏览器登录"账号2"抓取.')
o = s:option(Value, "stop", translate("Execute Delay"))
o.rmempty = false
o.default = 0
o.datatype = integer
o.description = translate("自定义延迟签到,单位毫秒. 默认分批并发无延迟. (延迟作用于每个签到接口, 如填入延迟则切换顺序签到. ) ")
o = s:option(Value, "serverchan", translate("ServerChan SCKEY"))
o.rmempty = true
o.description = translate("微信推送基于Server酱服务请自行登录 http://sc.ftqq.com/ 绑定并获取 SCKEY (仅在自动签到时推送)")
o = s:option(Flag, "failed", translate("Failed Push"))
o.rmempty = false
o.description = translate("仅当cookie失效时推送")
o = s:option(Flag, "auto_update", translate("Auto Update"))
o.rmempty = false
o.description = translate("Auto Update Script Service")
o =s:option(ListValue, "auto_update_time", translate("Update time (every day)"))
for t = 0, 23 do o:value(t, t .. ":01") end
o.default = 1
o.rmempty = true
o:depends("auto_update", "1")
o = s:option(Flag, "auto_run", translate("Auto Run"))
o.rmempty = false
o.description = translate("Auto Run Script Service")
o =s:option(ListValue, "auto_run_time", translate("Run time (every day)"))
for t = 0, 23 do o:value(t, t .. ":05") end
o.default = 1
o.rmempty = true
o:depends("auto_run", "1")
o = s:option(DummyValue, "", "")
o.rawhtml = true
o.version = sys.exec('uci get jd-dailybonus.@global[0].version')
o.template = "jd-dailybonus/update_service"
return m

View File

@ -0,0 +1,20 @@
local fs = require "nixio.fs"
local jd = "jd-dailybonus"
local conffile = "/www/JD_DailyBonus.htm"
f = SimpleForm("logview")
m = Map(jd)
-- [[ 基本设置 ]]--
s = m:section(TypedSection, "global")
s.anonymous = true
t = s:option(TextValue, "1", nil)
t.rmempty = true
t.rows = 30
function t.cfgvalue()
return fs.readfile(conffile) or ""
end
t.readonly="readonly"
return m

View File

@ -0,0 +1,25 @@
local fs = require "nixio.fs"
local jd = "jd-dailybonus"
local uci = luci.model.uci.cursor()
function sync_value_to_file(value, file)
value = value:gsub("\r\n?", "\n")
local old_value = nixio.fs.readfile(file)
if value ~= old_value then nixio.fs.writefile(file, value) end
end
s = SimpleForm("scriptview")
view_cfg = s:field(TextValue, "conf")
view_cfg.rmempty = false
view_cfg.rows = 43
function view_cfg.cfgvalue()
return nixio.fs.readfile("/usr/share/jd-dailybonus/JD_DailyBonus.js") or ""
end
function view_cfg.write(self, section, value)
sync_value_to_file(value, "/usr/share/jd-dailybonus/JD_DailyBonus.js")
end
return s

View File

@ -0,0 +1,21 @@
<%+cbi/valueheader%>
<label class="cbi-value-title"><%= translate("Cookie Tools") %></label>
<div class="cbi-value-field">
<a class="cbi-button cbi-button-reload" href='/jd-dailybonus/JDCookie.crx'><%= translate("JDCookie.crx") %></a> <a class="cbi-button cbi-button-reload" href='/jd-dailybonus/JDCookie.zip'><%= translate("JDCookie.zip") %></a>
<div class="cbi-value-description">
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="帮助"></span>
<%= translate("Click to Install copy cookie tools,And click the jd link below. if you can't install the crx extensions,please download the JDCookie.zip,unzip it,and use load Unpacked extensions to install.link:[chrome://extensions/]")%>
</div>
</div>
<label class="cbi-value-title"><%= translate("JD Url") %></label>
<div class="cbi-value-field">
<a class="cbi-button cbi-button-reload" href='https://bean.m.jd.com' target="_blank">bean.m.jd.com</a>
<div class="cbi-value-description">
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="帮助"></span>
<%= translate("Sign in ,then click JDCookie button.you will copy JD cookies, paste the cookie below.")%>
</div>
</div>
<%+cbi/valuefooter%>

View File

@ -0,0 +1,304 @@
<%+cbi/valueheader%>
<script src="/jd-dailybonus/jquery.min.js"></script>
<style>
.modals-bg {
position: fixed;
z-index: 999;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: rgba(255, 255, 255, 0.8);
display: none;
}
.modals {
position: fixed;
z-index: 100;
width: 60%;
height: 500px;
background: #172b4d;
left: 20%;
top: 15%;
color: #fff;
border-radius: 10px;
padding: 20px;
box-sizing: border-box;
-moz-box-sizing: border-box;
/* Firefox */
-webkit-box-sizing: border-box;
/* Safari */
}
.modals h2 {
color: #fff;
background: transparent;
padding: 0 !important;
}
.modals h3 {
font-size: 14px;
color: #f5365c !important;
background: transparent;
margin: 0 0 1em 0;
padding: 0 0 0.5em 0;
}
#log_content3 {
border: 0;
width: 99%;
height: calc(100% - 4rem);
font-family: 'Lucida Console';
font-size: 11px;
background: transparent;
color: #FFFFFF;
outline: none;
padding-left: 3px;
padding-right: 22px;
overflow: hidden
}
.cbi-value-version {
word-wrap: break-word;
font-size: 0.875rem;
line-height: 1.6;
color: #5e72e4;
font-weight: bold;
padding: .7rem;
padding-left: 0;
width: 23rem;
float: left;
text-align: left;
display: table-cell;
}
@media screen and (max-width: 1024px) {
.modals {
position: fixed;
z-index: 100;
width: 80%;
height: 500px;
background: #172b4d;
left: 10%;
top: 15%;
color: #fff;
border-radius: 10px;
padding: 20px;
}
}
@media screen and (max-width: 700px) {
.modals-bg {
position: fixed;
z-index: 100000;
}
.modals {
width: 100%;
height: 100%;
left: 0;
top: 0;
}
}
</style>
<label class="cbi-value-title"><%= translate("Run") %></label>
<div class="cbi-value-field">
<input class="cbi-button cbi-button-reload" id="update_service" type="button" size="0"
value="<%= translate("Save Cookies And Run Service") %>">
</div>
<%+cbi/valuefooter%>
<%+cbi/valueheader%>
<label class="cbi-value-title"><%= translate("Current Script Version") %></label>
<div class="cbi-value-field">
<div class="cbi-value-version">
v<%=self.version%>
</div>
</div>
<%+cbi/valuefooter%>
<%+cbi/valueheader%>
<label class="cbi-value-title"><%= translate("Update Script") %></label>
<div class="cbi-value-field">
<input class="cbi-button cbi-button-reload" id="update_script" type="button" size="0"
value="<%= translate("Check Script Version") %>">
</div>
<%+cbi/valuefooter%>
<script type="text/javascript">
const SAVE_URL = '<%=luci.dispatcher.build_url("admin", "services", "jd-dailybonus","run")%>';
const CHECK_URL = '<%=luci.dispatcher.build_url("admin", "services", "jd-dailybonus","check_update")%>';
const UPDATE_URL = '<%=luci.dispatcher.build_url("admin", "services", "jd-dailybonus","update")%>';
const CHECKING_TEXT = '<%= translate("Checking the New Version ...") %>';
const UPDATING_TEXT = '<%= translate("Updating script,please wait ...") %>';
const NEW_VERSION = '<%= translate("Is currently the latest version") %>';
const UPDATE_TEXT = '<%= translate("There is a new version, click to update") %>';
var needUpdate = false;
var newVersion;
var _responseLen;
var noChange = 0;
var modal = '<div class="modals-bg">' +
'<div class="modals">' +
'<h2><%:Sign in info%></h2>' +
'<h3 style="margin-left:0;"><%:Service is running,Please do not refresh!%></h3>' +
'<textarea cols="63" rows="28" wrap="on" readonly="readonly" id="log_content3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>' +
'</div>' +
'</div>';
//显示并开始刷新订阅
function update_service() {
$("body").append(modal);
$(".modals-bg").show();
setTimeout("get_realtime_log();", 500);
}
//保存订阅按钮
$("#update_service").click(function () {
prefix_array = $("#cbi-jd-dailybonus-global .cbi-section-node").attr("id").split("-");
prefix = prefix_array[prefix_array.length - 1];
//console.log(prefix);
if ($("[name='cbid.jd-dailybonus." + prefix + ".auto_update']").is(":checked")) {
var auto_update = "1";
var auto_update_time = $("[name='cbid.jd-dailybonus." + prefix + ".auto_update_time']").val();
} else {
var auto_update = "0";
var auto_update_time = "0";
}
if ($("[name='cbid.jd-dailybonus." + prefix + ".auto_run']").is(":checked")) {
var auto_run = "1";
var auto_run_time = $("[name='cbid.jd-dailybonus." + prefix + ".auto_run_time']").val();
} else {
var auto_run = "0";
var auto_run_time = "0";
}
var stop = $("[name='cbid.jd-dailybonus." + prefix + ".stop']").val();
var cookies = $("[name='cbid.jd-dailybonus." + prefix + ".cookie']").val();
var cookies2 = $("[name='cbid.jd-dailybonus." + prefix + ".cookie2']").val();
var failed=($("[name='cbid.jd-dailybonus." + prefix + ".failed']").is(":checked"))?"1":"0";
var serverchan = $("[name='cbid.jd-dailybonus." + prefix + ".serverchan']").val();
var data = {
auto_update: auto_update,
auto_update_time: auto_update_time,
auto_run: auto_run,
auto_run_time: auto_run_time,
cookies: cookies,
cookies2: cookies2,
stop: stop,
serverchan: serverchan,
failed: failed
}
//console.log(data);
$.ajax({
type: "post",
url: SAVE_URL,
dataType: "json",
data: data,
success: function (d) {
if (d.error == 0) {
update_service();
} else {
alert("请填写cookies");
}
}
});
return false;
});
//更新脚本
$("#update_script").click(function () {
if (!needUpdate) {
//获取远端脚本版本
check_version()
} else {
$("#update_script").attr("disabled", true);
$("#update_script").val(UPDATING_TEXT);
//console.log(data);
var data = {
version: $("#update_script").attr("data-version")
}
$.ajax({
type: "post",
url: UPDATE_URL,
dataType: "json",
data: data,
success: function (d) {
if (d.error == 0) {
$("#update_script").val(NEW_VERSION);
$(".cbi-value-version").text("v" + newVersion);
} else {
$("#update_script").attr("disabled", false);
alert("更新错误请重试");
}
}
});
}
return false;
});
function get_realtime_log() {
$.ajax({
url: '/JD_DailyBonus.htm?v=' + parseInt(Math.random() * 100000000),
dataType: 'html',
error: function (xhr) {
setTimeout("get_realtime_log();", 1000);
},
success: function (response) {
var retArea = document.getElementById("log_content3");
if (response.search(" 秒") != -1) {
noChange++;
}
console.log(noChange);
if (noChange > 10) {
window.location.href = '<%=luci.dispatcher.build_url("admin", "services", "jd-dailybonus")%>';
return false;
} else {
setTimeout("get_realtime_log();", 250);
}
retArea.value = response;
retArea.scrollTop = retArea.scrollHeight;
_responseLen = response.length;
},
error: function () {
setTimeout("get_realtime_log();", 500);
}
});
}
function check_version() {
$("#update_script").attr("disabled", true);
$("#update_script").val(CHECKING_TEXT);
$.ajax({
url: CHECK_URL,
dataType: 'json',
error: function (xhr) {
},
success: function (data) {
if(data.new_version == 501){
$("#update_script").attr("disabled", false);
$("#update_script").val("无法获取新版本,请重试!");
}else if (data.new_version > <%= self.version %>) {
$("#update_script").attr("disabled", false);
$("#update_script").val(UPDATE_TEXT + " v" + data.new_version);
$("#update_script").attr("data-version", data.new_version);
newVersion = data.new_version;
needUpdate = true;
} else {
$("#update_script").val(NEW_VERSION + " v" + data.new_version);
}
}
});
}
</script>

View File

@ -0,0 +1,97 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8\n"
msgid "JD-DailyBonus"
msgstr "京东签到服务"
msgid "Enable"
msgstr "启用"
msgid "Disable"
msgstr "停用"
msgid "Log"
msgstr "日志"
msgid "Script"
msgstr "脚本"
msgid "Base Config"
msgstr "基本设置"
msgid "Cookie Tools"
msgstr "Cookie 工具"
msgid "First Cookie"
msgstr "主账号Cookie"
msgid "Second Cookie"
msgstr "第二账号Cookie"
msgid "Click to Install copy cookie tools,And click the jd link below. if you can't install the crx extensions,please download the JDCookie.zip,unzip it,and use load Unpacked extensions to install.link:[chrome://extensions/]"
msgstr "点击上面的按钮安装Cookie工具然后点击下面的京东链接。如果浏览器禁止安装crx扩展请下载第二个 JDCookie.zip解压后在[chrome://extensions/]中使用加载已解压的扩展程序进行安装。 "
msgid "JD Url"
msgstr "京东链接"
msgid "Sign in ,then click JDCookie button.you will copy JD cookies, paste the cookie below."
msgstr "登录后点击JDCookie 扩展工具复制cookie然后粘贴到下面输入框中。"
msgid "Auto Update Script Service"
msgstr "自动更新脚本服务"
msgid "Update time (every day)"
msgstr "更新时间 (每天)"
msgid "Update Script"
msgstr "更新脚本"
msgid "Execute Delay"
msgstr "延迟签到"
msgid "ServerChan SCKEY"
msgstr "Server酱 SCKEY"
msgid "Failed Push"
msgstr "失效时推送"
msgid "Auto Run"
msgstr "自动签到"
msgid "Run"
msgstr "执行"
msgid "Auto Run Script Service"
msgstr "自动签到服务"
msgid "Run time (every day)"
msgstr "签到时间 (每天)"
msgid "Save Cookies And Run Service"
msgstr "保存Cookie并签到"
msgid "Sign in info"
msgstr "签到信息"
msgid "Service is running,Please do not refresh!"
msgstr "服务正在执行中,请勿刷新!"
msgid "Updating script,please wait ..."
msgstr "正在更新脚本,请稍候 ..."
msgid "Is currently the latest version"
msgstr "当前已是最新版本。"
msgid "There is a new version, click to update"
msgstr "有新的版本,请点击更新"
msgid "Checking the New Version ..."
msgstr "正在检查是否存在新的版本 ..."
msgid "Check Script Version"
msgstr "手动检查脚本更新"
msgid "Current Script Version"
msgstr "当前脚本版本"

View File

@ -0,0 +1,120 @@
########################################################
#
# RELEASE NOTES
#
########################################################
########################################################
//
// 0.8 2020-07-15
//
//
########################################################
Updates
- NEW: 增加了使用Server酱推送签到结果到微信的功能。
- NEW: 增加了仅当cookie失效时进行微信推送的功能。
- NEW: 增加了一个自定义延迟签到的选项,能够避免并发签到带来的负面影响。
- UPDATE: 修正了在不勾选自动签到或者自动更新选项时点击保存Cookie并签到无法执行的问题。
- UPDATE: 代码精简与优化。
########################################################
//
// 0.7.8 2020-07-13
//
//
########################################################
Updates
- UPDATE: 修改了签到时间策略将原来的固定时间修改为设定时间后的180秒间随机执行感谢kid424 提供方案)。
########################################################
//
// 0.7.7 2020-07-10
// 大幅修改,建议卸载后重新安装
//
########################################################
Updates
- UPDATE: 对整个插件进行了重构cookie更新机制做了修改。
- UPDATE: 增加新的栏目可以自行编辑脚本的cookie。
- UPDATE: 增加每天定时开关,可从脚本作者源更新脚本。
- UPDATE: 将当前的打开插件自动检测版本,修改为手动检查,检查到新版本可点击更新。
########################################################
//
// 0.7.5 2020-06-25
// 小幅修正
//
########################################################
Updates
- BUGFIX: 使用wget取代curl 现在不需要curl依赖了
- UPDATE: 增加 当前版本显示
########################################################
//
// 0.7.4 2020-06-07
// 小幅修正
//
########################################################
Updates
- BUGFIX: 修正编译依赖
- BUGFIX: 修正弹窗log无法自动关闭的bug
########################################################
//
// 0.7 2020-05-27
// 小幅修正
//
########################################################
Updates
- BUGFIX: 修正部分文字翻译错误
- UPD: 改善log输出方式
- UPD: 不再对脚本检测进行锁定,可以强制更新。
########################################################
//
// 0.6 2020-05-09
// 增加脚本在线版本检测和更新功能
//
########################################################
Updates
- UPD: 增加脚本在线版本检测和更新功能
########################################################
//
// 0.5 2020-05-06
// bug修复
//
########################################################
Updates
- UPD: 增加了一个cookie工具zip包如果crx安装不上可以解压zip包内容加载已解压的扩展包。
- UPD: 增加了第二个账号的cookie可以实现双签到
- UPD: 修复部分文字解释
########################################################==
//
// END RELEASE NOTES
//
########################################################==

View File

@ -0,0 +1,8 @@
config global
option version '1.27'
option auto_run_time '1'
option auto_run '1'
option auto_update_time '1'
option auto_update '1'
option stop '0'
option failed '0'

View File

@ -0,0 +1,33 @@
#!/bin/sh /etc/rc.common
#
# Copyright (C) 2020 Jerryk
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
USE_PROCD=1
START=25
NAME=jd-dailybonus
CRON_FILE=/etc/crontabs/root
JD_SCRIPT=/usr/share/jd-dailybonus/JD_DailyBonus.js
del_cron() {
sed -i '/jd-dailybonus/d' $CRON_FILE
/etc/init.d/cron restart
}
start_service(){
/usr/share/jd-dailybonus/newapp.sh -s
}
stop_service() {
del_cron
}
service_triggers() {
procd_add_reload_trigger "jd-dailybonus"
}

View File

@ -0,0 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@jd-dailybonus[-1]
add ucitrack jd-dailybonus
set ucitrack.@jd-dailybonus[-1].init=jd-dailybonus
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,178 @@
#!/bin/sh
#
# Copyright (C) 2020 luci-app-jd-dailybonus <jerrykuku@qq.com>
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
# 501 下载脚本出错
# 101 没有新版本无需更新
# 0 更新成功
NAME=jd-dailybonus
REMOTE_SCRIPT=https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js
TEMP_SCRIPT=/tmp/JD_DailyBonus.js
JD_SCRIPT=/usr/share/jd-dailybonus/JD_DailyBonus.js
LOG_HTM=/www/JD_DailyBonus.htm
CRON_FILE=/etc/crontabs/root
usage() {
cat <<-EOF
Usage: app.sh [options]
Valid options are:
-a Add Cron
-n Check
-r Run Script
-u Update Script From Server
-s Save Cookie And Add Cron
-w Background Run With Wechat Message
-h Help
EOF
exit $1
}
# Common functions
uci_get_by_name() {
local ret=$(uci get $NAME.$1.$2 2>/dev/null)
echo ${ret:=$3}
}
uci_get_by_type() {
local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null)
echo ${ret:=$3}
}
cancel() {
if [ $# -gt 0 ]; then
echo "$1"
fi
exit 1
}
fill_cookie() {
cookie1=$(uci_get_by_type global cookie)
if [ ! "$cookie1" = "" ]; then
varb="var Key = '$cookie1';"
sed -i "s/^var Key =.*/$varb/g" $JD_SCRIPT
fi
cookie2=$(uci_get_by_type global cookie2)
if [ ! "$cookie2" = "" ]; then
varb2="var DualKey = '$cookie2';"
sed -i "s/^var DualKey =.*/$varb2/g" $JD_SCRIPT
fi
stop=$(uci_get_by_type global stop)
if [ ! "$stop" = "" ]; then
varb3="var stop = $stop;"
sed -i "s/^var stop =.*/$varb3/g" $JD_SCRIPT
fi
}
remote_ver=$(cat $TEMP_SCRIPT | sed -n '/更新时间/p' | awk '{print $NF}' | sed 's/v//')
local_ver=$(uci_get_by_type global version)
add_cron() {
sed -i '/jd-dailybonus/d' $CRON_FILE
[ $(uci_get_by_type global auto_run 0) -eq 1 ] && echo '5 '$(uci_get_by_type global auto_run_time)' * * * /bin/bash -c "sleep $[RANDOM % 180]s"; /usr/share/jd-dailybonus/newapp.sh -w' >>$CRON_FILE
[ $(uci_get_by_type global auto_update 0) -eq 1 ] && echo '1 '$(uci_get_by_type global auto_update_time)' * * * /usr/share/jd-dailybonus/newapp.sh -u' >>$CRON_FILE
crontab $CRON_FILE
}
# Run Script
serverchan() {
sckey=$(uci_get_by_type global serverchan)
failed=$(uci_get_by_type global failed)
desc=$(cat /www/JD_DailyBonus.htm | sed 's/$/&\n/g' | sed -e '/左滑/d')
if [ $failed -eq 1 ]; then
grep "Cookie失效" /www/JD_DailyBonus.htm > /dev/null
if [ $? -eq 0 ]; then
title="$(date '+%Y年%m月%d日') 京东签到 Cookie 失效"
wget-ssl -q --post-data="text=$title~&desp=$desc" https://sc.ftqq.com/$sckey.send
fi
else
title="$(date '+%Y年%m月%d日') 京东签到"
wget-ssl -q --post-data="text=$title~&desp=$desc" https://sc.ftqq.com/$sckey.send
fi
}
run() {
fill_cookie
echo -e $(date '+%Y-%m-%d %H:%M:%S %A') >$LOG_HTM 2>/dev/null
nohup node $JD_SCRIPT >>$LOG_HTM 2>/dev/null &
}
back_run() {
fill_cookie
echo -e $(date '+%Y-%m-%d %H:%M:%S %A') >$LOG_HTM 2>/dev/null
node $JD_SCRIPT >>$LOG_HTM 2>/dev/null
serverchan
}
save() {
fill_cookie
add_cron
}
# Update Script From Server
check_ver() {
wget-ssl --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" --no-check-certificate -t 3 -T 10 -q $REMOTE_SCRIPT -O $TEMP_SCRIPT
if [ $? -ne 0 ]; then
cancel "501"
else
echo $remote_ver
fi
}
update() {
wget-ssl --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" --no-check-certificate -t 3 -T 10 -q $REMOTE_SCRIPT -O $TEMP_SCRIPT
if [ $? -ne 0 ]; then
cancel "501"
fi
if [ $(echo "$local_ver < $remote_ver" | bc) -eq 1 ]; then
cp -r $TEMP_SCRIPT $JD_SCRIPT
fill_cookie
uci set jd-dailybonus.@global[0].version=$remote_ver
uci commit jd-dailybonus
cancel "0"
else
cancel "101"
fi
}
while getopts ":anruswh" arg; do
case "$arg" in
a)
add_cron
exit 0
;;
n)
check_ver
exit 0
;;
r)
run
exit 0
;;
u)
update
exit 0
;;
s)
save
exit 0
;;
w)
back_run
exit 0
;;
h)
usage 0
;;
esac
done

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,69 @@
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NPM_NAME:=request
PKG_NAME:=node-$(PKG_NPM_NAME)
PKG_VERSION:=2.88.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/
PKG_HASH:=skip
PKG_MAINTAINER:=Jerrykuku <jerrykuku@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=node/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
include $(INCLUDE_DIR)/package.mk
define Package/node-request
SUBMENU:=Node.js
SECTION:=lang
CATEGORY:=Languages
TITLE:=Request is designed to be the simplest way possible to make http calls
URL:=https://www.npmjs.org/package/request
DEPENDS:=+node
endef
define Package/node-request/description
Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.
endef
NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
TMPNPM:=$(shell mktemp -u XXXXXXXXXX)
TARGET_CFLAGS+=$(FPIC)
TARGET_CPPFLAGS+=$(FPIC)
define Build/Prepare
$(INSTALL_DIR) $(PKG_BUILD_DIR)
endef
define Build/Compile
$(MAKE_VARS) \
$(MAKE_FLAGS) \
npm_config_arch=$(NODEJS_CPU) \
npm_config_target_arch=$(NODEJS_CPU) \
npm_config_build_from_source=true \
npm_config_nodedir=$(STAGING_DIR)/usr/ \
npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \
npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \
npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \
npm install -g $(DL_DIR)/$(PKG_SOURCE)
rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM)
rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM)
endef
define Package/node-request/install
$(INSTALL_DIR) $(1)/usr/lib/node
$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
endef
$(eval $(call BuildPackage,node-request))