tcpfiletransfer 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sendfile +7 -5
- data/lib/filetransfer/notifier.rb +7 -7
- data/lib/filetransfer.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c21b93b00f752504a666f5c0baf1e06167b106ec5c721578bbdf2c84ce121ce
|
4
|
+
data.tar.gz: ed0e6632f3bc245e5b9300932f997cfcb005d1ad2dae0cec3fb561465ae09986
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b657ba1a34854a07a5ab36c7abb357d2ef385adb86ed88a53b9fa2c2f311420df4b7080833046d164e9204b4dbf7aedeac10ab1c8fb8c304b90b989c43a4258a
|
7
|
+
data.tar.gz: 115bcd7e998a3d7d303fa515fd3c30a01fc57e770098110b9e9876d1cb01977778da27b593419274091b06ccfd284ef5a994bba23c34c9406243d7e4a2523a77
|
data/bin/sendfile
CHANGED
@@ -5,14 +5,16 @@ 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
|
@@ -1,27 +1,27 @@
|
|
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
|
16
16
|
return
|
17
17
|
end
|
18
|
-
open(accept_link) do |f|
|
18
|
+
URI.open(accept_link) do |f|
|
19
19
|
File.open(file_location, "wb") do |file|
|
20
20
|
file.write(f.read)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
else
|
24
|
-
f=open(accept_link + "/decline")
|
24
|
+
f=URI.open(accept_link + "/decline")
|
25
25
|
f.read
|
26
26
|
end
|
27
27
|
end
|
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.3
|
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-
|
11
|
+
date: 2023-11-09 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
|
@@ -43,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
|
-
rubygems_version: 3.
|
46
|
+
rubygems_version: 3.2.3
|
47
47
|
signing_key:
|
48
48
|
specification_version: 4
|
49
49
|
summary: Transfer files between linux computers
|