From 662c02c7e58acd77278039d590ae37d6cbc2443b Mon Sep 17 00:00:00 2001 From: y1ndan Date: Wed, 30 Dec 2020 19:20:12 +0800 Subject: [PATCH 1/7] fix: update DS --- genshin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/genshin.py b/genshin.py index 5623251..e493767 100755 --- a/genshin.py +++ b/genshin.py @@ -44,12 +44,12 @@ class ConfMeta(type): @property def app_version(self): - return '2.1.0' + return '2.2.1' @property def ua(self): return 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) Apple' \ - 'WebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/{}'.format(self.app_version) + 'WebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/2.2.0' @property def act_id(self): @@ -134,7 +134,8 @@ class Sign(object): return md5.hexdigest() def get_DS(self): - n = self.md5(Conf.app_version) + # n = self.md5(Conf.app_version) # V2.1.0 + n = 'cx2y9z9a29tfqvr1qsq6c7yz99b5jsqt' i = str(int(time.time())) r = ''.join(random.sample(string.ascii_lowercase + string.digits, 6)) c = self.md5('salt=' + n + '&t='+ i + '&r=' + r) From 5c2d54470c2b3a9460149526fff5a1f506e96b52 Mon Sep 17 00:00:00 2001 From: y1ndan Date: Thu, 31 Dec 2020 09:47:12 +0800 Subject: [PATCH 2/7] refactor: change text 'massage' to 'message' --- genshin.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/genshin.py b/genshin.py index e493767..7e1b40e 100755 --- a/genshin.py +++ b/genshin.py @@ -163,8 +163,8 @@ class Sign(object): try: rolesList = roles['data']['list'] except Exception as e: - massage = roles['massage'] - notify(sckey, '失败', massage) + message = roles['message'] + notify(sckey, '失败', message) exit(-1) else: logging.info('当前账号绑定了 {} 个角色'.format(len(rolesList))) @@ -189,16 +189,16 @@ class Sign(object): def run(self): logging.info('任务开始') - massageList = [] + messageList = [] infoList = self.get_info() for i in range(len(infoList)): if infoList[i]['data']['is_sign'] is True: #if infoList[i]['data']['is_sign'] is False: - massage = '旅行者 {} 号,你已经签到过了'.format(i + 1) - notify(sckey, '成功', massage) + message = '旅行者 {} 号,你已经签到过了'.format(i + 1) + notify(sckey, '成功', message) elif infoList[i]['data']['first_bind'] is True: - massage = '旅行者 {} 号,请先前往米游社绑定账号'.format(i + 1) - notify(sckey, '失败', massage) + message = '旅行者 {} 号,请先前往米游社绑定账号'.format(i + 1) + notify(sckey, '失败', message) exit(-1) else: today = infoList[i]['data']['today'] @@ -226,16 +226,16 @@ class Sign(object): # -5003: already signed in if code == 0: status = '成功' - massageList.append(self.massage().format(today, + messageList.append(self.message().format(today, self._regionNameList[i], uid, award['name'], award['cnt'], - totalSignDay, jdict['massage'])) + totalSignDay, jdict['message'])) else: status = '失败' - massageList = jdict + messageList = jdict - return notify(sckey, status, massageList) + return notify(sckey, status, messageList) - def massage(self): + def message(self): return ''' {:#^30} 🔅[{}]{} @@ -246,11 +246,11 @@ class Sign(object): ''' -def notify(sckey, status, massage): +def notify(sckey, status, message): if sckey.startswith('SC'): logging.info('准备推送通知...') url = 'https://sc.ftqq.com/{}.send'.format(sckey) - data = {'text': '原神签到小助手 签到{}'.format(status), 'desp': massage} + data = {'text': '原神签到小助手 签到{}'.format(status), 'desp': message} try: jdict = json.loads( requests.Session().post(url, data = data).text) @@ -266,7 +266,7 @@ def notify(sckey, status, massage): else: logging.info('未配置SCKEY,正在跳过推送') - logging.info('签到{}: {}'.format(status, massage)) + logging.info('签到{}: {}'.format(status, message)) return logging.info('任务结束') From b971c916dcc791f98a9362a395693a69e884a1fa Mon Sep 17 00:00:00 2001 From: y1ndan Date: Thu, 31 Dec 2020 10:04:51 +0800 Subject: [PATCH 3/7] fix: output error --- genshin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/genshin.py b/genshin.py index 7e1b40e..36e1755 100755 --- a/genshin.py +++ b/genshin.py @@ -228,7 +228,7 @@ class Sign(object): status = '成功' messageList.append(self.message().format(today, self._regionNameList[i], uid, award['name'], award['cnt'], - totalSignDay, jdict['message'])) + totalSignDay, jdict['message'], '')) else: status = '失败' messageList = jdict From f6fc8c53d132393def6e7d9f28aba5cca8892c16 Mon Sep 17 00:00:00 2001 From: y1ndan Date: Fri, 1 Jan 2021 06:53:26 +0800 Subject: [PATCH 4/7] chore: upgrade pip before running --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 211031d..b4d709b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,6 +37,7 @@ jobs: - name: Run sign run: | + python -m pip install --upgrade pip pip install -r requirements.txt echo "${{ secrets.COOKIE }}" | tr '#' "\n" | sed 's/$/&#${{ secrets.SCKEY }}/g' | xargs -I {} sh -c 'echo "{}" | python3 ./genshin.py' From aafc2f681351bd69f43cca81241f5604f98f594a Mon Sep 17 00:00:00 2001 From: y1ndan Date: Fri, 1 Jan 2021 06:57:42 +0800 Subject: [PATCH 5/7] refactor: remove branch restriction --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b4d709b..944f063 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ env: jobs: build: runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' + # if: github.ref == 'refs/heads/master' steps: - name: Checkout master From 9b10a983721dac2b59c0eb333ba5292dd6aa5b7b Mon Sep 17 00:00:00 2001 From: y1ndan Date: Fri, 1 Jan 2021 11:08:24 +0800 Subject: [PATCH 6/7] refactor: update DS --- genshin.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/genshin.py b/genshin.py index 36e1755..3a147d9 100755 --- a/genshin.py +++ b/genshin.py @@ -44,12 +44,12 @@ class ConfMeta(type): @property def app_version(self): - return '2.2.1' + return '2.3.0' @property def ua(self): return 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) Apple' \ - 'WebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/2.2.0' + 'WebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/{}'.format(self.app_version) @property def act_id(self): @@ -127,15 +127,15 @@ class Sign(object): self.__class__, type(__name__), type(cookie))) self._cookie = cookie - # Provided by Steesha def md5(self, text): md5 = hashlib.md5() md5.update(text.encode()) return md5.hexdigest() def get_DS(self): - # n = self.md5(Conf.app_version) # V2.1.0 - n = 'cx2y9z9a29tfqvr1qsq6c7yz99b5jsqt' + # n = self.md5(2.1.0) # v2.1.0 @Steesha + # n = 'cx2y9z9a29tfqvr1qsq6c7yz99b5jsqt' # v2.2.0 @Womsxd + n = 'h8w582wxwgqvahcdkpvdhbh2w9casgfl' # v2.3.0 web @povsister & @journey-ad i = str(int(time.time())) r = ''.join(random.sample(string.ascii_lowercase + string.digits, 6)) c = self.md5('salt=' + n + '&t='+ i + '&r=' + r) From a00979ac74b183ee8df49eb740b9704c608a7569 Mon Sep 17 00:00:00 2001 From: y1ndan Date: Fri, 1 Jan 2021 12:50:23 +0800 Subject: [PATCH 7/7] style(main.yml): modify description --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 944f063..27d9925 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: env: - # 是否允许从y1ndan/genshin-impact-helper同步代码 + # auto merge from y1ndan/genshin-impact-helper, default: false ALLOW_MERGE: 'false' jobs: @@ -21,7 +21,7 @@ jobs: fetch-depth: 0 ref: master - - name: Merge From y1ndan/genshin-impact-helper + - name: Auto merge if: ${{ env.ALLOW_MERGE != 'false' }} run: | git config --global user.name github-actions