tcpfiletransfer 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: caa1cea3d7b2808aca00ad1a748f1a397e874e1add0d0a1ed14ef5fd2f7b5602
4
- data.tar.gz: d8aac81d18586700087def6caa05bf85163b4ddc45fb07c7635045a0c9605ab1
3
+ metadata.gz: e05f1f2443f8672ad35b72d470ebaee0c906cf686d9e94fb010757d1d62dcb42
4
+ data.tar.gz: af5dcbb81340ddc9794f94c64401adccaba2fe0d2c39666016adb01d979c6644
5
5
  SHA512:
6
- metadata.gz: e9715882fcbcd4921f84f5668b837a6890a0757610e2d03a15c9fd6c24e8a295ab25368d23235d31b7e2670bfe7b1256115adc1f1bc38b368ae6832e8058861c
7
- data.tar.gz: 28269019957eb1a710ed3e2abbbf2d42022b920c2aeb9003b089fba83d64258c2a15ce5c0e0866f3b6b58dbf54b0137ba8b0be669b7f22967ae61c80f2a19b0c
6
+ metadata.gz: adc96bd9d1709741b31603b6874f61028ccb92b032dc0b4351fc010c00974adeb0138d3ea0111c29c904225a711460f3673568ef156c93abed835ea846b4960b
7
+ data.tar.gz: bb99ab26bca1a85e3d760cbcc63a47f2fe1d6f3c41d8763c2f603d0b79762968f361bb472e0f7fb48c4be6167793220644c233d14675cf273f9ee80240ba745f
data/bin/sendfile CHANGED
@@ -10,13 +10,15 @@ name = originalpath.split("/").last.gsub(" ", "_")
10
10
 
11
11
  recipient = ""
12
12
  loop do
13
- recipient = ARGV[1] || `zenity --text="Recipient\\n(Leave blank to discover available recipients)" --entry --title='Send File'`.chomp
13
+ recipient = ARGV[1] || `zenity --text="Recipient\\n(Leave blank to search for available recipients)" --entry --title='Send File'`.chomp
14
14
  exit(1) if $?.exitstatus == 1
15
15
 
16
16
  if recipient == ""
17
- `notify-send 'Please wait, searching for recipients'`
18
- hosts = `nmap -Pn -p8021 --open 192.168.0.0/24 | grep -oP '([\\w-]+\\s\\(((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}\\)|((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4})'`
19
- `zenity --info --no-wrap --title="Avalable recipients" --text="#{hosts}"`
17
+ `nmap -Pn -p8021 --open 192.168.0.0/24 | grep -oP '([\\w-]+\\s\\(((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}\\)|((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4})' | tee ~/.tmphosts | zenity --progress --pulsate --no-cancel --text="Searcing for available devices" --title="Searching..." --auto-close`
18
+ hosts = File.read("#{Dir.home}/.tmphosts")
19
+ recipient = `zenity --list --title="Avalable recipients" --text="Choose a device" --column="Available Recipients" #{hosts.split("\n").map{|h|"'#{h}'"}.join(" ")}`.match(/((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}/).to_s
20
+ break if recipient != ""
21
+ exit(1) if $?.exitstatus == 1
20
22
  else
21
23
  break
22
24
  end
@@ -4,7 +4,10 @@ module FileTransfer
4
4
  path = initdata[1].split("/")
5
5
  decline = (path[2] == "decline")
6
6
  path = ?/ + path[1]
7
+ sock_domain, remote_port, remote_hostname, remote_ip = client.peeraddr
8
+
7
9
  if decline
10
+ `zenity --error --title="Transfer Declined" --text="Your transfer to #{remote_hostname} has been declined." --no-wrap`
8
11
  $active_transfers.delete(path)
9
12
  client.puts "HTTP/1.0 200\r\nContent-Type: text/plain\r\n\r\nTransfer declined"
10
13
  client.close
@@ -23,6 +26,8 @@ module FileTransfer
23
26
  client.close
24
27
  return
25
28
  end
29
+
30
+ `zenity --info --title="Transfer Accepted" --text="Your transfer to #{remote_hostname} has been accepted." --no-wrap`
26
31
  client.puts "HTTP/1.0 200\r\nContent-Type: application/octet-stream\r\nContent-Disposition: attachment; filename=\"#{file[:name]}\"\r\n\r\n#{File.read(file[:path])}"
27
32
  $active_transfers.delete(path)
28
33
  client.close
@@ -9,7 +9,7 @@ module FileTransfer
9
9
 
10
10
  x=system("zenity --question --icon-name=document-save-symbolic.symbolic --no-wrap --text=\"#{notification_body}\" --title='#{notification_title}'")
11
11
  if x
12
- file_location = `zenity --file-selection --save --filename=#{filename.chomp}`.chomp
12
+ file_location = `zenity --title="Save file" --file-selection --save --filename=#{filename.chomp}`.chomp
13
13
  if file_location == ""
14
14
  f=open(accept_link + "/decline")
15
15
  f.read
data/lib/filetransfer.rb CHANGED
@@ -5,7 +5,7 @@ module FileTransfer
5
5
  @@files = ['server.rb', 'notifier.rb', 'httpserver.rb', 'ftserver.rb']
6
6
 
7
7
  def self.version
8
- "0.0.5"
8
+ "0.0.6"
9
9
  end
10
10
 
11
11
  def self.file_paths(relative:false)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tcpfiletransfer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-26 00:00:00.000000000 Z
11
+ date: 2023-03-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: An easy way to transfer files over TCP between linux computers
14
14
  email: matthias@matthiasclee.com