mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Change cron validation to allow day abbreviations
This commit is contained in:
parent
3432d660ef
commit
e3248e8657
@ -15,7 +15,7 @@ from tornado import iostream
|
|||||||
|
|
||||||
# TZLocal is set as a hidden import on win pipeline
|
# TZLocal is set as a hidden import on win pipeline
|
||||||
from tzlocal import get_localzone
|
from tzlocal import get_localzone
|
||||||
from cron_validator import CronValidator
|
from croniter import croniter
|
||||||
|
|
||||||
from app.classes.models.server_permissions import EnumPermissionsServer
|
from app.classes.models.server_permissions import EnumPermissionsServer
|
||||||
from app.classes.models.crafty_permissions import EnumPermissionsCrafty
|
from app.classes.models.crafty_permissions import EnumPermissionsCrafty
|
||||||
@ -1447,11 +1447,9 @@ class PanelHandler(BaseHandler):
|
|||||||
else:
|
else:
|
||||||
interval_type = ""
|
interval_type = ""
|
||||||
cron_string = bleach.clean(self.get_argument("cron", ""))
|
cron_string = bleach.clean(self.get_argument("cron", ""))
|
||||||
try:
|
if not croniter.is_valid(cron_string):
|
||||||
CronValidator.parse(cron_string)
|
|
||||||
except Exception as e:
|
|
||||||
self.redirect(
|
self.redirect(
|
||||||
f"/panel/error?error=INVALID FORMAT: Invalid Cron Format. {e}"
|
"/panel/error?error=INVALID FORMAT: Invalid Cron Format."
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
action = bleach.clean(self.get_argument("action", None))
|
action = bleach.clean(self.get_argument("action", None))
|
||||||
@ -1605,11 +1603,9 @@ class PanelHandler(BaseHandler):
|
|||||||
interval_type = ""
|
interval_type = ""
|
||||||
cron_string = bleach.clean(self.get_argument("cron", ""))
|
cron_string = bleach.clean(self.get_argument("cron", ""))
|
||||||
sch_id = self.get_argument("sch_id", None)
|
sch_id = self.get_argument("sch_id", None)
|
||||||
try:
|
if not croniter.is_valid(cron_string):
|
||||||
CronValidator.parse(cron_string)
|
|
||||||
except Exception as e:
|
|
||||||
self.redirect(
|
self.redirect(
|
||||||
f"/panel/error?error=INVALID FORMAT: Invalid Cron Format. {e}"
|
"/panel/error?error=INVALID FORMAT: Invalid Cron Format."
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
action = bleach.clean(self.get_argument("action", None))
|
action = bleach.clean(self.get_argument("action", None))
|
||||||
|
@ -4,7 +4,7 @@ argon2-cffi==20.1
|
|||||||
bleach==4.1
|
bleach==4.1
|
||||||
cached_property==1.5.2
|
cached_property==1.5.2
|
||||||
colorama==0.4
|
colorama==0.4
|
||||||
cron-validator==1.0.3
|
crontier==1.3.5
|
||||||
cryptography==3.4.8
|
cryptography==3.4.8
|
||||||
libgravatar==1.0.0
|
libgravatar==1.0.0
|
||||||
peewee==3.13
|
peewee==3.13
|
||||||
|
Loading…
Reference in New Issue
Block a user