mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-22 16:23:50 +02:00
Updates and fixes
This commit is contained in:
@@ -20,7 +20,7 @@ Vue.component('marquee-text', MarqueeText);
|
||||
(async function () {
|
||||
var $app = null;
|
||||
|
||||
await CefSharp.BindObjectAsync('AppApi');
|
||||
await CefSharp.BindObjectAsync('AppApiVr');
|
||||
|
||||
Noty.overrideDefaults({
|
||||
animation: {
|
||||
@@ -50,6 +50,18 @@ Vue.component('marquee-text', MarqueeText);
|
||||
String(s).replace(/["&'<>]/gu, (c) => `&#${c.charCodeAt(0)};`);
|
||||
Vue.filter('escapeTag', escapeTag);
|
||||
|
||||
var escapeTagRecursive = (obj) => {
|
||||
if (typeof obj === 'string') {
|
||||
return escapeTag(obj);
|
||||
}
|
||||
if (typeof obj === 'object') {
|
||||
for (var key in obj) {
|
||||
obj[key] = escapeTagRecursive(obj[key]);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
|
||||
var commaNumber = (n) =>
|
||||
String(Number(n) || 0).replace(/(\d)(?=(\d{3})+(?!\d))/gu, '$1,');
|
||||
Vue.filter('commaNumber', commaNumber);
|
||||
@@ -216,10 +228,7 @@ Vue.component('marquee-text', MarqueeText);
|
||||
watch: {},
|
||||
el: '#x-app',
|
||||
mounted() {
|
||||
workerTimers.setTimeout(
|
||||
() => AppApi.ExecuteAppFunction('vrInit', ''),
|
||||
1000
|
||||
);
|
||||
workerTimers.setTimeout(() => AppApiVr.VrInit(), 1000);
|
||||
if (this.appType === '1') {
|
||||
this.updateStatsLoop();
|
||||
}
|
||||
@@ -410,7 +419,7 @@ Vue.component('marquee-text', MarqueeText);
|
||||
.replace(',', '');
|
||||
|
||||
if (!this.config.hideCpuUsageFromFeed) {
|
||||
var cpuUsage = await AppApi.CpuUsage();
|
||||
var cpuUsage = await AppApiVr.CpuUsage();
|
||||
this.cpuUsage = cpuUsage.toFixed(0);
|
||||
}
|
||||
if (this.lastLocation.date !== 0) {
|
||||
@@ -429,7 +438,7 @@ Vue.component('marquee-text', MarqueeText);
|
||||
}
|
||||
|
||||
if (!this.config.hideDevicesFromFeed) {
|
||||
AppApi.GetVRDevices().then((devices) => {
|
||||
AppApiVr.GetVRDevices().then((devices) => {
|
||||
var deviceList = [];
|
||||
var baseStations = 0;
|
||||
devices.forEach((device) => {
|
||||
@@ -480,7 +489,7 @@ Vue.component('marquee-text', MarqueeText);
|
||||
this.devices = [];
|
||||
}
|
||||
if (this.config.pcUptimeOnFeed) {
|
||||
AppApi.GetUptime().then((uptime) => {
|
||||
AppApiVr.GetUptime().then((uptime) => {
|
||||
this.pcUptime = timeToText(uptime);
|
||||
});
|
||||
} else {
|
||||
@@ -494,7 +503,12 @@ Vue.component('marquee-text', MarqueeText);
|
||||
|
||||
$app.methods.playNoty = function (json) {
|
||||
var { noty, message, image } = JSON.parse(json);
|
||||
var message = escapeTag(message);
|
||||
if (typeof noty === 'undefined') {
|
||||
console.error('noty is undefined');
|
||||
return;
|
||||
}
|
||||
var noty = escapeTagRecursive(noty);
|
||||
var message = escapeTag(message) || '';
|
||||
var text = '';
|
||||
var img = '';
|
||||
if (image) {
|
||||
@@ -515,8 +529,8 @@ Vue.component('marquee-text', MarqueeText);
|
||||
noty.displayName
|
||||
}</strong> is in ${this.displayLocation(
|
||||
noty.location,
|
||||
escapeTag(noty.worldName),
|
||||
escapeTag(noty.groupName)
|
||||
noty.worldName,
|
||||
noty.groupName
|
||||
)}`;
|
||||
break;
|
||||
case 'Online':
|
||||
@@ -524,8 +538,8 @@ Vue.component('marquee-text', MarqueeText);
|
||||
if (noty.worldName) {
|
||||
locationName = ` to ${this.displayLocation(
|
||||
noty.location,
|
||||
escapeTag(noty.worldName),
|
||||
escapeTag(noty.groupName)
|
||||
noty.worldName,
|
||||
noty.groupName
|
||||
)}`;
|
||||
}
|
||||
text = `<strong>${noty.displayName}</strong> has logged in${locationName}`;
|
||||
@@ -534,16 +548,14 @@ Vue.component('marquee-text', MarqueeText);
|
||||
text = `<strong>${noty.displayName}</strong> has logged out`;
|
||||
break;
|
||||
case 'Status':
|
||||
text = `<strong>${noty.displayName}</strong> status is now <i>${
|
||||
noty.status
|
||||
}</i> ${escapeTag(noty.statusDescription)}`;
|
||||
text = `<strong>${noty.displayName}</strong> status is now <i>${noty.status}</i> ${noty.statusDescription}`;
|
||||
break;
|
||||
case 'invite':
|
||||
text = `<strong>${
|
||||
noty.senderUsername
|
||||
}</strong> has invited you to ${this.displayLocation(
|
||||
noty.details.worldId,
|
||||
escapeTag(noty.details.worldName)
|
||||
noty.details.worldName
|
||||
)}${message}`;
|
||||
break;
|
||||
case 'requestInvite':
|
||||
@@ -571,19 +583,19 @@ Vue.component('marquee-text', MarqueeText);
|
||||
text = `<strong>${noty.previousDisplayName}</strong> changed their name to ${noty.displayName}`;
|
||||
break;
|
||||
case 'group.announcement':
|
||||
text = escapeTag(noty.message);
|
||||
text = noty.message;
|
||||
break;
|
||||
case 'group.informative':
|
||||
text = escapeTag(noty.message);
|
||||
text = noty.message;
|
||||
break;
|
||||
case 'group.invite':
|
||||
text = escapeTag(noty.message);
|
||||
text = noty.message;
|
||||
break;
|
||||
case 'group.joinRequest':
|
||||
text = escapeTag(noty.message);
|
||||
text = noty.message;
|
||||
break;
|
||||
case 'group.queueReady':
|
||||
text = escapeTag(noty.message);
|
||||
text = noty.message;
|
||||
break;
|
||||
case 'PortalSpawn':
|
||||
if (noty.displayName) {
|
||||
@@ -591,33 +603,27 @@ Vue.component('marquee-text', MarqueeText);
|
||||
noty.displayName
|
||||
}</strong> has spawned a portal to ${this.displayLocation(
|
||||
noty.instanceId,
|
||||
escapeTag(noty.worldName),
|
||||
escapeTag(noty.groupName)
|
||||
noty.worldName,
|
||||
noty.groupName
|
||||
)}`;
|
||||
} else {
|
||||
text = 'User has spawned a portal';
|
||||
}
|
||||
break;
|
||||
case 'AvatarChange':
|
||||
text = `<strong>${
|
||||
noty.displayName
|
||||
}</strong> changed into avatar ${escapeTag(noty.name)}`;
|
||||
text = `<strong>${noty.displayName}</strong> changed into avatar ${noty.name}`;
|
||||
break;
|
||||
case 'ChatBoxMessage':
|
||||
text = `<strong>${noty.displayName}</strong> said ${escapeTag(
|
||||
noty.text
|
||||
)}`;
|
||||
text = `<strong>${noty.displayName}</strong> said ${noty.text}`;
|
||||
break;
|
||||
case 'Event':
|
||||
text = escapeTag(noty.data);
|
||||
text = noty.data;
|
||||
break;
|
||||
case 'External':
|
||||
text = escapeTag(noty.message);
|
||||
text = noty.message;
|
||||
break;
|
||||
case 'VideoPlay':
|
||||
text = `<strong>Now playing:</strong> ${escapeTag(
|
||||
noty.notyName
|
||||
)}`;
|
||||
text = `<strong>Now playing:</strong> ${noty.notyName}`;
|
||||
break;
|
||||
case 'BlockedOnPlayerJoined':
|
||||
text = `Blocked user <strong>${noty.displayName}</strong> has joined`;
|
||||
@@ -766,10 +772,10 @@ Vue.component('marquee-text', MarqueeText);
|
||||
this.hudTimeout = JSON.parse(json);
|
||||
};
|
||||
|
||||
$app.data.currentCulture = await AppApi.CurrentCulture();
|
||||
$app.data.currentCulture = await AppApiVr.CurrentCulture();
|
||||
|
||||
$app.methods.setDatetimeFormat = async function () {
|
||||
this.currentCulture = await AppApi.CurrentCulture();
|
||||
this.currentCulture = await AppApiVr.CurrentCulture();
|
||||
var formatDate = function (date) {
|
||||
if (!date) {
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user