Merge branch 'master' into feature/mp-hotkey

This commit is contained in:
Adam Saudagar 2021-05-16 19:55:35 +05:30 committed by GitHub
commit e5e45bb006
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 0 deletions

View File

@ -12,6 +12,8 @@ from fishy import gui, helper, web
from fishy.constants import chalutier, lam2
from fishy.engine.common.event_handler import EngineEventHandler
from fishy.gui import GUI, splash, update_dialog
from fishy.helper import hotkey
from fishy.helper.active_poll import active
from fishy.helper.config import config
from fishy.helper.hotkey.hotkey_process import hotkey
@ -67,6 +69,7 @@ def initialize(window_to_hide):
def main():
active.init()
config.init()
splash.start()
hotkey.init()
@ -90,10 +93,12 @@ def main():
initialize(window_to_hide)
gui_window.start()
active.start()
bot.start_event_handler()
config.stop()
hotkey.stop()
active.stop()
if __name__ == "__main__":

View File

@ -0,0 +1,23 @@
from event_scheduler import EventScheduler
from fishy.web import web
# noinspection PyPep8Naming
class active:
_scheduler: EventScheduler = None
@staticmethod
def init():
if active._scheduler:
return
active._scheduler = EventScheduler()
active._scheduler.start()
@staticmethod
def start():
active._scheduler.enter_recurring(60, 1, web.ping)
@staticmethod
def stop():
active._scheduler.stop(hard_stop=True)

View File

@ -15,6 +15,7 @@ session = domain + "/api/session"
terms = domain + "/terms.html"
discord = domain + "/api/discord"
beta = domain + "/api/beta"
ping = domain + "/api/ping"
def get_notification_page(uid):

View File

@ -141,3 +141,9 @@ def has_beta():
return False
return response.json()["beta"]
@fallback(None)
def ping():
body = {"uid": config.get("uid"), "apiversion": apiversion}
requests.post(urls.ping, params=body)