add cwd for calling notification button

dev
Thomas Lynch 2 years ago
parent 8adc157349
commit 6cac2135f3
  1. 7
      components/notifiers.py
  2. 10
      notification_button.py

@ -1,4 +1,5 @@
import subprocess
from os import getcwd
from abc import ABC, abstractmethod
@ -14,11 +15,11 @@ class TermuxNotifier(Notifier):
if 'url' in kwargs:
args = args + ['--action', f'termux-open-url {kwargs["url"]}',
'--button1', 'Delete',
'--button1-action', f'python3 notification_button.py -b {kwargs["board"]} -p {kwargs["postId"]} -a delete',
'--button1-action', f'python3 {getcwd()}/notification_button.py -b {kwargs["board"]} -p {kwargs["postId"]} -a delete',
'--button2', 'Delete+Ban',
'--button2-action', f'python3 notificaiton_button.py -b {kwargs["board"]} -p {kwargs["postId"]} -a delete,ban',
'--button2-action', f'python3 {getcwd()}/notificaiton_button.py -b {kwargs["board"]} -p {kwargs["postId"]} -a delete,ban',
'--button3', 'Delete+Global Ban',
'--button3-action', f'python3 notification_button.py -b {kwargs["board"]} -p {kwargs["postId"]} -a delete,global_ban']
'--button3-action', f'python3 {getcwd()}/notification_button.py -b {kwargs["board"]} -p {kwargs["postId"]} -a delete,global_ban']
subprocess.call(args)
class NotifySendNotifier(Notifier):

@ -23,7 +23,17 @@ def main(argv):
session.update_csrf()
res = session.post_actions(board=optdict['-b'], postid=optdict['-p'], actions=optdict['-a'])
toast_message = None
if 'message' in res:
toast_message = res['message']
elif 'messages' in res:
toast_message = "\n".join(res['messages'])
elif 'error' in res:
toast_message = res['error']
elif 'errors' in res:
toast_message = "\n".join(res['errors'])
if toast_message:
subprocess.call(['termux-toast', res['message']])
if __name__ == '__main__':

Loading…
Cancel
Save