rack_iphone_web_app 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rack_iphone_web_app.rb +6 -12
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/rack_iphone_web_app.rb
CHANGED
@@ -33,6 +33,7 @@ module Rack
|
|
33
33
|
localStorage.setItem('__cookie__', ''+document.cookie);
|
34
34
|
}
|
35
35
|
},1000);
|
36
|
+
|
36
37
|
}
|
37
38
|
})()
|
38
39
|
</script>
|
@@ -45,24 +46,17 @@ module Rack
|
|
45
46
|
|
46
47
|
def call(env)
|
47
48
|
if iphone_web_app?(env)
|
48
|
-
status, headers, body = @app.call(env)
|
49
|
-
|
50
49
|
if new_session?(env)
|
51
50
|
[200,{'Content-Length' => code(true).length.to_s, 'Content-Type' => 'text/html'}, code(true)]
|
52
51
|
else
|
52
|
+
status, headers, body = @app.call(env)
|
53
53
|
# Put in patch code
|
54
|
+
response = Rack::Response.new([], status, headers)
|
54
55
|
body.each do |part|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
if headers['Content-Length']
|
59
|
-
headers['Content-Length'] = (headers['Content-Length'].to_i + code.length).to_s
|
60
|
-
end
|
61
|
-
|
62
|
-
break
|
63
|
-
end
|
56
|
+
part.gsub!(/<\/head>/, "#{code}</head>")
|
57
|
+
response.write(part)
|
64
58
|
end
|
65
|
-
|
59
|
+
response.finish
|
66
60
|
end
|
67
61
|
else
|
68
62
|
@app.call(env)
|