tcpfiletransfer 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/sendfile +8 -5
- data/lib/filetransfer/httpserver.rb +1 -1
- data/lib/filetransfer/notifier.rb +5 -5
- data/lib/filetransfer.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2de1a3d36bc1c06cbf4dbc3e1363ccb19b69c606362c2588d16f864960f776aa
|
4
|
+
data.tar.gz: 3d56cb509fa6ec3dd2bb8bb57c9b039b4fcbbf02d11d711b21b83e61e04c2c95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc398dcce8433cb22c8e14e665352e914552b9fd5189023321461b7655273e1ef69973879668a2d0f5292bb831e9ba65ffca2726dc451715fa35e3940e34b4f0
|
7
|
+
data.tar.gz: 607e6be18fcb08eb70c392dc131009d96e2222613ea24590d0d36fa2c18fd154f87586f6bf0686655362a374ad887d216623250963808fa7527982204eb0ab9d
|
data/bin/sendfile
CHANGED
@@ -5,17 +5,20 @@ require "socket"
|
|
5
5
|
originalpath = ARGV[0] || `zenity --file-selection --title='Send File'`.chomp
|
6
6
|
exit(1) if (!ARGV[0] && $?.exitstatus == 1)
|
7
7
|
|
8
|
+
if File.directory?(originalpath)
|
9
|
+
name = originalpath.split("/").last.gsub(" ", "_")
|
10
|
+
newpath = "/tmp/#{name}.zip"
|
11
|
+
`cd #{File.dirname(originalpath)}; zip "#{newpath}" "#{name}" -r`
|
12
|
+
originalpath = newpath
|
13
|
+
end
|
14
|
+
|
8
15
|
path = File.expand_path(originalpath).gsub(" ", "`")
|
9
16
|
name = originalpath.split("/").last.gsub(" ", "_")
|
10
17
|
|
11
|
-
if File.directory?(path)
|
12
|
-
`zenity --error --text="Error: #{path} is a folder." --no-wrap --title="Send File"`
|
13
|
-
exit(1)
|
14
|
-
end
|
15
|
-
|
16
18
|
recipient = ""
|
17
19
|
loop do
|
18
20
|
recipient = ARGV[1] || `zenity --text="Recipient\\n(Leave blank to search for available recipients)" --entry --title='Send File'`.chomp
|
21
|
+
break if ARGV[1]
|
19
22
|
exit(1) if $?.exitstatus == 1
|
20
23
|
|
21
24
|
if recipient == ""
|
@@ -33,8 +33,8 @@ module FileTransfer
|
|
33
33
|
return
|
34
34
|
end
|
35
35
|
|
36
|
-
`zenity --info --title="Transfer Accepted" --text="Your transfer to #{remote_hostname} has been accepted." --no-wrap`
|
37
36
|
client.puts "HTTP/1.0 200\r\nContent-Length: #{File.size file[:path]}\r\nContent-Type: application/octet-stream\r\nContent-Disposition: attachment; filename=\"#{file[:name]}\"\r\n\r\n#{IO.binread(file[:path])}"
|
37
|
+
`zenity --info --title="Transfer Accepted" --text="Your transfer to #{remote_hostname} has been accepted." --no-wrap`
|
38
38
|
$active_transfers.delete(path)
|
39
39
|
client.close
|
40
40
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module FileTransfer
|
2
2
|
module Notifier
|
3
3
|
def self.file_transfer_notification(filename:, source:, filesize:, accept_link:)
|
4
|
-
notification_title = "Incoming file transfer from #{source}"
|
5
|
-
fileinfo = "Name: #{filename}\nSize: #{filesize}"
|
6
|
-
notification_body = "#{fileinfo}\nWould you like to accept?"
|
7
|
-
notification_command = "notify-send '#{notification_title}' \"#{notification_body}\""
|
4
|
+
notification_title = "Incoming file transfer from #{source}".gsub("\"", "")
|
5
|
+
fileinfo = "Name: #{filename}\nSize: #{filesize}".gsub("\"", "")
|
6
|
+
notification_body = "#{fileinfo}\nWould you like to accept?".gsub("\"", "")
|
7
|
+
notification_command = "notify-send '#{notification_title}' \"#{notification_body}\"".gsub("\"", "")
|
8
8
|
#system(notification_command)
|
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 --title="Save file" --file-selection --save --filename=#{filename.chomp}`.chomp
|
12
|
+
file_location = `zenity --title="Save file" --file-selection --save --filename=#{filename.chomp.gsub("\"", "")}`.chomp
|
13
13
|
if file_location == ""
|
14
14
|
f=open(accept_link + "/decline")
|
15
15
|
f.read
|
data/lib/filetransfer.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.2
|
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-04
|
11
|
+
date: 2023-09-04 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
|