fingerpoken 0.2.20101208032306 → 0.2.20101209151950
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.
- data/bin/fingerpoken.rb +32 -25
- data/lib/fingerpoken/vnc.rb +4 -2
- metadata +4 -4
data/bin/fingerpoken.rb
CHANGED
@@ -5,6 +5,7 @@ require "em-websocket"
|
|
5
5
|
require "json"
|
6
6
|
require "rack"
|
7
7
|
require "sinatra/async"
|
8
|
+
require "optparse"
|
8
9
|
|
9
10
|
class FingerPoken < Sinatra::Base
|
10
11
|
register Sinatra::Async
|
@@ -24,28 +25,34 @@ class FingerPoken < Sinatra::Base
|
|
24
25
|
end # GET /style.css
|
25
26
|
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
28
|
+
def main(args)
|
29
|
+
opts = OptionParser.new do |opts|
|
30
|
+
end
|
31
|
+
EventMachine::run do
|
32
|
+
$:.unshift(File.dirname(__FILE__) + "/lib")
|
33
|
+
channel = EventMachine::Channel.new
|
34
|
+
|
35
|
+
# TODO(sissel): Pick up here and make command flags to choose the
|
36
|
+
# target (vnc, xdo, etc)
|
37
|
+
require "fingerpoken/xdo"
|
38
|
+
target = FingerPoken::Target::Xdo.new :channel => channel
|
39
|
+
|
40
|
+
#require "fingerpoken/vnc"
|
41
|
+
#target = FingerPoken::Target::VNC.new :channel => channel
|
42
|
+
|
43
|
+
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 5001) do |ws|
|
44
|
+
ws.onmessage do |message|
|
45
|
+
request = JSON.parse(message)
|
46
|
+
p request
|
47
|
+
channel.push(request)
|
48
|
+
end # ws.onmessage
|
49
|
+
end # WebSocket
|
50
|
+
|
51
|
+
Rack::Handler::Thin.run(
|
52
|
+
Rack::CommonLogger.new( \
|
53
|
+
Rack::ShowExceptions.new( \
|
54
|
+
FingerPoken.new)), :Port => 5000)
|
55
|
+
end # EventMachine::run
|
56
|
+
end
|
57
|
+
|
58
|
+
exit(main(ARGV))
|
data/lib/fingerpoken/vnc.rb
CHANGED
@@ -27,8 +27,10 @@ class FingerPoken::Target::VNC < FingerPoken::Target
|
|
27
27
|
# TODO(sissel): Hack to make it work in TF2.
|
28
28
|
# Mouse movement is always "from center"
|
29
29
|
# So after each move, center the cursor.
|
30
|
-
|
31
|
-
|
30
|
+
if ENV["RECENTER"]
|
31
|
+
@x = (@vnc.screen_width / 2).to_i
|
32
|
+
@y = (@vnc.screen_height / 2).to_i
|
33
|
+
end
|
32
34
|
end
|
33
35
|
|
34
36
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fingerpoken
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 40202418303883
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 20101209151950
|
10
|
+
version: 0.2.20101209151950
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jordan Sissel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-09 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|