Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
69540e23
Commit
69540e23
authored
Oct 08, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow anonymous users to chat.
parent
2b4372ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
16 deletions
+7
-16
README
README
+1
-3
static/sfu.js
static/sfu.js
+6
-13
No files found.
README
View file @
69540e23
...
...
@@ -106,9 +106,7 @@ fields, all of which are optional.
- `max-history-age`: the time, in seconds, during which chat history is
kept (default 14400, i.e. 4 hours);
- `allow-recording`: if true, then recording is allowed in this group;
- `allow-anonymous`: if true, then users may connect with an empty
username; this is not recommended, since anonymous users are not
allowed to participate in the chat;
- `allow-anonymous`: if true, then users may connect with an empty username.
- `redirect`: if set, then attempts to join the group will be redirected
to the given URL; most other fields are ignored in this case.
...
...
static/sfu.js
View file @
69540e23
...
...
@@ -1275,12 +1275,14 @@ function addToChatbox(peerId, dest, nick, time, kind, message) {
if
(
kind
!==
'
me
'
)
{
let
p
=
formatLines
(
message
.
split
(
'
\n
'
));
if
(
lastMessage
.
nick
!==
nick
||
if
(
lastMessage
.
nick
!==
(
nick
||
null
)
||
lastMessage
.
peerId
!==
peerId
||
lastMessage
.
dest
!==
(
dest
||
null
))
{
let
header
=
document
.
createElement
(
'
p
'
);
let
user
=
document
.
createElement
(
'
span
'
);
user
.
textContent
=
dest
?
`
${
nick
}
\u2192
${
users
[
dest
]}
`
:
nick
;
user
.
textContent
=
dest
?
`
${
nick
||
'
(anon)
'
}
\u2192
${
users
[
dest
]
||
'
(anon)
'
}
`
:
(
nick
||
'
(anon)
'
);
user
.
classList
.
add
(
'
message-user
'
);
header
.
appendChild
(
user
);
if
(
time
)
{
...
...
@@ -1294,7 +1296,7 @@ function addToChatbox(peerId, dest, nick, time, kind, message) {
}
p
.
classList
.
add
(
'
message-content
'
);
container
.
appendChild
(
p
);
lastMessage
.
nick
=
nick
;
lastMessage
.
nick
=
(
nick
||
null
)
;
lastMessage
.
peerId
=
peerId
;
lastMessage
.
dest
=
(
dest
||
null
);
}
else
{
...
...
@@ -1302,7 +1304,7 @@ function addToChatbox(peerId, dest, nick, time, kind, message) {
asterisk
.
textContent
=
'
*
'
;
asterisk
.
classList
.
add
(
'
message-me-asterisk
'
);
let
user
=
document
.
createElement
(
'
span
'
);
user
.
textContent
=
nick
;
user
.
textContent
=
nick
||
'
(anon)
'
;
user
.
classList
.
add
(
'
message-me-user
'
);
let
content
=
document
.
createElement
(
'
span
'
);
formatLine
(
message
).
forEach
(
elt
=>
{
...
...
@@ -1472,10 +1474,6 @@ function handleInput() {
}
if
(
cmd
===
'
/msg
'
)
{
let
username
=
getUsername
();
if
(
!
username
)
{
displayError
(
"
Sorry, you're anonymous, you cannot chat
"
);
return
;
}
serverConnection
.
chat
(
username
,
''
,
id
,
parsed
[
1
]);
addToChatbox
(
serverConnection
.
id
,
id
,
username
,
Date
.
now
(),
''
,
parsed
[
1
]);
...
...
@@ -1500,11 +1498,6 @@ function handleInput() {
}
let
username
=
getUsername
();
if
(
!
username
)
{
displayError
(
"
Sorry, you're anonymous, you cannot chat
"
);
return
;
}
try
{
serverConnection
.
chat
(
username
,
me
?
'
me
'
:
''
,
''
,
message
);
}
catch
(
e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment