Rewrite shared feed

This commit is contained in:
Natsumi
2026-01-17 11:44:09 +13:00
parent 56bf69f64e
commit 9f80d5e64a
22 changed files with 534 additions and 841 deletions

View File

@@ -174,15 +174,11 @@
groupName.value = props.grouphint;
} else if (L.groupId) {
groupName.value = L.groupId;
getGroupName(instanceId)
.then((name) => {
if (!isDisposed && name && currentInstanceId() === L.tag) {
groupName.value = name;
}
})
.catch((e) => {
console.error(e);
});
getGroupName(instanceId).then((name) => {
if (!isDisposed && name && currentInstanceId() === L.tag) {
groupName.value = name;
}
});
}
region.value = '';
if (!L.isOffline && !L.isPrivate && !L.isTraveling) {
@@ -217,19 +213,15 @@
}
const ref = cachedWorlds.get(L.worldId);
if (typeof ref === 'undefined') {
getWorldName(L.worldId)
.then((name) => {
if (!isDisposed && name && currentInstanceId() === L.tag) {
if (L.instanceId) {
text.value = `${name} · ${translateAccessType(L.accessTypeName)}`;
} else {
text.value = name;
}
getWorldName(L.worldId).then((name) => {
if (!isDisposed && name && currentInstanceId() === L.tag) {
if (L.instanceId) {
text.value = `${name} · ${translateAccessType(L.accessTypeName)}`;
} else {
text.value = name;
}
})
.catch((e) => {
console.error(e);
});
}
});
} else if (L.instanceId) {
text.value = `${ref.name} · ${accessTypeLabel}`;
} else {

View File

@@ -84,15 +84,11 @@
groupName.value = props.grouphint;
} else if (locObj.groupId) {
groupName.value = locObj.groupId;
getGroupName(locObj.groupId)
.then((name) => {
if (name && props.locationobject.tag === locObj.tag) {
groupName.value = name;
}
})
.catch((e) => {
console.error(e);
});
getGroupName(locObj.groupId).then((name) => {
if (name && props.locationobject.tag === locObj.tag) {
groupName.value = name;
}
});
} else {
groupName.value = '';
}

View File

@@ -177,7 +177,12 @@ const feed = {
);
},
async lookupFeedDatabase(search, filters, vipList) {
async lookupFeedDatabase(
search,
filters,
vipList,
maxEntries = dbVars.maxTableSize
) {
search = search.replaceAll("'", "''");
if (search.startsWith('wrld_') || search.startsWith('grp_')) {
return this.getFeedByInstanceId(search, filters, vipList);
@@ -247,7 +252,7 @@ const feed = {
groupName: dbRow[8]
};
feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_gps WHERE (display_name LIKE '%${search}%' OR world_name LIKE '%${search}%' OR group_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_gps WHERE (display_name LIKE '%${search}%' OR world_name LIKE '%${search}%' OR group_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${maxEntries}`);
}
if (status) {
await sqliteService.execute((dbRow) => {
@@ -263,7 +268,7 @@ const feed = {
previousStatusDescription: dbRow[7]
};
feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_status WHERE (display_name LIKE '%${search}%' OR status LIKE '%${search}%' OR status_description LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_status WHERE (display_name LIKE '%${search}%' OR status LIKE '%${search}%' OR status_description LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${maxEntries}`);
}
if (bio) {
await sqliteService.execute((dbRow) => {
@@ -277,7 +282,7 @@ const feed = {
previousBio: dbRow[5]
};
feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_bio WHERE (display_name LIKE '%${search}%' OR bio LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_bio WHERE (display_name LIKE '%${search}%' OR bio LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${maxEntries}`);
}
if (avatar) {
var avatarQuery = '';
@@ -301,7 +306,7 @@ const feed = {
previousCurrentAvatarThumbnailImageUrl: dbRow[9]
};
feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_avatar WHERE ((display_name LIKE '%${search}%' OR avatar_name LIKE '%${search}%') ${avatarQuery}) ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_avatar WHERE ((display_name LIKE '%${search}%' OR avatar_name LIKE '%${search}%') ${avatarQuery}) ${vipQuery} ORDER BY id DESC LIMIT ${maxEntries}`);
}
if (online || offline) {
var query = '';
@@ -325,7 +330,7 @@ const feed = {
groupName: dbRow[8]
};
feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_online_offline WHERE ((display_name LIKE '%${search}%' OR world_name LIKE '%${search}%' OR group_name LIKE '%${search}%') ${query}) ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_online_offline WHERE ((display_name LIKE '%${search}%' OR world_name LIKE '%${search}%' OR group_name LIKE '%${search}%') ${query}) ${vipQuery} ORDER BY id DESC LIMIT ${maxEntries}`);
}
var compareByCreatedAt = function (a, b) {
var A = a.created_at;
@@ -339,8 +344,8 @@ const feed = {
return 0;
};
feedDatabase.sort(compareByCreatedAt);
if (feedDatabase.length > dbVars.maxTableSize) {
feedDatabase.splice(0, feedDatabase.length - dbVars.maxTableSize);
if (feedDatabase.length > maxEntries) {
feedDatabase.splice(0, feedDatabase.length - maxEntries);
}
return feedDatabase;
},

View File

@@ -671,7 +671,12 @@ const gameLog = {
* @returns {Promise<any[]>} The game log data
*/
async lookupGameLogDatabase(search, filters, vipList = []) {
async lookupGameLogDatabase(
search,
filters,
vipList,
maxEntries = dbVars.maxTableSize
) {
search = search.replaceAll("'", "''");
if (search.startsWith('wrld_') || search.startsWith('grp_')) {
return this.getGameLogByLocation(search, filters);
@@ -752,7 +757,7 @@ const gameLog = {
groupName: dbRow[6]
};
gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_location WHERE world_name LIKE '%${search}%' OR group_name LIKE '%${search}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM gamelog_location WHERE world_name LIKE '%${search}%' OR group_name LIKE '%${search}%' ORDER BY id DESC LIMIT ${maxEntries}`);
}
if (onplayerjoined || onplayerleft) {
var query = '';
@@ -774,7 +779,7 @@ const gameLog = {
time: dbRow[6]
};
gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_join_leave WHERE (display_name LIKE '%${search}%' AND user_id != '${dbVars.userId}') ${vipQuery} ${query} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM gamelog_join_leave WHERE (display_name LIKE '%${search}%' AND user_id != '${dbVars.userId}') ${vipQuery} ${query} ORDER BY id DESC LIMIT ${maxEntries}`);
}
if (portalspawn) {
await sqliteService.execute((dbRow) => {
@@ -789,7 +794,7 @@ const gameLog = {
worldName: dbRow[6]
};
gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_portal_spawn WHERE (display_name LIKE '%${search}%' OR world_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM gamelog_portal_spawn WHERE (display_name LIKE '%${search}%' OR world_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${maxEntries}`);
}
if (msgevent) {
await sqliteService.execute((dbRow) => {
@@ -800,7 +805,7 @@ const gameLog = {
data: dbRow[2]
};
gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_event WHERE data LIKE '%${search}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM gamelog_event WHERE data LIKE '%${search}%' ORDER BY id DESC LIMIT ${maxEntries}`);
}
if (external) {
await sqliteService.execute((dbRow) => {
@@ -814,7 +819,7 @@ const gameLog = {
location: dbRow[5]
};
gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_external WHERE (display_name LIKE '%${search}%' OR message LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM gamelog_external WHERE (display_name LIKE '%${search}%' OR message LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${maxEntries}`);
}
if (videoplay) {
await sqliteService.execute((dbRow) => {
@@ -830,7 +835,7 @@ const gameLog = {
userId: dbRow[7]
};
gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_video_play WHERE (video_url LIKE '%${search}%' OR video_name LIKE '%${search}%' OR display_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM gamelog_video_play WHERE (video_url LIKE '%${search}%' OR video_name LIKE '%${search}%' OR display_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${maxEntries}`);
}
if (resourceload_string || resourceload_image) {
var checkString = '';
@@ -850,7 +855,7 @@ const gameLog = {
location: dbRow[4]
};
gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_resource_load WHERE resource_url LIKE '%${search}%' ${checkString} ${checkImage} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
}, `SELECT * FROM gamelog_resource_load WHERE resource_url LIKE '%${search}%' ${checkString} ${checkImage} ORDER BY id DESC LIMIT ${maxEntries}`);
}
var compareByCreatedAt = function (a, b) {
var A = a.created_at;
@@ -864,7 +869,9 @@ const gameLog = {
return 0;
};
gamelogDatabase.sort(compareByCreatedAt);
gamelogDatabase.splice(0, gamelogDatabase.length - dbVars.maxTableSize);
if (gamelogDatabase.length > maxEntries) {
gamelogDatabase.splice(0, gamelogDatabase.length - maxEntries);
}
return gamelogDatabase;
},

View File

@@ -21,17 +21,63 @@ const notifications = {
inviteMessage: dbRow[10],
requestMessage: dbRow[11],
responseMessage: dbRow[12]
}
},
$isExpired: dbRow[13] === 1
};
row.$isExpired = false;
if (dbRow[13] === 1) {
row.$isExpired = true;
}
notifications.unshift(row);
}, `SELECT * FROM ${dbVars.userPrefix}_notifications ORDER BY created_at DESC LIMIT ${dbVars.maxTableSize}`);
return notifications;
},
async lookupNotificationDatabase(
search,
filters,
vipList,
maxEntries = dbVars.maxTableSize
) {
search = search.replaceAll("'", "''");
let notifications = [];
let vipQuery = '';
if (vipList.length > 0) {
const vipIds = vipList.map(
(userId) => `'${userId.replaceAll("'", "''")}'`
);
vipQuery = `AND sender_user_id IN (${vipIds.join(',')})`;
}
let filterQuery = '';
if (filters.length > 0) {
const filterTypes = filters.map(
(type) => `'${type.replaceAll("'", "''")}'`
);
filterQuery = `AND type IN (${filterTypes.join(',')})`;
}
await sqliteService.execute((dbRow) => {
let row = {
id: dbRow[0],
created_at: dbRow[1],
type: dbRow[2],
senderUserId: dbRow[3],
senderUsername: dbRow[4],
receiverUserId: dbRow[5],
message: dbRow[6],
details: {
worldId: dbRow[7],
worldName: dbRow[8],
imageUrl: dbRow[9],
inviteMessage: dbRow[10],
requestMessage: dbRow[11],
responseMessage: dbRow[12]
},
$isExpired: dbRow[13] === 1
};
notifications.unshift(row);
}, `SELECT * FROM ${dbVars.userPrefix}_notifications WHERE (sender_username LIKE '%${search}%' OR message LIKE '%${search}%' OR world_name LIKE '%${search}%') ${vipQuery} ${filterQuery} ORDER BY created_at DESC LIMIT ${maxEntries}`);
return notifications;
},
addNotificationToDatabase(row) {
var entry = {
id: '',

View File

@@ -573,7 +573,7 @@ function handlePipeline(args) {
}
notificationStore.queueNotificationNoty(noty);
notificationStore.notificationTable.data.push(noty);
sharedFeedStore.updateSharedFeed(true);
sharedFeedStore.addEntry(noty);
break;
default:

View File

@@ -12,10 +12,14 @@ async function getWorldName(location) {
const L = parseLocation(location);
if (L.isRealInstance && L.worldId) {
const args = await worldRequest.getCachedWorld({
worldId: L.worldId
});
worldName = args.ref.name;
try {
const args = await worldRequest.getCachedWorld({
worldId: L.worldId
});
worldName = args.ref.name;
} catch (e) {
console.error('getWorldName failed location', location, e);
}
}
return worldName;

View File

@@ -28,13 +28,10 @@ export const useFeedStore = defineStore('Feed', () => {
pageSizeLinked: true
});
const feedSessionTable = ref([]);
watch(
() => watchState.isLoggedIn,
(isLoggedIn) => {
feedTable.value.data.length = 0;
feedSessionTable.value = [];
if (isLoggedIn) {
initFeedTable();
}
@@ -160,9 +157,7 @@ export const useFeedStore = defineStore('Feed', () => {
function addFeed(feed) {
notificationStore.queueFeedNoty(feed);
feedSessionTable.value.push(feed);
sweepFeedSessionTable();
sharedFeedStore.updateSharedFeed(false);
sharedFeedStore.addEntry(feed);
if (
feedTable.value.filter.length > 0 &&
!feedTable.value.filter.includes(feed.type)
@@ -183,65 +178,21 @@ export const useFeedStore = defineStore('Feed', () => {
UiStore.notifyMenu('feed');
}
function sweepFeedSessionTable() {
const data = feedSessionTable.value;
const k = data.length;
if (!k) {
return;
}
// 24 hour limit
const date = new Date();
date.setDate(date.getDate() - 1);
const limit = date.toJSON();
if (data[0].created_at < limit) {
let i = 0;
while (i < k && data[i].created_at < limit) {
++i;
}
if (i === k) {
feedSessionTable.value = [];
return;
}
if (i) {
data.splice(0, i);
}
}
const maxLen = Math.floor(vrcxStore.maxTableSize * 1.5);
if (maxLen > 0 && data.length > maxLen + 100) {
data.splice(0, 100);
}
}
function sweepFeed() {
const { data } = feedTable.value;
const j = data.length;
if (j > vrcxStore.maxTableSize + 50) {
data.splice(0, 50);
}
sweepFeedSessionTable();
}
async function initFeedTable() {
feedTable.value.loading = true;
feedTableLookup();
const getFeedDatabaseResult = await database.getFeedDatabase();
if (getFeedDatabaseResult && getFeedDatabaseResult.length > 0) {
// rough, maybe 100 is enough
feedSessionTable.value = getFeedDatabaseResult.slice(-100);
} else {
feedSessionTable.value = [];
}
}
return {
feedTable,
feedSessionTable,
initFeedTable,
feedTableLookup,
addFeed

View File

@@ -993,6 +993,7 @@ export const useFriendStore = defineStore('Friend', () => {
friendLogTable.value.data.push(friendLogHistory);
database.addFriendLogHistory(friendLogHistory);
notificationStore.queueFriendLogNoty(friendLogHistory);
sharedFeedStore.addEntry(friendLogHistory);
const friendLogCurrent = {
userId: id,
displayName: ref.displayName,
@@ -1003,7 +1004,6 @@ export const useFriendStore = defineStore('Friend', () => {
database.setFriendLogCurrent(friendLogCurrent);
uiStore.notifyMenu('friend-log');
deleteFriendRequest(id);
sharedFeedStore.updateSharedFeed(true);
userRequest
.getUser({
userId: id
@@ -1067,13 +1067,13 @@ export const useFriendStore = defineStore('Friend', () => {
friendLogTable.value.data.push(friendLogHistory);
database.addFriendLogHistory(friendLogHistory);
notificationStore.queueFriendLogNoty(friendLogHistory);
sharedFeedStore.addEntry(friendLogHistory);
friendLog.delete(id);
database.deleteFriendLogCurrent(id);
favoriteStore.handleFavoriteDelete(id);
if (!appearanceSettingsStore.hideUnfriends) {
uiStore.notifyMenu('friend-log');
}
sharedFeedStore.updateSharedFeed(true);
deleteFriend(id);
}
});
@@ -1130,6 +1130,7 @@ export const useFriendStore = defineStore('Friend', () => {
notificationStore.queueFriendLogNoty(
friendLogHistoryDisplayName
);
sharedFeedStore.addEntry(friendLogHistoryDisplayName);
const friendLogCurrent = {
userId: ref.id,
displayName: ref.displayName,
@@ -1140,7 +1141,6 @@ export const useFriendStore = defineStore('Friend', () => {
database.setFriendLogCurrent(friendLogCurrent);
ctx.displayName = ref.displayName;
uiStore.notifyMenu('friend-log');
sharedFeedStore.updateSharedFeed(true);
}
}
if (
@@ -1176,6 +1176,7 @@ export const useFriendStore = defineStore('Friend', () => {
friendLogTable.value.data.push(friendLogHistoryTrustLevel);
database.addFriendLogHistory(friendLogHistoryTrustLevel);
notificationStore.queueFriendLogNoty(friendLogHistoryTrustLevel);
sharedFeedStore.addEntry(friendLogHistoryTrustLevel);
const friendLogCurrent2 = {
userId: ref.id,
displayName: ref.displayName,
@@ -1185,7 +1186,6 @@ export const useFriendStore = defineStore('Friend', () => {
friendLog.set(ref.id, friendLogCurrent2);
database.setFriendLogCurrent(friendLogCurrent2);
uiStore.notifyMenu('friend-log');
sharedFeedStore.updateSharedFeed(true);
}
ctx.trustLevel = ref.$trustLevel;
}

View File

@@ -15,7 +15,6 @@ import {
import { AppDebug } from '../service/appConfig';
import { database } from '../service/database';
import { useAdvancedSettingsStore } from './settings/advanced';
import { useAppearanceSettingsStore } from './settings/appearance';
import { useFriendStore } from './friend';
import { useGalleryStore } from './gallery';
import { useGameStore } from './game';
@@ -49,7 +48,6 @@ export const useGameLogStore = defineStore('GameLog', () => {
const vrcxStore = useVrcxStore();
const advancedSettingsStore = useAdvancedSettingsStore();
const gameStore = useGameStore();
const appearanceSettingsStore = useAppearanceSettingsStore();
const generalSettingsStore = useGeneralSettingsStore();
const galleryStore = useGalleryStore();
const photonStore = usePhotonStore();
@@ -70,8 +68,6 @@ export const useGameLogStore = defineStore('GameLog', () => {
vip: false
});
const gameLogSessionTable = ref([]);
const nowPlaying = ref({
url: '',
name: '',
@@ -93,7 +89,6 @@ export const useGameLogStore = defineStore('GameLog', () => {
() => watchState.isLoggedIn,
(isLoggedIn) => {
gameLogTable.value.data.length = 0;
gameLogSessionTable.value = [];
if (isLoggedIn) {
// wait for friends to load, silly but works
setTimeout(() => {
@@ -225,14 +220,15 @@ export const useGameLogStore = defineStore('GameLog', () => {
workerTimers.setTimeout(() => updateNowPlaying(), 1000);
}
function tryLoadPlayerList() {
async function tryLoadPlayerList() {
// TODO: make this work again
if (!gameStore.isGameRunning) {
return;
}
console.log('Loading player list from game log...');
let ctx;
let i;
const data = gameLogSessionTable.value;
const data = await database.getGamelogDatabase();
if (data.length === 0) {
return;
}
@@ -358,13 +354,6 @@ export const useGameLogStore = defineStore('GameLog', () => {
function addGameLog(entry) {
entry.isFriend = gameLogIsFriend(entry);
entry.isFavorite = gameLogIsFavorite(entry);
gameLogSessionTable.value.push(entry);
sweepGameLogSessionTable();
sharedFeedStore.updateSharedFeed(false);
if (entry.type === 'VideoPlay') {
// event time can be before last gameLog entry
sharedFeedStore.updateSharedFeed(true);
}
// If the VIP friend filter is enabled, logs from other friends will be ignored.
if (
@@ -402,38 +391,6 @@ export const useGameLogStore = defineStore('GameLog', () => {
uiStore.notifyMenu('game-log');
}
function sweepGameLogSessionTable() {
const data = gameLogSessionTable.value;
const k = data.length;
if (!k) {
return;
}
// 24 hour limit
const date = new Date();
date.setDate(date.getDate() - 1);
const limit = date.toJSON();
if (data[0].created_at < limit) {
let i = 0;
while (i < k && data[i].created_at < limit) {
++i;
}
if (i === k) {
gameLogSessionTable.value = [];
return;
}
if (i) {
data.splice(0, i);
}
}
const maxLen = Math.floor(vrcxStore.maxTableSize * 1.5);
if (maxLen > 0 && data.length > maxLen + 100) {
data.splice(0, 100);
}
}
async function addGamelogLocationToDatabase(input) {
const groupName = await getGroupName(input.location);
const entry = {
@@ -518,8 +475,6 @@ export const useGameLogStore = defineStore('GameLog', () => {
if (j > vrcxStore.maxTableSize + 50) {
data.splice(0, 50);
}
sweepGameLogSessionTable();
}
function addGameLogEntry(gameLog, location) {
@@ -657,22 +612,6 @@ export const useGameLogStore = defineStore('GameLog', () => {
if (typeof ref1 === 'undefined') {
break;
}
const friendRef = friendStore.friends.get(userId);
if (typeof friendRef?.ref !== 'undefined') {
friendRef.ref.$joinCount++;
friendRef.ref.$lastSeen = new Date().toJSON();
friendRef.ref.$timeSpent +=
dayjs(gameLog.dt) - ref1.joinTime;
if (
appearanceSettingsStore.sidebarSortMethods.includes(
'Sort by Last Seen'
)
) {
// TODO: remove
friendStore.sortVIPFriends = true;
friendStore.sortOnlineFriends = true;
}
}
const time = dayjs(gameLog.dt) - ref1.joinTime;
locationStore.lastLocation.playerList.delete(userId);
locationStore.lastLocation.friendList.delete(userId);
@@ -958,13 +897,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
break;
}
if (typeof entry !== 'undefined') {
// add tag colour
if (entry.userId) {
const tagRef = userStore.customUserTags.get(entry.userId);
if (typeof tagRef !== 'undefined') {
entry.tagColour = tagRef.colour;
}
}
sharedFeedStore.addEntry(entry);
notificationStore.queueGameLogNoty(entry);
addGameLog(entry);
}
@@ -1368,8 +1301,6 @@ export const useGameLogStore = defineStore('GameLog', () => {
async function getGameLogTable() {
await database.initTables();
gameLogSessionTable.value = await database.getGamelogDatabase();
sweepGameLogSessionTable();
const dateTill = await database.getLastDateGameLogDatabase();
updateGameLog(dateTill);
}
@@ -1433,7 +1364,8 @@ export const useGameLogStore = defineStore('GameLog', () => {
async function initGameLogTable() {
const rows = await database.lookupGameLogDatabase(
gameLogTable.value.search,
gameLogTable.value.filter
gameLogTable.value.filter,
[]
);
for (const row of rows) {
row.isFriend = gameLogIsFriend(row);
@@ -1447,7 +1379,6 @@ export const useGameLogStore = defineStore('GameLog', () => {
nowPlaying,
gameLogTable,
gameLogSessionTable,
lastVideoUrl,
lastResourceloadUrl,

View File

@@ -73,8 +73,7 @@ async function registerSentryPiniaPlugin() {
GameLog: {
// @ts-ignore
...state.GameLog,
gameLogTable: null,
gameLogSessionTable: null
gameLogTable: null
},
Notification: {
// @ts-ignore
@@ -92,7 +91,7 @@ async function registerSentryPiniaPlugin() {
SharedFeed: {
// @ts-ignore
...state.SharedFeed,
sharedFeed: null
sharedFeedData: null
},
Group: {
// @ts-ignore

View File

@@ -387,11 +387,15 @@ export const useInstanceStore = defineStore('Instance', () => {
const L = parseLocation(location);
if (L.isRealInstance && L.worldId && L.instanceId) {
const args = await instanceRequest.getCachedInstance({
worldId: L.worldId,
instanceId: L.instanceId
});
instanceName = args.ref.displayName;
try {
const args = await instanceRequest.getCachedInstance({
worldId: L.worldId,
instanceId: L.instanceId
});
instanceName = args.ref.displayName;
} catch (e) {
console.error('getInstanceName failed location', location, e);
}
}
return instanceName;
@@ -976,8 +980,8 @@ export const useInstanceStore = defineStore('Instance', () => {
uiStore.notifyMenu('notification');
}
notificationStore.queueNotificationNoty(noty);
sharedFeedStore.addEntry(noty);
notificationStore.notificationTable.data.push(noty);
sharedFeedStore.updateSharedFeed(true);
}
/**

View File

@@ -95,14 +95,14 @@ export const useLocationStore = defineStore('Location', () => {
// with the current state of things, lets not run this if we don't need to
return;
}
let lastLocationTemp = '';
for (let i = gameLogStore.gameLogSessionTable.length - 1; i > -1; i--) {
const item = gameLogStore.gameLogSessionTable[i];
if (item.type === 'Location') {
lastLocationTemp = item.location;
break;
}
}
const lastLocationArray = await database.lookupGameLogDatabase(
'',
['Location'],
[],
1
);
const lastLocationTemp =
lastLocationArray.length > 0 ? lastLocationArray[0].location : '';
if (lastLocationTemp === location) {
return;
}

View File

@@ -146,10 +146,10 @@ export const useNotificationStore = defineStore('Notification', () => {
}
unseenNotifications.value.push(ref.id);
queueNotificationNoty(ref);
sharedFeedStore.addEntry(ref);
}
}
notificationTable.value.data.push(ref);
sharedFeedStore.updateSharedFeed(true);
const D = userStore.userDialog;
if (
D.visible === false ||

View File

@@ -1645,6 +1645,7 @@ export const usePhotonStore = defineStore('Photon', () => {
type
};
notificationStore.queueModerationNoty(noty);
sharedFeedStore.addEntry(noty);
const entry = {
created_at: gameLogDate,
userId: ref.id,
@@ -1653,9 +1654,6 @@ export const usePhotonStore = defineStore('Photon', () => {
};
moderationAgainstTable.value.push(entry);
}
if (block || mute || block !== row.block || mute !== row.mute) {
sharedFeedStore.updateSharedFeed(true);
}
if (block || mute) {
database.setModeration({
userId: ref.id,

View File

@@ -1,11 +1,15 @@
import { defineStore } from 'pinia';
import { ref } from 'vue';
import { useSharedFeedStore } from '../sharedFeed';
import configRepository from '../../service/config';
export const useWristOverlaySettingsStore = defineStore(
'WristOverlaySettings',
() => {
const sharedFeed = useSharedFeedStore();
const overlayWrist = ref(true);
const hidePrivateFromFeed = ref(false);
const openVRAlways = ref(false);
@@ -68,6 +72,7 @@ export const useWristOverlaySettingsStore = defineStore(
'VRCX_hidePrivateFromFeed',
hidePrivateFromFeed.value
);
sharedFeed.loadSharedFeed();
}
function setOpenVRAlways() {
openVRAlways.value = !openVRAlways.value;

File diff suppressed because it is too large Load Diff

View File

@@ -630,17 +630,11 @@ export const useUserStore = defineStore('User', () => {
...ref
});
currentTravelers.set(ref.id, travelRef);
sharedFeedStore.sharedFeed.pendingUpdate = true;
sharedFeedStore.updateSharedFeed(false);
onPlayerTraveling(travelRef);
}
} else {
ref.$location = parseLocation(ref.location);
if (currentTravelers.has(ref.id)) {
currentTravelers.delete(ref.id);
sharedFeedStore.sharedFeed.pendingUpdate = true;
sharedFeedStore.updateSharedFeed(false);
}
currentTravelers.delete(ref.id);
}
if (
!instanceStore.cachedInstances.has(ref.$location.tag) &&
@@ -1651,7 +1645,7 @@ export const useUserStore = defineStore('User', () => {
ref.$customTag = data.Tag;
ref.$customTagColour = data.TagColour;
}
sharedFeedStore.updateSharedFeed(true);
sharedFeedStore.addTag(data.UserId, data.TagColour);
}
async function initUserNotes() {

View File

@@ -44,12 +44,11 @@ export const useVrStore = defineStore('Vr', () => {
updateVRLastLocation();
updateVrNowPlaying();
// run these methods again to send data to the overlay
sharedFeedStore.updateSharedFeed(true);
sharedFeedStore.sendSharedFeed();
friendStore.updateOnlineFriendCounter(true); // force an update
}
async function saveOpenVROption() {
sharedFeedStore.updateSharedFeed(true);
updateVRConfigVars();
updateVRLastLocation();
AppApi.ExecuteVrOverlayFunction('notyClear', '');

View File

@@ -30,15 +30,7 @@ export function useInstanceActivityData() {
async function getWorldNameData() {
worldNameArray.value = await Promise.all(
activityData.value.map(async (item) => {
try {
return await getWorldName(item.location);
} catch {
console.error(
'getWorldName failed location',
item.location
);
return 'Unknown world';
}
return await getWorldName(item.location);
})
);
}

View File

@@ -65,7 +65,7 @@
padding: `${16 * props.cardScale * props.cardSpacing}px`
}));
const avatarFallback = computed(() => props.friend.name.charAt(0) ?? '?');
const avatarFallback = computed(() => props.friend?.name?.charAt(0) ?? '?');
const statusDotClass = computed(() => {
const status = userStatusClass(props.friend.ref, props.friend.pendingOffline);

View File

@@ -100,7 +100,7 @@
const { photonLoggingEnabled } = storeToRefs(usePhotonStore());
const { notyFeedFiltersOptions, wristFeedFiltersOptions, photonFeedFiltersOptions } = feedFiltersOptions();
const { sharedFeedFilters } = storeToRefs(useNotificationsSettingsStore());
const { updateSharedFeed } = useSharedFeedStore();
const { loadSharedFeed } = useSharedFeedStore();
const props = defineProps({
feedFiltersDialogMode: {
@@ -136,7 +136,7 @@
function saveSharedFeedFilters() {
configRepository.setString('sharedFeedFilters', JSON.stringify(sharedFeedFilters.value));
updateSharedFeed(true);
loadSharedFeed();
}
function resetNotyFeedFilters() {