From 7895442b51fcf06b19785c9280599e877c3d09e0 Mon Sep 17 00:00:00 2001 From: Kevin F Date: Wed, 4 Jan 2023 00:52:15 -0600 Subject: [PATCH] Respond to OPTIONS in rpc --- static-data/official-plugins/rpc/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static-data/official-plugins/rpc/main.py b/static-data/official-plugins/rpc/main.py index b713f48d..9afcc9b7 100644 --- a/static-data/official-plugins/rpc/main.py +++ b/static-data/official-plugins/rpc/main.py @@ -60,6 +60,12 @@ class OnionrRPC(object): @cherrypy.expose def rpc(self): # Dispatcher is dictionary {: callable} + + if cherrypy.request.method == 'OPTIONS': + cherrypy.response.headers['Access-Control-Allow-Origin'] = '*' + cherrypy.response.headers['Access-Control-Allow-Methods'] = 'POST' + return '' + data = cherrypy.request.body.read().decode('utf-8') response = JSONRPCResponseManager.handle(data, dispatcher)