mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
user online/offline changes
This commit is contained in:
+29
-27
@@ -1602,6 +1602,12 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
params: {
|
||||||
|
worldId: string,
|
||||||
|
instanceId: string
|
||||||
|
}
|
||||||
|
*/
|
||||||
API.getInstance = function (params) {
|
API.getInstance = function (params) {
|
||||||
return this.call(`instances/${params.worldId}:${params.instanceId}`, {
|
return this.call(`instances/${params.worldId}:${params.instanceId}`, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@@ -5385,38 +5391,36 @@ speechSynthesis.getVoices();
|
|||||||
removeFromArray(this.friendsGroup3_, ctx);
|
removeFromArray(this.friendsGroup3_, ctx);
|
||||||
removeFromArray(this.friendsGroupD_, ctx);
|
removeFromArray(this.friendsGroupD_, ctx);
|
||||||
}
|
}
|
||||||
if (typeof ctx.ref !== 'undefined') {
|
var { location, $location_at } = ref;
|
||||||
if ((ctx.ref.$offline_for === '') &&
|
var args = await API.getUser({
|
||||||
|
userId: id
|
||||||
|
});
|
||||||
|
if ((typeof args !== 'undefined') &&
|
||||||
|
(typeof args.ref !== 'undefined')) {
|
||||||
|
state = args.ref.state;
|
||||||
|
ctx.ref = args.ref;
|
||||||
|
}
|
||||||
|
if (ctx.state !== state) {
|
||||||
|
if ((typeof ctx.ref.$offline_for !== 'undefined') &&
|
||||||
|
(ctx.ref.$offline_for === '') &&
|
||||||
((state === 'offline') || (state === 'active')) &&
|
((state === 'offline') || (state === 'active')) &&
|
||||||
(ctx.state === 'online')) {
|
(ctx.state === 'online')) {
|
||||||
ctx.ref.$online_for = '';
|
ctx.ref.$online_for = '';
|
||||||
ctx.ref.$offline_for = Date.now();
|
ctx.ref.$offline_for = Date.now();
|
||||||
if (ctx.state === 'online') {
|
if (ctx.state === 'online') {
|
||||||
var ts = Date.now();
|
var ts = Date.now();
|
||||||
var time = ts - ctx.ref.$location_at;
|
var time = ts - $location_at;
|
||||||
API.getUser({
|
|
||||||
userId: id
|
|
||||||
});
|
|
||||||
this.addFeed('Offline', ctx.ref, {
|
this.addFeed('Offline', ctx.ref, {
|
||||||
location: (ctx.ref.location === 'offline') ? '' : ctx.ref.location,
|
location: (location === 'offline') ? '' : location,
|
||||||
time: time
|
time
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
} else if (state === 'online') {
|
||||||
if (state === 'online') {
|
|
||||||
ctx.ref.$location_at = Date.now();
|
ctx.ref.$location_at = Date.now();
|
||||||
ctx.ref.$online_for = Date.now();
|
ctx.ref.$online_for = Date.now();
|
||||||
ctx.ref.$offline_for = '';
|
ctx.ref.$offline_for = '';
|
||||||
API.getUser({
|
this.addFeed('Online', ctx.ref, {
|
||||||
userId: id
|
location: ctx.ref.location
|
||||||
}).then((args) => {
|
|
||||||
this.addFeed('Online', args.ref, {
|
|
||||||
location: args.ref.location
|
|
||||||
});
|
|
||||||
}).catch(() => {
|
|
||||||
this.addFeed('Online', ctx.ref, {
|
|
||||||
location: ctx.ref.location
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5428,13 +5432,11 @@ speechSynthesis.getVoices();
|
|||||||
if (ctx.isVIP !== isVIP) {
|
if (ctx.isVIP !== isVIP) {
|
||||||
ctx.isVIP = isVIP;
|
ctx.isVIP = isVIP;
|
||||||
}
|
}
|
||||||
if (typeof ref !== 'undefined') {
|
if (ctx.ref.state === '') {
|
||||||
if (ctx.ref !== ref) {
|
ctx.ref.state = 'offline';
|
||||||
ctx.ref = ref;
|
}
|
||||||
}
|
if (ctx.name !== ctx.ref.displayName) {
|
||||||
if (ctx.name !== ref.displayName) {
|
ctx.name = ctx.ref.displayName;
|
||||||
ctx.name = ref.displayName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (ctx.state === 'online') {
|
if (ctx.state === 'online') {
|
||||||
if (ctx.isVIP) {
|
if (ctx.isVIP) {
|
||||||
|
|||||||
Reference in New Issue
Block a user