hashbang 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "hashbang"
3
- s.version = "1.0.1"
3
+ s.version = "1.0.2"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "Magic support of Google/Bing/... AJAX search indexing for your Rails apps"
6
6
  s.email = "boris@roundlake.ru"
@@ -8,4 +8,9 @@ $: << Bundler.load.specs.find{|s| s.name == 'hashbang' }.full_gem_path + '/lib'
8
8
  require 'hashbang'
9
9
  require 'hashbang/standalone/middleware'
10
10
 
11
- run Hashbang::Standalone::Middleware.new(File.expand_path('..', __FILE__))
11
+ app = Rack::Builder.app do
12
+ use Rack::ShowExceptions
13
+ run Hashbang::Standalone::Middleware.new(File.expand_path('..', __FILE__))
14
+ end
15
+
16
+ run app
@@ -1,3 +1,5 @@
1
+ require 'uri'
2
+
1
3
  # coding: utf-8
2
4
  module Hashbang
3
5
  module Standalone
@@ -11,12 +13,17 @@ module Hashbang
11
13
  url = environment['QUERY_STRING'].split('&').find{|x| x[0,4] == 'url='}
12
14
 
13
15
  unless url.to_s.length == 0
14
- url = url.split('=')[1]
16
+ url = url.split('=')
17
+ url.shift
18
+
19
+ url = url.join('=')
15
20
  url = URI.unescape url
16
21
  url = Crawler.urlFromUrl url
17
22
  end
18
23
 
19
- if url.to_s.length == 0 || !url.match(Config.url)
24
+ host = URI.parse(url).host
25
+
26
+ if url.to_s.length == 0 || !host.match(Config.url)
20
27
  return [200, {"Content-Type" => "text/html; charset=utf-8"}, ['']]
21
28
  end
22
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashbang
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-19 00:00:00.000000000 Z
12
+ date: 2012-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: headless
16
- requirement: &70125844892140 !ruby/object:Gem::Requirement
16
+ requirement: &70188730061260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70125844892140
24
+ version_requirements: *70188730061260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sunscraper
27
- requirement: &70125844891520 !ruby/object:Gem::Requirement
27
+ requirement: &70188730059200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.2.0.pre1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70125844891520
35
+ version_requirements: *70188730059200
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: unicorn
38
- requirement: &70125844890880 !ruby/object:Gem::Requirement
38
+ requirement: &70188730058480 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70125844890880
46
+ version_requirements: *70188730058480
47
47
  description: Hashbang is a tiny Rack proxy serving HTML dumps for your RICH web-applications
48
48
  according to Google AJAX Crawling conventions. Make your Rails AJAX applications
49
49
  indexable in no time.