require 'sinatra' get '/public/AUTHIMAGE.jpg' do auth_header = request.env['HTTP_AUTHORIZATION'] puts auth_header # Check if the header value starts with "Nostr " unless auth_header && auth_header.start_with?("Nostr ") headers['WWW-AUTHENTICATE'] = 'NOSTR-NIP-98' headers['Access-Control-Expose-Headers'] = 'WWW-Authenticate' headers['Access-Control-Allow-Origin'] = '*' halt 401, 'Unauthorized' end begin # Read the image file file_path = 'public/AUTHIMAGE.jpg' if File.exist?(file_path) send_file file_path, type: 'image/jpeg' else halt 404, 'Not Found' end rescue halt 500, 'Internal Server Error' end end # Start the Sinatra server set :port, 9550