External event type

This commit is contained in:
Natsumi
2023-07-29 00:52:39 +12:00
parent 0ee1ebefe2
commit 07676ecfea
6 changed files with 142 additions and 16 deletions
+48 -15
View File
@@ -6407,6 +6407,9 @@ speechSynthesis.getVoices();
case 'Event': case 'Event':
this.speak(noty.data); this.speak(noty.data);
break; break;
case 'External':
this.speak(noty.message);
break;
case 'VideoPlay': case 'VideoPlay':
this.speak(`Now playing: ${noty.notyName}`); this.speak(`Now playing: ${noty.notyName}`);
break; break;
@@ -6642,6 +6645,9 @@ speechSynthesis.getVoices();
case 'Event': case 'Event':
AppApi.XSNotification('VRCX', noty.data, timeout, image); AppApi.XSNotification('VRCX', noty.data, timeout, image);
break; break;
case 'External':
AppApi.XSNotification('VRCX', noty.message, timeout, image);
break;
case 'VideoPlay': case 'VideoPlay':
AppApi.XSNotification( AppApi.XSNotification(
'VRCX', 'VRCX',
@@ -6909,6 +6915,9 @@ speechSynthesis.getVoices();
case 'Event': case 'Event':
AppApi.DesktopNotification('Event', noty.data, image); AppApi.DesktopNotification('Event', noty.data, image);
break; break;
case 'External':
AppApi.DesktopNotification('External', noty.message, image);
break;
case 'VideoPlay': case 'VideoPlay':
AppApi.DesktopNotification('Now playing', noty.notyName, image); AppApi.DesktopNotification('Now playing', noty.notyName, image);
break; break;
@@ -9532,6 +9541,14 @@ speechSynthesis.getVoices();
return true; return true;
} }
return false; return false;
case 'External':
if (String(row.message).toUpperCase().includes(value)) {
return true;
}
if (String(row.displayName).toUpperCase().includes(value)) {
return true;
}
return false;
case 'VideoPlay': case 'VideoPlay':
if (String(row.displayName).toUpperCase().includes(value)) { if (String(row.displayName).toUpperCase().includes(value)) {
return true; return true;
@@ -14445,6 +14462,7 @@ speechSynthesis.getVoices();
'group.queueReady': 'On', 'group.queueReady': 'On',
PortalSpawn: 'Everyone', PortalSpawn: 'Everyone',
Event: 'On', Event: 'On',
External: 'On',
VideoPlay: 'Off', VideoPlay: 'Off',
BlockedOnPlayerJoined: 'Off', BlockedOnPlayerJoined: 'Off',
BlockedOnPlayerLeft: 'Off', BlockedOnPlayerLeft: 'Off',
@@ -14482,6 +14500,7 @@ speechSynthesis.getVoices();
'group.queueReady': 'On', 'group.queueReady': 'On',
PortalSpawn: 'Everyone', PortalSpawn: 'Everyone',
Event: 'On', Event: 'On',
External: 'On',
VideoPlay: 'On', VideoPlay: 'On',
BlockedOnPlayerJoined: 'Off', BlockedOnPlayerJoined: 'Off',
BlockedOnPlayerLeft: 'Off', BlockedOnPlayerLeft: 'Off',
@@ -14525,6 +14544,10 @@ speechSynthesis.getVoices();
$app.data.sharedFeedFilters.noty['group.queueReady'] = 'On'; $app.data.sharedFeedFilters.noty['group.queueReady'] = 'On';
$app.data.sharedFeedFilters.wrist['group.queueReady'] = 'On'; $app.data.sharedFeedFilters.wrist['group.queueReady'] = 'On';
} }
if (!$app.data.sharedFeedFilters.noty.External) {
$app.data.sharedFeedFilters.noty.External = 'On';
$app.data.sharedFeedFilters.wrist.External = 'On';
}
$app.data.trustColor = JSON.parse( $app.data.trustColor = JSON.parse(
configRepository.getString( configRepository.getString(
@@ -23330,7 +23353,8 @@ speechSynthesis.getVoices();
joinLeave: await database.getJoinLeaveTableSize(), joinLeave: await database.getJoinLeaveTableSize(),
portalSpawn: await database.getPortalSpawnTableSize(), portalSpawn: await database.getPortalSpawnTableSize(),
videoPlay: await database.getVideoPlayTableSize(), videoPlay: await database.getVideoPlayTableSize(),
event: await database.getEventTableSize() event: await database.getEventTableSize(),
external: await database.getExternalTableSize()
}; };
}; };
@@ -23418,14 +23442,11 @@ speechSynthesis.getVoices();
this.photonLoggingEnabled = true; this.photonLoggingEnabled = true;
configRepository.setBool('VRCX_photonLoggingEnabled', true); configRepository.setBool('VRCX_photonLoggingEnabled', true);
} }
if (!this.companionUpdateReminder && data.version < '1.1.3') {
// check version
this.promptCompanionUpdateReminder();
}
this.ipcEnabled = true; this.ipcEnabled = true;
this.ipcTimeout = 60; // 30secs this.ipcTimeout = 60; // 30secs
break; break;
case 'MsgPing': case 'MsgPing':
this.externalNotifierVersion = data.version;
break; break;
case 'LaunchCommand': case 'LaunchCommand':
AppApi.FocusWindow(); AppApi.FocusWindow();
@@ -23439,16 +23460,7 @@ speechSynthesis.getVoices();
} }
}; };
$app.data.companionUpdateReminder = false; $app.data.externalNotifierVersion = 0;
$app.methods.promptCompanionUpdateReminder = function () {
this.$alert(
'An update is required for it to function properly.',
'VRCX Companion mod is out of date'
);
this.companionUpdateReminder = true;
};
$app.data.photonEventCount = 0; $app.data.photonEventCount = 0;
$app.data.photonEventIcon = false; $app.data.photonEventIcon = false;
$app.data.customUserTags = new Map(); $app.data.customUserTags = new Map();
@@ -23493,6 +23505,13 @@ speechSynthesis.getVoices();
}); });
break; break;
case 'Noty': case 'Noty':
if (
this.photonLoggingEnabled ||
(this.externalNotifierVersion &&
this.externalNotifierVersion > 21)
) {
return;
}
var entry = { var entry = {
created_at: new Date().toJSON(), created_at: new Date().toJSON(),
type: 'Event', type: 'Event',
@@ -23502,6 +23521,20 @@ speechSynthesis.getVoices();
this.queueGameLogNoty(entry); this.queueGameLogNoty(entry);
this.addGameLog(entry); this.addGameLog(entry);
break; break;
case 'External':
var displayName = data.DisplayName ?? '';
var entry = {
created_at: new Date().toJSON(),
type: 'External',
message: data.Data,
displayName,
userId: data.UserId,
location: this.lastLocation.location
};
database.addGamelogExternalToDatabase(entry);
this.queueGameLogNoty(entry);
this.addGameLog(entry);
break;
default: default:
console.log('VRCXMessage:', data); console.log('VRCXMessage:', data);
break; break;
+10
View File
@@ -1646,6 +1646,11 @@ html
el-radio-group(v-model="sharedFeedFilters.noty.Event" size="mini") el-radio-group(v-model="sharedFeedFilters.noty.Event" size="mini")
el-radio-button(label="Off") {{ $t('dialog.shared_feed_filters.off') }} el-radio-button(label="Off") {{ $t('dialog.shared_feed_filters.off') }}
el-radio-button(label="On") {{ $t('dialog.shared_feed_filters.on') }} el-radio-button(label="On") {{ $t('dialog.shared_feed_filters.on') }}
.toggle-item
span.toggle-name External
el-radio-group(v-model="sharedFeedFilters.noty.External" size="mini")
el-radio-button(label="Off") {{ $t('dialog.shared_feed_filters.off') }}
el-radio-button(label="On") {{ $t('dialog.shared_feed_filters.on') }}
.toggle-item .toggle-item
span.toggle-name Blocked Player Joins span.toggle-name Blocked Player Joins
el-radio-group(v-model="sharedFeedFilters.noty.BlockedOnPlayerJoined" size="mini") el-radio-group(v-model="sharedFeedFilters.noty.BlockedOnPlayerJoined" size="mini")
@@ -1863,6 +1868,11 @@ html
el-radio-group(v-model="sharedFeedFilters.wrist.Event" size="mini") el-radio-group(v-model="sharedFeedFilters.wrist.Event" size="mini")
el-radio-button(label="Off") {{ $t('dialog.shared_feed_filters.off') }} el-radio-button(label="Off") {{ $t('dialog.shared_feed_filters.off') }}
el-radio-button(label="On") {{ $t('dialog.shared_feed_filters.on') }} el-radio-button(label="On") {{ $t('dialog.shared_feed_filters.on') }}
.toggle-item
span.toggle-name External
el-radio-group(v-model="sharedFeedFilters.wrist.External" size="mini")
el-radio-button(label="Off") {{ $t('dialog.shared_feed_filters.off') }}
el-radio-button(label="On") {{ $t('dialog.shared_feed_filters.on') }}
.toggle-item .toggle-item
span.toggle-name Blocked Player Joins span.toggle-name Blocked Player Joins
el-radio-group(v-model="sharedFeedFilters.wrist.BlockedOnPlayerJoined" size="mini") el-radio-group(v-model="sharedFeedFilters.wrist.BlockedOnPlayerJoined" size="mini")
+3 -1
View File
@@ -4,7 +4,7 @@ mixin gameLogTab()
template(#tool) template(#tool)
div(style="margin:0 0 10px;display:flex;align-items:center") div(style="margin:0 0 10px;display:flex;align-items:center")
el-select(v-model="gameLogTable.filter" @change="gameLogTableLookup" multiple clearable collapse-tags style="flex:1" :placeholder="$t('view.game_log.filter_placeholder')") el-select(v-model="gameLogTable.filter" @change="gameLogTableLookup" multiple clearable collapse-tags style="flex:1" :placeholder="$t('view.game_log.filter_placeholder')")
el-option(v-once v-for="type in ['Location', 'OnPlayerJoined', 'OnPlayerLeft', 'PortalSpawn', 'Event', 'VideoPlay', 'StringLoad', 'ImageLoad']" :key="type" :label="type" :value="type") el-option(v-once v-for="type in ['Location', 'OnPlayerJoined', 'OnPlayerLeft', 'PortalSpawn', 'VideoPlay', 'Event', 'External', 'StringLoad', 'ImageLoad']" :key="type" :label="type" :value="type")
el-input(v-model="gameLogTable.search" :placeholder="$t('view.game_log.search_placeholder')" @keyup.native.13="gameLogTableLookup" @change="gameLogTableLookup" clearable style="flex:none;width:150px;margin:0 10px") el-input(v-model="gameLogTable.search" :placeholder="$t('view.game_log.search_placeholder')" @keyup.native.13="gameLogTableLookup" @change="gameLogTableLookup" clearable style="flex:none;width:150px;margin:0 10px")
//- el-tooltip(placement="bottom" content="Reload game log" :disabled="hideTooltips") //- el-tooltip(placement="bottom" content="Reload game log" :disabled="hideTooltips")
//- el-button(type="default" @click="resetGameLog" icon="el-icon-refresh" circle style="flex:none") //- el-button(type="default" @click="resetGameLog" icon="el-icon-refresh" circle style="flex:none")
@@ -34,6 +34,8 @@ mixin gameLogTab()
location(v-else-if="scope.row.type === 'PortalSpawn'" :location="scope.row.instanceId" :hint="scope.row.worldName" :grouphint="scope.row.groupName") location(v-else-if="scope.row.type === 'PortalSpawn'" :location="scope.row.instanceId" :hint="scope.row.worldName" :grouphint="scope.row.groupName")
template(v-else-if="scope.row.type === 'Event'") template(v-else-if="scope.row.type === 'Event'")
span(v-text="scope.row.data") span(v-text="scope.row.data")
template(v-else-if="scope.row.type === 'External'")
span(v-text="scope.row.message")
template(v-else-if="scope.row.type === 'VideoPlay'") template(v-else-if="scope.row.type === 'VideoPlay'")
span(v-if="scope.row.videoId" style="margin-right:5px") {{ scope.row.videoId }}: span(v-if="scope.row.videoId" style="margin-right:5px") {{ scope.row.videoId }}:
span(v-if="scope.row.videoId === 'LSMedia'" v-text="scope.row.videoName") span(v-if="scope.row.videoId === 'LSMedia'" v-text="scope.row.videoName")
+68
View File
@@ -65,6 +65,9 @@ class Database {
await sqliteService.executeNonQuery( await sqliteService.executeNonQuery(
`CREATE TABLE IF NOT EXISTS gamelog_event (id INTEGER PRIMARY KEY, created_at TEXT, data TEXT, UNIQUE(created_at, data))` `CREATE TABLE IF NOT EXISTS gamelog_event (id INTEGER PRIMARY KEY, created_at TEXT, data TEXT, UNIQUE(created_at, data))`
); );
await sqliteService.executeNonQuery(
`CREATE TABLE IF NOT EXISTS gamelog_external (id INTEGER PRIMARY KEY, created_at TEXT, message TEXT, display_name TEXT, user_id TEXT, location TEXT, UNIQUE(created_at, message))`
);
await sqliteService.executeNonQuery( await sqliteService.executeNonQuery(
`CREATE TABLE IF NOT EXISTS cache_avatar (id TEXT PRIMARY KEY, added_at TEXT, author_id TEXT, author_name TEXT, created_at TEXT, description TEXT, image_url TEXT, name TEXT, release_status TEXT, thumbnail_image_url TEXT, updated_at TEXT, version INTEGER)` `CREATE TABLE IF NOT EXISTS cache_avatar (id TEXT PRIMARY KEY, added_at TEXT, author_id TEXT, author_name TEXT, created_at TEXT, description TEXT, image_url TEXT, name TEXT, release_status TEXT, thumbnail_image_url TEXT, updated_at TEXT, version INTEGER)`
); );
@@ -565,6 +568,18 @@ class Database {
}; };
gamelogDatabase.unshift(row); gamelogDatabase.unshift(row);
}, `SELECT * FROM gamelog_event WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM gamelog_event WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
created_at: dbRow[1],
type: 'External',
message: dbRow[2],
displayName: dbRow[3],
userId: dbRow[4],
location: dbRow[5]
};
gamelogDatabase.unshift(row);
}, `SELECT * FROM gamelog_external WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`);
var compareByCreatedAt = function (a, b) { var compareByCreatedAt = function (a, b) {
var A = a.created_at; var A = a.created_at;
var B = b.created_at; var B = b.created_at;
@@ -701,6 +716,19 @@ class Database {
); );
} }
addGamelogExternalToDatabase(entry) {
sqliteService.executeNonQuery(
`INSERT OR IGNORE INTO gamelog_external (created_at, message, display_name, user_id, location) VALUES (@created_at, @message, @display_name, @user_id, @location)`,
{
'@created_at': entry.created_at,
'@message': entry.message,
'@display_name': entry.displayName,
'@user_id': entry.userId,
'@location': entry.location
}
);
}
async getNotifications() { async getNotifications() {
var notifications = []; var notifications = [];
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
@@ -906,6 +934,14 @@ class Database {
return size; return size;
} }
async getExternalTableSize() {
var size = 0;
await sqliteService.execute((row) => {
size = row[0];
}, `SELECT COUNT(*) FROM gamelog_external`);
return size;
}
async getLastVisit(worldId, currentWorldMatch) { async getLastVisit(worldId, currentWorldMatch) {
if (currentWorldMatch) { if (currentWorldMatch) {
var count = 2; var count = 2;
@@ -1552,6 +1588,7 @@ class Database {
var onplayerleft = true; var onplayerleft = true;
var portalspawn = true; var portalspawn = true;
var msgevent = true; var msgevent = true;
var external = true;
var videoplay = true; var videoplay = true;
var resourceload_string = true; var resourceload_string = true;
var resourceload_image = true; var resourceload_image = true;
@@ -1561,6 +1598,7 @@ class Database {
onplayerleft = false; onplayerleft = false;
portalspawn = false; portalspawn = false;
msgevent = false; msgevent = false;
external = false;
videoplay = false; videoplay = false;
resourceload_string = false; resourceload_string = false;
resourceload_image = false; resourceload_image = false;
@@ -1581,6 +1619,9 @@ class Database {
case 'Event': case 'Event':
msgevent = true; msgevent = true;
break; break;
case 'External':
external = true;
break;
case 'VideoPlay': case 'VideoPlay':
videoplay = true; videoplay = true;
break; break;
@@ -1657,6 +1698,20 @@ class Database {
gamelogDatabase.unshift(row); gamelogDatabase.unshift(row);
}, `SELECT * FROM gamelog_event WHERE data LIKE '%${search}%' ORDER BY id DESC LIMIT ${Database.maxTableSize}`); }, `SELECT * FROM gamelog_event WHERE data LIKE '%${search}%' ORDER BY id DESC LIMIT ${Database.maxTableSize}`);
} }
if (external) {
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
created_at: dbRow[1],
type: 'External',
message: dbRow[2],
displayName: dbRow[3],
userId: dbRow[4],
location: dbRow[5]
};
gamelogDatabase.unshift(row);
}, `SELECT * FROM gamelog_external WHERE (display_name LIKE '%${search}%' OR message LIKE '%${search}%') ORDER BY id DESC LIMIT ${Database.maxTableSize}`);
}
if (videoplay) { if (videoplay) {
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
@@ -1855,6 +1910,9 @@ class Database {
case 'Event': case 'Event':
this.deleteGameLogEvent(input); this.deleteGameLogEvent(input);
break; break;
case 'External':
this.deleteGameLogExternal(input);
break;
case 'StringLoad': case 'StringLoad':
case 'ImageLoad': case 'ImageLoad':
this.deleteGameLogResourceLoad(input); this.deleteGameLogResourceLoad(input);
@@ -1883,6 +1941,16 @@ class Database {
); );
} }
deleteGameLogExternal(input) {
sqliteService.executeNonQuery(
`DELETE FROM gamelog_external WHERE created_at = @created_at AND message = @message`,
{
'@created_at': input.created_at,
'@message': input.message
}
);
}
deleteGameLogResourceLoad(input) { deleteGameLogResourceLoad(input) {
sqliteService.executeNonQuery( sqliteService.executeNonQuery(
`DELETE FROM gamelog_resource_load WHERE created_at = @created_at AND resource_url = @resource_url AND location = @location`, `DELETE FROM gamelog_resource_load WHERE created_at = @created_at AND resource_url = @resource_url AND location = @location`,
+3
View File
@@ -609,6 +609,9 @@ Vue.component('marquee-text', MarqueeText);
case 'Event': case 'Event':
text = escapeTag(noty.data); text = escapeTag(noty.data);
break; break;
case 'External':
text = escapeTag(noty.message);
break;
case 'VideoPlay': case 'VideoPlay':
text = `<strong>Now playing:</strong> ${escapeTag( text = `<strong>Now playing:</strong> ${escapeTag(
noty.notyName noty.notyName
+10
View File
@@ -175,6 +175,11 @@ html
span.extra span.extra
span.time {{ feed.created_at | formatDate }} span.time {{ feed.created_at | formatDate }}
| 🛑 #[span.name(v-text="feed.data")] | 🛑 #[span.name(v-text="feed.data")]
div(v-else-if="feed.type === 'External'" class="x-friend-item")
.detail
span.extra
span.time {{ feed.created_at | formatDate }}
| 🟠 #[span.name(v-text="feed.message")] #[span.name(v-text="feed.displayName")]
div(v-else-if="feed.type === 'BlockedOnPlayerJoined'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") div(v-else-if="feed.type === 'BlockedOnPlayerJoined'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail .detail
span.extra span.extra
@@ -381,6 +386,11 @@ html
span.extra span.extra
span.time {{ feed.created_at | formatDate }} span.time {{ feed.created_at | formatDate }}
| Event: #[span.name(v-text="feed.data")] | Event: #[span.name(v-text="feed.data")]
div(v-else-if="feed.type === 'External'" class="x-friend-item")
.detail
span.extra
span.time {{ feed.created_at | formatDate }}
| External: #[span.name(v-text="feed.message")] #[span.name(v-text="feed.displayName")]
div(v-else-if="feed.type === 'BlockedOnPlayerJoined'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") div(v-else-if="feed.type === 'BlockedOnPlayerJoined'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail .detail
span.extra span.extra