Skip to content

Commit

Permalink
Merge pull request #3169 from LmeSzinc/dev
Browse files Browse the repository at this point in the history
Bug fix
  • Loading branch information
LmeSzinc authored Sep 30, 2023
2 parents ce1cb8a + 3c34621 commit b31864f
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
Binary file modified assets/jp/handler/AUTO_SEARCH_SET_SUB_AUTO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/jp/handler/AUTO_SEARCH_SET_SUB_STANDBY.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bin/DroidCast/DroidCast_raw-release-1.0.apk
Binary file not shown.
15 changes: 9 additions & 6 deletions deploy/git_over_cdn/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,23 +215,26 @@ def git_reset(self, keep_changes=False):
else:
self.git_command('reset', '--hard', f'{self.source}/{self.branch}')

def is_uptodate(self):
def get_status(self):
"""
Returns:
bool: If repo is up-to-date
str: 'uptodate' if repo is up-to-date
'behind' if repos is not up-to-date
'failed' if failed
"""
_ = self.current_commit
_ = self.latest_commit
if not self.current_commit:
self.logger.error('Failed to get current commit')
return False
return 'failed'
if not self.latest_commit:
self.logger.error('Failed to get latest commit')
return False
return 'failed'
if self.current_commit == self.latest_commit:
self.logger.info('Already up to date')
return True
return False
return 'uptodate'
self.logger.info('Current repo is behind remote')
return 'behind'

def update(self, keep_changes=False):
"""
Expand Down
4 changes: 4 additions & 0 deletions module/device/method/droidcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def screenshot_droidcast(self):
raise ImageTruncated('Empty image after reading from buffer')
if image.shape == (1843200,):
raise DroidCastVersionIncompatible('Requesting screenshots from `DroidCast` but server is `DroidCast_raw`')
if image.size < 500:
logger.warning(f'Unexpected screenshot: {resp.content}')

image = cv2.imdecode(image, cv2.IMREAD_COLOR)
if image is None:
Expand All @@ -182,6 +184,8 @@ def screenshot_droidcast_raw(self):
try:
arr = np.frombuffer(image, dtype=np.uint16).reshape((720, 1280))
except ValueError as e:
if len(image) < 500:
logger.warning(f'Unexpected screenshot: {image}')
# Try to load as `DroidCast`
image = np.frombuffer(image, np.uint8)
if image is not None:
Expand Down
4 changes: 2 additions & 2 deletions module/handler/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
AUTO_SEARCH_SET_BOSS = Button(area={'cn': (633, 189, 651, 207), 'en': (616, 192, 634, 210), 'jp': (633, 189, 651, 207), 'tw': (633, 189, 651, 207)}, color={'cn': (37, 38, 39), 'en': (36, 38, 38), 'jp': (42, 40, 41), 'tw': (41, 41, 42)}, button={'cn': (633, 189, 651, 207), 'en': (616, 192, 634, 210), 'jp': (633, 189, 651, 207), 'tw': (633, 189, 651, 207)}, file={'cn': './assets/cn/handler/AUTO_SEARCH_SET_BOSS.png', 'en': './assets/en/handler/AUTO_SEARCH_SET_BOSS.png', 'jp': './assets/jp/handler/AUTO_SEARCH_SET_BOSS.png', 'tw': './assets/tw/handler/AUTO_SEARCH_SET_BOSS.png'})
AUTO_SEARCH_SET_MOB = Button(area={'cn': (494, 189, 513, 207), 'en': (477, 191, 496, 210), 'jp': (494, 189, 513, 207), 'tw': (494, 189, 513, 207)}, color={'cn': (38, 39, 39), 'en': (38, 40, 40), 'jp': (92, 136, 59), 'tw': (76, 105, 56)}, button={'cn': (494, 189, 513, 207), 'en': (477, 191, 496, 210), 'jp': (494, 189, 513, 207), 'tw': (494, 189, 513, 207)}, file={'cn': './assets/cn/handler/AUTO_SEARCH_SET_MOB.png', 'en': './assets/en/handler/AUTO_SEARCH_SET_MOB.png', 'jp': './assets/jp/handler/AUTO_SEARCH_SET_MOB.png', 'tw': './assets/tw/handler/AUTO_SEARCH_SET_MOB.png'})
AUTO_SEARCH_SET_STANDBY = Button(area={'cn': (930, 189, 948, 207), 'en': (941, 192, 959, 210), 'jp': (930, 189, 948, 207), 'tw': (930, 189, 948, 207)}, color={'cn': (75, 106, 55), 'en': (36, 36, 37), 'jp': (40, 40, 40), 'tw': (40, 39, 40)}, button={'cn': (930, 189, 948, 207), 'en': (941, 192, 959, 210), 'jp': (930, 189, 948, 207), 'tw': (930, 189, 948, 207)}, file={'cn': './assets/cn/handler/AUTO_SEARCH_SET_STANDBY.png', 'en': './assets/en/handler/AUTO_SEARCH_SET_STANDBY.png', 'jp': './assets/jp/handler/AUTO_SEARCH_SET_STANDBY.png', 'tw': './assets/tw/handler/AUTO_SEARCH_SET_STANDBY.png'})
AUTO_SEARCH_SET_SUB_AUTO = Button(area={'cn': (576, 469, 595, 488), 'en': (577, 475, 595, 492), 'jp': (553, 471, 572, 490), 'tw': (576, 469, 595, 488)}, color={'cn': (40, 40, 42), 'en': (34, 37, 37), 'jp': (39, 39, 38), 'tw': (40, 40, 41)}, button={'cn': (576, 469, 595, 488), 'en': (577, 475, 595, 492), 'jp': (553, 471, 572, 490), 'tw': (576, 469, 595, 488)}, file={'cn': './assets/cn/handler/AUTO_SEARCH_SET_SUB_AUTO.png', 'en': './assets/en/handler/AUTO_SEARCH_SET_SUB_AUTO.png', 'jp': './assets/jp/handler/AUTO_SEARCH_SET_SUB_AUTO.png', 'tw': './assets/tw/handler/AUTO_SEARCH_SET_SUB_AUTO.png'})
AUTO_SEARCH_SET_SUB_STANDBY = Button(area={'cn': (892, 469, 911, 488), 'en': (856, 475, 874, 492), 'jp': (862, 471, 880, 490), 'tw': (892, 469, 911, 488)}, color={'cn': (39, 39, 42), 'en': (32, 33, 34), 'jp': (36, 36, 36), 'tw': (37, 37, 38)}, button={'cn': (892, 469, 911, 488), 'en': (856, 475, 874, 492), 'jp': (862, 471, 880, 490), 'tw': (892, 469, 911, 488)}, file={'cn': './assets/cn/handler/AUTO_SEARCH_SET_SUB_STANDBY.png', 'en': './assets/en/handler/AUTO_SEARCH_SET_SUB_STANDBY.png', 'jp': './assets/jp/handler/AUTO_SEARCH_SET_SUB_STANDBY.png', 'tw': './assets/tw/handler/AUTO_SEARCH_SET_SUB_STANDBY.png'})
AUTO_SEARCH_SET_SUB_AUTO = Button(area={'cn': (576, 469, 595, 488), 'en': (577, 475, 595, 492), 'jp': (576, 469, 595, 488), 'tw': (576, 469, 595, 488)}, color={'cn': (40, 40, 42), 'en': (34, 37, 37), 'jp': (37, 37, 38), 'tw': (40, 40, 41)}, button={'cn': (576, 469, 595, 488), 'en': (577, 475, 595, 492), 'jp': (576, 469, 595, 488), 'tw': (576, 469, 595, 488)}, file={'cn': './assets/cn/handler/AUTO_SEARCH_SET_SUB_AUTO.png', 'en': './assets/en/handler/AUTO_SEARCH_SET_SUB_AUTO.png', 'jp': './assets/jp/handler/AUTO_SEARCH_SET_SUB_AUTO.png', 'tw': './assets/tw/handler/AUTO_SEARCH_SET_SUB_AUTO.png'})
AUTO_SEARCH_SET_SUB_STANDBY = Button(area={'cn': (892, 469, 911, 488), 'en': (856, 475, 874, 492), 'jp': (892, 469, 911, 488), 'tw': (892, 469, 911, 488)}, color={'cn': (39, 39, 42), 'en': (32, 33, 34), 'jp': (72, 100, 53), 'tw': (37, 37, 38)}, button={'cn': (892, 469, 911, 488), 'en': (856, 475, 874, 492), 'jp': (892, 469, 911, 488), 'tw': (892, 469, 911, 488)}, file={'cn': './assets/cn/handler/AUTO_SEARCH_SET_SUB_STANDBY.png', 'en': './assets/en/handler/AUTO_SEARCH_SET_SUB_STANDBY.png', 'jp': './assets/jp/handler/AUTO_SEARCH_SET_SUB_STANDBY.png', 'tw': './assets/tw/handler/AUTO_SEARCH_SET_SUB_STANDBY.png'})
BATTLE_PASS_NOTICE = Button(area={'cn': (554, 483, 726, 540), 'en': (716, 488, 869, 533), 'jp': (554, 483, 726, 540), 'tw': (554, 483, 726, 540)}, color={'cn': (107, 152, 207), 'en': (89, 138, 201), 'jp': (107, 152, 207), 'tw': (107, 152, 207)}, button={'cn': (863, 173, 929, 217), 'en': (863, 173, 929, 217), 'jp': (863, 173, 929, 217), 'tw': (863, 173, 929, 217)}, file={'cn': './assets/cn/handler/BATTLE_PASS_NOTICE.png', 'en': './assets/en/handler/BATTLE_PASS_NOTICE.png', 'jp': './assets/cn/handler/BATTLE_PASS_NOTICE.png', 'tw': './assets/cn/handler/BATTLE_PASS_NOTICE.png'})
BOOK_BOX_AUTO = Button(area={'cn': (737, 614, 756, 631), 'en': (739, 615, 754, 630), 'jp': (808, 614, 825, 631), 'tw': (807, 613, 826, 632)}, color={'cn': (67, 74, 82), 'en': (57, 64, 74), 'jp': (59, 62, 68), 'tw': (62, 66, 71)}, button={'cn': (737, 614, 756, 631), 'en': (739, 615, 754, 630), 'jp': (808, 614, 825, 631), 'tw': (807, 613, 826, 632)}, file={'cn': './assets/cn/handler/BOOK_BOX_AUTO.png', 'en': './assets/en/handler/BOOK_BOX_AUTO.png', 'jp': './assets/jp/handler/BOOK_BOX_AUTO.png', 'tw': './assets/tw/handler/BOOK_BOX_AUTO.png'})
BOOK_BOX_PREP = Button(area={'cn': (922, 600, 940, 617), 'en': (906, 604, 922, 619), 'jp': (921, 602, 939, 621), 'tw': (906, 604, 922, 619)}, color={'cn': (88, 122, 68), 'en': (29, 32, 29), 'jp': (35, 35, 36), 'tw': (29, 32, 29)}, button={'cn': (922, 600, 940, 617), 'en': (906, 604, 922, 619), 'jp': (921, 602, 939, 621), 'tw': (906, 604, 922, 619)}, file={'cn': './assets/cn/handler/BOOK_BOX_PREP.png', 'en': './assets/en/handler/BOOK_BOX_PREP.png', 'jp': './assets/jp/handler/BOOK_BOX_PREP.png', 'tw': './assets/tw/handler/BOOK_BOX_PREP.png'})
Expand Down
8 changes: 6 additions & 2 deletions module/webui/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,16 @@ def _check_update(self) -> bool:
self.state = "checking"

if State.deploy_config.GitOverCdn:
if self.goc_client.is_uptodate():
status = self.goc_client.get_status()
if status == "uptodate":
logger.info(f"No update")
return False
else:
elif status == "behind":
logger.info(f"New update available")
return True
else:
# failed, should fallback to `git pull`
pass

source = "origin"
for _ in range(3):
Expand Down

0 comments on commit b31864f

Please sign in to comment.