def METHOD_NAME():
    if flask.request.referrer not in (
        "http://localhost:9666/flashgot",
        "http://127.0.0.1:9666/flashgot",
    ):
        flask.abort(500)
    package = flask.request.form.get("package")
    urls = [url for url in flask.request.form["urls"].split("\n") if url.strip()]
    # folder = flask.request.form.get('dir', None)
    autostart = int(flask.request.form.get("autostart", 0))
    api = flask.current_app.config["PYLOAD_API"]
    if package:
        api.add_package(package, urls, Destination.QUEUE if autostart else Destination.COLLECTOR)
    else:
        api.generate_and_add_packages(urls, Destination.QUEUE if autostart else Destination.COLLECTOR)