mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-17 13:53:52 +02:00
Base64 notification images
This commit is contained in:
@@ -4305,7 +4305,10 @@ speechSynthesis.getVoices();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (noty.type === 'Notification' || noty.type === 'LocationDestination') {
|
||||
if (
|
||||
noty.type === 'Notification' ||
|
||||
noty.type === 'LocationDestination'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
// remove current user
|
||||
@@ -4638,20 +4641,30 @@ speechSynthesis.getVoices();
|
||||
if (playNotificationTTS) {
|
||||
this.playNotyTTS(noty, message);
|
||||
}
|
||||
if (playOverlayNotification) {
|
||||
this.notyGetImage(noty).then((imageUrl) => {
|
||||
this.displayOverlayNotification(noty, message, imageUrl);
|
||||
});
|
||||
}
|
||||
if (playDesktopToast || playXSNotification) {
|
||||
this.notySaveImage(noty).then((image) => {
|
||||
if (playDesktopToast || playXSNotification || playOverlayNotification) {
|
||||
if (this.imageNotifications) {
|
||||
this.notySaveImage(noty).then((image) => {
|
||||
if (playXSNotification) {
|
||||
this.displayXSNotification(noty, message, image);
|
||||
}
|
||||
if (playDesktopToast) {
|
||||
this.displayDesktopToast(noty, message, image);
|
||||
}
|
||||
if (playOverlayNotification) {
|
||||
this.displayOverlayNotification(noty, message, image);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (playXSNotification) {
|
||||
this.displayXSNotification(noty, message, image);
|
||||
this.displayXSNotification(noty, message, '');
|
||||
}
|
||||
if (playDesktopToast) {
|
||||
this.displayDesktopToast(noty, message, image);
|
||||
this.displayDesktopToast(noty, message, '');
|
||||
}
|
||||
});
|
||||
if (playOverlayNotification) {
|
||||
this.displayOverlayNotification(noty, message, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4702,8 +4715,9 @@ speechSynthesis.getVoices();
|
||||
|
||||
$app.methods.notySaveImage = async function (noty) {
|
||||
var imageUrl = await this.notyGetImage(noty);
|
||||
var base64Image = '';
|
||||
try {
|
||||
await fetch(imageUrl, {
|
||||
base64Image = await fetch(imageUrl, {
|
||||
method: 'GET',
|
||||
redirect: 'follow',
|
||||
headers: {
|
||||
@@ -4718,24 +4732,18 @@ speechSynthesis.getVoices();
|
||||
for (var i = 0; i < length; i++) {
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
var imageData = btoa(binary);
|
||||
AppApi.CacheImage(imageData);
|
||||
return btoa(binary);
|
||||
});
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return false;
|
||||
}
|
||||
return base64Image;
|
||||
};
|
||||
|
||||
$app.methods.displayOverlayNotification = function (
|
||||
noty,
|
||||
message,
|
||||
imageUrl
|
||||
) {
|
||||
$app.methods.displayOverlayNotification = function (noty, message, image) {
|
||||
AppApi.ExecuteVrOverlayFunction(
|
||||
'playNoty',
|
||||
JSON.stringify({noty, message, imageUrl})
|
||||
JSON.stringify({noty, message, image})
|
||||
);
|
||||
};
|
||||
|
||||
@@ -6806,7 +6814,6 @@ speechSynthesis.getVoices();
|
||||
this.getAuth();
|
||||
|
||||
$app.updateSharedFeed(true);
|
||||
$app.notyInit = true;
|
||||
|
||||
if ($app.isGameRunning) {
|
||||
$app.loadPlayerList();
|
||||
@@ -7144,7 +7151,9 @@ speechSynthesis.getVoices();
|
||||
{
|
||||
prop: 'type',
|
||||
value: true,
|
||||
filterFn: (row) => row.type !== 'Notification' || row.type !== 'LocationDestination'
|
||||
filterFn: (row) =>
|
||||
row.type !== 'Notification' &&
|
||||
row.type !== 'LocationDestination'
|
||||
}
|
||||
],
|
||||
tableProps: {
|
||||
@@ -8602,6 +8611,9 @@ speechSynthesis.getVoices();
|
||||
$app.data.xsNotifications = configRepository.getBool(
|
||||
'VRCX_xsNotifications'
|
||||
);
|
||||
$app.data.imageNotifications = configRepository.getBool(
|
||||
'VRCX_imageNotifications'
|
||||
);
|
||||
$app.data.desktopToast = configRepository.getString('VRCX_desktopToast');
|
||||
$app.data.minimalFeed = configRepository.getBool('VRCX_minimalFeed');
|
||||
$app.data.displayVRCPlusIconsAsAvatar = configRepository.getBool(
|
||||
@@ -8640,7 +8652,7 @@ speechSynthesis.getVoices();
|
||||
'VRCX_autoUpdateVRCX'
|
||||
);
|
||||
$app.data.branch = configRepository.getString('VRCX_branch');
|
||||
var saveOpenVROption = function () {
|
||||
$app.methods.saveOpenVROption = function () {
|
||||
configRepository.setBool('openVR', this.openVR);
|
||||
configRepository.setBool('openVRAlways', this.openVRAlways);
|
||||
configRepository.setBool('VRCX_overlaybutton', this.overlaybutton);
|
||||
@@ -8658,6 +8670,10 @@ speechSynthesis.getVoices();
|
||||
);
|
||||
configRepository.setBool('VRCX_overlayWrist', this.overlayWrist);
|
||||
configRepository.setBool('VRCX_xsNotifications', this.xsNotifications);
|
||||
configRepository.setBool(
|
||||
'VRCX_imageNotifications',
|
||||
this.imageNotifications
|
||||
);
|
||||
configRepository.setString('VRCX_desktopToast', this.desktopToast);
|
||||
configRepository.setBool('VRCX_minimalFeed', this.minimalFeed);
|
||||
configRepository.setBool(
|
||||
@@ -8693,7 +8709,7 @@ speechSynthesis.getVoices();
|
||||
this.updateVRConfigVars();
|
||||
};
|
||||
$app.data.TTSvoices = speechSynthesis.getVoices();
|
||||
var saveNotificationTTS = function () {
|
||||
$app.methods.saveNotificationTTS = function () {
|
||||
speechSynthesis.cancel();
|
||||
if (
|
||||
configRepository.getString('VRCX_notificationTTS') === 'Never' &&
|
||||
@@ -8707,25 +8723,6 @@ speechSynthesis.getVoices();
|
||||
);
|
||||
this.updateVRConfigVars();
|
||||
};
|
||||
$app.watch.openVR = saveOpenVROption;
|
||||
$app.watch.openVRAlways = saveOpenVROption;
|
||||
$app.watch.overlaybutton = saveOpenVROption;
|
||||
$app.watch.hidePrivateFromFeed = saveOpenVROption;
|
||||
$app.watch.hideDevicesFromFeed = saveOpenVROption;
|
||||
$app.watch.overlayNotifications = saveOpenVROption;
|
||||
$app.watch.overlayWrist = saveOpenVROption;
|
||||
$app.watch.xsNotifications = saveOpenVROption;
|
||||
$app.watch.desktopToast = saveOpenVROption;
|
||||
$app.watch.minimalFeed = saveOpenVROption;
|
||||
$app.watch.displayVRCPlusIconsAsAvatar = saveOpenVROption;
|
||||
$app.watch.hideTooltips = saveOpenVROption;
|
||||
$app.watch.worldAutoCacheInvite = saveOpenVROption;
|
||||
$app.watch.worldAutoCacheGPS = saveOpenVROption;
|
||||
$app.watch.worldAutoCacheInviteFilter = saveOpenVROption;
|
||||
$app.watch.worldAutoCacheGPSFilter = saveOpenVROption;
|
||||
$app.watch.autoSweepVRChatCache = saveOpenVROption;
|
||||
$app.watch.vrBackgroundEnabled = saveOpenVROption;
|
||||
$app.watch.notificationTTS = saveNotificationTTS;
|
||||
$app.data.themeMode = configRepository.getString('VRCX_ThemeMode');
|
||||
if (!$app.data.themeMode) {
|
||||
$app.data.themeMode = 'system';
|
||||
@@ -9342,6 +9339,7 @@ speechSynthesis.getVoices();
|
||||
'VRCX_notificationTimeout',
|
||||
this.notificationTimeout
|
||||
);
|
||||
this.updateVRConfigVars();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -719,10 +719,10 @@ html
|
||||
el-radio-button(label="dark") Dark
|
||||
div.options-container-item
|
||||
span.name VRCPlus Profile Icons
|
||||
el-switch(v-model="displayVRCPlusIconsAsAvatar")
|
||||
el-switch(v-model="displayVRCPlusIconsAsAvatar" @change="saveOpenVROption")
|
||||
div.options-container-item
|
||||
span.name Disable Tooltips
|
||||
el-switch(v-model="hideTooltips")
|
||||
el-switch(v-model="hideTooltips" @change="saveOpenVROption")
|
||||
div.options-container
|
||||
span.header Side Panel
|
||||
br
|
||||
@@ -805,61 +805,64 @@ html
|
||||
br
|
||||
div.options-container-item
|
||||
span.name Enable
|
||||
el-switch(v-model="openVR")
|
||||
el-switch(v-model="openVR" @change="saveOpenVROption")
|
||||
div.options-container-item
|
||||
span.name Force Run (Opens SteamVR)
|
||||
el-switch(v-model="openVRAlways" :disabled="!openVR")
|
||||
el-switch(v-model="openVRAlways" @change="saveOpenVROption" :disabled="!openVR")
|
||||
div.options-container-item
|
||||
span.name Hide Private Worlds
|
||||
el-switch(v-model="hidePrivateFromFeed")
|
||||
el-switch(v-model="hidePrivateFromFeed" @change="saveOpenVROption")
|
||||
br
|
||||
span.sub-header Wrist Feed
|
||||
div.options-container-item
|
||||
span.name Wrist Feed Overlay
|
||||
el-switch(v-model="overlayWrist" :disabled="!openVR")
|
||||
el-switch(v-model="overlayWrist" @change="saveOpenVROption" :disabled="!openVR")
|
||||
div.options-container-item
|
||||
span.name(style="min-width:137px") Overlay Button
|
||||
el-switch(v-model="overlaybutton" inactive-text="Grip" active-text="Menu" :disabled="!openVR || !overlayWrist")
|
||||
el-switch(v-model="overlaybutton" @change="saveOpenVROption" inactive-text="Grip" active-text="Menu" :disabled="!openVR || !overlayWrist")
|
||||
div.options-container-item
|
||||
span.name Background Color
|
||||
el-switch(v-model="vrBackgroundEnabled" :disabled="!openVR || !overlayWrist")
|
||||
el-switch(v-model="vrBackgroundEnabled" @change="saveOpenVROption" :disabled="!openVR || !overlayWrist")
|
||||
div.options-container-item
|
||||
span.name Minimal Feed Icons
|
||||
el-switch(v-model="minimalFeed" :disabled="!openVR || !overlayWrist")
|
||||
el-switch(v-model="minimalFeed" @change="saveOpenVROption" :disabled="!openVR || !overlayWrist")
|
||||
div.options-container-item
|
||||
span.name Hide VR Devices
|
||||
el-switch(v-model="hideDevicesFromFeed" :disabled="!openVR || !overlayWrist")
|
||||
el-switch(v-model="hideDevicesFromFeed" @change="saveOpenVROption" :disabled="!openVR || !overlayWrist")
|
||||
div.options-container-item
|
||||
el-button(size="small" icon="el-icon-notebook-2" @click="showWristFeedFiltersDialog()" :disabled="!openVR || !overlayWrist") Wrist Feed Filters
|
||||
el-button(size="small" icon="el-icon-notebook-2" @click="showWristFeedFiltersDialog" :disabled="!openVR || !overlayWrist") Wrist Feed Filters
|
||||
br
|
||||
span.sub-header Notifications
|
||||
div.options-container-item
|
||||
span.name Overlay Notifications
|
||||
el-switch(v-model="overlayNotifications" :disabled="!openVR")
|
||||
el-switch(v-model="overlayNotifications" @change="saveOpenVROption" :disabled="!openVR")
|
||||
div.options-container-item
|
||||
el-button(size="small" icon="el-icon-rank" @click="showNotificationPositionDialog()" :disabled="!overlayNotifications || !openVR") Notification Position
|
||||
el-button(size="small" icon="el-icon-rank" @click="showNotificationPositionDialog" :disabled="!overlayNotifications || !openVR") Notification Position
|
||||
div.options-container-item
|
||||
span.name XSOverlay Notifications
|
||||
el-switch(v-model="xsNotifications")
|
||||
el-switch(v-model="xsNotifications" @change="saveOpenVROption")
|
||||
div.options-container-item
|
||||
el-button(size="small" icon="el-icon-time" @click="promptNotificationTimeout()" :disabled="(!overlayNotifications || !openVR) && !xsNotifications") Notification Timeout
|
||||
span.name User images (slower)
|
||||
el-switch(v-model="imageNotifications" @change="saveOpenVROption")
|
||||
div.options-container-item
|
||||
el-button(size="small" icon="el-icon-time" @click="promptNotificationTimeout" :disabled="(!overlayNotifications || !openVR) && !xsNotifications") Notification Timeout
|
||||
div.options-container-item
|
||||
span.name Desktop Notifications, When to display:
|
||||
br
|
||||
el-radio-group(v-model="desktopToast" size="mini")
|
||||
el-radio-group(v-model="desktopToast" @change="saveOpenVROption" size="mini")
|
||||
el-radio-button(label="Never")
|
||||
el-radio-button(label="Inside VR")
|
||||
el-radio-button(label="Game Closed")
|
||||
el-radio-button(label="Game Running")
|
||||
el-radio-button(label="Always")
|
||||
div.options-container-item
|
||||
el-button(size="small" icon="el-icon-chat-square" @click="showNotyFeedFiltersDialog()") Notification Filters
|
||||
el-button(size="small" icon="el-icon-chat-square" @click="showNotyFeedFiltersDialog") Notification Filters
|
||||
br
|
||||
span.sub-header Text-To-Speech Options
|
||||
div.options-container-item
|
||||
span.name Notification TTS, When to play:
|
||||
br
|
||||
el-radio-group(v-model="notificationTTS" size="mini")
|
||||
el-radio-group(v-model="notificationTTS" @change="saveNotificationTTS" size="mini")
|
||||
el-radio-button(label="Never")
|
||||
el-radio-button(label="Inside VR")
|
||||
el-radio-button(label="Game Closed")
|
||||
@@ -880,31 +883,31 @@ html
|
||||
div.options-container-item
|
||||
span.name Download on invite:
|
||||
br
|
||||
el-radio-group(v-model="worldAutoCacheInvite" size="mini")
|
||||
el-radio-group(v-model="worldAutoCacheInvite" @change="saveOpenVROption" size="mini")
|
||||
el-radio-button(label="Never")
|
||||
el-radio-button(label="Game Closed")
|
||||
el-radio-button(label="Game Running")
|
||||
el-radio-button(label="Always")
|
||||
div.options-container-item
|
||||
el-switch(v-model="worldAutoCacheInviteFilter" inactive-text="VIP" active-text="Everyone" :disabled="worldAutoCacheInvite == 'Never'")
|
||||
el-switch(v-model="worldAutoCacheInviteFilter" @change="saveOpenVROption" inactive-text="VIP" active-text="Everyone" :disabled="worldAutoCacheInvite === 'Never'")
|
||||
div.options-container-item
|
||||
span.name Download on GPS:
|
||||
br
|
||||
el-radio-group(v-model="worldAutoCacheGPS" size="mini")
|
||||
el-radio-group(v-model="worldAutoCacheGPS" @change="saveOpenVROption" size="mini")
|
||||
el-radio-button(label="Never")
|
||||
el-radio-button(label="Game Closed")
|
||||
el-radio-button(label="Game Running")
|
||||
el-radio-button(label="Always")
|
||||
div.options-container-item
|
||||
el-switch(v-model="worldAutoCacheGPSFilter" inactive-text="VIP" active-text="Everyone" :disabled="worldAutoCacheGPS == 'Never'")
|
||||
el-switch(v-model="worldAutoCacheGPSFilter" @change="saveOpenVROption" inactive-text="VIP" active-text="Everyone" :disabled="worldAutoCacheGPS === 'Never'")
|
||||
div.options-container-item
|
||||
el-button-group
|
||||
el-button(size="small" icon="el-icon-download" @click="showDownloadDialog()") Download History
|
||||
el-button(size="small" icon="el-icon-download" @click="showDownloadDialog") Download History
|
||||
br
|
||||
span.sub-header Automatically Manage Cache When Closing VRChat
|
||||
div.options-container-item
|
||||
span.name(style="min-width:300px") Auto delete old versions from cache
|
||||
el-switch(v-model="autoSweepVRChatCache")
|
||||
el-switch(v-model="autoSweepVRChatCache" @change="saveOpenVROption")
|
||||
div.options-container
|
||||
span.header Application
|
||||
div.options-container-item
|
||||
|
||||
@@ -13,6 +13,10 @@ class GameLogService {
|
||||
gameLog.worldName = args[1];
|
||||
break;
|
||||
|
||||
case 'location-destination':
|
||||
gameLog.location = args[0];
|
||||
break;
|
||||
|
||||
case 'player-joined':
|
||||
gameLog.userDisplayName = args[0];
|
||||
gameLog.userType = args[1];
|
||||
|
||||
@@ -318,11 +318,11 @@ speechSynthesis.getVoices();
|
||||
};
|
||||
|
||||
$app.methods.playNoty = function (json) {
|
||||
var {noty, message, imageUrl} = JSON.parse(json);
|
||||
var {noty, message, image} = JSON.parse(json);
|
||||
var text = '';
|
||||
var img = '';
|
||||
if (imageUrl) {
|
||||
img = `<img class="noty-img" src="${imageUrl}"></img>`;
|
||||
if (image) {
|
||||
img = `<img class="noty-img" src="data:image/png;base64, ${image}"></img>`;
|
||||
}
|
||||
switch (noty.type) {
|
||||
case 'OnPlayerJoined':
|
||||
|
||||
Reference in New Issue
Block a user