diff --git a/app/lib/core/biu.py b/app/lib/core/biu.py index e94c10b..9d8b670 100644 --- a/app/lib/core/biu.py +++ b/app/lib/core/biu.py @@ -14,7 +14,7 @@ @interRoot.bind("biu", "LIB_CORE") class CoreBiu(interRoot): def __init__(self): - self.ver = 206000 + self.ver = 206001 self.place = "local" self.sysPlc = platform.system() self.api_route = "direct" @@ -236,15 +236,20 @@ def __show_ready_info(self): def __pro_refresh_token(self): """ - 子线程,每 60*6 分钟刷新一次 token 以持久化登录状态。 + 子线程,每 30 分钟刷新一次 token 以持久化登录状态。 :return: none """ while True: - time.sleep(3600 * 6) - self.STATIC.localMsger.msg( - f"{self.lang('others.hint_in_update_token')}: %s" - % time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))) - self.__login(refresh_token=self.api.refresh_token, silent=True) + time.sleep(30 * 60) + self.update_token() + + def update_token(self): + ori_access_token = self.api.access_token + self.STATIC.localMsger.msg( + f"{self.lang('others.hint_in_update_token')}: %s" + % time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))) + self.__login(refresh_token=self.api.refresh_token, silent=True) + return self.api.access_token != ori_access_token def update_status(self, type_, key, c): """ diff --git a/app/plugin/do/update_token.py b/app/plugin/do/update_token.py new file mode 100644 index 0000000..cfb00bd --- /dev/null +++ b/app/plugin/do/update_token.py @@ -0,0 +1,14 @@ +from altfe.interface.root import interRoot + + +@interRoot.bind("api/biu/do/update_token/", "PLUGIN") +class doUpdateToken(interRoot): + def run(self, cmd): + try: + self.STATIC.arg.getArgs("update_token", li=["pass"], way="POST") + except: + return {"code": 0, "msg": "missing parameters"} + return { + "code": 1, + "msg": self.CORE.biu.update_token(), + } diff --git a/app/plugin/sys/biu_outdated.py b/app/plugin/sys/biu_outdated.py deleted file mode 100644 index dbb7568..0000000 --- a/app/plugin/sys/biu_outdated.py +++ /dev/null @@ -1,17 +0,0 @@ -import json - -import requests - -from altfe.interface.root import interRoot - - -@interRoot.bind("api/biu/get/outdated/", "PLUGIN") -class outdated(interRoot): - def run(self, cmd): - r = self.CORE.biu.biuInfo - try: - r = json.loads(requests.get("https://biu.tls.moe/d/biuinfo.json", timeout=6).text) - finally: - return {"code": 1, - "msg": {"latest": self.CORE.biu.ver >= r["version"], "current": self.CORE.biu.format_version(), - "online": r}} diff --git a/app/plugin/sys/biu_language.py b/app/plugin/sys/language.py similarity index 100% rename from app/plugin/sys/biu_language.py rename to app/plugin/sys/language.py diff --git a/app/plugin/sys/outdated.py b/app/plugin/sys/outdated.py new file mode 100644 index 0000000..84b99ee --- /dev/null +++ b/app/plugin/sys/outdated.py @@ -0,0 +1,22 @@ +import json + +import requests + +from altfe.interface.root import interRoot + + +@interRoot.bind("api/biu/get/outdated/", "PLUGIN") +class outdated(interRoot): + def run(self, cmd): + try: + r = json.loads(requests.get("https://biu.tls.moe/d/biuinfo.json", timeout=6).text) + except: + r = self.CORE.biu.biuInfo + return { + "code": 1, + "msg": { + "latest": self.CORE.biu.ver >= r["version"], + "current": self.CORE.biu.format_version(), + "online": r, + } + } diff --git a/app/plugin/sys/biu_status.py b/app/plugin/sys/status.py similarity index 100% rename from app/plugin/sys/biu_status.py rename to app/plugin/sys/status.py diff --git a/requirements.txt b/requirements.txt index 04a18ae..97b985e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -certifi==2022.9.24 +certifi==2022.12.7 charset-normalizer==2.1.1 click==8.1.3 cloudscraper==1.2.66 diff --git a/usr/static/multiverse/assets/css/n.css b/usr/static/multiverse/assets/css/n.css index f4539bd..46bb872 100644 --- a/usr/static/multiverse/assets/css/n.css +++ b/usr/static/multiverse/assets/css/n.css @@ -213,12 +213,29 @@ display: none !important; } +.poptrox-popup .nav-previous, +.poptrox-popup .nav-next { + position: fixed; + display: block !important; + filter: drop-shadow(0 0 3px rgb(0, 0, 0)); +} + @media screen and (max-width: 1680px) { #main .thumb { width: 25% !important; } } +@media screen and (min-width: 1680px) { + + body, + input, + select, + textarea { + font-size: 12pt; + } +} + @media screen and (max-width: 1280px) { #main .thumb { width: 33.333333% !important; @@ -231,23 +248,39 @@ } } -@media screen and (max-width: 736px) { +@media screen and (max-width: 800px) { body { - padding: 0 !important; + padding: 5px !important; } + .search-area { padding: 100px 1em 3em 1em; } + .poptrox-popup .caption { display: block !important; - font-size: .8em; - line-height: 1.05em; + font-size: .9em; + background-color: rgba(0, 0, 0, .5); + } + + .poptrox-popup .caption p:first-child { + max-width: 100% !important; + } + + .poptrox-popup .nav-previous, + .poptrox-popup .nav-next { + position: absolute; + opacity: 1; } } -@media screen and (min-width: 1680px) { - body, input, select, textarea { - font-size: 12pt; +@media screen and (min-width: 800px) { + .poptrox-popup .nav-previous { + transform: scale(-1.5); + } + + .poptrox-popup .nav-next { + transform: scale(1.5); } } diff --git a/usr/static/multiverse/assets/js/biu/actions.js b/usr/static/multiverse/assets/js/biu/actions.js index 762fbf2..72f210d 100644 --- a/usr/static/multiverse/assets/js/biu/actions.js +++ b/usr/static/multiverse/assets/js/biu/actions.js @@ -427,6 +427,26 @@ function doDownloadStopPic(workID) { }); } +function doUpdateToken() { + const el = $("#btnUpdateToken"); + el.tooltipster("content", "更新中..."); + $.ajax({ + type: "POST", + url: 'api/biu/do/update_token/', + data: { pass: "on" }, + success: rep => { + rep = jQuery.parseJSON(JSON.stringify(rep)); + if (rep.code !== 1) + throw Error(); + el.tooltipster("content", rep.msg ? "更新 Token 状态成功" : "失败了,具体可以查看程序日志"); + }, + error: err => { + console.log(err); + el.tooltipster("content", "不知道为什么失败了"); + } + }); +} + function grpActChon(type, grpIdx = -1, args = null) { if (args === null) { if (!tmpPageData || !tmpPageData['args']) return; diff --git a/usr/templates/multiverse/index.html b/usr/templates/multiverse/index.html index 808e0f8..1acfd75 100644 --- a/usr/templates/multiverse/index.html +++ b/usr/templates/multiverse/index.html @@ -175,7 +175,8 @@
更多设置请于 config.yml 文件中修改。
+若所有操作都没有结果,可以尝试点击这里以手动更新 Token 状态。