Compare commits

...

11 Commits

Author SHA1 Message Date
Sai Raj
3812f3da30
Merge pull request #2 from sairajzero/master
Group feature
Security issue fix
File sharing feature
2019-09-17 20:02:29 +05:30
sairajzero
2a642f5c29 Added File-Share feature
Users can now share files
Click on the file-share button next to message input to attach file
Files are encrypted and sign along with messages
Note: file size is not restricted, yet its advised to share only files with size <1.5MB
2019-09-16 19:34:21 +05:30
sairajzero
f083b8c313 Update gitattributes 2019-09-16 19:27:42 +05:30
sairajzero
dc8efe511a Directly unicast/broadcast the incoming websocket messages
Directly send the incoming websocket messages through unicast or broadcast
Incoming messages for unicast and broadcast are not processed inside the server
Server response speed is increased as duplicating the message is eliminated
Websocket message limit of 5000 is eliminated since the message is directly sent
2019-09-16 17:08:59 +05:30
sairajzero
eaa3470cf4 Security Fix and minor UI changes
Verify privKey of groupID when creating new group
Names and Messages are now added in textContent instead of innerHTML to prevent HTML injection
Both direct message and group message use the same IDB objectStore
Converted send message input to textarea : now users can send multi-line messages
Minor UI changes and fixes
Improved Enter Key Press :
Shift+Enter key will now insert a new line
(Enter key pressed without shift key will send message as before)
Enter key event to send message will now tigger on keydown instead of keyup
2019-09-15 19:05:50 +05:30
sairajzero
ebd532b608 Added UI for group options
Added custom checkbox list for selecting users in group options
Added buttons to invoke group options
Hover on the 'more-options' (3-dot) button in the top-right corner to view group options
Note : group options will only be displayed when user is either creator or admin of respective group
2019-09-13 01:15:49 +05:30
sairajzero
2cdca59c6f Bug fix 2019-09-10 16:04:45 +05:30
sairajzero
2dc46ff44d Added Search Contact/Group Feature
Users can now search contacts or groups using name or floID
use @floID to search contact with floID
use #floID to search group with floID
use <name> to search contact or group with <name>
2019-09-08 14:19:14 +05:30
Sai Raj
c4422be7fe
Added Admin privileges for groups
added addGroupAdmins and rmGroupAdmins
Fixed delete Group feature
Improved Signing for Group features
2019-09-08 13:08:09 +05:30
Sai Raj
e2c38c0bea
Adding some 'group' features
Added addGroupMembers, rmGroupMember, deleteGroup
2019-09-07 01:18:57 +05:30
Sai Raj
3b939d3c0b
Merge pull request #1 from sairajzero/master 2019-07-07 20:49:09 +05:30
7 changed files with 871 additions and 607 deletions

4
.gitattributes vendored
View File

@ -3,4 +3,6 @@ util/mongoose.c linguist-vendored
util/mongoose.h linguist-vendored
util/websocket_chatExample/* linguist-vendored
.gitattributes export-ignore
.gitattributes export-ignore
screenshots/* export-ignore
util/* export-ignore

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,25 @@
</head>
<body onload = "userDataStartUp();">
<body onload="userDataStartUp();">
<div id="overlay">
<div class="userChecklist-container">
<input type="text" class="grpName form-control" placeholder="Group Name">
<div class="row searchBox">
<div class="col-sm-12 searchBox-inner">
<div class="form-group has-feedback">
<input id="searchList" type="text" class="form-control" placeholder="Search">
<span class="glyphicon glyphicon-search form-control-feedback"></span>
</div>
</div>
</div>
<div id="userChecklist"></div>
<button class="ok btn btn-success">Ok</button>
<button class="cancel btn btn-default">Cancel</button>
</div>
</div>
<div class="container app">
<div class="row app-one">
@ -25,40 +43,33 @@
<div class="row heading">
<span class="name-meta"><b>FLO Whatsapp </b> </span>
<!--
<div class="col-sm-1 col-xs-1 heading-dot pull-right">
<div class="col-sm-1 col-xs-1 heading-icon pull-right">
<i class="fa fa-ellipsis-v fa-2x pull-right" aria-hidden="true" onclick="min();"></i>
</div>
-->
<div class="col-sm-2 col-xs-2 heading-compose pull-right">
<i class="fa fa-comments fa-2x pull-right" aria-hidden="true" onclick="newGroup();"></i>
<div class="col-sm-2 col-xs-2 heading-icon pull-right">
<i class="fa fa-comments fa-2x pull-right" aria-hidden="true" onclick="createGroup();"></i>
</div>
<br/>
<br />
<span class="name-meta"><i>created by Ranchimall</i></span>
</div>
<!-- Heading End -->
<!-- SearchBox -->
<!--
<div class="row searchBox">
<div class="col-sm-12 searchBox-inner">
<div class="form-group has-feedback">
<input id="searchText" type="text" class="form-control" name="searchText" placeholder="Search">
<input id="searchContact" type="text" class="form-control" placeholder="Search Contact/Group">
<span class="glyphicon glyphicon-search form-control-feedback"></span>
</div>
</div>
</div>
-->
<!-- Search Box End -->
<!-- sideBar -->
<div class="row sideBar" id="contact-display">
</div>
<div class="row sideBar">
</div>
<div class="row sideBar" id="contact-display"></div>
<!-- Sidebar End -->
</div>
<!-- Sidebar End -->
@ -70,14 +81,20 @@
<!-- Heading -->
<div class="row heading">
<div class="col-sm-8 col-xs-8 heading-name">
<span class="heading-name-meta"><span id="recipient-status">O</span> &nbsp;&nbsp;<span id="recipient-floID">Select Contact</span>
<span class="heading-name-meta"><span id="recipient-status">O</span> &nbsp;&nbsp;
<span id="recipient-floID">Select Contact</span>
</span>
</div>
<!--
<div class="col-sm-1 col-xs-1 heading-dot pull-right">
<div class="col-sm-1 col-xs-1 heading-icon pull-right dropdown" id="groupOptions">
<i class="fa fa-ellipsis-v fa-2x pull-right" aria-hidden="true"></i>
<div class="dropdown-content">
<li onclick="addGroupMembers()">Add Members</li>
<li onclick="rmGroupMembers()">Remove Members</li>
<li onclick="addGroupAdmins()">Add Admins</li>
<li onclick="rmGroupAdmins()">Remove Admins</li>
<li onclick="deleteGroup()">Delete Group</li>
</div>
</div>
-->
</div>
<!-- Heading End -->
@ -88,22 +105,32 @@
<!-- Reply Box -->
<div class="row reply">
<!--
<div class="col-sm-1 col-xs-1 reply-emojis">
<i class="fa fa-smile-o fa-2x"></i>
</div>
-->
<div class="col-sm-9 col-xs-9 reply-main">
<input class="form-control" rows="1" id="sendMsgInput" placeholder="Type message" autocomplete="off" ></input>
</div>
<!--
<div class="col-sm-1 col-xs-1 reply-recording">
<i class="fa fa-microphone fa-2x" aria-hidden="true"></i>
</div>
-->
<div class="col-sm-1 col-xs-1 reply-send" onclick = "sendMsg()">
<i class="fa fa-send fa-2x" aria-hidden="true"></i>
</div>
<form id="replyForm">
<!--
<div class="col-sm-1 col-xs-1 reply-icon">
<i class="fa fa-smile-o fa-2x"></i>
</div>
-->
<div class="col-sm-9 col-xs-9 reply-main">
<textarea class="form-control" rows="1" id="msgInput" placeholder="Type message"
autocomplete="off"></textarea>
</div>
<div class="col-sm-1 col-xs-1 reply-icon">
<label>
<i class="fa fa-file fa-2x" aria-hidden="true"></i>
<input class="attach-file" type="file" id="fileInput"><span></span>
</label>
</div>
<!--
<div class="col-sm-1 col-xs-1 reply-icon">
<i class="fa fa-microphone fa-2x" aria-hidden="true"></i>
</div>
-->
<div class="col-sm-1 col-xs-1 reply-icon" onclick="sendMsg()">
<i class="fa fa-send fa-2x" aria-hidden="true"></i>
</div>
</form>
</div>
<!-- Reply Box End -->
</div>

View File

@ -6077,3 +6077,47 @@ Bitcoin.Util = {
}
})("secp256k1");
/*
FlexSearch v0.6.22
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
//FlexSearch min mode
DEBUG = true;
'use strict';(function(I,R,v){let K;(K=v.define)&&K.amd?K([],function(){return R}):(K=v.modules)?K[I.toLowerCase()]=R:"object"===typeof exports?module.exports=R:v[I]=R})("FlexSearch",function ma(I){function v(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:na++;this.init(a,b);fa(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)});fa(this,"length",function(){return this.index.length})}function K(a,b,c,d){this.u!==this.g&&(this.o=this.o.concat(c),this.u++,
d&&this.o.length>=d&&(this.u=this.g),this.u===this.g&&(this.cache&&this.l.set(b,this.o),this.F&&this.F(this.o)));return this}function S(a){const b=B();for(const c in a)if(a.hasOwnProperty(c)){const d=a[c];b[c]=E(d)?d.slice(0):J(d)?S(d):d}return b}function W(a,b){const c=a.length,d=O(b),e=[];for(let f=0,g=0;f<c;f++){const h=a[f];if(d&&b(h)||!d&&!b[h])e[g++]=h}return e}function P(a,b,c,d,e,f,g,h,l,m){c=ha(c,g?0:e,h,f,b,l,m);let n;h&&(h=c.page,n=c.next,c=c.result);if(g)b=this.where(g,null,e,c);else{b=
c;c=this.h;e=b.length;f=Array(e);for(g=0;g<e;g++)f[g]=c[b[g]];b=f}c=b;d&&(O(d)||(L=d.split(":"),1<L.length?d=oa:(L=L[0],d=pa)),c.sort(d));c=T(h,n,c);this.cache&&this.l.set(a,c);return c}function fa(a,b,c){Object.defineProperty(a,b,{get:c})}function q(a){return new RegExp(a,"g")}function Q(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function V(a,b,c,d,e,f,g,h){if(b[c])return b[c];e=e?(h-(g||h/1.5))*f+(g||h/1.5)*e:f;b[c]=e;e>=g&&(a=a[h-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=
d);return e}function ba(a,b){if(a){const c=Object.keys(a);for(let d=0,e=c.length;d<e;d++){const f=c[d],g=a[f];if(g)for(let h=0,l=g.length;h<l;h++)if(g[h]===b){1===l?delete a[f]:g.splice(h,1);break}else J(g[h])&&ba(g[h],b)}}}function ca(a){let b="",c="";var d="";for(let e=0;e<a.length;e++){const f=a[e];if(f!==c)if(e&&"h"===f){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===c)b+=f}else b+=f;d=e===a.length-1?"":a[e+1];c=f}return b}
function qa(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function pa(a,b){a=a[L];b=b[L];return a<b?-1:a>b?1:0}function oa(a,b){const c=L.length;for(let d=0;d<c;d++)a=a[L[d]],b=b[L[d]];return a<b?-1:a>b?1:0}function T(a,b,c){return a?{page:a,next:b?""+b:null,result:c}:c}function ha(a,b,c,d,e,f,g){let h,l=[];if(!0===c){c="0";var m=""}else m=c&&c.split(":");const n=a.length;if(1<n){const y=B(),r=[];let w,x;var p=0,k;let G;var u=!0;let C,D=0,N,da,X,ea;m&&(2===m.length?(X=m,m=!1):m=ea=parseInt(m[0],10));
if(g){for(w=B();p<n;p++)if("not"===e[p])for(x=a[p],G=x.length,k=0;k<G;k++)w["@"+x[k]]=1;else da=p+1;if(H(da))return T(c,h,l);p=0}else N=M(e)&&e;let Y;for(;p<n;p++){const ra=p===(da||n)-1;if(!N||!p)if((k=N||e&&e[p])&&"and"!==k)if("or"===k)Y=!1;else continue;else Y=f=!0;x=a[p];if(G=x.length){if(u)if(C){var t=C.length;for(k=0;k<t;k++){u=C[k];var A="@"+u;g&&w[A]||(y[A]=1,f||(l[D++]=u))}C=null;u=!1}else{C=x;continue}A=!1;for(k=0;k<G;k++){t=x[k];var z="@"+t;const Z=f?y[z]||0:p;if(!(!Z&&!d||g&&w[z]||!f&&
y[z]))if(Z===p){if(ra){if(!ea||--ea<D)if(l[D++]=t,b&&D===b)return T(c,D+(m||0),l)}else y[z]=p+1;A=!0}else d&&(z=r[Z]||(r[Z]=[]),z[z.length]=t)}if(Y&&!A&&!d)break}else if(Y&&!d)return T(c,h,x)}if(C)if(p=C.length,g)for(k=m?parseInt(m,10):0;k<p;k++)a=C[k],w["@"+a]||(l[D++]=a);else l=C;if(d)for(D=l.length,X?(p=parseInt(X[0],10)+1,k=parseInt(X[1],10)+1):(p=r.length,k=0);p--;)if(t=r[p]){for(G=t.length;k<G;k++)if(d=t[k],!g||!w["@"+d])if(l[D++]=d,b&&D===b)return T(c,p+":"+k,l);k=0}}else!n||e&&"not"===e[0]||
(l=a[0],m&&(m=parseInt(m[0],10)));b&&(g=l.length,m&&m>g&&(m=0),m=m||0,h=m+b,h<g?l=l.slice(m,h):(h=0,m&&(l=l.slice(m))));return T(c,h,l)}function M(a){return"string"===typeof a}function E(a){return a.constructor===Array}function O(a){return"function"===typeof a}function J(a){return"object"===typeof a}function H(a){return"undefined"===typeof a}function ia(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=B();return b}function B(){return Object.create(null)}function sa(){let a,b;self.onmessage=function(c){if(c=
c.data)if(c.search){const d=b.search(c.content,c.threshold?{limit:c.limit,threshold:c.threshold,where:c.where}:c.limit);self.postMessage({id:a,content:c.content,limit:c.limit,result:d})}else c.add?b.add(c.id,c.content):c.update?b.update(c.id,c.content):c.remove?b.remove(c.id):c.clear?b.clear():c.info?(c=b.info(),c.worker=a,console.log(c)):c.register&&(a=c.id,c.options.cache=!1,c.options.async=!1,c.options.worker=!1,b=(new Function(c.register.substring(c.register.indexOf("{")+1,c.register.lastIndexOf("}"))))(),
b=new b(c.options))}}function ta(a,b,c,d){a=I("flexsearch","id"+a,sa,function(f){(f=f.data)&&f.result&&d(f.id,f.content,f.result,f.limit,f.where,f.cursor,f.suggest)},b);const e=ma.toString();c.id=b;a.postMessage({register:e,options:c,id:b});return a}const F={encode:"icase",f:"forward",split:/\W+/,cache:!1,async:!1,g:!1,D:!1,a:!1,b:9,threshold:0,depth:0},ja={memory:{encode:"extra",f:"strict",threshold:0,b:1},speed:{encode:"icase",f:"strict",threshold:1,b:3,depth:2},match:{encode:"extra",f:"full",threshold:1,
b:3},score:{encode:"extra",f:"strict",threshold:1,b:9,depth:4},balance:{encode:"balance",f:"strict",threshold:0,b:3,depth:3},fast:{encode:"icase",f:"strict",threshold:8,b:9,depth:1}},aa=[];let na=0;const ka={},la={};v.create=function(a,b){return new v(a,b)};v.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&aa.push(q(b),a[b]);return this};v.registerEncoder=function(a,b){U[a]=b.bind(U);return this};v.registerLanguage=function(a,b){ka[a]=b.filter;la[a]=b.stemmer;return this};v.encode=
function(a,b){return U[a](b)};v.prototype.init=function(a,b){this.v=[];if(b){var c=b.preset;a=b}else a||(a=F),c=a.preset;b={};M(a)?(b=ja[a],a={}):c&&(b=ja[c]);if(c=a.worker)if("undefined"===typeof Worker)a.worker=!1,this.m=null;else{var d=parseInt(c,10)||4;this.C=-1;this.u=0;this.o=[];this.F=null;this.m=Array(d);for(var e=0;e<d;e++)this.m[e]=ta(this.id,e,a,K.bind(this))}this.f=a.tokenize||b.f||this.f||F.f;this.split=a.split||this.split||F.split;this.D=a.rtl||this.D||F.D;this.async="undefined"===typeof Promise||
H(c=a.async)?this.async||F.async:c;this.g=H(c=a.worker)?this.g||F.g:c;this.threshold=H(c=a.threshold)?b.threshold||this.threshold||F.threshold:c;this.b=H(c=a.resolution)?c=b.b||this.b||F.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth="strict"!==this.f||H(c=a.depth)?b.depth||this.depth||F.depth:c;this.w=(c=H(c=a.encode)?b.encode||F.encode:c)&&U[c]&&U[c].bind(U)||(O(c)?c:this.w||!1);(c=a.matcher)&&this.addMatcher(c);if(c=(b=a.lang)||a.filter){M(c)&&(c=ka[c]);if(E(c)){d=this.w;e=B();for(var f=
0;f<c.length;f++){var g=d?d(c[f]):c[f];e[g]=1}c=e}this.filter=c}if(c=b||a.stemmer){var h;b=M(c)?la[c]:c;d=this.w;e=[];for(h in b)b.hasOwnProperty(h)&&(f=d?d(h):h,e.push(q(f+"($|\\W)"),d?d(b[h]):b[h]));this.stemmer=h=e}this.a=e=(c=a.doc)?S(c):this.a||F.a;this.j=ia(this.b-(this.threshold||0));this.i=B();this.c=B();if(e){this.h=B();a.doc=null;h=e.index={};b=e.keys=[];d=e.field;f=e.tag;E(e.id)||(e.id=e.id.split(":"));if(f){this.G=B();g=B();if(d)if(M(d))g[d]=a;else if(E(d))for(let l=0;l<d.length;l++)g[d[l]]=
a;else J(d)&&(g=d);E(f)||(e.tag=f=[f]);for(d=0;d<f.length;d++)this.G[f[d]]=B();this.I=f;d=g}if(d){let l;E(d)||(J(d)?(l=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)f=d[e],E(f)||(l&&(a=l[f]),b[e]=f,d[e]=f.split(":")),h[f]=new v(a),h[f].h=this.h}}this.B=!0;this.l=(this.cache=c=H(c=a.cache)?this.cache||F.cache:c)?new ua(c):!1;return this};v.prototype.encode=function(a){a&&aa.length&&(a=Q(a,aa));a&&this.v.length&&(a=Q(a,this.v));a&&this.w&&(a=this.w(a));a&&this.stemmer&&(a=Q(a,this.stemmer));
return a};v.prototype.addMatcher=function(a){const b=this.v;for(const c in a)a.hasOwnProperty(c)&&b.push(q(c),a[c]);return this};v.prototype.add=function(a,b,c,d,e){if(this.a&&J(a))return this.A("add",a,b);if(b&&M(b)&&(a||0===a)){var f="@"+a;if(this.c[f]&&!d)return this.update(a,b);if(this.g)return++this.C>=this.m.length&&(this.C=0),this.m[this.C].postMessage({add:!0,id:a,content:b}),this.c[f]=""+this.C,c&&c(),this;if(!e){if(this.async&&"function"!==typeof importScripts){let r=this;f=new Promise(function(w){setTimeout(function(){r.add(a,
b,null,d,!0);r=null;w()})});if(c)f.then(c);else return f;return this}if(c)return this.add(a,b,null,d,!0),c(),this}b=this.encode(b);if(!b.length)return this;c=this.f;e=O(c)?c(b):b.split(this.split);this.filter&&(e=W(e,this.filter));const p=B();p._ctx=B();const k=e.length,u=this.threshold,t=this.depth,A=this.b,z=this.j,y=this.D;for(let r=0;r<k;r++){var g=e[r];if(g){var h=g.length,l=(y?r+1:k-r)/k,m="";switch(c){case "reverse":case "both":for(var n=h;--n;)m=g[n]+m,V(z,p,m,a,y?1:(h-n)/h,l,u,A-1);m="";
case "forward":for(n=0;n<h;n++)m+=g[n],V(z,p,m,a,y?(n+1)/h:1,l,u,A-1);break;case "full":for(n=0;n<h;n++){const w=(y?n+1:h-n)/h;for(let x=h;x>n;x--)m=g.substring(n,x),V(z,p,m,a,w,l,u,A-1)}break;default:if(h=V(z,p,g,a,1,l,u,A-1),t&&1<k&&h>=u)for(h=p._ctx[g]||(p._ctx[g]=B()),g=this.i[g]||(this.i[g]=ia(A-(u||0))),l=r-t,m=r+t+1,0>l&&(l=0),m>k&&(m=k);l<m;l++)l!==r&&V(g,h,e[l],a,0,A-(l<r?r-l:l-r),u,A-1)}}}this.c[f]=1;this.B=!1}return this};v.prototype.A=function(a,b,c){if(E(b))for(let l=0,m=b.length;l<m;l++){if(l===
m-1)return this.A(a,b[l],c);this.A(a,b[l])}else{const l=this.a.index,m=this.a.keys;var d=this.a.tag,e=this.a.id;let n;let p;for(var f=0;f<e.length;f++)n=(n||b)[e[f]];if(d){for(e=0;e<d.length;e++){var g=d[e];var h=g.split(":");for(f=0;f<h.length;f++)p=(p||b)[h[f]];p="@"+p}h=this.G[g];h=h[p]||(h[p]=[])}if("remove"===a){delete this.h[n];for(let k=0,u=m.length;k<u;k++){if(k===u-1)return l[m[k]].remove(n,c),this;l[m[k]].remove(n)}}e=this.a.field;h&&(h[h.length]=b);this.h[n]=b;for(let k=0,u=e.length;k<
u;k++){d=e[k];let t;for(g=0;g<d.length;g++)t=(t||b)[d[g]];d=l[m[k]];g="add"===a?d.add:d.update;k===u-1?g.call(d,n,t,c):g.call(d,n,t)}}return this};v.prototype.update=function(a,b,c){if(this.a&&J(a))return this.A("update",a,b);this.c["@"+a]&&M(b)&&(this.remove(a),this.add(a,b,c,!0));return this};v.prototype.remove=function(a,b,c){if(this.a&&J(a))return this.A("remove",a,b);var d="@"+a;if(this.c[d]){if(this.g)return this.m[this.c[d]].postMessage({remove:!0,id:a}),delete this.c[d],b&&b(),this;if(!c){if(this.async&&
"function"!==typeof importScripts){let e=this;d=new Promise(function(f){setTimeout(function(){e.remove(a,null,!0);e=null;f()})});if(b)d.then(b);else return d;return this}if(b)return this.remove(a,null,!0),b(),this}for(b=0;b<this.b-(this.threshold||0);b++)ba(this.j[b],a);this.depth&&ba(this.i,a);delete this.c[d];this.B=!1}return this};let L;v.prototype.search=function(a,b,c,d){if(J(b)){if(E(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=1E3}else b&&O(b)?(c=b,b=1E3):b||0===b||(b=1E3);
let f=[],g=a;let h,l,m;if(J(a)&&!E(a)){c||(c=a.callback)&&(g.callback=null);l=a.sort;h=a.page;b=a.limit;var n=a.threshold;m=a.suggest;a=a.query}if(this.a){n=this.a.index;const y=g.where;var p=g.bool||"or",k=g.field;let r=p;let w,x;if(k)E(k)||(k=[k]);else if(E(g)){var u=g;k=[];r=[];for(var t=0;t<g.length;t++)d=g[t],e=d.bool||p,k[t]=d.field,r[t]=e,"not"===e?w=!0:"and"===e&&(x=!0)}else k=this.a.keys;p=k.length;for(t=0;t<p;t++)u&&(g=u[t]),h&&!M(g)&&(g.page=null,g.limit=0),f[t]=n[k[t]].search(g,0);if(this.g){this.F=
c;this.u=0;this.o=[];for(n=0;n<this.g;n++)this.m[n].postMessage({search:!0,limit:b,content:g});return}if(c)return c(P.call(this,a,r,f,l,b,m,y,h,x,w));if(this.async){const G=this;return new Promise(function(C){Promise.all(f).then(function(D){C(P.call(G,a,r,D,l,b,m,y,h,x,w))})})}return P.call(this,a,r,f,l,b,m,y,h,x,w)}n||(n=this.threshold||0);if(!d){if(this.async&&"function"!==typeof importScripts){let y=this;n=new Promise(function(r){setTimeout(function(){r(y.search(g,b,null,!0));y=null})});if(c)n.then(c);
else return n;return this}if(c)return c(this.search(g,b,null,!0)),this}if(!a||!M(a))return f;g=a;if(this.cache)if(this.B){if(c=this.l.get(a))return c}else this.l.clear(),this.B=!0;g=this.encode(g);if(!g.length)return f;c=this.f;c=O(c)?c(g):g.split(this.split);this.filter&&(c=W(c,this.filter));u=c.length;d=!0;e=[];const A=B();let z=0;1<u&&(this.depth&&"strict"===this.f?p=!0:c.sort(qa));if(!p||(t=this.i)){const y=this.b;for(;z<u;z++){let r=c[z];if(r){if(p){if(!k)if(t[r])k=r,A[r]=1;else if(!m)return f;
if(m&&z===u-1&&!e.length)p=!1,r=k||r,A[r]=0;else if(!k)continue}if(!A[r]){const w=[];let x=!1,G=0;const C=p?t[k]:this.j;if(C){let D;for(let N=0;N<y-n;N++)if(D=C[N]&&C[N][r])w[G++]=D,x=!0}if(x)k=r,e[e.length]=1<G?w.concat.apply([],w):w[0];else if(!m){d=!1;break}A[r]=1}}}}else d=!1;d&&(f=ha(e,b,h,m));this.cache&&this.l.set(a,f);return f};v.prototype.find=function(a,b){return this.where(a,b,1)[0]||null};v.prototype.where=function(a,b,c,d){const e=this.h,f=[];let g=0;let h;var l;let m;if(J(a)){c||(c=
b);var n=Object.keys(a);var p=n.length;h=!1;if(1===p&&"id"===n[0])return[e[a.id]];if((l=this.I)&&!d)for(var k=0;k<l.length;k++){var u=l[k],t=a[u];if(!H(t)){m=this.G[u]["@"+t];if(0===--p)return m;n.splice(n.indexOf(u),1);delete a[u];break}}l=Array(p);for(k=0;k<p;k++)l[k]=n[k].split(":")}else{if(O(a)){b=d||Object.keys(e);c=b.length;for(n=0;n<c;n++)p=e[b[n]],a(p)&&(f[g++]=p);return f}if(H(b))return[e[a]];if("id"===a)return[e[b]];n=[a];p=1;l=[a.split(":")];h=!0}d=m||d||Object.keys(e);k=d.length;for(u=
0;u<k;u++){t=m?d[u]:e[d[u]];let A=!0;for(let z=0;z<p;z++){h||(b=a[n[z]]);const y=l[z],r=y.length;let w=t;if(1<r)for(let x=0;x<r;x++)w=w[y[x]];else w=w[y[0]];if(w!==b){A=!1;break}}if(A&&(f[g++]=t,c&&g===c))break}return f};v.prototype.info=function(){if(this.g)for(let a=0;a<this.g;a++)this.m[a].postMessage({info:!0,id:this.id});else return{id:this.id,items:this.length,cache:this.cache&&this.cache.s?this.cache.s.length:!1,matcher:aa.length+(this.v?this.v.length:0),worker:this.g,threshold:this.threshold,
depth:this.depth,resolution:this.b,contextual:this.depth&&"strict"===this.f}};v.prototype.clear=function(){return this.destroy().init()};v.prototype.destroy=function(){this.cache&&(this.l.clear(),this.l=null);this.j=this.i=this.c=null;if(this.a){const a=this.a.keys;for(let b=0;b<a.length;b++)this.a.index[a[b]].destroy();this.a=this.h=null}return this};v.prototype.export=function(){let a;if(this.a){const b=this.a.keys;a=Array(b.length+1);let c=0;for(;c<b.length;c++){const d=this.a.index[b[c]];a[c]=
[d.j,d.i,Object.keys(d.c)]}a[c]=this.h}else a=[this.j,this.i,Object.keys(this.c)];return JSON.stringify(a)};v.prototype.import=function(a){a=JSON.parse(a);const b=B();if(this.a){var c=this.a.keys,d=c.length,e=a[0][2];for(var f=0;f<e.length;f++)b[e[f]]=1;for(e=0;e<d;e++)f=this.a.index[c[e]],f.j=a[e][0],f.i=a[e][1],f.c=b,f.h=a[d];this.h=a[d]}else{c=a[2];for(d=0;d<c.length;d++)b[c[d]]=1;this.j=a[0];this.i=a[1];this.c=b}};const U={icase:function(a){return a.toLowerCase()},simple:function(){const a=[q("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),
"a",q("[\u00e8\u00e9\u00ea\u00eb]"),"e",q("[\u00ec\u00ed\u00ee\u00ef]"),"i",q("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",q("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",q("[\u00fd\u0177\u00ff]"),"y",q("\u00f1"),"n",q("[\u00e7c]"),"k",q("\u00df"),"s",q(" & ")," and ",q("[-/]")," ",q("[^a-z0-9 ]"),"",q("\\s+")," "];return function(b){b=Q(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){const a=[q("ae"),"a",q("ai"),"ei",q("ay"),"ei",q("ey"),"ei",q("oe"),"o",q("ue"),"u",q("ie"),"i",q("sz"),
"s",q("zs"),"s",q("sh"),"s",q("ck"),"k",q("cc"),"k",q("th"),"t",q("dt"),"t",q("ph"),"f",q("pf"),"f",q("ou"),"o",q("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);2<b.length&&(b=Q(b,a));c||1<b.length&&(b=ca(b));return b}}(),extra:function(){const a=[q("p"),"b",q("z"),"s",q("[cgq]"),"k",q("n"),"m",q("d"),"t",q("[vw]"),"f",q("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(let c=0;c<b.length;c++){const d=b[c];1<d.length&&(b[c]=
d[0]+Q(d.substring(1),a))}b=b.join(" ");b=ca(b)}return b}}(),balance:function(){const a=[q("[-/]")," ",q("[^a-z0-9 ]"),"",q("\\s+")," "];return function(b){return ca(Q(b.toLowerCase(),a))}}()},ua=function(){function a(b){this.clear();this.H=!0!==b&&b}a.prototype.clear=function(){this.cache=B();this.count=B();this.index=B();this.s=[]};a.prototype.set=function(b,c){if(this.H&&H(this.cache[b])){let d=this.s.length;if(d===this.H){d--;const e=this.s[d];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[b]=
d;this.s[d]=b;this.count[b]=-1;this.cache[b]=c;this.get(b)}else this.cache[b]=c};a.prototype.get=function(b){const c=this.cache[b];if(this.H&&c){var d=++this.count[b];const f=this.index;let g=f[b];if(0<g){const h=this.s;for(var e=g;this.count[h[--g]]<=d&&-1!==g;);g++;if(g!==e){for(d=e;d>g;d--)e=h[d-1],h[d]=e,f[e]=d;h[g]=b;f[b]=g}}}return c};return a}();return v}(function(){const I={},R="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(v,K,S,W,P){S=R?URL.createObjectURL(new Blob(["("+
S.toString()+")()"],{type:"text/javascript"})):v+".min.js";v+="-"+K;I[v]||(I[v]=[]);I[v][P]=new Worker(S);I[v][P].onmessage=W;return I[v][P]}}()),this);

View File

@ -10,6 +10,20 @@ span {
box-sizing: border-box;
}
pre {
color: inherit;
padding: 0 !important;
margin: 0 !important;
font: inherit;
background-color: transparent;
border: 0;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;
}
body {
background: no-repeat fixed center;
background-size: cover;
@ -43,6 +57,7 @@ body {
margin: 0 !important;
height: 100%;
}
.side-one {
padding: 0;
margin: 0;
@ -68,26 +83,14 @@ body {
}
.heading {
padding: 10px 16px 10px 15px;
margin: 0 !important;
height: 60px;
width: 100%;
background-color: #eee;
z-index: 1000;
}
.heading-avatar {
padding: 0 !important;
cursor: pointer;
}
.heading-avatar-icon img {
border-radius: 50%;
height: 40px;
width: 40px;
z-index: 1;
overflow: visible;
}
.heading-name {
@ -107,42 +110,25 @@ body {
display: block;
}
#recipient-status{
#recipient-status {
border-radius: 50%;
background: none;
background: none;
height: 25px;
width: 25px;
color:white;
color: white;
}
.heading-online {
display: none;
padding: 0 5px;
font-size: 12px;
color: #93918f;
}
.heading-compose {
.heading-icon {
padding: 0;
}
.heading-compose i {
.heading-icon i {
text-align: center;
padding: 5px;
color: #93918f;
cursor: pointer;
}
.heading-dot {
padding: 0;
margin-left: 10px;
}
.heading-dot i {
text-align: right;
padding: 5px;
color: #93918f;
cursor: pointer;
}
.searchBox {
padding: 0 !important;
margin: 0 !important;
@ -157,7 +143,6 @@ body {
background-color: #fbfbfb;
}
/*#searchBox-inner input {
box-shadow: none;
}*/
@ -190,17 +175,6 @@ body {
background-color: #f2f2f2;
}
.sideBar-avatar {
text-align: center;
padding: 0 !important;
}
.avatar-icon img {
border-radius: 50%;
height: 49px;
width: 49px;
}
.sideBar-main {
padding: 0 !important;
}
@ -244,6 +218,7 @@ body {
position: relative;
left: -100%;
}
.newMessage-heading {
padding: 10px 16px 10px 15px !important;
margin: 0 !important;
@ -268,6 +243,7 @@ body {
font-weight: 700;
padding: 10px 5px !important;
}
.newMessage-back {
text-align: center;
vertical-align: baseline;
@ -275,6 +251,7 @@ body {
display: block;
cursor: pointer;
}
.newMessage-back i {
margin: auto !important;
}
@ -328,29 +305,13 @@ body {
border: 1px solid #f7f7f7;
height: calc(100% - 120px);
}
.message-inner{
overflow-y: auto;
}
.message-previous {
margin : 0 !important;
padding: 0 !important;
height: auto;
width: 100%;
}
.previous {
font-size: 15px;
text-align: center;
padding: 10px !important;
cursor: pointer;
}
.previous a {
text-decoration: none;
font-weight: 700;
.message-inner {
overflow-y: auto;
}
.message-body {
margin: 0 !important;
margin: 5px 0px !important;
padding: 0 !important;
width: auto;
height: auto;
@ -358,48 +319,51 @@ body {
.message-main-receiver {
/*padding: 10px 20px;*/
max-width: 60%;
max-width: 80%;
height: auto;
}
.message-main-sender {
padding: 3px 20px !important;
margin-left: 40% !important;
max-width: 60%;
margin-left: 20% !important;
max-width: 80%;
height: auto;
}
.message-text {
margin: 0 !important;
padding: 5px !important;
word-wrap:break-word;
padding: 0px !important;
font-weight: 200;
font-size: 14px;
padding-bottom: 0 !important;
height: auto;
word-break: break-word;
}
.message-text i {
border: 0.5px solid rgba(0, 0, 0, 0.3);
border-radius: 5px;
background-color: rgba(0, 0, 0, 0.1);
padding: 5px;
display: block;
cursor: pointer;
}
.message-time {
margin: 0 !important;
margin-left: 50px !important;
font-size: 12px;
text-align: right;
color: #9a9a9a;
height: auto;
}
.receiver {
float: left;
width: auto !important;
padding: 4px 10px 7px !important;
padding: 5px 10px 2px !important;
border-radius: 10px 10px 10px 0;
background: #ffffff;
font-size: 12px;
word-wrap: break-word;
display: inline-block;
height: auto;
}
.sender {
@ -408,13 +372,10 @@ body {
height: auto;
background: #dcf8c6;
border-radius: 10px 10px 0 10px;
padding: 4px 10px 7px !important;
padding: 5px 10px 2px !important;
font-size: 12px;
display: inline-block;
word-wrap: break-word;
}
/*Reply*/
.reply {
@ -426,33 +387,12 @@ body {
z-index: 1000;
}
.reply-emojis {
.reply-icon {
padding: 5px !important;
overflow: visible;
}
.reply-emojis i {
text-align: center;
padding: 5px 5px 5px 5px !important;
color: #93918f;
cursor: pointer;
}
.reply-recording {
padding: 5px !important;
}
.reply-recording i {
text-align: center;
padding: 5px !important;
color: #93918f;
cursor: pointer;
}
.reply-send {
padding: 5px !important;
}
.reply-send i {
.reply-icon i {
text-align: center;
padding: 5px !important;
color: #93918f;
@ -463,7 +403,7 @@ body {
padding: 2px 5px !important;
}
.reply-main input {
.reply-main textarea {
width: 100%;
resize: none;
overflow: hidden;
@ -476,126 +416,108 @@ body {
font-size: 16px;
}
.reply-main input:focus {
.reply-main textarea:focus {
outline: none;
border: none;
text-indent: 5px;
box-shadow: none;
}
@media screen and (max-width: 700px) {
.app {
top: 0;
height: 100%;
}
.heading {
height: 70px;
background-color: #009688;
}
.fa-2x {
font-size: 2.3em !important;
}
.heading-avatar {
padding: 0 !important;
}
.heading-avatar-icon img {
height: 50px;
width: 50px;
}
.heading-compose {
padding: 5px !important;
}
.heading-compose i {
color: #fff;
cursor: pointer;
}
.heading-dot {
padding: 5px !important;
margin-left: 10px !important;
}
.heading-dot i {
color: #fff;
cursor: pointer;
}
.sideBar {
height: calc(100% - 130px);
}
.sideBar-body {
height: 80px;
}
.sideBar-avatar {
text-align: left;
padding: 0 8px !important;
}
.avatar-icon img {
height: 55px;
width: 55px;
}
.sideBar-main {
padding: 0 !important;
}
.sideBar-main .row {
padding: 0 !important;
margin: 0 !important;
}
.sideBar-name {
padding: 10px 5px !important;
}
.name-meta {
font-size: 16px;
padding: 5% !important;
}
.sideBar-time {
padding: 10px !important;
}
.time-meta {
text-align: right;
font-size: 14px;
padding: 4% !important;
color: rgba(0, 0, 0, .4);
vertical-align: baseline;
}
/*Conversation*/
.conversation {
padding: 0 !important;
margin: 0 !important;
height: 100%;
/*width: 100%;*/
border-left: 1px solid rgba(0, 0, 0, .08);
/*overflow-y: auto;*/
}
.message {
height: calc(100% - 140px);
}
.reply {
height: 70px;
}
.reply-emojis {
padding: 5px 0 !important;
}
.reply-emojis i {
padding: 5px 2px !important;
font-size: 1.8em !important;
}
.reply-main {
padding: 2px 8px !important;
}
.reply-main input {
padding: 8px !important;
font-size: 18px;
}
.reply-recording {
padding: 5px 0 !important;
}
.reply-recording i {
padding: 5px 0 !important;
font-size: 1.8em !important;
}
.reply-send {
padding: 5px 0 !important;
}
.reply-send i {
padding: 5px 2px 5px 0 !important;
font-size: 1.8em !important;
}
.badgebox {
opacity: 0;
}
.badgebox+.badge {
height: 14px;
width: 20px;
font-size: 0px;
padding: 2px;
float: right;
}
.badgebox:focus+.badge {
box-shadow: inset 0px 0px 3px;
}
.badgebox:checked+.badge {
font-size: inherit;
}
.listLabel {
margin: 5px;
text-align: left;
line-height: 50%;
padding: 10px;
display: block;
}
#overlay {
width: 100%;
height: 100%;
text-align: center;
position: fixed;
top: 0;
z-index: 2;
background-color: rgba(0, 0, 0, .5);
display: none;
}
.userChecklist-container {
margin-top: 25px;
padding: 5px;
width: 325px;
height: auto;
background-color: #eee;
display: inline-block;
}
#userChecklist {
height: 275px;
overflow-y: scroll;
}
.dropdown-content {
display: none;
position: absolute;
min-width: 150px;
z-index: 1;
cursor: pointer;
margin-left: -100px;
overflow: inherit;
}
.dropdown-content li {
color: rgb(95, 95, 95);
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: right;
background-color: #ddd;
}
.dropdown-content li:hover {
background-color: #aaa;
}
.dropdown:hover .dropdown-content {
display: block;
}
#groupOptions {
display: none;
overflow: visible;
}
input.attach-file {
display: none;
}
input.attach-file+span {
color: #93918f;
font-size: 10px;
}
.hidden {
display: none;
}

Binary file not shown.

View File

@ -22,23 +22,15 @@ static int is_websocket(const struct mg_connection *nc) {
static void broadcast(struct mg_connection *nc, const struct mg_str msg) {
struct mg_connection *c;
char buf[500];
snprintf(buf, sizeof(buf), "%.*s", (int) msg.len, msg.p);
printf("%s\n", buf); /* Local echo. */
for (c = mg_next(nc->mgr, NULL); c != NULL; c = mg_next(nc->mgr, c)) {
if (c == nc) continue; /* Don't send to the sender. */
mg_send_websocket_frame(c, WEBSOCKET_OP_TEXT, buf, strlen(buf));
mg_send_websocket_frame(c, WEBSOCKET_OP_TEXT, msg.p, msg.len);
}
}
static void unicast(struct mg_connection *nc,const struct mg_str msg) {
char buf[5000];
snprintf(buf, sizeof(buf), "%.*s", (int) msg.len, msg.p);
printf("%s\n", buf); /* Local echo. */
if(nc != NULL)
mg_send_websocket_frame(nc, WEBSOCKET_OP_TEXT, buf, strlen(buf));
mg_send_websocket_frame(nc, WEBSOCKET_OP_TEXT, msg.p, msg.len);
else
printf("No selfClient is connected!\n");
@ -115,7 +107,7 @@ int main(int argc, char** argv) {
nc = mg_bind(&mgr, s_http_port, ev_handler);
mg_set_protocol_http_websocket(nc);
s_http_server_opts.document_root = "app"; // Serve current directory
s_http_server_opts.document_root = "."; // Serve current directory
s_http_server_opts.enable_directory_listing = "no";
printf("Started on port %s\n", s_http_port);