mirror of
https://github.com/matrix-construct/construct
synced 2025-04-29 13:04:17 +02:00
client: Various fixes to the client.
This commit is contained in:
parent
c9e947e66f
commit
36eb3a778d
9 changed files with 54 additions and 21 deletions
modules/static
|
@ -2117,12 +2117,11 @@ div.main div.list div.item div.head div.focus:hover.selected
|
|||
|
||||
.ircd .room div.status div.explore
|
||||
{
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.ircd .room div.status div.explore i
|
||||
{
|
||||
margin: auto;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
/* detail control bar */
|
||||
|
@ -3014,7 +3013,7 @@ div.main div.list div.item div.head div.focus:hover.selected
|
|||
{
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
flex-flow: row wrap;
|
||||
flex-flow: row nowrap;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
align-content: flex-start;
|
||||
|
|
|
@ -174,6 +174,9 @@ mc.auth["m.register.user"] = async function(opts = {})
|
|||
|
||||
mc.auth.logout = async function(opts = {})
|
||||
{
|
||||
if(!mc.instance.authentic)
|
||||
return false;
|
||||
|
||||
let request = mc.m.logout.post(opts);
|
||||
let data = await request.response;
|
||||
delete mc.session.access_token;
|
||||
|
|
|
@ -107,7 +107,7 @@ mc.date.describe.elapsed = (ms, short = false) =>
|
|||
for(let key in order)
|
||||
{
|
||||
let val = parseInt(order[key]);
|
||||
if(val <= 0)
|
||||
if(val <= 0.0001)
|
||||
continue;
|
||||
|
||||
let unit = short? key[0] : " " + key;
|
||||
|
|
|
@ -49,7 +49,7 @@ const debug =
|
|||
* @param {number} r - The current frame's recursion depth.
|
||||
* @returns {string} A string representation of the object.
|
||||
*/
|
||||
stringify(obj, r_max = 10, enumerator = Object.oeach, r = 1)
|
||||
stringify(obj, r_max = 10, enumerator = Object.aeach, r = 1)
|
||||
{
|
||||
let tabular = (r, ret = "", i = 0) =>
|
||||
{
|
||||
|
@ -111,19 +111,19 @@ const debug =
|
|||
return ret + "\n" + tabular(r - 1) + "}";
|
||||
},
|
||||
|
||||
log(func, obj, r_max = 1, enumerator = Object.oeach)
|
||||
log(func, obj, r_max = 1, enumerator = Object.aeach)
|
||||
{
|
||||
func(this.stringify(obj, r_max, enumerator));
|
||||
},
|
||||
|
||||
/** Stringify to console.log() */
|
||||
object(obj, r_max = 2, enumerator = Object.oeach)
|
||||
object(obj, r_max = 2, enumerator = Object.aeach)
|
||||
{
|
||||
this.log(console.log, obj, r_max, enumerator);
|
||||
},
|
||||
|
||||
/** Stringify to console.error() */
|
||||
error(obj, r_max = 2, enumerator = Object.oeach)
|
||||
error(obj, r_max = 2, enumerator = Object.aeach)
|
||||
{
|
||||
this.log(console.error, obj, r_max, enumerator);
|
||||
},
|
||||
|
|
|
@ -164,7 +164,11 @@ mc.io.request.constructor = function(ctx = {})
|
|||
// This should be done here for now
|
||||
this.xhr.open(this.ctx.method, this.ctx.url);
|
||||
|
||||
console.log(this.ctx.method + " " + this.ctx.resource + " " + this.ctx.url + " " + maybe(() => this.ctx.content.length) + " bytes");
|
||||
console.log(this.ctx.method
|
||||
+ " " + this.ctx.resource
|
||||
+ " " + this.ctx.url
|
||||
+ " sending " + maybe(() => this.ctx.content.length) + " bytes"
|
||||
);
|
||||
}
|
||||
|
||||
/** Construct XHR related for the request.
|
||||
|
@ -249,7 +253,13 @@ mc.io.request.destructor = function()
|
|||
let type = xhr.responseType;
|
||||
let bytes_up = this.uploaded();
|
||||
let bytes_down = this.loaded();
|
||||
console.log(xhr.status + " " + ctx.method + " " + ctx.resource + " sent:" + bytes_up + " recv:" + bytes_down + " " + type);
|
||||
console.log(xhr.status
|
||||
+ " " + ctx.method
|
||||
+ " " + ctx.resource
|
||||
+ " sent:" + bytes_up
|
||||
+ " recv:" + bytes_down
|
||||
+ " " + type
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -417,6 +427,7 @@ mc.io.request.on.readystatechange[XMLHttpRequest.OPENED] = function(event)
|
|||
|
||||
mc.io.request.on.readystatechange[XMLHttpRequest.HEADERS_RECEIVED] = function(event)
|
||||
{
|
||||
//console.log("" + xhr.getAllResponseHeaders());
|
||||
};
|
||||
|
||||
mc.io.request.on.readystatechange[XMLHttpRequest.LOADING] = function(event)
|
||||
|
@ -427,7 +438,8 @@ mc.io.request.on.readystatechange[XMLHttpRequest.DONE] = function(event)
|
|||
{
|
||||
mc.io.request.destructor.call(this);
|
||||
|
||||
switch(this.xhr.status / 100)
|
||||
let code = parseInt(this.xhr.status);
|
||||
switch(Math.floor(code / 100))
|
||||
{
|
||||
case 2: // 2xx
|
||||
return mc.io.request.success.call(this, event);
|
||||
|
@ -457,6 +469,7 @@ mc.io.request.on.progress = function(event)
|
|||
mc.io.stats.sent.msgs++;
|
||||
else
|
||||
mc.io.stats.recv.msgs++;
|
||||
|
||||
}
|
||||
|
||||
mc.io.request.on.load = function(event)
|
||||
|
|
|
@ -256,7 +256,7 @@ mc.main.on_logout = function()
|
|||
*/
|
||||
mc.main.menu =
|
||||
{
|
||||
"":
|
||||
"MENU":
|
||||
{
|
||||
icon: "fa-bars",
|
||||
target: "#charybdis_menu",
|
||||
|
|
|
@ -52,7 +52,8 @@ let client = mc;
|
|||
mc.opts =
|
||||
{
|
||||
// Base URL to use if there is no real window location (i.e browsing from file://)
|
||||
base_url: new String(window.location.origin),
|
||||
//base_url: "https://matrix.org:8448",
|
||||
base_url: String(window.location.origin),
|
||||
|
||||
// The root element for the application in the DOM.
|
||||
root: "#charybdis",
|
||||
|
|
|
@ -97,6 +97,12 @@ mc.users.learn = function(event)
|
|||
if(!user.last_active_ago || user.last_active_ago > elapsed)
|
||||
user.last_active_ago = elapsed;
|
||||
}
|
||||
|
||||
if(event.sender)
|
||||
if(event.type == "m.room.member")
|
||||
if(event.membership == "join")
|
||||
if(maybe(() => event.content.displayname))
|
||||
this.get(event.sender).displayname = event.content.displayname;
|
||||
};
|
||||
|
||||
mc.users.add = function(mxid)
|
||||
|
|
|
@ -38,7 +38,7 @@ lang="en"
|
|||
-->
|
||||
|
||||
<title>
|
||||
Charybdis 5 - Internet Relay Collaboration
|
||||
Charybdis 5 - Internet Relay Collaboration
|
||||
</title>
|
||||
</head>
|
||||
|
||||
|
@ -48,10 +48,10 @@ ng-app="ircd"
|
|||
ng-class="{ loaded: true }"
|
||||
>
|
||||
|
||||
<!-- --------------------------------------------------------------------------
|
||||
<!----------------------------------------------------------------------------
|
||||
|
||||
Charybdis 5 Client
|
||||
|
||||
|
||||
The document is specified as a set of Angular templates in <script> tags.
|
||||
These templates are composed into the document by including other templates
|
||||
in a tree. The root of the tree is the #charybdis <div> at the end of the
|
||||
|
@ -75,7 +75,7 @@ ng-class="{ loaded: true }"
|
|||
ng-foo="foo"
|
||||
>
|
||||
|
||||
--------------------------------------------------------------------------- -->
|
||||
----------------------------------------------------------------------------->
|
||||
|
||||
|
||||
<script
|
||||
|
@ -115,11 +115,11 @@ type="text/ng-template"
|
|||
</script>
|
||||
|
||||
|
||||
<!-- --------------------------------------------------------------------------
|
||||
<!----------------------------------------------------------------------------
|
||||
|
||||
Rooms
|
||||
|
||||
--------------------------------------------------------------------------- -->
|
||||
----------------------------------------------------------------------------->
|
||||
|
||||
|
||||
<script
|
||||
|
@ -1834,7 +1834,7 @@ type="text/ng-template"
|
|||
ng-click="room.toggle_explore($event);"
|
||||
>
|
||||
<i
|
||||
class="fa icon arrow"
|
||||
class="explore fa icon arrow"
|
||||
aria-hidden="true"
|
||||
ng-class="
|
||||
{
|
||||
|
@ -1955,7 +1955,18 @@ type="text/ng-template"
|
|||
{
|
||||
me: event.sender == mc.session.user_id,
|
||||
}"
|
||||
>{{ mc.m.sid(event.sender) }}</span>
|
||||
>
|
||||
<span
|
||||
ng-if="mc.users[event.sender].displayname"
|
||||
>
|
||||
{{ mc.users[event.sender].displayname }}
|
||||
</span>
|
||||
<span
|
||||
ng-if="!mc.users[event.sender].displayname"
|
||||
>
|
||||
{{ mc.m.sid(event.sender) }}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue