def download_plugin(self): plugin = request.args.get("plugin", None) if plugin is None: return redirect(url_for('plugins'), code=302) mad_plugin = next((item for item in self.plugins if item["name"] == plugin), None) if mad_plugin is None: return redirect(url_for('plugins'), code=302) mp_file = self.zip_plugin(plugin, mad_plugin['path'], self.get_plugin_version(mad_plugin['path'])) if mp_file is None: return redirect(url_for('plugins'), code=302) return send_file(generate_path(self._mad['args'].temp_path) + "/" + plugin + ".mp", as_attachment=True, attachment_filename=plugin + ".mp", cache_timeout=0)
def get_logcat(self): origin = request.args.get('origin') origin_logger = get_origin_logger(self._logger, origin=origin) origin_logger.info('MADmin: fetching logcat') filename = generate_device_logcat_zip_path(origin, self._args) origin_logger.info("Logcat being stored at {}", filename) if self._fetch_logcat_websocket(origin, filename): # TODO: send file to user? return send_file(generate_path(filename), as_attachment=True, attachment_filename="logcat_{}.zip".format(origin)) else: origin_logger.error("Failed fetching logcat") # TODO: Return proper error :P return None
def pushstatic(self, path): return send_from_directory(generate_path('madmin/static'), path)
def pushscreens(self, path): return send_from_directory(generate_path(self._args.temp_path), path)