Don't forget to lycansubscribe

fixed POST startImport in development

since the user is passed in params, and in POST they're sent as a JSON body, we need to:
1) parse the params from the JSON manually, Sinatra doesn't do that
2) add an OPTIONS route for the CORS preflight

Changed files
+16 -1
app
+16 -1
app/server.rb
··· 26 26 27 27 def get_user_did 28 28 if settings.development? 29 - if did = params[:user] 29 + did = if request.post? 30 + json = JSON.parse(request.body.read) 31 + request.body.rewind 32 + json['user'] 33 + else 34 + params[:user] 35 + end 36 + 37 + if did 30 38 return did 31 39 else 32 40 halt json_error('AuthMissing', 'Missing "user" parameter', status: 401) ··· 113 121 end 114 122 115 123 json_response(terms: query.terms, posts: post_uris, cursor: items.last&.cursor) 124 + end 125 + 126 + if settings.development? 127 + options '/xrpc/blue.feeds.lycan.startImport' do 128 + headers['Access-Control-Allow-Origin'] = '*' 129 + headers['Access-Control-Allow-Headers'] = 'content-type' 130 + end 116 131 end 117 132 118 133 post '/xrpc/blue.feeds.lycan.startImport' do