diff --git a/app/training_api.py b/app/training_api.py index 2512852..d2fdd79 100644 --- a/app/training_api.py +++ b/app/training_api.py @@ -81,6 +81,11 @@ async def retrieve_flags(self, request): logging.error(e) return web.json_response(dict(badges=[b.display for b in badges])) + async def retrieve_certs(self, request): + access = dict(access=tuple(await self.auth_svc.get_permissions(request))) + certifications = await self.data_svc.locate('certifications', match=access) + return web.json_response(dict(certificates=[cert.display for cert in certifications])) + async def reset_flag(self, request): """ Allows cert takers to reset the latest flag if something went wrong with running the automatic operation. diff --git a/gui/views/training.vue b/gui/views/training.vue new file mode 100644 index 0000000..83013ad --- /dev/null +++ b/gui/views/training.vue @@ -0,0 +1,531 @@ + + + + + diff --git a/hook.py b/hook.py index d809b33..e87c11d 100644 --- a/hook.py +++ b/hook.py @@ -21,8 +21,9 @@ async def enable(services): training_api = TrainingApi(services) app = services.get('app_svc').application - app.router.add_static('/training', 'plugins/training/static/', append_version=True) + app.router.add_static('/plugin/training/assets', 'plugins/training/static/', append_version=True) app.router.add_route('GET', '/plugin/training/gui', training_api.splash) + app.router.add_route('GET', '/plugin/training/certs', training_api.retrieve_certs) app.router.add_route('POST', '/plugin/training/flags', training_api.retrieve_flags) app.router.add_route('POST', '/plugin/training/reset_flag', training_api.reset_flag)