diff --git a/gitea-caldav.py b/gitea-to-ics.py similarity index 72% rename from gitea-caldav.py rename to gitea-to-ics.py index b616b76..1a7b4bf 100644 --- a/gitea-caldav.py +++ b/gitea-to-ics.py @@ -8,7 +8,6 @@ from subprocess import run import cherrypy -from defusedxml.ElementTree import fromstring from icalendar import Calendar, Todo GITEA_REPO_URL="https://git.bitmessage.org/api/v1" @@ -58,7 +57,7 @@ def get_token(input_token): class Root: @cherrypy.expose - def index(self): + def todo(self): cherrypy.response.headers['WWW-Authenticate'] = \ 'Basic realm="ICS access"' authorization = cherrypy.request.headers.get('Authorization', ':') @@ -72,34 +71,8 @@ class Root: raise cherrypy.HTTPError(401, 'Unauthorized') return(process_combined(combined)) -class Dav: - exposed = True - #@cherrypy.expose - @cherrypy.tools.accept(media='application/xml') - def PROPFIND(self): - cl = cherrypy.request.headers['Content-Length'] - rawbody = cherrypy.request.body.read(size=int(cl)) - et = fromstring(rawbody) - for child in et: - if child.tag == '{DAV:}prop': - for x in child: - print("T:", x.tag, "; A:", x.attrib) - #print(et) - print(f"BODY {rawbody}") - - if __name__ == '__main__': - conf = { - '/dav': { - 'request.dispatch': cherrypy.dispatch.MethodDispatcher(), - 'request.methods_with_bodies': ('POST', - 'PUT', - 'PROPFIND'), - } - } cherrypy.config.update({'server.socket_host': '0.0.0.0', 'server.socket_port': 8080, }) - webapp = Root() - webapp.dav = Dav() - cherrypy.quickstart(webapp, '/', conf) + cherrypy.quickstart(Root(), '/') diff --git a/requirements.txt b/requirements.txt index 026e028..c18433f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ cherrypy -defusedxml icalendar