enigmamachine 0.2.1 → 0.2.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.
- data/README.rdoc +53 -4
- data/VERSION +1 -1
- data/enigmamachine.gemspec +1 -1
- data/lib/enigmamachine.rb +1 -3
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -54,6 +54,47 @@ The enigmamachine will run all encoding tasks on the video. If a new video is
|
|
54
54
|
uploaded while the first one is still encoding, it will be placed in a queue.
|
55
55
|
Videos are encoded sequentially as they arrive.
|
56
56
|
|
57
|
+
All requests, whether they come from your browser or from your code, are
|
58
|
+
protected by HTTP basic auth. By default, the username is
|
59
|
+
<i>admin</i> and the password is <i>admin</i>.
|
60
|
+
|
61
|
+
Programmatic requests in Ruby might look something like this:
|
62
|
+
|
63
|
+
require 'rubygems'
|
64
|
+
require 'httparty'
|
65
|
+
require 'base64'
|
66
|
+
|
67
|
+
class EnigmaClient
|
68
|
+
|
69
|
+
include HTTParty
|
70
|
+
base_uri 'localhost:2002'
|
71
|
+
|
72
|
+
def initialize (u, p)
|
73
|
+
@auth = encode_credentials(u, p)
|
74
|
+
end
|
75
|
+
|
76
|
+
def post(path_to_video, encoder_id)
|
77
|
+
self.class.post('/videos', {
|
78
|
+
:body => {:video => {:file => path_to_video}, :encoder_id => encoder_id},
|
79
|
+
'HTTP_AUTHORIZATION' => @auth
|
80
|
+
})
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def encode_credentials(username, password)
|
86
|
+
"Basic " + Base64.encode64("#{username}:#{password}")
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
# Let's use it!
|
94
|
+
#
|
95
|
+
EnigmaClient.new("admin", "admin").post("/path/to/your/uploaded/video.mp4", 1)
|
96
|
+
|
97
|
+
|
57
98
|
== Encoders and Encoding Tasks
|
58
99
|
|
59
100
|
When you POST the location of a video to your enigmamachine, you need to tell
|
@@ -92,15 +133,23 @@ _Grab a 320x240 JPEG thumbnail_:
|
|
92
133
|
|
93
134
|
Rinse and repeat for the 160x120 thumbnail.
|
94
135
|
|
95
|
-
== Security
|
136
|
+
== Security considerations
|
96
137
|
|
97
138
|
Enigmamachine is set to bind by default to 127.0.0.1 (your system's loopback)
|
98
|
-
interface rather than on all network interfaces
|
139
|
+
interface rather than on all network interfaces, so it won't be accessible from
|
140
|
+
other machines.
|
99
141
|
|
100
142
|
Making an enigmamachine available on an untrusted network (like
|
101
143
|
the Internet) would be a suicidal move on your part, since the code used to
|
102
|
-
talk to ffmpeg is a simple exec call and you'll be inviting everyone in
|
103
|
-
to execute commands on your server
|
144
|
+
talk to ffmpeg is a simple backtick exec call and you'll be inviting everyone in
|
145
|
+
the world to execute commands on your server, with your effective user
|
146
|
+
permissions.
|
147
|
+
|
148
|
+
When the enigmamachine starts for the first time in a given directory, it will
|
149
|
+
spit out a config.yml file containing a username and password. All requests
|
150
|
+
will need to submit this auth information. This should make enigmamachine
|
151
|
+
reasonably safe to use on shared hosts, just make sure nobody can read the
|
152
|
+
config file except the user executing the enigmamachine process.
|
104
153
|
|
105
154
|
If you don't know what any of this means, don't run it. I'm not responsible if
|
106
155
|
your enigmamachine screws up your system, allows people to exploit you, or
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/enigmamachine.gemspec
CHANGED
data/lib/enigmamachine.rb
CHANGED
@@ -102,9 +102,7 @@ class EnigmaMachine < Sinatra::Base
|
|
102
102
|
|
103
103
|
# Set up Rack authentication
|
104
104
|
#
|
105
|
-
#
|
106
|
-
# of providing security for shared hosts. TODO: figure out how to secure the
|
107
|
-
# app for use on shared hosts.
|
105
|
+
# Provides minimal security for shared hosts.
|
108
106
|
#
|
109
107
|
use Rack::Auth::Basic do |username, password|
|
110
108
|
[username, password] == [@@username, @@password]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enigmamachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- dave
|