mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-17 05:43:51 +02:00
Location group name cache
This commit is contained in:
108
html/src/app.js
108
html/src/app.js
@@ -823,6 +823,10 @@ speechSynthesis.getVoices();
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
grouphint: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
link: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
@@ -884,7 +888,9 @@ speechSynthesis.getVoices();
|
||||
this.text = ref.name;
|
||||
}
|
||||
}
|
||||
if (L.groupId) {
|
||||
if (this.grouphint) {
|
||||
this.groupName = this.grouphint;
|
||||
} else if (L.groupId) {
|
||||
this.groupName = L.groupId;
|
||||
API.getCachedGroup({groupId: L.groupId}).then((args) => {
|
||||
this.groupName = args.json.name;
|
||||
@@ -946,7 +952,11 @@ speechSynthesis.getVoices();
|
||||
props: {
|
||||
locationobject: Object,
|
||||
currentuserid: String,
|
||||
worlddialogshortname: String
|
||||
worlddialogshortname: String,
|
||||
grouphint: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -954,6 +964,7 @@ speechSynthesis.getVoices();
|
||||
instanceName: this.instanceName,
|
||||
accessType: this.accessType,
|
||||
region: this.region,
|
||||
shortName: this.shortName,
|
||||
isUnlocked: this.isUnlocked,
|
||||
strict: this.strict,
|
||||
groupName: this.groupName
|
||||
@@ -965,6 +976,7 @@ speechSynthesis.getVoices();
|
||||
this.instanceName = this.locationobject.instanceName;
|
||||
this.accessType = this.locationobject.accessType;
|
||||
this.strict = this.locationobject.strict;
|
||||
this.shortName = this.locationobject.shortName;
|
||||
|
||||
this.isUnlocked = false;
|
||||
if (
|
||||
@@ -983,7 +995,9 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
|
||||
this.groupName = '';
|
||||
if (this.locationobject.groupId) {
|
||||
if (this.grouphint) {
|
||||
this.groupName = this.grouphint;
|
||||
} else if (this.locationobject.groupId) {
|
||||
this.groupName = this.locationobject.groupId;
|
||||
API.getCachedGroup({
|
||||
groupId: this.locationobject.groupId
|
||||
@@ -994,7 +1008,7 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
},
|
||||
showLaunchDialog() {
|
||||
API.$emit('SHOW_LAUNCH_DIALOG', this.location);
|
||||
API.$emit('SHOW_LAUNCH_DIALOG', this.location, this.shortName);
|
||||
},
|
||||
showGroupDialog() {
|
||||
if (!this.location) {
|
||||
@@ -4601,7 +4615,9 @@ speechSynthesis.getVoices();
|
||||
this.verifyShortName('', tag)
|
||||
);
|
||||
API.$on('SHOW_GROUP_DIALOG', (tag) => this.showGroupDialog(tag));
|
||||
API.$on('SHOW_LAUNCH_DIALOG', (tag) => this.showLaunchDialog(tag));
|
||||
API.$on('SHOW_LAUNCH_DIALOG', (tag, shortName) =>
|
||||
this.showLaunchDialog(tag, shortName)
|
||||
);
|
||||
this.updateLoop();
|
||||
this.getGameLogTable();
|
||||
this.refreshCustomCss();
|
||||
@@ -7477,6 +7493,7 @@ speechSynthesis.getVoices();
|
||||
var ts = Date.now();
|
||||
var time = ts - $location_at;
|
||||
var worldName = await this.getWorldName(location);
|
||||
var groupName = await this.getGroupName(location);
|
||||
var feed = {
|
||||
created_at: new Date().toJSON(),
|
||||
type: 'Offline',
|
||||
@@ -7484,6 +7501,7 @@ speechSynthesis.getVoices();
|
||||
displayName: newRef.displayName,
|
||||
location,
|
||||
worldName,
|
||||
groupName,
|
||||
time
|
||||
};
|
||||
this.addFeed(feed);
|
||||
@@ -7498,6 +7516,7 @@ speechSynthesis.getVoices();
|
||||
ctx.ref.$online_for = Date.now();
|
||||
ctx.ref.$offline_for = '';
|
||||
var worldName = await this.getWorldName(newRef.location);
|
||||
var groupName = await this.getGroupName(location);
|
||||
var feed = {
|
||||
created_at: new Date().toJSON(),
|
||||
type: 'Online',
|
||||
@@ -7505,6 +7524,7 @@ speechSynthesis.getVoices();
|
||||
displayName: ctx.name,
|
||||
location: newRef.location,
|
||||
worldName,
|
||||
groupName,
|
||||
time: ''
|
||||
};
|
||||
this.addFeed(feed);
|
||||
@@ -7569,6 +7589,20 @@ speechSynthesis.getVoices();
|
||||
return worldName;
|
||||
};
|
||||
|
||||
$app.methods.getGroupName = async function (location) {
|
||||
var groupName = '';
|
||||
try {
|
||||
var L = API.parseLocation(location);
|
||||
if (L.groupId) {
|
||||
var args = await API.getCachedGroup({
|
||||
groupId: L.groupId
|
||||
});
|
||||
groupName = args.ref.name;
|
||||
}
|
||||
} catch (err) {}
|
||||
return groupName;
|
||||
};
|
||||
|
||||
$app.methods.updateFriendGPS = function (userId) {
|
||||
if (!this.orderFriendsGroupGPS) {
|
||||
if (this.orderFriendsGroupPrivate || this.orderFriendsGroupStatus) {
|
||||
@@ -8291,6 +8325,7 @@ speechSynthesis.getVoices();
|
||||
ref.$location_at = Date.now() - props.location[2];
|
||||
} else {
|
||||
var worldName = await $app.getWorldName(props.location[0]);
|
||||
var groupName = await $app.getGroupName(props.location[0]);
|
||||
var feed = {
|
||||
created_at: new Date().toJSON(),
|
||||
type: 'GPS',
|
||||
@@ -8298,6 +8333,7 @@ speechSynthesis.getVoices();
|
||||
displayName: ref.displayName,
|
||||
location: props.location[0],
|
||||
worldName,
|
||||
groupName,
|
||||
previousLocation,
|
||||
time
|
||||
};
|
||||
@@ -8866,7 +8902,7 @@ speechSynthesis.getVoices();
|
||||
worldName: gameLog.worldName,
|
||||
time: 0
|
||||
};
|
||||
database.addGamelogLocationToDatabase(entry);
|
||||
this.addGamelogLocationToDatabase(entry);
|
||||
break;
|
||||
case 'player-joined':
|
||||
var joinTime = Date.parse(gameLog.dt);
|
||||
@@ -9098,6 +9134,15 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
};
|
||||
|
||||
$app.methods.addGamelogLocationToDatabase = async function (input) {
|
||||
var groupName = await this.getGroupName(input.location);
|
||||
var entry = {
|
||||
...input,
|
||||
groupName
|
||||
};
|
||||
database.addGamelogLocationToDatabase(entry);
|
||||
};
|
||||
|
||||
$app.data.lastPortalList = new Map();
|
||||
$app.data.moderationEventQueue = new Map();
|
||||
$app.data.moderationAgainstTable = [];
|
||||
@@ -16467,7 +16512,8 @@ speechSynthesis.getVoices();
|
||||
D.instanceName = D.instanceName.replace(/[^A-Za-z0-9-_]/g, '');
|
||||
tags.push(D.instanceName);
|
||||
} else {
|
||||
tags.push((99999 * Math.random() + 1).toFixed(0));
|
||||
var randValue = (99999 * Math.random() + 1).toFixed(0);
|
||||
tags.push(String(randValue).padStart(5, '0'));
|
||||
}
|
||||
if (!D.userId) {
|
||||
D.userId = API.currentUser.id;
|
||||
@@ -16478,15 +16524,14 @@ speechSynthesis.getVoices();
|
||||
tags.push(`~hidden(${userId})`);
|
||||
} else if (D.accessType === 'friends') {
|
||||
tags.push(`~friends(${userId})`);
|
||||
} else if (D.accessType === 'group') {
|
||||
tags.push(`~group(${D.groupId})`);
|
||||
} else {
|
||||
tags.push(`~private(${userId})`);
|
||||
}
|
||||
if (D.accessType === 'invite+') {
|
||||
tags.push('~canRequestInvite');
|
||||
}
|
||||
if (D.accessType === 'group') {
|
||||
tags.push(`~group(${D.groupId})`);
|
||||
}
|
||||
}
|
||||
if (D.region === 'US West') {
|
||||
tags.push(`~region(us)`);
|
||||
@@ -16497,7 +16542,7 @@ speechSynthesis.getVoices();
|
||||
} else if (D.region === 'Japan') {
|
||||
tags.push(`~region(jp)`);
|
||||
}
|
||||
if (D.accessType !== 'public') {
|
||||
if (D.accessType !== 'public' && D.accessType !== 'group') {
|
||||
tags.push(`~nonce(${uuidv4()})`);
|
||||
}
|
||||
if (D.accessType !== 'invite' && D.accessType !== 'friends') {
|
||||
@@ -21327,7 +21372,7 @@ speechSynthesis.getVoices();
|
||||
$app.data.databaseVersion = configRepository.getInt('VRCX_databaseVersion');
|
||||
|
||||
$app.methods.updateDatabaseVersion = async function () {
|
||||
var databaseVersion = 3;
|
||||
var databaseVersion = 4;
|
||||
if (this.databaseVersion !== databaseVersion) {
|
||||
console.log(
|
||||
`Updating database from ${this.databaseVersion} to ${databaseVersion}...`
|
||||
@@ -21337,6 +21382,9 @@ speechSynthesis.getVoices();
|
||||
await database.fixNegativeGPS(); // fix GPS being a negative value due to VRCX bug with traveling
|
||||
await database.fixBrokenLeaveEntries(); // fix user instance timer being higher than current user location timer
|
||||
await database.fixBrokenGroupInvites(); // fix notification v2 in wrong table
|
||||
if (this.databaseVersion && this.databaseVersion < 4) {
|
||||
await database.updateTableForGroupNames(); // alter tables to include group name
|
||||
}
|
||||
this.databaseVersion = databaseVersion;
|
||||
configRepository.setInt('VRCX_databaseVersion', databaseVersion);
|
||||
console.log('Database update complete.');
|
||||
@@ -23363,27 +23411,28 @@ speechSynthesis.getVoices();
|
||||
$app.data.loadMoreGroupMembersParams = {};
|
||||
|
||||
$app.methods.getGroupDialogGroupMembers = async function () {
|
||||
this.groupDialog.members = [];
|
||||
var D = this.groupDialog;
|
||||
D.members = [];
|
||||
this.isGroupMembersDone = false;
|
||||
this.loadMoreGroupMembersParams = {
|
||||
n: 25,
|
||||
offset: 0,
|
||||
groupId: this.groupDialog.id
|
||||
groupId: D.id
|
||||
};
|
||||
if (this.isAllowedToViewGroupMembers()) {
|
||||
if (this.hasGroupPermission(D.ref, 'group-members-viewall')) {
|
||||
// friend only group view perms only allow max n=25
|
||||
this.loadMoreGroupMembersParams.n = 100;
|
||||
}
|
||||
if (!this.groupDialog.inGroup) {
|
||||
if (!D.inGroup) {
|
||||
return;
|
||||
}
|
||||
await API.getGroupMember({
|
||||
groupId: this.groupDialog.id,
|
||||
groupId: D.id,
|
||||
userId: API.currentUser.id
|
||||
}).then((args) => {
|
||||
if (args.json) {
|
||||
args.json.user = API.currentUser;
|
||||
this.groupDialog.members.push(args.json);
|
||||
D.members.push(args.json);
|
||||
}
|
||||
return args;
|
||||
});
|
||||
@@ -23422,14 +23471,13 @@ speechSynthesis.getVoices();
|
||||
});
|
||||
};
|
||||
|
||||
$app.methods.isAllowedToViewGroupMembers = function () {
|
||||
var D = this.groupDialog;
|
||||
$app.methods.hasGroupPermission = function (ref, permission) {
|
||||
if (
|
||||
D.ref &&
|
||||
D.ref.myMember &&
|
||||
D.ref.myMember.permissions &&
|
||||
(D.ref.myMember.permissions.includes('*') ||
|
||||
D.ref.myMember.permissions.includes('group-members-viewall'))
|
||||
ref &&
|
||||
ref.myMember &&
|
||||
ref.myMember.permissions &&
|
||||
(ref.myMember.permissions.includes('*') ||
|
||||
ref.myMember.permissions.includes(permission))
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
@@ -23534,15 +23582,7 @@ speechSynthesis.getVoices();
|
||||
D.loading = true;
|
||||
API.getGroup({groupId})
|
||||
.then((args) => {
|
||||
var group = args.ref;
|
||||
if (
|
||||
group.myMember &&
|
||||
group.myMember.permissions &&
|
||||
(group.myMember.permissions.includes('*') ||
|
||||
group.myMember.permissions.includes(
|
||||
'group-invites-manage'
|
||||
))
|
||||
) {
|
||||
if (this.hasGroupPermission(args.ref, 'group-invites-manage')) {
|
||||
return args;
|
||||
}
|
||||
// not allowed to invite
|
||||
|
||||
@@ -176,7 +176,7 @@ html
|
||||
i.x-user-status(:class="statusClass(scope.row.status)")
|
||||
span(v-if="scope.row.statusDescription !== scope.row.previousStatusDescription" v-text="scope.row.statusDescription" style="margin-left:5px")
|
||||
span.x-link(v-else-if="scope.row.type === 'PortalSpawn'" @click="showWorldDialog(scope.row.location, scope.row.shortName)")
|
||||
location(:location="scope.row.location" :hint="scope.row.worldName" :link="false")
|
||||
location(:location="scope.row.location" :hint="scope.row.worldName" :grouphint="scope.row.groupName" :link="false")
|
||||
span(v-else-if="scope.row.type === 'ChatBoxMessage'" v-text="scope.row.text")
|
||||
span(v-else-if="scope.row.type === 'OnPlayerJoined'")
|
||||
span.x-link(v-text="scope.row.avatar.name" @click="showAvatarDialog(scope.row.avatar.id)")
|
||||
@@ -230,7 +230,7 @@ html
|
||||
i.x-user-status(:class="statusClass(scope.row.status)")
|
||||
span(v-if="scope.row.statusDescription !== scope.row.previousStatusDescription" v-text="scope.row.statusDescription" style="margin-left:5px")
|
||||
span.x-link(v-else-if="scope.row.type === 'PortalSpawn'" @click="showWorldDialog(scope.row.location, scope.row.shortName)")
|
||||
location(:location="scope.row.location" :hint="scope.row.worldName" :link="false")
|
||||
location(:location="scope.row.location" :hint="scope.row.worldName" :grouphint="scope.row.groupName" :link="false")
|
||||
span(v-else-if="scope.row.type === 'ChatBoxMessage'" v-text="scope.row.text")
|
||||
span(v-else-if="scope.row.type === 'OnPlayerJoined'")
|
||||
span.x-link(v-text="scope.row.avatar.name" @click="showAvatarDialog(scope.row.avatar.id)")
|
||||
@@ -328,13 +328,13 @@ html
|
||||
br
|
||||
span
|
||||
i.el-icon-right
|
||||
location(v-if="scope.row.location" :location="scope.row.location" :hint="scope.row.worldName")
|
||||
location(v-if="scope.row.location" :location="scope.row.location" :hint="scope.row.worldName" :grouphint="scope.row.groupName")
|
||||
template(v-else-if="scope.row.type === 'Offline'")
|
||||
template(v-if="scope.row.location")
|
||||
location(:location="scope.row.location" :hint="scope.row.worldName")
|
||||
location(:location="scope.row.location" :hint="scope.row.worldName" :grouphint="scope.row.groupName")
|
||||
el-tag(type="info" effect="plain" size="mini" style="margin-left:5px") {{ scope.row.time | timeToText }}
|
||||
template(v-else-if="scope.row.type === 'Online'")
|
||||
location(v-if="scope.row.location" :location="scope.row.location" :hint="scope.row.worldName")
|
||||
location(v-if="scope.row.location" :location="scope.row.location" :hint="scope.row.worldName" :grouphint="scope.row.groupName")
|
||||
template(v-else-if="scope.row.type === 'Avatar'")
|
||||
el-popover(placement="right" width="500px" trigger="click")
|
||||
img.x-link(slot="reference" v-lazy="scope.row.previousCurrentAvatarThumbnailImageUrl" style="flex:none;width:160px;height:120px;border-radius:4px")
|
||||
@@ -379,9 +379,9 @@ html
|
||||
el-table-column(label="Detail")
|
||||
template(v-once #default="scope")
|
||||
template(v-if="scope.row.type === 'GPS'")
|
||||
location(v-if="scope.row.location" :location="scope.row.location" :hint="scope.row.worldName")
|
||||
location(v-if="scope.row.location" :location="scope.row.location" :hint="scope.row.worldName" :grouphint="scope.row.groupName")
|
||||
template(v-else-if="scope.row.type === 'Offline' || scope.row.type === 'Online'")
|
||||
location(v-if="scope.row.location" :location="scope.row.location" :hint="scope.row.worldName")
|
||||
location(v-if="scope.row.location" :location="scope.row.location" :hint="scope.row.worldName" :grouphint="scope.row.groupName")
|
||||
template(v-else-if="scope.row.type === 'Status'")
|
||||
template(v-if="scope.row.statusDescription === scope.row.previousStatusDescription")
|
||||
el-tooltip(placement="top")
|
||||
@@ -441,8 +441,8 @@ html
|
||||
span.x-link(v-if="scope.row.displayName" v-text="scope.row.displayName" @click="lookupUser(scope.row)" style="padding-right:10px")
|
||||
el-table-column(label="Detail" prop="data")
|
||||
template(v-once #default="scope")
|
||||
location(v-if="scope.row.type === 'Location'" :location="scope.row.location" :hint="scope.row.worldName")
|
||||
location(v-else-if="scope.row.type === 'PortalSpawn'" :location="scope.row.instanceId" :hint="scope.row.worldName")
|
||||
location(v-if="scope.row.type === 'Location'" :location="scope.row.location" :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'")
|
||||
span(v-text="scope.row.data")
|
||||
template(v-else-if="scope.row.type === 'VideoPlay'")
|
||||
@@ -757,7 +757,7 @@ html
|
||||
template(v-once #default="scope")
|
||||
el-tooltip(v-if="scope.row.type === 'invite'" placement="top")
|
||||
template(#content)
|
||||
location(v-if="scope.row.details" :location="scope.row.details.worldId" :hint="scope.row.details.worldName" :link="false")
|
||||
location(v-if="scope.row.details" :location="scope.row.details.worldId" :hint="scope.row.details.worldName" :grouphint="scope.row.details.groupName" :link="false")
|
||||
span.x-link(v-text="scope.row.type" @click="showWorldDialog(scope.row.details.worldId)")
|
||||
template(v-else-if="scope.row.link")
|
||||
el-tooltip(placement="top" :content="scope.row.linkText" :disabled="hideTooltips")
|
||||
@@ -2304,7 +2304,7 @@ html
|
||||
span.extra {{ groupDialog.ref.myMember.joinedAt | formatDate('long') }}
|
||||
el-tab-pane(label="Members")
|
||||
template(v-if="groupDialog.visible && groupDialog.ref.membershipStatus === 'member'")
|
||||
span(v-if="isAllowedToViewGroupMembers()" style="font-weight:bold;font-size:16px") All Members
|
||||
span(v-if="hasGroupPermission(groupDialog.ref, 'group-members-viewall')" style="font-weight:bold;font-size:16px") All Members
|
||||
span(v-else style="font-weight:bold;font-size:16px") Friends Only
|
||||
br
|
||||
el-button(type="default" @click="getGroupDialogGroupMembers()" size="mini" icon="el-icon-refresh" circle)
|
||||
@@ -3310,7 +3310,7 @@ html
|
||||
span {{ scope.row.created_at | formatDate('short') }}
|
||||
el-table-column(label="World" prop="name" sortable)
|
||||
template(v-once #default="scope")
|
||||
location(:location="scope.row.location" :hint="scope.row.name")
|
||||
location(:location="scope.row.location" :hint="scope.row.worldName" :grouphint="scope.row.groupName")
|
||||
el-table-column(label="Instance Creator" prop="location" width="160")
|
||||
template(v-once #default="scope")
|
||||
display-name(:userid="scope.row.$location.userId" :location="scope.row.$location.tag" :key="previousInstancesUserDialog.forceUpdate")
|
||||
@@ -3336,7 +3336,7 @@ html
|
||||
span {{ scope.row.created_at | formatDate('short') }}
|
||||
el-table-column(label="Instance Name" prop="name")
|
||||
template(v-once #default="scope")
|
||||
location-world(:locationobject="scope.row.$location" :currentuserid="API.currentUser.id")
|
||||
location-world(:locationobject="scope.row.$location" :grouphint="scope.row.groupName" :currentuserid="API.currentUser.id")
|
||||
el-table-column(label="Instance Creator" prop="location")
|
||||
template(v-once #default="scope")
|
||||
display-name(:userid="scope.row.$location.userId" :location="scope.row.$location.tag" :key="previousInstancesWorldDialog.forceUpdate")
|
||||
|
||||
@@ -9,7 +9,7 @@ class Database {
|
||||
Database.userId = userId;
|
||||
Database.userPrefix = userId.replaceAll('-', '').replaceAll('_', '');
|
||||
await sqliteService.executeNonQuery(
|
||||
`CREATE TABLE IF NOT EXISTS ${Database.userPrefix}_feed_gps (id INTEGER PRIMARY KEY, created_at TEXT, user_id TEXT, display_name TEXT, location TEXT, world_name TEXT, previous_location TEXT, time INTEGER)`
|
||||
`CREATE TABLE IF NOT EXISTS ${Database.userPrefix}_feed_gps (id INTEGER PRIMARY KEY, created_at TEXT, user_id TEXT, display_name TEXT, location TEXT, world_name TEXT, previous_location TEXT, time INTEGER, group_name TEXT)`
|
||||
);
|
||||
await sqliteService.executeNonQuery(
|
||||
`CREATE TABLE IF NOT EXISTS ${Database.userPrefix}_feed_status (id INTEGER PRIMARY KEY, created_at TEXT, user_id TEXT, display_name TEXT, status TEXT, status_description TEXT, previous_status TEXT, previous_status_description TEXT)`
|
||||
@@ -18,7 +18,7 @@ class Database {
|
||||
`CREATE TABLE IF NOT EXISTS ${Database.userPrefix}_feed_avatar (id INTEGER PRIMARY KEY, created_at TEXT, user_id TEXT, display_name TEXT, owner_id TEXT, avatar_name TEXT, current_avatar_image_url TEXT, current_avatar_thumbnail_image_url TEXT, previous_current_avatar_image_url TEXT, previous_current_avatar_thumbnail_image_url TEXT)`
|
||||
);
|
||||
await sqliteService.executeNonQuery(
|
||||
`CREATE TABLE IF NOT EXISTS ${Database.userPrefix}_feed_online_offline (id INTEGER PRIMARY KEY, created_at TEXT, user_id TEXT, display_name TEXT, type TEXT, location TEXT, world_name TEXT, time INTEGER)`
|
||||
`CREATE TABLE IF NOT EXISTS ${Database.userPrefix}_feed_online_offline (id INTEGER PRIMARY KEY, created_at TEXT, user_id TEXT, display_name TEXT, type TEXT, location TEXT, world_name TEXT, time INTEGER, group_name TEXT)`
|
||||
);
|
||||
await sqliteService.executeNonQuery(
|
||||
`CREATE TABLE IF NOT EXISTS ${Database.userPrefix}_friend_log_current (user_id TEXT PRIMARY KEY, display_name TEXT, trust_level TEXT)`
|
||||
@@ -42,7 +42,7 @@ class Database {
|
||||
|
||||
async initTables() {
|
||||
await sqliteService.executeNonQuery(
|
||||
`CREATE TABLE IF NOT EXISTS gamelog_location (id INTEGER PRIMARY KEY, created_at TEXT, location TEXT, world_id TEXT, world_name TEXT, time INTEGER, UNIQUE(created_at, location))`
|
||||
`CREATE TABLE IF NOT EXISTS gamelog_location (id INTEGER PRIMARY KEY, created_at TEXT, location TEXT, world_id TEXT, world_name TEXT, time INTEGER, groupName TEXT, UNIQUE(created_at, location))`
|
||||
);
|
||||
await sqliteService.executeNonQuery(
|
||||
`CREATE TABLE IF NOT EXISTS gamelog_join_leave (id INTEGER PRIMARY KEY, created_at TEXT, type TEXT, display_name TEXT, location TEXT, user_id TEXT, time INTEGER, UNIQUE(created_at, type, display_name))`
|
||||
@@ -82,7 +82,8 @@ class Database {
|
||||
location: dbRow[4],
|
||||
worldName: dbRow[5],
|
||||
previousLocation: dbRow[6],
|
||||
time: dbRow[7]
|
||||
time: dbRow[7],
|
||||
groupName: dbRow[8]
|
||||
};
|
||||
feedDatabase.unshift(row);
|
||||
}, `SELECT * FROM ${Database.userPrefix}_feed_gps WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`);
|
||||
@@ -125,7 +126,8 @@ class Database {
|
||||
type: dbRow[4],
|
||||
location: dbRow[5],
|
||||
worldName: dbRow[6],
|
||||
time: dbRow[7]
|
||||
time: dbRow[7],
|
||||
groupName: dbRow[8]
|
||||
};
|
||||
feedDatabase.unshift(row);
|
||||
}, `SELECT * FROM ${Database.userPrefix}_feed_online_offline WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`);
|
||||
@@ -346,7 +348,7 @@ class Database {
|
||||
|
||||
addGPSToDatabase(entry) {
|
||||
sqliteService.executeNonQuery(
|
||||
`INSERT OR IGNORE INTO ${Database.userPrefix}_feed_gps (created_at, user_id, display_name, location, world_name, previous_location, time) VALUES (@created_at, @user_id, @display_name, @location, @world_name, @previous_location, @time)`,
|
||||
`INSERT OR IGNORE INTO ${Database.userPrefix}_feed_gps (created_at, user_id, display_name, location, world_name, previous_location, time, group_name) VALUES (@created_at, @user_id, @display_name, @location, @world_name, @previous_location, @time, @group_name)`,
|
||||
{
|
||||
'@created_at': entry.created_at,
|
||||
'@user_id': entry.userId,
|
||||
@@ -354,7 +356,8 @@ class Database {
|
||||
'@location': entry.location,
|
||||
'@world_name': entry.worldName,
|
||||
'@previous_location': entry.previousLocation,
|
||||
'@time': entry.time
|
||||
'@time': entry.time,
|
||||
'@group_name': entry.groupName
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -396,7 +399,7 @@ class Database {
|
||||
|
||||
addOnlineOfflineToDatabase(entry) {
|
||||
sqliteService.executeNonQuery(
|
||||
`INSERT OR IGNORE INTO ${Database.userPrefix}_feed_online_offline (created_at, user_id, display_name, type, location, world_name, time) VALUES (@created_at, @user_id, @display_name, @type, @location, @world_name, @time)`,
|
||||
`INSERT OR IGNORE INTO ${Database.userPrefix}_feed_online_offline (created_at, user_id, display_name, type, location, world_name, time, group_name) VALUES (@created_at, @user_id, @display_name, @type, @location, @world_name, @time, @group_name)`,
|
||||
{
|
||||
'@created_at': entry.created_at,
|
||||
'@user_id': entry.userId,
|
||||
@@ -404,7 +407,8 @@ class Database {
|
||||
'@type': entry.type,
|
||||
'@location': entry.location,
|
||||
'@world_name': entry.worldName,
|
||||
'@time': entry.time
|
||||
'@time': entry.time,
|
||||
'@group_name': entry.groupName
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -422,7 +426,8 @@ class Database {
|
||||
location: dbRow[2],
|
||||
worldId: dbRow[3],
|
||||
worldName: dbRow[4],
|
||||
time: dbRow[5]
|
||||
time: dbRow[5],
|
||||
groupName: dbRow[6]
|
||||
};
|
||||
gamelogDatabase.unshift(row);
|
||||
}, `SELECT * FROM gamelog_location WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`);
|
||||
@@ -491,13 +496,14 @@ class Database {
|
||||
|
||||
addGamelogLocationToDatabase(entry) {
|
||||
sqliteService.executeNonQuery(
|
||||
`INSERT OR IGNORE INTO gamelog_location (created_at, location, world_id, world_name, time) VALUES (@created_at, @location, @world_id, @world_name, @time)`,
|
||||
`INSERT OR IGNORE INTO gamelog_location (created_at, location, world_id, world_name, time, group_name) VALUES (@created_at, @location, @world_id, @world_name, @time, @group_name)`,
|
||||
{
|
||||
'@created_at': entry.created_at,
|
||||
'@location': entry.location,
|
||||
'@world_id': entry.worldId,
|
||||
'@world_name': entry.worldName,
|
||||
'@time': entry.time
|
||||
'@time': entry.time,
|
||||
'@group_name': entry.groupName
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1019,7 +1025,8 @@ class Database {
|
||||
location: dbRow[4],
|
||||
worldName: dbRow[5],
|
||||
previousLocation: dbRow[6],
|
||||
time: dbRow[7]
|
||||
time: dbRow[7],
|
||||
groupName: dbRow[8]
|
||||
};
|
||||
feedDatabase.unshift(row);
|
||||
}, `SELECT * FROM ${Database.userPrefix}_feed_gps WHERE (display_name LIKE '%${search}%' OR world_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${Database.maxTableSize}`);
|
||||
@@ -1076,7 +1083,8 @@ class Database {
|
||||
type: dbRow[4],
|
||||
location: dbRow[5],
|
||||
worldName: dbRow[6],
|
||||
time: dbRow[7]
|
||||
time: dbRow[7],
|
||||
groupName: dbRow[8]
|
||||
};
|
||||
feedDatabase.unshift(row);
|
||||
}, `SELECT * FROM ${Database.userPrefix}_feed_online_offline WHERE ((display_name LIKE '%${search}%' OR world_name LIKE '%${search}%') ${query}) ${vipQuery} ORDER BY id DESC LIMIT ${Database.maxTableSize}`);
|
||||
@@ -1145,7 +1153,8 @@ class Database {
|
||||
location: dbRow[2],
|
||||
worldId: dbRow[3],
|
||||
worldName: dbRow[4],
|
||||
time: dbRow[5]
|
||||
time: dbRow[5],
|
||||
groupName: dbRow[6]
|
||||
};
|
||||
gamelogDatabase.unshift(row);
|
||||
}, `SELECT * FROM gamelog_location WHERE world_name LIKE '%${search}%' ORDER BY id DESC LIMIT ${Database.maxTableSize}`);
|
||||
@@ -1336,11 +1345,12 @@ class Database {
|
||||
created_at: dbRow[0],
|
||||
location: dbRow[1],
|
||||
time,
|
||||
name: dbRow[3]
|
||||
worldName: dbRow[3],
|
||||
groupName: dbRow[4]
|
||||
};
|
||||
data.set(row.location, row);
|
||||
},
|
||||
`SELECT DISTINCT gamelog_join_leave.created_at, gamelog_join_leave.location, gamelog_join_leave.time, gamelog_location.world_name
|
||||
`SELECT DISTINCT gamelog_join_leave.created_at, gamelog_join_leave.location, gamelog_join_leave.time, gamelog_location.world_name, gamelog_location.group_name
|
||||
FROM gamelog_join_leave
|
||||
INNER JOIN gamelog_location ON gamelog_join_leave.location = gamelog_location.location
|
||||
WHERE user_id = @userId OR display_name = @displayName
|
||||
@@ -1380,11 +1390,12 @@ class Database {
|
||||
created_at: dbRow[0],
|
||||
location: dbRow[1],
|
||||
time,
|
||||
name: dbRow[3]
|
||||
worldName: dbRow[3],
|
||||
groupName: dbRow[4]
|
||||
};
|
||||
data.set(row.location, row);
|
||||
},
|
||||
`SELECT created_at, location, time, world_name
|
||||
`SELECT created_at, location, time, world_name, group_name
|
||||
FROM gamelog_location
|
||||
WHERE world_id = @worldId
|
||||
ORDER BY id DESC`,
|
||||
@@ -1762,6 +1773,22 @@ class Database {
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
async updateTableForGroupNames() {
|
||||
try {
|
||||
var tables = [];
|
||||
await sqliteService.execute((dbRow) => {
|
||||
tables.push(dbRow[0]);
|
||||
}, `SELECT name FROM sqlite_schema WHERE type='table' AND name LIKE '%_feed_gps' OR name LIKE '%_feed_online_offline' OR name = 'gamelog_location'`);
|
||||
tables.forEach((tableName) => {
|
||||
sqliteService.executeNonQuery(
|
||||
`ALTER TABLE ${tableName} ADD group_name TEXT DEFAULT ''`
|
||||
);
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var self = new Database();
|
||||
|
||||
@@ -79,19 +79,27 @@ Vue.component('marquee-text', MarqueeText);
|
||||
|
||||
Vue.component('location', {
|
||||
template:
|
||||
'<span><span style="margin-right:5px">{{ text }}</span><span class="flags" :class="region" style="display:inline-block;margin-bottom:2px"></span><i v-if="strict" class="el-icon el-icon-lock" style="display:inline-block;margin-left:5px"></i></span>',
|
||||
'<span><span style="margin-right:5px">{{ text }}</span>' +
|
||||
'<span v-if="groupName" style="margin-right:5px">{{ groupName }}</span>' +
|
||||
'<span class="flags" :class="region" style="display:inline-block;margin-bottom:2px"></span>' +
|
||||
'<i v-if="strict" class="el-icon el-icon-lock" style="display:inline-block;margin-left:5px"></i></span>',
|
||||
props: {
|
||||
location: String,
|
||||
hint: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
grouphint: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
text: this.location,
|
||||
region: this.region,
|
||||
strict: this.strict
|
||||
strict: this.strict,
|
||||
groupName: this.groupName
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -130,6 +138,7 @@ Vue.component('marquee-text', MarqueeText);
|
||||
}
|
||||
}
|
||||
this.strict = L.strict;
|
||||
this.groupName = this.grouphint;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
Reference in New Issue
Block a user