#!/usr/bin/env python # import argparse from flask import Flask, Response, request from core import config, fedi, owncast, __version__, root_logger from core.logger import logging # parser = argparse.ArgumentParser(description="Stream service selection") # parser.add_argument("-s", "--service", # default="all", # help="connect to a service. Needs all, twitch, fedi, or owncast") # args = parser.parse_args() app = Flask(__name__) logging.debug("Loaded %s, running ameliabot v%s" % ( config["DEFAULT"]["BotName"], __version__)) # the url of the Owncast API for bot posts owncast_url = "{}/api/integrations/chat/send".format( config["owncast"]["ServerURL"]) @app.route('/webhook/owncast', methods=['POST']) def respond(): owncast.parse_webhook() return Response(status=200) @app.route('/webhook/fedi', methods=['POST']) def fedipost(): args = request.args repo = args.get("repo") # Incredibly insecure lmao if repo != None: fedi.parse_webhook(args.get("repo")) return Response(status=200) return 400