jschat 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  var EmoteHelper = {
2
- legalEmotes: ['angry', 'arr', 'blink', 'blush', 'brucelee', 'btw', 'chuckle', 'clap', 'cool', 'drool', 'drunk', 'dry', 'eek', 'flex', 'happy', 'holmes', 'huh', 'laugh', 'lol', 'mad', 'mellow', 'noclue', 'oh', 'ohmy', 'ph34r', 'pimp', 'punch', 'realmad', 'rock', 'rofl', 'rolleyes', 'sad', 'scratch', 'shifty', 'shock', 'shrug', 'sleep', 'sleeping', 'smile', 'suicide', 'sweat', 'thumbs', 'tongue', 'unsure', 'w00t', 'wacko', 'whistling', 'wink', 'worship', 'yucky'],
2
+ legalEmotes: ['angry', 'arr', 'blink', 'blush', 'brucelee', 'btw', 'chuckle', 'clap', 'cool', 'drool', 'drunk', 'dry', 'eek', 'flex', 'happy', 'holmes', 'huh', 'laugh', 'lol', 'mad', 'mellow', 'noclue', 'oh', 'ohmy', 'panic', 'ph34r', 'pimp', 'punch', 'realmad', 'rock', 'rofl', 'rolleyes', 'sad', 'scratch', 'shifty', 'shock', 'shrug', 'sleep', 'sleeping', 'smile', 'suicide', 'sweat', 'thumbs', 'tongue', 'unsure', 'w00t', 'wacko', 'whistling', 'wink', 'worship', 'yucky'],
3
3
 
4
4
  emoteToImage: function(emote) {
5
5
  var result = emote;
@@ -17,9 +17,11 @@ var Display = {
17
17
  var name = JsChat.user.name;
18
18
  var user_class = name == message['user'] ? 'user active' : 'user';
19
19
  var text = '<span class="\#{user_class}">\#{user}</span> <span class="\#{message_class}">\#{message}</span>';
20
+ var blurred_mention = '';
20
21
 
21
22
  if (message['message'].match(new RegExp(name, 'i')) && name != message['user']) {
22
23
  user_class = 'user mentioned';
24
+ blurred_mention = '*';
23
25
  }
24
26
 
25
27
  Display.clearIdleState(message['user']);
@@ -37,7 +39,7 @@ var Display = {
37
39
 
38
40
  if (this.show_unread) {
39
41
  this.unread++;
40
- document.title = 'JsChat: (' + this.unread + ') new messages';
42
+ document.title = 'JsChat: (' + this.unread + blurred_mention + ') new messages';
41
43
  }
42
44
  },
43
45
 
@@ -10,6 +10,7 @@
10
10
  <script src="/javascripts/all.js?<%= Time.now.to_i %>" type="text/javascript"></script>
11
11
  <link href="/stylesheets/screen.css?<%= Time.now.to_i %>" media="screen" rel="stylesheet" type="text/css" />
12
12
  <link href="/stylesheets/ipad.css?<%= Time.now.to_i %>" media="screen" rel="stylesheet" type="text/css" />
13
+ <link rel="apple-touch-icon" media="screen and (resolution: 132dpi)" href="/iOS-72.png" />
13
14
  </head>
14
15
  <body class="ipad">
15
16
  <div id="loading" style="display: none">Loading...</div>
@@ -10,6 +10,8 @@
10
10
  <script src="/javascripts/all.js?<%= Time.now.to_i %>" type="text/javascript"></script>
11
11
  <link href="/stylesheets/screen.css?<%= Time.now.to_i %>" media="screen" rel="stylesheet" type="text/css" />
12
12
  <link href="/stylesheets/iphone.css?<%= Time.now.to_i %>" media="screen" rel="stylesheet" type="text/css" />
13
+ <link rel="apple-touch-icon" media="screen and (resolution: 163dpi)" href="/iOS-57.png" />
14
+ <link rel="apple-touch-icon" media="screen and (resolution: 326dpi)" href="/iOS-114.png" />
13
15
  </head>
14
16
  <body class="iphone" onload="setTimeout(function() { window.scrollTo(0, 1); }, 100);">
15
17
  <div id="loading" style="display: none">Loading...</div>
@@ -71,8 +71,8 @@ module JsChat
71
71
  @expires = Time.now.utc + @session_length
72
72
  end
73
73
 
74
- def to_json
75
- { 'name' => @name, 'last_activity' => @last_activity }.to_json
74
+ def to_json(*a)
75
+ { 'name' => @name, 'last_activity' => @last_activity }.to_json(*a)
76
76
  end
77
77
 
78
78
  def name=(name)
@@ -218,8 +218,8 @@ module JsChat
218
218
  @users.collect { |user| user.name }
219
219
  end
220
220
 
221
- def to_json
222
- { 'name' => @name, 'members' => member_names }.to_json
221
+ def to_json(*a)
222
+ { 'name' => @name, 'members' => member_names }.to_json(*a)
223
223
  end
224
224
 
225
225
  def notice(user, message, all = false)
@@ -6,7 +6,7 @@ end
6
6
  module JsChat::Storage
7
7
  module MongoDriver
8
8
  def self.connect!
9
- @db = Mongo::Connection.new(ServerConfig['db_host'], ServerConfig['db_port']).db(ServerConfig['db_name'])
9
+ @db = Mongo::Connection.new(ServerConfig['db_host'], ServerConfig['db_port'], :slave_ok => true).db(ServerConfig['db_name'])
10
10
  if ServerConfig['db_username'] and ServerConfig['db_password']
11
11
  if @db.authenticate(ServerConfig['db_username'], ServerConfig['db_password'])
12
12
  true
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class TestJsChat < Test::Unit::TestCase
3
+ class ServerTest < Test::Unit::TestCase
4
4
  include JsChatHelpers
5
5
 
6
6
  def setup
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class TestJsChat < Test::Unit::TestCase
3
+ class StatelessTest < Test::Unit::TestCase
4
4
  include JsChatHelpers
5
5
 
6
6
  def setup
@@ -6,9 +6,7 @@ require 'json'
6
6
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
7
7
  require File.join(File.dirname(__FILE__), '..', 'lib', 'jschat', 'server.rb')
8
8
 
9
- ServerConfig = {
10
- 'max_message_length' => 500
11
- }
9
+ ServerConfig['max_message_length'] = 500
12
10
 
13
11
  class JsChat::Room
14
12
  def self.reset
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 6
9
- version: 0.3.6
8
+ - 7
9
+ version: 0.3.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alex R. Young
@@ -45,24 +45,10 @@ dependencies:
45
45
  version: 1.1.9
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: sprockets
50
- prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 1
57
- - 0
58
- - 2
59
- version: 1.0.2
60
- type: :runtime
61
- version_requirements: *id003
62
48
  - !ruby/object:Gem::Dependency
63
49
  name: eventmachine
64
50
  prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
51
+ requirement: &id003 !ruby/object:Gem::Requirement
66
52
  requirements:
67
53
  - - ">="
68
54
  - !ruby/object:Gem::Version
@@ -72,11 +58,11 @@ dependencies:
72
58
  - 8
73
59
  version: 0.12.8
74
60
  type: :runtime
75
- version_requirements: *id004
61
+ version_requirements: *id003
76
62
  - !ruby/object:Gem::Dependency
77
63
  name: ncurses
78
64
  prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
65
+ requirement: &id004 !ruby/object:Gem::Requirement
80
66
  requirements:
81
67
  - - ">="
82
68
  - !ruby/object:Gem::Version
@@ -86,7 +72,7 @@ dependencies:
86
72
  - 1
87
73
  version: 0.9.1
88
74
  type: :runtime
89
- version_requirements: *id005
75
+ version_requirements: *id004
90
76
  description: JsChat is a JSON-based web and console chat app.
91
77
  email: alex@alexyoung.org
92
78
  executables:
@@ -104,7 +90,6 @@ files:
104
90
  - lib/jschat/client.rb
105
91
  - lib/jschat/errors.rb
106
92
  - lib/jschat/flood_protection.rb
107
- - lib/jschat/http/config/sprockets.yml
108
93
  - lib/jschat/http/config.ru
109
94
  - lib/jschat/http/helpers/url_for.rb
110
95
  - lib/jschat/http/jschat.rb
@@ -133,6 +118,7 @@ files:
133
118
  - lib/jschat/http/public/images/emoticons/noclue.gif
134
119
  - lib/jschat/http/public/images/emoticons/oh.gif
135
120
  - lib/jschat/http/public/images/emoticons/ohmy.gif
121
+ - lib/jschat/http/public/images/emoticons/panic.gif
136
122
  - lib/jschat/http/public/images/emoticons/ph34r.gif
137
123
  - lib/jschat/http/public/images/emoticons/pimp.gif
138
124
  - lib/jschat/http/public/images/emoticons/punch.gif
@@ -161,6 +147,10 @@ files:
161
147
  - lib/jschat/http/public/images/emoticons/yucky.gif
162
148
  - lib/jschat/http/public/images/jschat.gif
163
149
  - lib/jschat/http/public/images/shadow.png
150
+ - lib/jschat/http/public/iOS-114.png
151
+ - lib/jschat/http/public/iOS-57.png
152
+ - lib/jschat/http/public/iOS-72.png
153
+ - lib/jschat/http/public/javascripts/all.js
164
154
  - lib/jschat/http/public/javascripts/app/controllers/chat_controller.js
165
155
  - lib/jschat/http/public/javascripts/app/controllers/signon_controller.js
166
156
  - lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
@@ -180,7 +170,6 @@ files:
180
170
  - lib/jschat/http/public/stylesheets/ipad.css
181
171
  - lib/jschat/http/public/stylesheets/iphone.css
182
172
  - lib/jschat/http/public/stylesheets/screen.css
183
- - lib/jschat/http/script/sprockets.rb
184
173
  - lib/jschat/http/tmp/restart.txt
185
174
  - lib/jschat/http/views/form.erb
186
175
  - lib/jschat/http/views/index.erb
@@ -201,7 +190,7 @@ files:
201
190
  - test/test_helper.rb
202
191
  - README.textile
203
192
  - MIT-LICENSE
204
- has_rdoc: false
193
+ has_rdoc: true
205
194
  homepage: http://github.com/alexyoung/jschat
206
195
  licenses: []
207
196
 
@@ -1,7 +0,0 @@
1
- :load_path:
2
- - public/javascripts
3
- - public/javascripts/all
4
- :source_files:
5
- - public/javascripts/init.js
6
- - public/javascripts/app/**/*.js
7
- :output_file: public/javascripts/all.js
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
- require 'sprockets'
4
-
5
- sprockets_root = File.join(File.dirname(__FILE__), '..')
6
- sprockets_config = YAML.load(IO.read(File.join(sprockets_root, 'config', 'sprockets.yml')))
7
-
8
- secretary = Sprockets::Secretary.new(
9
- :root => sprockets_root,
10
- :load_path => sprockets_config[:load_path],
11
- :source_files => sprockets_config[:source_files]
12
- )
13
-
14
- secretary.concatenation.save_to(File.join(sprockets_root, sprockets_config[:output_file]))