An unofficial, mostly Bitwarden-compatible API server written in Ruby (Sinatra and ActiveRecord)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a global route for OPTIONS requests, respond with CORS headers

The new Safari extension does OPTIONS requests for each
POST/PUT/DELETE and expects CORS headers to be in the response, so
give it what it asks for

Should fix #103

+12
+12
lib/app.rb
··· 55 55 56 56 # we're always going to reply with json 57 57 content_type :json 58 + 59 + # set CORS headers for safari extension 60 + response.headers["Access-Control-Allow-Origin"] = "file://" 61 + # just parrot back whatever safari asked for 62 + response.headers["Access-Control-Allow-Methods"] = 63 + request.env["HTTP_ACCESS_CONTROL_REQUEST_METHOD"] 64 + response.headers["Access-Control-Allow-Headers"] = 65 + request.env["HTTP_ACCESS_CONTROL_REQUEST_HEADERS"] 58 66 end 59 67 60 68 register Rubywarden::Routing::Api 61 69 register Rubywarden::Routing::Icons 62 70 register Rubywarden::Routing::Identity 63 71 register Rubywarden::Routing::Attachments 72 + 73 + options /.*/ do 74 + # empty response just to respond with CORS headers 75 + end 64 76 end 65 77 end