mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-12 11:23:52 +02:00
Last time joined instance timer
This commit is contained in:
@@ -1101,6 +1101,39 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
});
|
||||
|
||||
Vue.component('last-join', {
|
||||
template:
|
||||
'<span>' +
|
||||
'<el-tooltip placement="top" style="margin-left:5px" v-if="lastJoin">' +
|
||||
'<div slot="content">' +
|
||||
'<span>{{ $t("dialog.user.info.last_join") }} <timer :epoch="lastJoin"></timer></span>' +
|
||||
'</div>' +
|
||||
'<i v-if="lastJoin" class="el-icon el-icon-location-outline" style="display:inline-block"></i>' +
|
||||
'</el-tooltip>' +
|
||||
'</span>',
|
||||
props: {
|
||||
location: String
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
lastJoin: this.lastJoin
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
parse() {
|
||||
this.lastJoin = $app.instanceJoinHistory.get(this.location);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
locationobject() {
|
||||
this.parse();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.parse();
|
||||
}
|
||||
});
|
||||
|
||||
Vue.component('instance-info', {
|
||||
template:
|
||||
'<div style="display:inline-block;margin-left:5px">' +
|
||||
@@ -10897,6 +10930,7 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
break;
|
||||
case 'location':
|
||||
this.addInstanceJoinHistory(this.lastLocation, gameLog.dt);
|
||||
var worldName = this.replaceBioSymbols(gameLog.worldName);
|
||||
if (this.isGameRunning) {
|
||||
this.lastLocationReset(gameLog.dt);
|
||||
@@ -10916,6 +10950,7 @@ speechSynthesis.getVoices();
|
||||
this.applyWorldDialogInstances();
|
||||
this.applyGroupDialogInstances();
|
||||
}
|
||||
this.addInstanceJoinHistory(gameLog.location, gameLog.dt);
|
||||
var L = API.parseLocation(gameLog.location);
|
||||
var entry = {
|
||||
created_at: gameLog.dt,
|
||||
@@ -32919,6 +32954,34 @@ speechSynthesis.getVoices();
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region instance join history
|
||||
|
||||
$app.data.instanceJoinHistory = new Map();
|
||||
|
||||
API.$on('LOGIN', function () {
|
||||
$app.instanceJoinHistory = new Map();
|
||||
$app.getInstanceJoinHistory();
|
||||
});
|
||||
|
||||
$app.methods.getInstanceJoinHistory = async function () {
|
||||
this.instanceJoinHistory = await database.getInstanceJoinHistory();
|
||||
};
|
||||
|
||||
$app.methods.addInstanceJoinHistory = function (location, dateTime) {
|
||||
if (!location || !dateTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.instanceJoinHistory.has(location)) {
|
||||
this.instanceJoinHistory.delete(location);
|
||||
}
|
||||
|
||||
var epoch = new Date(dateTime).getTime();
|
||||
this.instanceJoinHistory.set(location, epoch);
|
||||
};
|
||||
|
||||
// #endregion
|
||||
|
||||
$app = new Vue($app);
|
||||
window.$app = $app;
|
||||
})();
|
||||
|
||||
@@ -332,6 +332,7 @@ html
|
||||
invite-yourself(:location="userDialog.$location.tag" :shortname="userDialog.$location.shortName" style="margin-left:5px")
|
||||
el-tooltip(placement="top" :content="$t('dialog.user.info.refresh_instance_info')" :disabled="hideTooltips")
|
||||
el-button(@click="refreshInstancePlayerCount(userDialog.$location.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle)
|
||||
last-join(:location="userDialog.$location.tag")
|
||||
instance-info(:location="userDialog.$location.tag" :instance="userDialog.instance.ref" :friendcount="userDialog.instance.friendCount" :updateelement="updateInstanceInfo")
|
||||
location(:location="userDialog.ref.location" :traveling="userDialog.ref.travelingToLocation" style="display:block;margin-top:5px")
|
||||
.x-friend-list(style="flex:1;margin-top:10px;max-height:150px")
|
||||
@@ -707,6 +708,7 @@ html
|
||||
invite-yourself(:location="room.$location.tag" :shortname="room.$location.shortName" style="margin-left:5px")
|
||||
el-tooltip(placement="top" :content="$t('dialog.world.instances.refresh_instance_info')" :disabled="hideTooltips")
|
||||
el-button(@click="refreshInstancePlayerCount(room.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle)
|
||||
last-join(:location="room.$location.tag")
|
||||
instance-info(:location="room.tag" :instance="room.ref" :friendcount="room.friendCount" :updateelement="updateInstanceInfo")
|
||||
.x-friend-list(style="margin:10px 0;max-height:unset" v-if="room.$location.userId || room.users.length")
|
||||
.x-friend-item(v-if="room.$location.userId" @click="showUserDialog(room.$location.userId)" class="x-friend-item-border")
|
||||
@@ -1053,6 +1055,7 @@ html
|
||||
invite-yourself(:location="room.tag" style="margin-left:5px")
|
||||
el-tooltip(placement="top" content="Refresh player count" :disabled="hideTooltips")
|
||||
el-button(@click="refreshInstancePlayerCount(room.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle)
|
||||
last-join(:location="room.tag")
|
||||
instance-info(:location="room.tag" :instance="room.ref" :friendcount="room.friendCount" :updateelement="updateInstanceInfo")
|
||||
.x-friend-list(style="margin:10px 0;padding:0;max-height:unset" v-if="room.users.length")
|
||||
.x-friend-item(v-for="user in room.users" :key="user.id" @click="showUserDialog(user.id)" class="x-friend-item-border")
|
||||
|
||||
@@ -597,6 +597,7 @@
|
||||
"instance_queue": "Queue:",
|
||||
"instance_users": "Users:",
|
||||
"instance_game_version": "Game Version:",
|
||||
"last_join": "Last Join:",
|
||||
"instance_queuing_enabled": "Queuing Enabled",
|
||||
"instance_creator": "Instance Creator",
|
||||
"note": "Note",
|
||||
|
||||
@@ -2530,6 +2530,25 @@ class Database {
|
||||
async setWal() {
|
||||
await sqliteService.executeNonQuery('PRAGMA journal_mode=WAL');
|
||||
}
|
||||
|
||||
async getInstanceJoinHistory() {
|
||||
var oneWeekAgo = new Date(Date.now() - 604800000).toJSON();
|
||||
var instances = new Map();
|
||||
await sqliteService.execute(
|
||||
(row) => {
|
||||
if (!instances.has(row[1])) {
|
||||
var epoch = new Date(row[0]).getTime();
|
||||
instances.set(row[1], epoch);
|
||||
}
|
||||
},
|
||||
`SELECT created_at, location FROM gamelog_join_leave WHERE user_id = @userId AND created_at > @created_at ORDER BY created_at DESC`,
|
||||
{
|
||||
'@userId': Database.userId,
|
||||
'@created_at': oneWeekAgo
|
||||
}
|
||||
);
|
||||
return instances;
|
||||
}
|
||||
}
|
||||
|
||||
var self = new Database();
|
||||
|
||||
Reference in New Issue
Block a user