rack_iphone_web_app 0.0.2 → 0.0.3
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/VERSION +1 -1
- data/lib/rack_iphone_web_app.rb +8 -4
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/rack_iphone_web_app.rb
CHANGED
@@ -3,7 +3,7 @@ module Rack
|
|
3
3
|
CODE = %{
|
4
4
|
<script type="text/javascript">
|
5
5
|
(function(){
|
6
|
-
var RESEND_REQUEST =
|
6
|
+
var RESEND_REQUEST = {{RESEND}};
|
7
7
|
|
8
8
|
function isFullScreen(){
|
9
9
|
return navigator.userAgent.match(/WebKit.*Mobile/) &&
|
@@ -48,15 +48,15 @@ module Rack
|
|
48
48
|
status, headers, body = @app.call(env)
|
49
49
|
|
50
50
|
if new_session?(env)
|
51
|
-
[200,{'Content-Length' =>
|
51
|
+
[200,{'Content-Length' => code(true).length.to_s, 'Content-Type' => 'text/html'}, code(true)]
|
52
52
|
else
|
53
53
|
# Put in patch code
|
54
54
|
body.each do |part|
|
55
55
|
if part =~ /<\/head>/
|
56
|
-
part.sub!(/<\/head>/, "#{
|
56
|
+
part.sub!(/<\/head>/, "#{code}</head>")
|
57
57
|
|
58
58
|
if headers['Content-Length']
|
59
|
-
headers['Content-Length'] = (headers['Content-Length'].to_i +
|
59
|
+
headers['Content-Length'] = (headers['Content-Length'].to_i + code.length).to_s
|
60
60
|
end
|
61
61
|
|
62
62
|
break
|
@@ -70,6 +70,10 @@ module Rack
|
|
70
70
|
end
|
71
71
|
protected
|
72
72
|
|
73
|
+
def code(resend=false)
|
74
|
+
CODE.gsub('{{RESEND}}', resend.to_s)
|
75
|
+
end
|
76
|
+
|
73
77
|
def new_session?(env)
|
74
78
|
request = Rack::Request.new(env)
|
75
79
|
if request.cookies['_cookieset_'].nil?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack_iphone_web_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Hoskins
|
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements: []
|
66
66
|
|
67
67
|
rubyforge_project:
|
68
|
-
rubygems_version: 1.3.
|
68
|
+
rubygems_version: 1.3.5
|
69
69
|
signing_key:
|
70
70
|
specification_version: 3
|
71
71
|
summary: Enables cookies in iPhone full screen web app mode
|