meshchat 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/meshchat/cli.rb +3 -1
- data/lib/meshchat/command/base.rb +1 -0
- data/lib/meshchat/command/bind.rb +41 -0
- data/lib/meshchat/command/online.rb +1 -1
- data/lib/meshchat/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f2e0fe21e401d973ec504f6fe5c2eeb5d4acff0
|
4
|
+
data.tar.gz: ca8adc64e30b1b166b1a55844b7bd8c9bdcd164e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2cbab8677c041a77df0628a5337e2aa9b7d7344ce711dbfde64ef38a546ab0707e91e4ba323bd20a81050ea2dc4be008bf23ab612a871739bb886b408795fc9
|
7
|
+
data.tar.gz: 6d7b7dbbffd5836b1b92ea245a8256197d18eb3bd1c09a94d057e82c0ec641a0a3c1b4c2af301789cf6840d1c88a824e8314b095b44fc4ba14cdc7e393b75f90
|
data/lib/meshchat/cli.rb
CHANGED
@@ -12,6 +12,7 @@ require 'meshchat/command/exit'
|
|
12
12
|
require 'meshchat/command/listen'
|
13
13
|
require 'meshchat/command/stop_listening'
|
14
14
|
require 'meshchat/command/help'
|
15
|
+
require 'meshchat/command/bind'
|
15
16
|
require 'meshchat/command/online'
|
16
17
|
require 'meshchat/command/offline'
|
17
18
|
require 'meshchat/command/init'
|
@@ -41,7 +42,8 @@ module MeshChat
|
|
41
42
|
MeshChat::Command::Base::EXPORT => MeshChat::Command::Share,
|
42
43
|
MeshChat::Command::Base::ONLINE => MeshChat::Command::Offline,
|
43
44
|
MeshChat::Command::Base::OFFLINE => MeshChat::Command::Online,
|
44
|
-
MeshChat::Command::Base::HELP => MeshChat::Command::Help
|
45
|
+
MeshChat::Command::Base::HELP => MeshChat::Command::Help,
|
46
|
+
MeshChat::Command::Base::BIND => MeshChat::Command::Bind
|
45
47
|
}
|
46
48
|
|
47
49
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'socket'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
module MeshChat
|
5
|
+
class Command
|
6
|
+
class Bind < Command::Base
|
7
|
+
def self.description
|
8
|
+
'helper for choosing what ip address to use for yourself'
|
9
|
+
end
|
10
|
+
|
11
|
+
def handle
|
12
|
+
options = ip_addresses
|
13
|
+
option_numbers = []
|
14
|
+
Display.success 'Choose an ip:'
|
15
|
+
options.each_with_index do |ip, index|
|
16
|
+
Display.info "#{index}: #{ip}"
|
17
|
+
option_numbers << index
|
18
|
+
end
|
19
|
+
|
20
|
+
selected = MeshChat::CLI.get_input
|
21
|
+
|
22
|
+
if option_numbers.include?(selected.to_i)
|
23
|
+
Display.success Settings.set('ip', with: options[selected.to_i])
|
24
|
+
else
|
25
|
+
Display.alert 'Invalid selection'
|
26
|
+
handle # repeat
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
def ip_addresses
|
33
|
+
local = Socket.getifaddrs.map { |i| i.addr.ip_address if i.addr.ipv4? }.compact
|
34
|
+
# get public
|
35
|
+
remote_ip = open('http://whatismyip.akamai.com').read
|
36
|
+
local << remote_ip
|
37
|
+
local
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/meshchat/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meshchat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- L. Preston Sego III
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- lib/meshchat/cli/base.rb
|
192
192
|
- lib/meshchat/cli/input.rb
|
193
193
|
- lib/meshchat/command/base.rb
|
194
|
+
- lib/meshchat/command/bind.rb
|
194
195
|
- lib/meshchat/command/config.rb
|
195
196
|
- lib/meshchat/command/exit.rb
|
196
197
|
- lib/meshchat/command/help.rb
|
@@ -260,5 +261,5 @@ rubyforge_project:
|
|
260
261
|
rubygems_version: 2.4.8
|
261
262
|
signing_key:
|
262
263
|
specification_version: 4
|
263
|
-
summary: MeshChat-0.6.
|
264
|
+
summary: MeshChat-0.6.9
|
264
265
|
test_files: []
|