social_stream 0.12.1 → 0.12.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -5
- data/base/app/assets/javascripts/social_stream-base.js +1 -0
- data/base/app/models/contact.rb +3 -1
- data/base/config/routes.rb +14 -4
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/vendor/assets/javascripts/jquery.screw.js +188 -0
- data/documents/app/assets/javascripts/documents.js.erb +6 -0
- data/documents/app/assets/stylesheets/documents.css.scss +5 -0
- data/documents/app/controllers/documents_controller.rb +31 -4
- data/documents/app/views/common/_headers.html.erb +76 -0
- data/documents/app/views/common/_index.html.erb +16 -30
- data/documents/config/routes.rb +1 -1
- data/documents/lib/social_stream/documents/version.rb +1 -1
- data/documents/social_stream-documents.gemspec +1 -1
- data/events/db/migrate/20111102145626_add_more_fields_to_events.rb +24 -0
- data/events/lib/social_stream/events/version.rb +1 -1
- data/events/social_stream-events.gemspec +1 -1
- data/lib/social_stream/version.rb +1 -1
- data/presence/app/assets/javascripts/store.js +6 -0
- data/presence/app/assets/javascripts/{xmpp_client.js → xmpp_client.js.erb} +53 -1
- data/presence/app/controllers/xmpp_controller.rb +2 -2
- data/presence/app/views/xmpp/_chat.html.erb +22 -36
- data/presence/app/views/xmpp/_chat_connecting.html.erb +1 -1
- data/presence/app/views/xmpp/_chat_contacts.html.erb +6 -6
- data/presence/app/views/xmpp/_chat_off.html.erb +29 -15
- data/presence/app/views/xmpp/index.html +0 -1
- data/presence/config/locales/en.yml +11 -0
- data/presence/config/locales/es.yml +11 -0
- data/presence/config/routes.rb +1 -0
- data/presence/ejabberd/conf/ssconfig_example.cfg +6 -0
- data/presence/ejabberd/ejabberd_scripts/authentication_script +61 -5
- data/presence/ejabberd/ejabberd_scripts/emanagement +123 -35
- data/presence/ejabberd/mod_sspresence/mod_sspresence.beam +0 -0
- data/presence/lib/generators/social_stream/presence/templates/initializer.rb +13 -6
- data/presence/lib/social_stream-presence.rb +9 -4
- data/presence/lib/social_stream/presence/models/buddy_manager.rb +10 -2
- data/presence/lib/social_stream/presence/version.rb +1 -1
- data/presence/lib/social_stream/presence/xmpp_server_order.rb +193 -121
- data/presence/lib/tasks/presence/synchronize.rake +2 -2
- data/presence/social_stream-presence.gemspec +2 -0
- data/social_stream.gemspec +3 -3
- metadata +19 -15
- data/presence/app/views/xmpp/chat.html.erb +0 -13
data/documents/config/routes.rb
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
|
14
14
|
# Gem dependencies
|
15
|
-
s.add_runtime_dependency('social_stream-base', '~> 0.9.
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.9.25')
|
16
16
|
s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
|
17
17
|
s.add_runtime_dependency('paperclip','2.3.11')
|
18
18
|
s.add_runtime_dependency('delayed_paperclip','>= 0.7.2')
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class AddMoreFieldsToEvents < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :events, :description, :string
|
4
|
+
add_column :events, :place, :string
|
5
|
+
add_column :events, :isabel_event, :string
|
6
|
+
add_column :events, :machine_id, :int
|
7
|
+
add_column :events, :repeat, :string
|
8
|
+
add_column :events, :at_job, :int
|
9
|
+
add_column :events, :parent_id, :int
|
10
|
+
add_column :events, :character, :int
|
11
|
+
add_column :events, :public_read, :int
|
12
|
+
add_column :events, :marte_event, :int
|
13
|
+
add_column :events, :marte_room, :int
|
14
|
+
add_column :events, :spam, :int
|
15
|
+
add_column :events, :notes, :int
|
16
|
+
add_column :events, :location, :text
|
17
|
+
add_column :events, :streamming_url, :text
|
18
|
+
add_column :events, :permalink, :string
|
19
|
+
add_column :events, :cm_event_id, :int
|
20
|
+
add_column :events, :vc_mode, :int
|
21
|
+
add_column :events, :other_participation_url, :text
|
22
|
+
add_column :events, :web_interface, :int
|
23
|
+
end
|
24
|
+
end
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
|
14
14
|
# Gem dependencies
|
15
|
-
s.add_runtime_dependency('social_stream-base', '~> 0.9.
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.9.25')
|
16
16
|
s.add_runtime_dependency('conference_manager-ruby', '~> 0.0.3')
|
17
17
|
|
18
18
|
# Development Gem dependencies
|
@@ -10,6 +10,12 @@ $(document).ready(function () {
|
|
10
10
|
|
11
11
|
|
12
12
|
function storePassword() {
|
13
|
+
|
14
|
+
//Dont store password if cookie authentication is enable
|
15
|
+
if (authByCookie()) {
|
16
|
+
return
|
17
|
+
}
|
18
|
+
|
13
19
|
if (window.sessionStorage) {
|
14
20
|
if (($("#user_password").length==1)&&($("#user_password").val()!="")){
|
15
21
|
sessionStorage.setItem("ss_user_pass", $('#user_password').val());
|
@@ -3,7 +3,7 @@
|
|
3
3
|
////////////////////
|
4
4
|
|
5
5
|
function log(msg) {
|
6
|
-
|
6
|
+
console.log(msg)
|
7
7
|
}
|
8
8
|
|
9
9
|
|
@@ -17,6 +17,45 @@ statusMessage['away'] = "Away";
|
|
17
17
|
statusMessage['xa'] = "Away";
|
18
18
|
statusMessage['dnd'] = "Busy";
|
19
19
|
|
20
|
+
|
21
|
+
////////////////////
|
22
|
+
//Connect functions
|
23
|
+
////////////////////
|
24
|
+
|
25
|
+
function connectToServerWithCookie(){
|
26
|
+
try {
|
27
|
+
connection = new Strophe.Connection(BOSH_SERVICE);
|
28
|
+
connection.connect(user_jid, cookie, onConnect);
|
29
|
+
} catch (err) {
|
30
|
+
//"Handle errors"
|
31
|
+
return false;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
//Password: Get from chatPassword param if exists, instead try to get from sessionStorage.
|
36
|
+
function connectToServerWithPassword(chatPassword){
|
37
|
+
|
38
|
+
//Get Password
|
39
|
+
if ((chatPassword!=null)&&(chatPassword!="")){
|
40
|
+
var password = chatPassword;
|
41
|
+
} else if ((window.sessionStorage)&&(sessionStorage.getItem("ss_user_pass") != null)) {
|
42
|
+
var password = sessionStorage.getItem("ss_user_pass");
|
43
|
+
} else {
|
44
|
+
return false;
|
45
|
+
}
|
46
|
+
|
47
|
+
try {
|
48
|
+
//Connect actual user to the chat
|
49
|
+
connection = new Strophe.Connection(BOSH_SERVICE);
|
50
|
+
connection.connect(user_jid, password, onConnect);
|
51
|
+
} catch (err) {
|
52
|
+
//"Handle errors"
|
53
|
+
return false;
|
54
|
+
}
|
55
|
+
|
56
|
+
return true;
|
57
|
+
}
|
58
|
+
|
20
59
|
////////////////////
|
21
60
|
//Strophe functions
|
22
61
|
////////////////////
|
@@ -176,6 +215,19 @@ function sendChatMessage(from,to,text){
|
|
176
215
|
return true;
|
177
216
|
}
|
178
217
|
|
218
|
+
function authByCookie(){
|
219
|
+
var authMethod = '<%= SocialStream::Presence.auth_method %>';
|
220
|
+
return authMethod=="cookie";
|
221
|
+
}
|
222
|
+
|
223
|
+
function authByPassword(){
|
224
|
+
var authMethod = '<%= SocialStream::Presence.auth_method %>';
|
225
|
+
return authMethod=="password";
|
226
|
+
}
|
227
|
+
|
228
|
+
function ifCookie(){
|
229
|
+
return (!(typeof cookie == 'undefined'))
|
230
|
+
}
|
179
231
|
|
180
232
|
////////////////////
|
181
233
|
//Audio functions
|
@@ -100,7 +100,7 @@ class XmppController < ApplicationController
|
|
100
100
|
return
|
101
101
|
end
|
102
102
|
|
103
|
-
SocialStream::Presence::XmppServerOrder::
|
103
|
+
SocialStream::Presence::XmppServerOrder::resetPresence
|
104
104
|
|
105
105
|
render :text => "Ok"
|
106
106
|
end
|
@@ -115,7 +115,7 @@ class XmppController < ApplicationController
|
|
115
115
|
#Actual connected users
|
116
116
|
user_slugs = params[:name]
|
117
117
|
|
118
|
-
SocialStream::Presence::XmppServerOrder::
|
118
|
+
SocialStream::Presence::XmppServerOrder::synchronizePresenceForSlugs(user_slugs)
|
119
119
|
|
120
120
|
render :text => "ok"
|
121
121
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% if current_subject.subject_type=="User" %>
|
1
|
+
<% if current_user and current_subject.subject_type=="User" %>
|
2
2
|
|
3
3
|
<% content_for :headers do %>
|
4
4
|
<%= stylesheet_link_tag "chat.css", :media => "screen, projection" %>
|
@@ -9,49 +9,35 @@
|
|
9
9
|
<%= javascript_include_tag 'xmpp_client'%>
|
10
10
|
<%= javascript_include_tag 'store'%>
|
11
11
|
<% end %>
|
12
|
-
|
13
12
|
|
13
|
+
|
14
14
|
<script type="text/javascript">
|
15
|
-
|
16
|
-
|
15
|
+
|
16
|
+
//Global variables
|
17
17
|
var BOSH_SERVICE = '<%= SocialStream::Presence.bosh_service || root_url + "http-bind/" %>';
|
18
|
+
var cookie = "AuthenticationByCookie>>" + "<%=cookies[Rails.application.config.session_options[:key]]%>";
|
18
19
|
var domain = '<%=SocialStream::Presence.domain%>';
|
19
|
-
|
20
|
+
var user_name = '<%=current_user.name%>';
|
20
21
|
var user_slug = '<%=current_user.slug%>';
|
21
|
-
|
22
|
-
var sound_path = "/assets/audio/chat/onMessage"
|
23
|
-
|
24
|
-
function connectToServer(chatPassword){
|
25
|
-
<%unless current_user.nil? %>
|
26
|
-
|
27
|
-
//Get Password
|
28
|
-
if ((chatPassword!=null)&&(chatPassword!="")){
|
29
|
-
var password = chatPassword;
|
30
|
-
} else if ((window.sessionStorage)&&(sessionStorage.getItem("ss_user_pass") != null)) {
|
31
|
-
var password = sessionStorage.getItem("ss_user_pass");
|
32
|
-
} else {
|
33
|
-
return false;
|
34
|
-
}
|
35
|
-
|
36
|
-
try {
|
37
|
-
//Connect actual user to the chat
|
38
|
-
connection = new Strophe.Connection(BOSH_SERVICE);
|
39
|
-
connection.connect(user_jid, password, onConnect);
|
40
|
-
} catch (err) {
|
41
|
-
//"Handle errors"
|
42
|
-
return false;
|
43
|
-
}
|
22
|
+
var user_jid = '<%=current_user.slug%>'+"@"+domain;
|
23
|
+
var sound_path = "/assets/audio/chat/onMessage";
|
44
24
|
|
45
|
-
return true;
|
46
|
-
<%end%>
|
47
|
-
}
|
48
25
|
|
49
26
|
$(document).ready(function () {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
27
|
+
|
28
|
+
if (authByCookie()){
|
29
|
+
if (connectToServerWithCookie()==false){
|
30
|
+
refreshChatWindow();
|
31
|
+
}
|
32
|
+
} else {
|
33
|
+
if (connectToServerWithPassword(null)==false){
|
34
|
+
refreshChatWindow();
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
initialTimer = setTimeout("updateChatWindow()", 15000);
|
39
|
+
initAudio();
|
40
|
+
|
55
41
|
});
|
56
42
|
|
57
43
|
</script>
|
@@ -4,17 +4,17 @@
|
|
4
4
|
<div class="header">
|
5
5
|
<%=image_tag("btn/btn_friend.png", :class => "header_icon")%>
|
6
6
|
<div class="header_text">
|
7
|
-
|
7
|
+
<%=t('chat.title')%>
|
8
8
|
</div>
|
9
9
|
</div>
|
10
10
|
|
11
11
|
<div id="status" class="dropdown">
|
12
|
-
<dt><a href=""><span
|
12
|
+
<dt><a href=""><span><%=t('chat.status.choose')%></span></a></dt>
|
13
13
|
<dd>
|
14
14
|
<ul>
|
15
|
-
<li><a href="#" class="option"><img class="flag" src="assets/status/available.png" alt=""/>
|
16
|
-
<li><a href="#" class="option"><img class="flag" src="assets/status/away.png" alt=""/>
|
17
|
-
<li><a href="#" class="option"><img class="flag" src="assets/status/dnd.png" alt=""/>
|
15
|
+
<li><a href="#" class="option"><img class="flag" src="assets/status/available.png" alt=""/> <%=t('chat.status.available')%> <span class="value">chat</span></a></li>
|
16
|
+
<li><a href="#" class="option"><img class="flag" src="assets/status/away.png" alt=""/> <%=t('chat.status.away')%> <span class="value">away</span></a></li>
|
17
|
+
<li><a href="#" class="option"><img class="flag" src="assets/status/dnd.png" alt=""/> <%=t('chat.status.dnd')%> <span class="value">dnd</span></a></li>
|
18
18
|
</ul>
|
19
19
|
</dd>
|
20
20
|
</div>
|
@@ -30,7 +30,7 @@
|
|
30
30
|
<a title='<%=contact.name%>' class="presence_user_link" width="28">
|
31
31
|
<%=image_tag(contact.logo.url, :alt => contact.name , :size => "28x28")%>
|
32
32
|
<% if contact.user.status %>
|
33
|
-
|
33
|
+
<%=image_tag("status/" + contact.user.status + ".png", :class => "presence_status") %></a>
|
34
34
|
<% end %>
|
35
35
|
</a>
|
36
36
|
</div>
|
@@ -1,18 +1,32 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
$(document).ready(function () {
|
3
|
-
if ((window.sessionStorage) && (sessionStorage.getItem("ss_user_pass") != null)) {
|
4
|
-
$("#passwordFormChat").hide();
|
5
|
-
} else {
|
6
|
-
$("#passwordFormChat").show();
|
7
|
-
}
|
2
|
+
$(document).ready(function () {
|
8
3
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
if (authByCookie()){
|
5
|
+
//Authentication by cookie
|
6
|
+
|
7
|
+
$("#passwordFormChat").hide();
|
8
|
+
$('.connectChatButton').bind('click', function () {
|
9
|
+
connectToServerWithCookie();
|
10
|
+
});
|
11
|
+
|
12
|
+
} else {
|
13
|
+
//Authentication by password
|
14
|
+
|
15
|
+
if ((window.sessionStorage) && (sessionStorage.getItem("ss_user_pass") != null)) {
|
16
|
+
$("#passwordFormChat").hide();
|
17
|
+
} else {
|
18
|
+
$("#passwordFormChat").show();
|
19
|
+
}
|
20
|
+
|
21
|
+
$('.connectChatButton').bind('click', function () {
|
22
|
+
connectToServerWithPassword($('#user_password').val());
|
23
|
+
});
|
24
|
+
|
25
|
+
$('.storePass').bind('click', function () {
|
26
|
+
storePassword();
|
27
|
+
});
|
28
|
+
|
29
|
+
}
|
16
30
|
|
17
31
|
});
|
18
32
|
</script>
|
@@ -21,14 +35,14 @@
|
|
21
35
|
<div class="header">
|
22
36
|
<%=image_tag("btn/btn_friend.png", :class => "header_icon")%>
|
23
37
|
<div class="header_text">
|
24
|
-
|
38
|
+
<%=t('chat.disconnected')%>
|
25
39
|
</div>
|
26
40
|
</div>
|
27
41
|
</div>
|
28
42
|
|
29
43
|
<div class="chat_off">
|
30
44
|
<div id="passwordFormChat">
|
31
|
-
<label for="user_password" class="chatPasswordTitle"
|
45
|
+
<label for="user_password" class="chatPasswordTitle"><%=t('chat.password')%></label>
|
32
46
|
<input id="user_password" class="chat_password" type="password"></input>
|
33
47
|
</div>
|
34
48
|
<input class="connectChatButton storePass" value="Connect">
|
data/presence/config/routes.rb
CHANGED
@@ -15,6 +15,8 @@ scripts_path=/my_scripts_path
|
|
15
15
|
|
16
16
|
#API REST
|
17
17
|
auth_api=http://localhost/users/sign_in
|
18
|
+
auth_by_cookie_api=http://localhost/api/me
|
19
|
+
cookie_name=_rails_server_cookie
|
18
20
|
set_connection_api=http://localhost/xmpp/setConnection
|
19
21
|
unset_connection_api=http://localhost/xmpp/unsetConnection
|
20
22
|
reset_connection_api=http://localhost/xmpp/resetConnection
|
@@ -30,3 +32,7 @@ ss_password=password
|
|
30
32
|
|
31
33
|
#Ejabberd Server Password
|
32
34
|
ejabberd_password=password
|
35
|
+
|
36
|
+
#Emanagement configuration
|
37
|
+
users_require_sudo=user1,user2,...
|
38
|
+
verbose=false
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'logger'
|
4
4
|
require 'rest_client'
|
5
|
+
require 'rexml/document'
|
6
|
+
include REXML
|
5
7
|
|
6
8
|
$stdout.sync = true
|
7
9
|
$stdin.sync = true
|
@@ -30,6 +32,8 @@ def getOption(option)
|
|
30
32
|
end
|
31
33
|
|
32
34
|
$accessUrl = getOption("auth_api=")
|
35
|
+
$accessByCookieUrl = getOption("auth_by_cookie_api=")
|
36
|
+
$cookie_name = getOption("cookie_name=")
|
33
37
|
$sslogin = getOption("ss_login=")
|
34
38
|
$sspass = getOption("ss_password=")
|
35
39
|
|
@@ -75,6 +79,45 @@ def auth(username, password)
|
|
75
79
|
end
|
76
80
|
|
77
81
|
|
82
|
+
def authByCookie(username, cookie)
|
83
|
+
begin
|
84
|
+
response = RestClient.get $accessByCookieUrl, :cookies => {:"#{$cookie_name}" => cookie}
|
85
|
+
doc = REXML::Document.new(response.body)
|
86
|
+
|
87
|
+
slug = ""
|
88
|
+
doc.elements.each('user/slug') do |ele|
|
89
|
+
slug = ele.text
|
90
|
+
end
|
91
|
+
|
92
|
+
if username != "" and username == slug
|
93
|
+
return true
|
94
|
+
else
|
95
|
+
return false
|
96
|
+
end
|
97
|
+
|
98
|
+
rescue => e
|
99
|
+
|
100
|
+
unless e.class.name == "RestClient::Unauthorized" and e.message == "401 Unauthorized"
|
101
|
+
$logger.error "#{Process.pid}: Exception in authByCookie(username, cookie)"
|
102
|
+
$logger.error "#{Process.pid}: #{e.class.name}: #{e.message}"
|
103
|
+
end
|
104
|
+
|
105
|
+
return false
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
def validateParameters(username,domain,password)
|
111
|
+
if !username or !password or !domain
|
112
|
+
return false
|
113
|
+
end
|
114
|
+
if (username.gsub(/\s+/, "")=="") or (password.gsub(/\s+/, "")=="") or (domain.gsub(/\s+/, "")=="")
|
115
|
+
return false
|
116
|
+
end
|
117
|
+
return true
|
118
|
+
end
|
119
|
+
|
120
|
+
|
78
121
|
loop do
|
79
122
|
begin
|
80
123
|
$stdin.eof? # wait for input
|
@@ -91,12 +134,25 @@ loop do
|
|
91
134
|
|
92
135
|
when "auth"
|
93
136
|
$logger.info "#{Process.pid}: Authenticating #{data[0]}@#{data[1]}"
|
94
|
-
#$logger.info "#{Process.pid}: With password #{data[2]}"
|
95
|
-
#password = data[2]
|
96
|
-
|
97
|
-
#Authorization condition for LOGIN
|
98
|
-
auth(data[0], data[2])
|
99
137
|
|
138
|
+
#Parameters basic validation: validateParameters(username,domain,password)
|
139
|
+
if !validateParameters(data[0],data[1],data[2])
|
140
|
+
$logger.info "#{Process.pid}: Invalid parameters"
|
141
|
+
return false
|
142
|
+
end
|
143
|
+
|
144
|
+
#Select authorization condition for LOGIN
|
145
|
+
#Authentication methods: user/password or user/cookie
|
146
|
+
password = data[2]
|
147
|
+
if password.split(">>")[0]=="AuthenticationByCookie"
|
148
|
+
cookie = password.split(">>")[1]
|
149
|
+
$logger.info "#{Process.pid}: With username #{data[0]} and cookie #{cookie}"
|
150
|
+
authByCookie(data[0], cookie)
|
151
|
+
else
|
152
|
+
$logger.info "#{Process.pid}: With username #{data[0]} and password ******"
|
153
|
+
#$logger.info "#{Process.pid}: With username #{data[0]} and password #{data[2]}"
|
154
|
+
auth(data[0], data[2])
|
155
|
+
end
|
100
156
|
|
101
157
|
when "isuser"
|
102
158
|
|