From bcea6a2a62109e9f1af9e7e0b7d4c5eaf01167da Mon Sep 17 00:00:00 2001 From: "G. Gibson" Date: Sat, 1 Nov 2025 12:49:32 -0700 Subject: [PATCH] Dep bug fix for mimemagic --- gxg-framework.gemspec | 1 + lib/gxg-framework.rb | 1 + lib/gxg/gxg_events.rb | 2 +- lib/gxg/net_clients.rb | 75 +++++++++++++++++++++++++++++++++--------- 4 files changed, 63 insertions(+), 16 deletions(-) diff --git a/gxg-framework.gemspec b/gxg-framework.gemspec index b002193..8aff593 100644 --- a/gxg-framework.gemspec +++ b/gxg-framework.gemspec @@ -28,6 +28,7 @@ Gem::Specification.new do |s| # s.add_runtime_dependency 'ezmq' end s.add_runtime_dependency 'nokogiri' + s.add_runtime_dependency 'shared-mime-info' s.add_runtime_dependency 'mimemagic' s.add_runtime_dependency 'rubysl-securerandom' s.add_runtime_dependency 'net-ssh' diff --git a/lib/gxg-framework.rb b/lib/gxg-framework.rb index 74e2269..80cb0e3 100644 --- a/lib/gxg-framework.rb +++ b/lib/gxg-framework.rb @@ -37,6 +37,7 @@ requirements.push({:requirement => "chronic", :gem => "chronic"}) # requirements.push({:requirement => "ezmq", :gem => "ezmq"}) # requirements.push({:requirement => "nokogiri", :gem => "nokogiri"}) requirements.push({:requirement => "rufus-scheduler", :gem => "rufus-scheduler"}) +requirements.push({:requirement => "shared-mime-info", :gem => "shared-mime-info"}) requirements.push({:requirement => "mimemagic", :gem => "mimemagic"}) #requirements.push({:requirement => "mimemagic/overlay", :gem => "mimemagic"}) requirements.push({:requirement => "bcrypt", :gem => "bcrypt"}) diff --git a/lib/gxg/gxg_events.rb b/lib/gxg/gxg_events.rb index 54d8952..68d1012 100644 --- a/lib/gxg/gxg_events.rb +++ b/lib/gxg/gxg_events.rb @@ -1,7 +1,7 @@ # module GxG # - GXG_FEDERATION = {:title => "Untitled", :uuid => nil, :available => {}, :connections => {}} + GXG_FEDERATION = {:title => "Untitled", :uuid => nil, :access_url => nil, :available => {}, :connections => {}} GXG_FEDERATION_SAFETY = Mutex.new def self.federation_servers() result = {} diff --git a/lib/gxg/net_clients.rb b/lib/gxg/net_clients.rb index 5476b53..2769b75 100644 --- a/lib/gxg/net_clients.rb +++ b/lib/gxg/net_clients.rb @@ -3895,28 +3895,27 @@ module GxG end # def initialize(the_url=nil, options={}) - # URI Note: user:password@hostname/path/to/endpoint - the_uri = ::URI::parse(the_url.to_s) - @uuid = ::GxG::uuid_generate.to_s.to_sym + # URI Note: user:password@hostname/path/to/endpoint + @uri = ::URI::parse(the_url.to_s) + if ::GxG::valid_uuid?(options[:use_uuid].to_s.to_sym) + @uuid = options[:use_uuid].to_s.to_sym + else + @uuid = ::GxG::uuid_generate.to_s.to_sym + end @scheme = "https" - @hostname = the_uri.hostname + @hostname = @uri.hostname @services = {} self.refresh_services @clients = {} + @credential = :"00000000-0000-4000-0000-000000000000" + @bridge_challenge = ::GxG::uuid_generate.to_s.to_sym + @status = :unavailable @services.each_pair do |service,endpoint| @clients[(service)] = ::GxG::Networking::GxGApi.new("gxg://#{@hostname}#{endpoint}") - if service == :federation - @clients[(service)].login(the_uri.username, the_uri.password) - if @clients[(service)].respond_to_event?(:connect) - header = @clients[(service)].get({:connect => @uuid}) - if header.is_a?(::Hash) - @title = header[:title] - else - raise Exception.new("Could not connect") - end - end - end + @clients[(service)].login(@uri.username, @uri.password) + # end + @status = :connected self end # @@ -3928,6 +3927,52 @@ module GxG @title end # + def credential() + @credential + end + # + def status() + @status + end + # ### Bridging tools: + def connect_bridge(parmameters={}) + localuuid = nil + localtitle = "Untitled" + localaccess = nil + ::GxG::GXG_FEDERATION_SAFETY.synchronize do + localuuid = ::GxG::GXG_FEDERATION[:uuid] + localtitle = ::GxG::GXG_FEDERATION[:title] + localaccess = ::GxG::GXG_FEDERATION[:access_url] + end + # @bridge_challenge + # {:uuid => localuuid, :title => localtitle, :access_url => localaccess, :bridge_challenge => @bridge_challenge} + header = @clients[:federation].get({:connect => {:uuid => localuuid, :title => localtitle, :access_url => localaccess, :bridge_challenge => @bridge_challenge}}) + # xxx + if service == :federation + # :access_url + if @clients[(service)].respond_to_event?(:connect) + # {:uuid => (uuid), :username => String, :password => String} + header = @clients[(service)].get({:connect => {:uuid => @uuid, :username => "", :password => ""}}) + # {} + if header.is_a?(::Hash) + @title = header[:title] + else + raise Exception.new("Could not connect") + end + end + end + # + end + # + def disconnect_bridge(parmameters={}) + # @bridge_challenge + # + end + # + def complete_bridge(parmameters={}) + #@bridge_challenge + end + # def interface result = {} #