deelay 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,15 +2,21 @@ require "sinatra"
2
2
  require "uri"
3
3
 
4
4
  module Deelay
5
- class DeelayApp < Sinatra::Application
5
+ class DeelayApp < Sinatra::Base
6
6
 
7
7
  get '/:delay' do
8
8
  delay = params[:delay].to_i
9
9
  url = request.query_string
10
10
 
11
+ raise "Invalid URL" if (URI::regexp =~ url).nil?
12
+
11
13
  sleep(delay / 1000)
12
14
  redirect url
13
15
  end
14
16
 
17
+ error 400..510 do
18
+ "<script>(function () { location.href = '#{Deelay::HOMEPAGE}/error'; }())</script>"
19
+ end
20
+
15
21
  end
16
22
  end
@@ -1,3 +1,3 @@
1
1
  module Deelay
2
- HOMEPAGE = "http://deelay.me/"
2
+ HOMEPAGE = "http://deelay.me"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Deelay
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deelay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70156513237400 !ruby/object:Gem::Requirement
16
+ requirement: &70325289713320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70156513237400
24
+ version_requirements: *70325289713320
25
25
  description: With Deelay you can delay loading web resources with specified time
26
26
  email:
27
27
  - gbiesiadecki@gmail.com
@@ -39,7 +39,7 @@ files:
39
39
  - lib/deelay/deelay_app.rb
40
40
  - lib/deelay/homepage.rb
41
41
  - lib/deelay/version.rb
42
- homepage: http://deelay.me/
42
+ homepage: http://deelay.me
43
43
  licenses: []
44
44
  post_install_message:
45
45
  rdoc_options: []
@@ -53,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  segments:
55
55
  - 0
56
- hash: -3912335946754377730
56
+ hash: -1572510627585904182
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  version: '0'
63
63
  segments:
64
64
  - 0
65
- hash: -3912335946754377730
65
+ hash: -1572510627585904182
66
66
  requirements: []
67
67
  rubyforge_project: deelay
68
68
  rubygems_version: 1.8.15