mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 22:33:50 +02:00
Group search
This commit is contained in:
115
html/src/app.js
115
html/src/app.js
@@ -2324,6 +2324,31 @@ speechSynthesis.getVoices();
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
params: {
|
||||
worldId: string,
|
||||
type: string,
|
||||
region: string,
|
||||
ownerId: string,
|
||||
roleIds: string[],
|
||||
groupAccessType: string,
|
||||
queueEnabled: boolean
|
||||
}
|
||||
*/
|
||||
API.createInstance = function (params) {
|
||||
return this.call('instances', {
|
||||
method: 'POST',
|
||||
params
|
||||
}).then((json) => {
|
||||
var args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
this.$emit('INSTANCE', args);
|
||||
return args;
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
params: {
|
||||
worldId: string,
|
||||
@@ -12034,9 +12059,12 @@ speechSynthesis.getVoices();
|
||||
$app.data.searchAvatarFilter = '';
|
||||
$app.data.searchAvatarSort = '';
|
||||
$app.data.searchAvatarFilterRemote = '';
|
||||
$app.data.searchGroupResults = [];
|
||||
$app.data.searchGroupParams = {};
|
||||
$app.data.isSearchUserLoading = false;
|
||||
$app.data.isSearchWorldLoading = false;
|
||||
$app.data.isSearchAvatarLoading = false;
|
||||
$app.data.isSearchGroupLoading = false;
|
||||
|
||||
API.$on('LOGIN', function () {
|
||||
$app.searchText = '';
|
||||
@@ -12051,6 +12079,8 @@ speechSynthesis.getVoices();
|
||||
$app.searchAvatarFilter = '';
|
||||
$app.searchAvatarSort = '';
|
||||
$app.searchAvatarFilterRemote = '';
|
||||
$app.searchGroupResults = [];
|
||||
$app.searchGroupParams = {};
|
||||
$app.isSearchUserLoading = false;
|
||||
$app.isSearchWorldLoading = false;
|
||||
$app.isSearchAvatarLoading = false;
|
||||
@@ -12065,6 +12095,7 @@ speechSynthesis.getVoices();
|
||||
this.searchAvatarResults = [];
|
||||
this.searchAvatarPage = [];
|
||||
this.searchAvatarPageNum = 0;
|
||||
this.searchGroupResults = [];
|
||||
};
|
||||
|
||||
$app.methods.search = function () {
|
||||
@@ -12078,6 +12109,9 @@ speechSynthesis.getVoices();
|
||||
case '2':
|
||||
this.searchAvatar();
|
||||
break;
|
||||
case '3':
|
||||
this.searchGroup();
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12326,6 +12360,41 @@ speechSynthesis.getVoices();
|
||||
);
|
||||
};
|
||||
|
||||
$app.methods.searchGroup = async function () {
|
||||
this.searchGroupParams = {
|
||||
n: 10,
|
||||
offset: 0,
|
||||
query: this.replaceBioSymbols(this.searchText)
|
||||
};
|
||||
await this.moreSearchGroup();
|
||||
};
|
||||
|
||||
$app.methods.moreSearchGroup = async function (go) {
|
||||
var params = this.searchGroupParams;
|
||||
if (go) {
|
||||
params.offset += params.n * go;
|
||||
if (params.offset < 0) {
|
||||
params.offset = 0;
|
||||
}
|
||||
}
|
||||
this.isSearchGroupLoading = true;
|
||||
await API.groupSearch(params)
|
||||
.finally(() => {
|
||||
this.isSearchGroupLoading = false;
|
||||
})
|
||||
.then((args) => {
|
||||
var map = new Map();
|
||||
for (var json of args.json) {
|
||||
var ref = API.cachedGroups.get(json.id);
|
||||
if (typeof ref !== 'undefined') {
|
||||
map.set(ref.id, ref);
|
||||
}
|
||||
}
|
||||
this.searchGroupResults = Array.from(map.values());
|
||||
return args;
|
||||
});
|
||||
};
|
||||
|
||||
// #endregion
|
||||
// #region | App: Favorite
|
||||
|
||||
@@ -25025,6 +25094,52 @@ speechSynthesis.getVoices();
|
||||
});
|
||||
};
|
||||
|
||||
API.getUsersGroupInstances = function () {
|
||||
return this.call(`users/${this.currentUser.id}/instances/groups`, {
|
||||
method: 'GET'
|
||||
}).then((json) => {
|
||||
var args = {
|
||||
json
|
||||
};
|
||||
this.$emit('GROUP:USER:INSTANCES', args);
|
||||
return args;
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
params: {
|
||||
query: string,
|
||||
n: number,
|
||||
offset: number,
|
||||
order: string,
|
||||
sortBy: string
|
||||
}
|
||||
*/
|
||||
API.groupSearch = function (params) {
|
||||
return this.call(`groups`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
var args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
this.$emit('GROUP:SEARCH', args);
|
||||
return args;
|
||||
});
|
||||
};
|
||||
|
||||
API.$on('GROUP:SEARCH', function (args) {
|
||||
for (var json of args.json) {
|
||||
this.$emit('GROUP', {
|
||||
json,
|
||||
params: {
|
||||
groupId: json.id
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
params: {
|
||||
groupId: string
|
||||
|
||||
Reference in New Issue
Block a user