OSDN Git Service

luci-app-unblockneteasemusic: bump to 2.10-4
authorTianling Shen <cnsztl@immortalwrt.org>
Thu, 26 Aug 2021 15:44:07 +0000 (23:44 +0800)
committerTianling Shen <cnsztl@immortalwrt.org>
Thu, 26 Aug 2021 15:44:07 +0000 (23:44 +0800)
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
applications/luci-app-unblockneteasemusic/Makefile
applications/luci-app-unblockneteasemusic/luasrc/controller/unblockneteasemusic.lua
applications/luci-app-unblockneteasemusic/luasrc/model/cbi/unblockneteasemusic/unblockneteasemusic.lua
applications/luci-app-unblockneteasemusic/luasrc/model/cbi/unblockneteasemusic/unblockneteasemusic_upgrade.lua
applications/luci-app-unblockneteasemusic/luasrc/view/unblockneteasemusic/remove_core.htm [new file with mode: 0644]
applications/luci-app-unblockneteasemusic/luasrc/view/unblockneteasemusic/unblockneteasemusic_status.htm
applications/luci-app-unblockneteasemusic/luasrc/view/unblockneteasemusic/update_core.htm
applications/luci-app-unblockneteasemusic/root/etc/init.d/unblockneteasemusic

index 11f1e22..6faab96 100644 (file)
@@ -10,7 +10,7 @@ LUCI_PKGARCH:=all
 
 PKG_NAME:=luci-app-unblockneteasemusic
 PKG_VERSION:=2.10
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
 
index 2cb32da..aba3a6b 100644 (file)
@@ -10,21 +10,22 @@ function index()
        end
 
        local page
-       page = entry({"admin", "services", "unblockneteasemusic"},firstchild(), _("解除网易云音乐播放限制"), 50)
+       page = entry({"admin", "services", "unblockneteasemusic"}, firstchild(), _("解除网易云音乐播放限制"), 50)
        page.dependent = false
        page.acl_depends = { "luci-app-unblockneteasemusic" }
 
-       entry({"admin", "services", "unblockneteasemusic", "general"},cbi("unblockneteasemusic/unblockneteasemusic"), _("基本设定"), 1)
-       entry({"admin", "services", "unblockneteasemusic", "upgrade"},form("unblockneteasemusic/unblockneteasemusic_upgrade"), _("更新组件"), 2).leaf = true
-       entry({"admin", "services", "unblockneteasemusic", "log"},form("unblockneteasemusic/unblockneteasemusic_log"), _("日志"), 3)
+       entry({"admin", "services", "unblockneteasemusic", "general"}, cbi("unblockneteasemusic/unblockneteasemusic"), _("基本设定"), 1)
+       entry({"admin", "services", "unblockneteasemusic", "upgrade"}, form("unblockneteasemusic/unblockneteasemusic_upgrade"), _("更新组件"), 2).leaf = true
+       entry({"admin", "services", "unblockneteasemusic", "log"}, form("unblockneteasemusic/unblockneteasemusic_log"), _("日志"), 3)
 
-       entry({"admin", "services", "unblockneteasemusic", "status"},call("act_status")).leaf=true
-       entry({"admin", "services", "unblockneteasemusic", "update_core"},call("act_update_core"))
+       entry({"admin", "services", "unblockneteasemusic", "status"}, call("act_status")).leaf = true
+       entry({"admin", "services", "unblockneteasemusic", "update_core"}, call("act_update_core"))
+       entry({"admin", "services", "unblockneteasemusic", "remove_core"}, call("act_remove_core"))
 end
 
 function act_status()
-       local e={}
-       e.running=luci.sys.call("ps |grep unblockneteasemusic |grep app.js |grep -v grep >/dev/null")==0
+       local e = {}
+       e.running = luci.sys.call("ps |grep unblockneteasemusic |grep app.js |grep -v grep >/dev/null") == 0
        luci.http.prepare_content("application/json")
        luci.http.write_json(e)
 end
@@ -57,3 +58,10 @@ function act_update_core()
                ret = update_core();
        })
 end
+
+function act_remove_core()
+       local ret = {}
+       ret.ret = luci.sys.call("cd /usr/share/unblockneteasemusic && rm -rf core && rm -f core_local_ver") == 0
+       luci.http.prepare_content("application/json")
+       luci.http.write_json(ret)
+end
index cb9fed3..05b1bbb 100644 (file)
@@ -47,6 +47,12 @@ use_custom_cookie.description = translate("使用自定义 Cookie 请求音源
 use_custom_cookie.default = 0
 use_custom_cookie.rmempty = false
 
+joox_cookie = s:option(Value, "joox_cookie", translate("JOOX Cookie"))
+joox_cookie.description = translate("在 joox.com 获取,需要wmid和session_key值")
+joox_cookie.placeholder = "wmid=; session_key="
+joox_cookie.datatype = "string"
+joox_cookie:depends("use_custom_cookie", 1)
+
 migu_cookie = s:option(Value, "migu_cookie", translate("Migu Cookie"))
 migu_cookie.description = translate("通过抓包手机客户端请求获取,需要aversionid值")
 migu_cookie.datatype = "string"
index 6400d79..5e58988 100644 (file)
@@ -4,10 +4,16 @@ m = SimpleForm("Version")
 m.reset = false
 m.submit = false
 
-up_core = m:field(DummyValue,"update_core", translate("更新主程序"))
+rm_core = m:field(DummyValue,"remove_core", translate("删除核心"))
+rm_core.rawhtml = true
+rm_core.template = "unblockneteasemusic/remove_core"
+rm_core.value = translate("")
+rm_core.description = "删除核心后,需手动点击下面的按钮重新下载,有助于解决版本冲突问题"
+
+up_core = m:field(DummyValue,"update_core", translate("更新核心"))
 up_core.rawhtml = true
 up_core.template = "unblockneteasemusic/update_core"
-up_core.value = translate("未检查")
+up_core.value = translate("")
 up_core.description = "更新完毕后会自动在后台重启插件,无需手动重启"
 
 return m
diff --git a/applications/luci-app-unblockneteasemusic/luasrc/view/unblockneteasemusic/remove_core.htm b/applications/luci-app-unblockneteasemusic/luasrc/view/unblockneteasemusic/remove_core.htm
new file mode 100644 (file)
index 0000000..986e18e
--- /dev/null
@@ -0,0 +1,32 @@
+<%+cbi/valueheader%>
+
+<script type="text/javascript">//<![CDATA[
+       function act_remove_core(btn, dataname)
+       {
+               btn.disabled = true;
+               btn.value = '<%:正在删除核心...%>';
+               XHR.get('<%=luci.dispatcher.build_url("admin", "services", "unblockneteasemusic", "remove_core")%>',
+                       status.ret,
+                       function(x, status)
+                       {
+                               var s = document.getElementById(dataname + '-status');
+                               if (s)
+                               {
+                                       if(status.ret)
+                                               s.innerHTML = "<font color='green'>" + "<%:删除核心成功%>" + "</font>";
+                                       else
+                                               s.innerHTML = "<font color='red'>" + "<%:删除核心失败%>"+"</font>";
+                               }
+                               btn.disabled = false;
+                               btn.value = '<%:点此删除核心%>';
+                       }
+               );
+               return false;
+       }
+//]]></script>
+
+
+<input type="button" class="btn cbi-button cbi-input-reload" value="<%:点此删除核心%>" onclick="return act_remove_core(this, '<%=self.option%>')" />
+<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
+
+<%+cbi/valuefooter%>
index b9e979e..8e5c695 100644 (file)
@@ -4,10 +4,10 @@ XHR.poll(3, '<%=url([[admin]], [[services]], [[unblockneteasemusic]], [[status]]
                var tb = document.getElementById('unblockneteasemusic_status');
                if (data && tb) {
                        if (data.running) {
-                               var links = '<em><b><font color=green>UnblockNeteaseMusic <%:RUNNING%></font></b></em>';
+                               var links = '<em><b><font color=green>UnblockNeteaseMusic <%:运行中%></font></b></em>';
                                tb.innerHTML = links;
                        } else {
-                               tb.innerHTML = '<em><b><font color=red>UnblockNeteaseMusic <%:NOT RUNNING%></font></b></em>';
+                               tb.innerHTML = '<em><b><font color=red>UnblockNeteaseMusic <%:未在运行%></font></b></em>';
                        }
                }
        }
index 2e07088..3c37dd7 100644 (file)
@@ -1,28 +1,28 @@
 <%+cbi/valueheader%>
 
 <script type="text/javascript">//<![CDATA[
-       function act_update_core(btn,dataname)
+       function act_update_core(btn, dataname)
        {
                btn.disabled = true;
-               btn.value    = '<%:正在更新主程序...%> ';
-               XHR.get('<%=luci.dispatcher.build_url("admin", "services", "unblockneteasemusic","update_core")%>',
+               btn.value = '<%:正在更新核心...%>';
+               XHR.get('<%=luci.dispatcher.build_url("admin", "services", "unblockneteasemusic", "update_core")%>',
                        status.ret,
-                       function(x,status)
+                       function(x, status)
                        {
-                               var s = document.getElementById(dataname+'-status');
+                               var s = document.getElementById(dataname + '-status');
                                if (s)
                                {
-                                       if(status.ret=="0")
-                                               s.innerHTML ="<font color='green'>"+"<%:当前已是最新版本%>"+"</font>";
-                                       else if (status.ret=="1")
-                                               s.innerHTML ="<font color='red'>"+"<%:无法检测最新版本%>"+"</font>";
-                                       else if(status.ret=="2")
-                                               s.innerHTML ="<font color='red'>"+"<%:更新失败,请稍后重试%>"+"</font>";
+                                       if(status.ret == "0")
+                                               s.innerHTML = "<font color='green'>" + "<%:当前已是最新版本%>" + "</font>";
+                                       else if (status.ret == "1")
+                                               s.innerHTML = "<font color='red'>" + "<%:无法检测最新版本%>" + "</font>";
+                                       else if(status.ret == "2")
+                                               s.innerHTML = "<font color='red'>" + "<%:更新失败,请稍后重试%>" + "</font>";
                                        else
-                                               s.innerHTML ="<font color='green'>"+"<%:更新成功,当前版本号:%>"+status.ret+"</font>";
+                                               s.innerHTML = "<font color='green'>" + "<%:更新成功,当前版本号:%>" + status.ret + "</font>";
                                }
                                btn.disabled = false;
-                               btn.value    = '<%:点此更新主程序%>';
+                               btn.value = '<%:点此更新核心%>';
                        }
                );
                return false;
@@ -30,7 +30,7 @@
 //]]></script>
 
 
-<input type="button" class="btn cbi-button cbi-input-reload" value="<%:点此更新主程序%> " onclick="return act_update_core(this,'<%=self.option%>')" />
+<input type="button" class="btn cbi-button cbi-input-reload" value="<%:点此更新核心%>" onclick="return act_update_core(this, '<%=self.option%>')" />
 <span id="<%=self.option%>-status"><em><%=self.value%></em></span>
 
 <%+cbi/valuefooter%>
index acc2feb..2c6fa2c 100755 (executable)
@@ -93,6 +93,7 @@ start()
        config_padding_arg "config" "netease_server_ip" "-f"
        config_padding_arg "config" "proxy_server_ip" "-u"
 
+       append_param_env "config" "joox_cookie" "JOOX_COOKIE"
        append_param_env "config" "migu_cookie" "MIGU_COOKIE"
        append_param_env "config" "qq_cookie" "QQ_COOKIE"
        append_param_env "config" "youtube_key" "YOUTUBE_KEY"