New weapons against flooding

2 new Tools available in /chatadmin/security to fight against flooding the chat

maxLenthMessage

 Maximum number of characters an user can send per message.
Default is 512.
When user tries to send a longer message, message is cropped to N-1 chars

 

maxLinesMessages

Maximum number of RETURN character in a chat message.
Default value is 8
When users inserts more than N RETURN characters, messages is cropped.

adult rooms

New feature: you can now assign rooms as adult room

When a new user enters an adult room, you can choose 3 actions.

These actions are defined in the security panel

You can :

  • do nothing
  • Warn an user it is adult
  • Hide the room if user is minor of 18

The case “Hide the room if user is minor of 18”, implies you know the age of the user. We added the “age” on the registration panel.

If you use JWT to inject your data, then you can use that extra field:

birthyear

to add the year of birth of the user

ex: birthyear:1995

 

You can also use

seenByAdultOnly

that means that this member will be seen only by adults (if seenByAdultOnly=1)

 

New private and whisper features

New private text and mention features

For better readability and clarity we renamed:

“Send quick message” to “Mention”

and we remove the # and @ in texts and add clearly the avatar and the action of the user:

You clearly see now the avatar of the user you are sending a mention or a private text

You can however style use the shortcuts # and @ to autocomplete the user

# is for private message

@ is for mention.

This change also corrects the user of users that were containing some [SPACE] character inside their usernames.

mention

start

How to directly enter a room ?

(UPDATED – fixed bug)
New feature: It is now possible to join a particular room directly at login

2 cases

Let suppose you want to join room id : 1620
(you can find out your room id in your chatadmin)

https://html5-chat.com/chat/54/?startRoom=1620

 

  1. if you don’t use JWT authentification, just pass the url parameter startRoom
    ?startRoom=1620
  2. You do use JWT to login, then just inject the parameter: startRoom: id
roomid
Where to find the room id ?

 

so for room : 1620, you just need to add

'startRoom'=>1620

So for instance your JSON will be:

 

$json = json_encode(array('username'=>'myUsername', 'password'=>'myChatAccountPassword', 'gender'=>'male', 'role'=>'user', 
'image'=>base64_encode('https://html5-chat.com/img/malecostume.svg'), 'profile'=>'https://monsite.com/profile/myUserername', 'startRoom'=>1620));
phpsocial

html5 chat and phpsocial integration

PHP social is a cool social “facebook” like script.  It is not free but has a moderated price of 49$.

We suppose we want to get a chat page in full screen, auto loggedon and called “chat”.

(You need to be registered and loggedon on netswing.fr to test it)

ex: https://www.netswing.fr/chat

How can we integrate HTML5-chat into php social ?

Step1 : edit .htaccess and add this line

RewriteRule ^chat/?$        index.php?a=chat          [NC]

Step2 : edit config.php and add

'chat'        => 'chat',

Step3: download this script: chat , unzip it and edit it and change the 2 lines: webmasterid and password

$webmasterid = xxx;
$password = 'xxxx';

Step4: FTP upload chat.php to /sources folder

Step5: Test that your chat works fine on https://www.netswing.fr/chat

 

Here is the source of chat.php 


<?php
function PageMain() {
/*
* Change these 2 parameters and put your webmasterid and your chat password here
*/
$webmasterid = 'xxxxx'; // your webmasterid number
$password = 'yyyyy'; // your chat password
//

global $TMPL, $LNG, $CONF, $db, $user, $settings, $plugins;
if(!isset($user) || !isset($user['idu']) ) {
header("Location: ".$CONF['url']."/index.php?a=welcome");
}

$json = json_encode(array('id'=>$user['idu'], 'username'=>$user['username'], 'image'=>$CONF['url'].permalink('/thumb.php?t=a&w=112&h=112&src='.$user['image']),
'gender'=>($user['gender'] == 1) ? 'male' : 'female', 'role'=>'user', 'profile'=>$CONF['url']. '/profile/'.$user['username'], 'password'=>$password));
$encoded = file_get_contents("https://jwt.html5-chat.com/protect/".base64_encode($json));
ob_start();?>
<script src="https://jwt.html5-chat.com/script/<?=$webmasterid?>/<?=$encoded?>"></script>
<?php
$script = ob_get_clean();
echo $script;
exit;
}
Users

Registered and guest users together !

We have added a new mixed mode to enter the chat.
For now you could Both mode

  • guest : any one can connect to chat and only have to provide the username and the gender
  • user : before an user connects, user must register and provide his data such gender, email, password

We have now a new mode, a mixed mode, that allows to enter as user (providing registered username and password), but also as guest.

mixed mode
mixed mode

How to activate the mixed mode ?

go your chatadmin, chat config, then choose one of the 3 selections in “Enter chat mode” input select.

Note: This of course is useless if you use the jwt authentification, since in JWT, you can explicitly assign an username, gender and role.

Mobile

Html5 chat: better mobile support

For a long time, HTML5 “mobile compatible” was just a marketing directive because we did not focus enough on the mobile version and we just made mobile and responsive tests without really focusing on real user experience. That was a mistake.

It was of course compatible with mobile, but interface was not really user friendly. We believe now that mobile is future of Internet and we decided to improve the user experience with mobile devices:

  • better layout
  • keyboard auto hides after sending message
  • H264 for ios and android so both iphones and Androids are able to send streams and watch streams
  • speed optimisation
  • Many CSS fixing for readability (change size, paddings, margins)
  • Synch uploading of photos to avoid bugs on Iphone while uploading

And much more…

 

Chat HTML5 is FLEX

Why using FLEX ?

We changed the CSS layout to FLEX instead of using old layout techniques like floating, margins, paddings.

Q) What does it change for me ?

A) Nothing.


Q) So what’s the point ?

A) Using Flex layout allows us to make the layout .. more flexible


Q) I still don’t understand what’s the point !

A) It will allow many different layout like for conferences, webinars.
Ex: you want the user’s list to be on the LEFT side,  Just add 1 line of CSS  and that’s all

#chatContainer {
   order:2
}

 

if you don’t know how to change the CSS of your layout, please refer to that post

 

rest

REST API for HTML5 chat (updated)

New HTML5 features REST API available (updated Nov 2020)

These features are only for SUBSCRIBED ussers.

-> Log in into your chatadmin / developers panel to get your REST API URL.

We are adding new REST interfaces that allow users to get some informations about their chat.

The pattern is:

https://YOUR_REST_API_LINK:2083/{action}/{webmasterid}/{token}

For now we added these REST APIs:


getNumberUsers: allows to get the number of users in all rooms in chat!

This example is for : webmasterid = 1 token = 999

https://YOUR_REST_API_LINK:2083/getNumberUsers/1/999


getUsers : get all users in all rooms in chat

This example is for : webmasterid = 1 token = 999

https://YOUR_REST_API_LINK:2083/getUsers/1/999


getPerformers : get all performers in a namespace webmasterid (performers = users whose role = ‘performer’)

This example is for : webmasterid = 1 token = 999

https://YOUR_REST_API_LINK:2083/getPerformers/1/999



getOnlinePerformers : get all online performers in a namespace webmasterid (performers = users whose role = ‘performer’)

This example is for : webmasterid = 1 token = 999

https://YOUR_REST_API_LINK:2083/getOnlinePerformers /1/999


getUserStatus: get the status of userid in a namespace webmasterid  (returns: “online” or “offline”  or “busy”)

This example is for : webmasterid = 1 userid= 300

https://YOUR_REST_API_LINK:2083/getUserStatus/1/300


getUsersInRoom: get all users in a room roomid of namespace webmasterid

This example is for : webmasterid = 1 roomid = 50

https://YOUR_REST_API_LINK:2083/getUsersInRoom/1/50/token


getNumberUsersInRoom: return the number of users of a room roomid in namespace webmasterid

This example is for : webmasterid = 1 roomid = 50, token=999

https://YOUR_REST_API_LINK:2083/getNumberUsersInRoom/1/50/999


How to use that in php for instance: (we suppose your YOUR_REST_API_LINK is https://chat.html5-chat.com which can be DIFFERENT on your website: connect to chatadmin -> developers  to get yours)

$numberOfUsers = file_get_contents("https://chat.html5-chat.com:2083/getNumberUsers/1/50/999");

getRooms: return your chat rooms.

This example is for : webmasterid = 1, token=999

https://YOUR_REST_API_LINK:2083/getRooms/1/999


How to use that in php for instance: (we suppose your YOUR_REST_API_LINK is https://chat.html5-chat.com which can be DIFFERENT on your website: connect to chatadmin -> developers  to get yours)

$rooms = json_decode(file_get_contents("https://chat.html5-chat.com:2083/getRooms/1/999"));
print_r($rooms)
award

Promote users in real time and assign roles per room

Promote users in real time and assign roles per room

you can assign roles per user AND per room and you can even do that in real time and be permanent or temporary.

roles-usersWhat you need to know

  1. be sure guest users are disabled. (You cannot assign to guest users since they are temporary users !)
  2. Be sure in your role, you configure the 2 fields:
    “canPromote”: this fields gives the opportunity to that role to assign roles in real time (ex: admin and moderator can promote by default. Other roles should not be able to promote)
    “canBePromoted”: only these roles are eligible to be promoted (ex: admin user should not be promoted : it has already the highest possible rank !)
  3. You can now set a role to a specific user :
    – you can do that within your chatadmin , in users panel
    – You can do that in real time: click on user : you will get the contextual menu. Choose “Promote user” menu item.
    you will get the modal Box that allows to choose the user to be promoted and the list of available roles.promoteUser2promoteUser