lib/mcrt.rb in mcrt-1.4.0 vs lib/mcrt.rb in mcrt-1.5.0

- old
+ new

@@ -51,11 +51,22 @@ result = JSON.parse(result) result['data'].select do |repo| repo['profileName'] == profile_name && repo['userId'] == self.username && repo['userAgent'] == self.user_agent && - (!ignore_transitioning_repositories || !repo['transitioning']) + (!ignore_transitioning_repositories || !repo['transitioning']) && + get_my_ip_addresses.any?{|a| a == repo['ipAddress']} end + end + + def get_my_ip_addresses + addresses = Socket.ip_address_list.collect{|a| a.ip_address.to_s } + begin + addresses << Net::HTTP.get(URI('http://www.myexternalip.com/raw')).strip + rescue Error + # ignored + end + addresses end def close_repository(repository_id, description) post_request('https://oss.sonatype.org/service/local/staging/bulk/close', JSON.pretty_generate('data' => { 'description' => description, 'stagedRepositoryIds' => [repository_id] }))