update: removed recovery functionality

This commit is contained in:
2026-06-02 18:33:40 +08:00
parent d6c9575c82
commit c65fbec79b
3 changed files with 9 additions and 27 deletions

View File

@@ -100,8 +100,8 @@
<label for="greet" class="pure-checkbox"> <label for="greet" class="pure-checkbox">
<input id="greet" type="checkbox"/> Greet recipients (by proper names if possible) <input id="greet" type="checkbox"/> Greet recipients (by proper names if possible)
</label> </label>
<label for="recovery" class="pure-checkbox"> <label for="force" class="pure-checkbox">
<input id="recovery" type="checkbox"/> Try recover from a mismatched address/subject error <input id="force" type="checkbox"/> Ignore address/subject mismatch errors
</label> </label>
<label for="slice" class="pure-checkbox"> <label for="slice" class="pure-checkbox">
<input id="slice" type="checkbox"/> Enable task slicing <input id="slice" type="checkbox"/> Enable task slicing

32
main.py
View File

@@ -283,9 +283,9 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
flow.append(Skip) flow.append(Skip)
sp.set('actions', lambda: flow.capabilities()) sp.set('actions', lambda: flow.capabilities())
sp.set('cancel', lambda: flow.do(Cancel)) sp.set('cancel', lambda: flow.do(Cancel, force=True))
sp.set('close', lambda: flow.do(Close)) sp.set('close', lambda: flow.do(Close, force=True))
sp.set('skip', lambda: flow.do(Skip)) sp.set('skip', lambda: flow.do(Skip, force=True))
def loads(name: str, b64: str): def loads(name: str, b64: str):
from base64 import b64decode from base64 import b64decode
@@ -428,8 +428,7 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
while mails := driver.find_elements(By.CSS_SELECTOR, "div.io-ox-mail-compose-window"): while mails := driver.find_elements(By.CSS_SELECTOR, "div.io-ox-mail-compose-window"):
try: try:
click(mails[0].find_element(By.CSS_SELECTOR, "button[data-action='close']"), wait=False) click(mails[0].find_element(By.CSS_SELECTOR, "button[data-action='minimize']"), wait=False)
click("div.modal-footer button[data-action='delete']", wait=False)
except Exception as e: except Exception as e:
logger.warning('Unable to close off email compose windows', exc_info=e) logger.warning('Unable to close off email compose windows', exc_info=e)
break break
@@ -446,29 +445,12 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
if (target := get_address()) != parameters['account']: if (target := get_address()) != parameters['account']:
error = MismatchedEmailAddress(target) error = MismatchedEmailAddress(target)
if not options.get('recovery'): raise error
if (target := get_subject()) != subject: if (target := get_subject()) != subject:
error = MismatchedEmailSubject(target) error = MismatchedEmailSubject(target)
if not options.get('recovery'): raise error
if error is not None and (c := EC.presence_of_element_located): if error is not None and not options.get('force'):
click("li[data-id='virtual/standard'] > .subfolders li:nth-child(6) .folder-arrow", condition=c) raise error
click("li[data-id='virtual/standard'] > .subfolders li:nth-child(6) li.folder:nth-child(1)", condition=c)
catch(ready, force=False)
click("ul[aria-label='List view'] li[data-index='0']", condition=c)
catch(ready, force=False)
click("ul.classic-toolbar button[aria-label='More actions']", condition=c)
click(".abs + ul.dropdown-menu a[data-action='io.ox/mail/actions/copy']", condition=c)
click(".modal-dialog ul.subfolders li[data-id='default0/Brouillons']", condition=c)
click(".modal-dialog .modal-footer button[data-action='ok']", condition=c)
click("li[data-id='default0/Brouillons']")
for _ in range(parameters['attempts']):
catch(ready, force=False)
click("ul[aria-label='List view'] li[data-index='0']", condition=c)
if get_subject() == subject: break
if not get_subject() == subject: raise error
flow.do(Wait) flow.do(Wait)
flow.react() flow.react()

Binary file not shown.