mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-25 01:33:51 +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', {
|
Vue.component('instance-info', {
|
||||||
template:
|
template:
|
||||||
'<div style="display:inline-block;margin-left:5px">' +
|
'<div style="display:inline-block;margin-left:5px">' +
|
||||||
@@ -10897,6 +10930,7 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'location':
|
case 'location':
|
||||||
|
this.addInstanceJoinHistory(this.lastLocation, gameLog.dt);
|
||||||
var worldName = this.replaceBioSymbols(gameLog.worldName);
|
var worldName = this.replaceBioSymbols(gameLog.worldName);
|
||||||
if (this.isGameRunning) {
|
if (this.isGameRunning) {
|
||||||
this.lastLocationReset(gameLog.dt);
|
this.lastLocationReset(gameLog.dt);
|
||||||
@@ -10916,6 +10950,7 @@ speechSynthesis.getVoices();
|
|||||||
this.applyWorldDialogInstances();
|
this.applyWorldDialogInstances();
|
||||||
this.applyGroupDialogInstances();
|
this.applyGroupDialogInstances();
|
||||||
}
|
}
|
||||||
|
this.addInstanceJoinHistory(gameLog.location, gameLog.dt);
|
||||||
var L = API.parseLocation(gameLog.location);
|
var L = API.parseLocation(gameLog.location);
|
||||||
var entry = {
|
var entry = {
|
||||||
created_at: gameLog.dt,
|
created_at: gameLog.dt,
|
||||||
@@ -32919,6 +32954,34 @@ speechSynthesis.getVoices();
|
|||||||
|
|
||||||
// #endregion
|
// #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);
|
$app = new Vue($app);
|
||||||
window.$app = $app;
|
window.$app = $app;
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -332,6 +332,7 @@ html
|
|||||||
invite-yourself(:location="userDialog.$location.tag" :shortname="userDialog.$location.shortName" style="margin-left:5px")
|
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-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)
|
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")
|
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")
|
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")
|
.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")
|
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-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)
|
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")
|
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-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")
|
.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")
|
invite-yourself(:location="room.tag" style="margin-left:5px")
|
||||||
el-tooltip(placement="top" content="Refresh player count" :disabled="hideTooltips")
|
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)
|
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")
|
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-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")
|
.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_queue": "Queue:",
|
||||||
"instance_users": "Users:",
|
"instance_users": "Users:",
|
||||||
"instance_game_version": "Game Version:",
|
"instance_game_version": "Game Version:",
|
||||||
|
"last_join": "Last Join:",
|
||||||
"instance_queuing_enabled": "Queuing Enabled",
|
"instance_queuing_enabled": "Queuing Enabled",
|
||||||
"instance_creator": "Instance Creator",
|
"instance_creator": "Instance Creator",
|
||||||
"note": "Note",
|
"note": "Note",
|
||||||
|
|||||||
@@ -2530,6 +2530,25 @@ class Database {
|
|||||||
async setWal() {
|
async setWal() {
|
||||||
await sqliteService.executeNonQuery('PRAGMA journal_mode=WAL');
|
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();
|
var self = new Database();
|
||||||
|
|||||||
Reference in New Issue
Block a user