| 680 | |
| 681 | @app.route('/plugins/setting', methods=['POST', 'PUT']) |
| 682 | async def update_plugin_setting() -> Response: |
| 683 | data: dict = await request.get_json() |
| 684 | if 'setting' not in data: |
| 685 | return error("setting field is required ...") |
| 686 | |
| 687 | name = data.get('plugin_name', None) |
| 688 | if not name: |
| 689 | return error("plugin_name field is required ...") |
| 690 | |
| 691 | if name not in self._plugins: |
| 692 | return error(f'plugin<{name}> not exist ...') |
| 693 | |
| 694 | plugin: WechatyPlugin = self._plugins[name] |
| 695 | plugin.setting = data['setting'] |
| 696 | return success(None) |
| 697 | |
| 698 | @app.route("/js/<string:name>", methods=['GET']) |
| 699 | @app.route("/css/<string:name>", methods=['GET']) |