This commit is contained in:
j3d1 2026-08-27 19:41:52 +02:00
parent ebd0db4b43
commit 2bb6624d50
4 changed files with 156 additions and 216 deletions

View file

@ -619,12 +619,16 @@ export default createStore({
const {domain} = splitGroupHandle(groupHandle)
const servers = await dispatch('getFriendServers', {username: 'x@' + domain})
const items = await servers.get(getters.signAuth, '/api/v1/inventory_items/' + encodeHandleForUrl(groupHandle) + '/')
// Keyed by the full handle, not a bare id: a group pk is only unique within its own
// backend's database, so two different domains could otherwise collide on the same
// item_map key - the handle already carries the domain, so no separate namespacing is needed.
commit('setInventoryItems', {url: '/' + groupHandle, items})
return items
},
async fetchFriendInventoryItems({commit, dispatch, getters}, {friendHandle}) {
const servers = await dispatch('getFriendServers', {username: friendHandle})
const items = await servers.get(getters.signAuth, '/api/v1/inventory_items/' + encodeHandleForUrl(friendHandle) + '/')
items.map(item => item.files.map(file => file.owner = item.owner))
commit('setInventoryItems', {url: '/' + friendHandle, items})
return items
},
async fetchFiles({state, commit, dispatch, getters}) {
if (state.last_load.files > Date.now() - 1000 * 60 * 60 * 24) {
return state.files