desviar 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Apache-License.txt +202 -0
- data/Gemfile +10 -0
- data/README.md +72 -0
- data/config/config.rb.example +89 -0
- data/config.ru +13 -0
- data/desviar.gemspec +32 -0
- data/desviar.rb +239 -0
- data/lib/auth.rb +100 -0
- data/lib/authorization.rb +55 -0
- data/lib/encrypt.rb +417 -0
- data/lib/model.rb +44 -0
- data/lib/version.rb +17 -0
- data/public/favicon.ico +0 -0
- data/views/captcha.erb +8 -0
- data/views/config.erb +41 -0
- data/views/content.erb +1 -0
- data/views/create.erb +18 -0
- data/views/layout.erb +70 -0
- data/views/list.erb +11 -0
- data/views/show.erb +15 -0
- metadata +100 -0
data/views/create.erb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
<div class="desviar">
|
2
|
+
<h2>Create a new temporary URI</h2>
|
3
|
+
<hr>
|
4
|
+
<form action="/create" method="POST">
|
5
|
+
<p><label for="uri">Existing URI: </label><input type="text" name="redir_uri" /><br>
|
6
|
+
<label for="expire">Seconds before Expiration: </label><input type="text" name="expiration" value="<%= $config[:exp] %>"/><p>
|
7
|
+
<label for="user">Username (if needed): </label><input type="text" name="remoteuser" /><p>
|
8
|
+
<label for="pass">Password (if needed): </label><input type="password" name="remotepw" /><p>
|
9
|
+
<label for="captcha">Require CAPTCHA: </label><input type="radio" name="captcha" value="0" checked/>No
|
10
|
+
<input type="radio" name="captcha" value="1" />Yes<br>
|
11
|
+
<label for="prompt">CAPTCHA prompt: </label><input type="text" name="captcha_prompt" /><br>
|
12
|
+
<label for="button">CAPTCHA button: </label><input type="text" name="captcha_button" value="Proceed" /></p>
|
13
|
+
Notes:<br>
|
14
|
+
<textarea name="notes" id="notes" rows="3"></textarea>
|
15
|
+
<br/>
|
16
|
+
<input type="submit" value="Save"/>
|
17
|
+
</form>
|
18
|
+
</div>
|
data/views/layout.erb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
<head>
|
4
|
+
<title><%= $config[:title] %></title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #eee;
|
8
|
+
font-family: "Trebuchet MS", verdana, tahoma, arial, sans-serif;
|
9
|
+
}
|
10
|
+
.desviar {
|
11
|
+
margin: 5px;
|
12
|
+
}
|
13
|
+
.desviar textarea, .desviar .sbody {
|
14
|
+
border: 2px dotted #eee;
|
15
|
+
padding: 5px;
|
16
|
+
width: 500px;
|
17
|
+
color: #fff;
|
18
|
+
background-color: #777;
|
19
|
+
}
|
20
|
+
.desviar textarea {
|
21
|
+
padding: 10px;
|
22
|
+
}
|
23
|
+
.desviar input, .desviar .sdate {
|
24
|
+
margin-top: 5px;
|
25
|
+
}
|
26
|
+
label {
|
27
|
+
float: left;
|
28
|
+
width: 150px;
|
29
|
+
text-align: right;
|
30
|
+
margin-right: 0.5em;
|
31
|
+
}
|
32
|
+
table.grid {
|
33
|
+
font-family: verdana,arial,sans-serif;
|
34
|
+
font-size:11px;
|
35
|
+
color:#333333;
|
36
|
+
border-width: 1px;
|
37
|
+
border-color: #666666;
|
38
|
+
border-collapse: collapse;
|
39
|
+
}
|
40
|
+
table.grid th {
|
41
|
+
border-width: 1px;
|
42
|
+
padding: 4px;
|
43
|
+
border-style: solid;
|
44
|
+
border-color: #666666;
|
45
|
+
background-color: #dedede;
|
46
|
+
}
|
47
|
+
table.grid td {
|
48
|
+
border-width: 1px;
|
49
|
+
padding: 4px;
|
50
|
+
border-style: solid;
|
51
|
+
border-color: #666666;
|
52
|
+
background-color: #ffffff;
|
53
|
+
}
|
54
|
+
#box .syntax {
|
55
|
+
background-color: #777;
|
56
|
+
padding: 2px;
|
57
|
+
margin: 5px;
|
58
|
+
margin-left: 1em;
|
59
|
+
margin-bottom: 1em;
|
60
|
+
}
|
61
|
+
#box .syntax .line_number {
|
62
|
+
text-align: right;
|
63
|
+
font-family: monospace;
|
64
|
+
padding-right: 1em;
|
65
|
+
color: #999;
|
66
|
+
}
|
67
|
+
</style>
|
68
|
+
</head>
|
69
|
+
<body><%= yield %></body>
|
70
|
+
</html>
|
data/views/list.erb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="desviar">
|
2
|
+
<h2>URI Listing (<%= @count %> of <%= @total %>)</h2>
|
3
|
+
<table class="grid">
|
4
|
+
<tr><th>id</th><th>created_at</th><th>expires_at</th><th>redir_uri</th><th>c</th><th>size</th><th>notes</th></tr>
|
5
|
+
<% @desviar.each do |item| %>
|
6
|
+
<%= "<tr><td><a href=/link/#{item.id}>#{item.id}</a></td><td>#{item.created_at}</td><td>#{item.expires_at}</td><td>#{item.redir_uri}</td><td>#{'•' if item.captcha}</td><td>#{item.content.bytesize}</td><td>#{item.notes[0,50]}</td>" %>
|
7
|
+
<% end %>
|
8
|
+
</table>
|
9
|
+
<p><a href="/create">Create</a> <a href="/config">Config</a> <a href="/clean">Clean</a>
|
10
|
+
<hr>
|
11
|
+
</div>
|
data/views/show.erb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="desviar">
|
2
|
+
<a href="/desviar/<%= @desviar.temp_uri[0, @desviar.temp_uri.length - $config[:urisuffix].length] %>">
|
3
|
+
https:<%= settings.bind %>:<%= settings.port %>/desviar/<%= @desviar.temp_uri[0, @desviar.temp_uri.length - $config[:urisuffix].length] %></a><br><hr>
|
4
|
+
<h2><a href="<%= @desviar.redir_uri %>"><%= @desviar.redir_uri %></a></h2>
|
5
|
+
<div class="sbody" id="box">
|
6
|
+
<%= @desviar.formatted_notes %>
|
7
|
+
</div>
|
8
|
+
<div class="sdate">
|
9
|
+
Created <%= @desviar.created_at.strftime("%D at %T %Z") %> <%= ENV['REMOTE_USER'] %><br>
|
10
|
+
Expires <%= @desviar.expires_at.strftime("%D at %T %Z") %>
|
11
|
+
<%= @desviar.captcha ? "<br>CAPTCHA is required" : "" %>
|
12
|
+
</div>
|
13
|
+
<hr>
|
14
|
+
<a href="/create">Create new temporary URI!</a>
|
15
|
+
</div>
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: desviar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.9
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Rich Braun
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-07-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sinatra
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.4'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.4'
|
30
|
+
description: ! 'Desviar provides URL redirection; some possible applications include:
|
31
|
+
|
32
|
+
- Web signup process
|
33
|
+
|
34
|
+
- Continuous-deploy servers
|
35
|
+
|
36
|
+
- Online ticket sales
|
37
|
+
|
38
|
+
'
|
39
|
+
email: richb@instantlinux.net
|
40
|
+
executables: []
|
41
|
+
extensions: []
|
42
|
+
extra_rdoc_files: []
|
43
|
+
files:
|
44
|
+
- Apache-License.txt
|
45
|
+
- Gemfile
|
46
|
+
- README.md
|
47
|
+
- config.ru
|
48
|
+
- config/config.rb.example
|
49
|
+
- desviar.gemspec
|
50
|
+
- desviar.rb
|
51
|
+
- lib/auth.rb
|
52
|
+
- lib/authorization.rb
|
53
|
+
- lib/encrypt.rb
|
54
|
+
- lib/model.rb
|
55
|
+
- lib/version.rb
|
56
|
+
- public/favicon.ico
|
57
|
+
- views/captcha.erb
|
58
|
+
- views/config.erb
|
59
|
+
- views/content.erb
|
60
|
+
- views/create.erb
|
61
|
+
- views/layout.erb
|
62
|
+
- views/list.erb
|
63
|
+
- views/show.erb
|
64
|
+
homepage: http://github.com/instantlinux/desviar
|
65
|
+
licenses: []
|
66
|
+
post_install_message: ! '------------------------------------------------------------------------------
|
67
|
+
|
68
|
+
Desviar v0.0.9
|
69
|
+
|
70
|
+
|
71
|
+
Thanks for using Desviar.
|
72
|
+
|
73
|
+
------------------------------------------------------------------------------
|
74
|
+
|
75
|
+
'
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- config
|
79
|
+
- lib
|
80
|
+
- public
|
81
|
+
- views
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project: desviar
|
96
|
+
rubygems_version: 1.8.23
|
97
|
+
signing_key:
|
98
|
+
specification_version: 3
|
99
|
+
summary: Preauthorized secure/random URI redirection
|
100
|
+
test_files: []
|