CALDERA入门(2)(构建插件入门)
一、编写插件代码
1.在caldera/plugins文件夹中创建文件夹test
2.在test文件夹中创建hook.py文件,以下是hook.py此次用的代码
from aiohttp_jinja2 import template, web
from app.service.auth_svc import check_authorization
name = 'test'
description = 'A sample plugin for demonstration purposes'
address = '/plugin/abilities/gui'
async def enable(services):
app = services.get('app_svc').application
fetcher = AbilityFetcher(services)
app.router.add_route('*', '/plugin/abilities/gui', fetcher.splash)
app.router.add_route('GET', '/get/abilities', fetcher.get_abilities)
class AbilityFetcher: