mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 22:33:50 +02:00
User badges
This commit is contained in:
102
html/src/app.js
102
html/src/app.js
@@ -688,6 +688,22 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (
|
||||
ref.$isVRCPlus &&
|
||||
ref.badges &&
|
||||
ref.badges.every((x) => x.badgeName !== 'Supporter')
|
||||
) {
|
||||
// I doubt this will last long
|
||||
ref.badges.unshift({
|
||||
badgeId: 'bdg_system_supporter',
|
||||
badgeName: 'Supporter',
|
||||
badgeDescription: 'Supports VRChat through VRC+',
|
||||
badgeImageUrl:
|
||||
'https://assets.vrchat.com/badges/fa/bdgai_8c9cf371-ffd2-4177-9894-1093e2e34bf7.png',
|
||||
hidden: true,
|
||||
showcased: false
|
||||
});
|
||||
}
|
||||
var friendCtx = $app.friends.get(ref.id);
|
||||
if (friendCtx) {
|
||||
friendCtx.ref = ref;
|
||||
@@ -1373,6 +1389,10 @@ speechSynthesis.getVoices();
|
||||
|
||||
API.$on('FRIEND:LIST', function (args) {
|
||||
for (var json of args.json) {
|
||||
if (!json.displayName) {
|
||||
console.error('/friends gave us garbage', json);
|
||||
continue;
|
||||
}
|
||||
this.$emit('USER', {
|
||||
json,
|
||||
params: {
|
||||
@@ -3905,6 +3925,7 @@ speechSynthesis.getVoices();
|
||||
)}</strong>!`
|
||||
}).show();
|
||||
$app.$refs.menu.activeIndex = 'feed';
|
||||
$app.updateStoredUser(this.currentUser);
|
||||
});
|
||||
|
||||
API.$on('LOGOUT', async function () {
|
||||
@@ -7036,7 +7057,11 @@ speechSynthesis.getVoices();
|
||||
};
|
||||
|
||||
$app.methods.addFriendship = function (id) {
|
||||
if (!this.friendLogInitStatus || this.friendLog.has(id) || id === API.currentUser.id) {
|
||||
if (
|
||||
!this.friendLogInitStatus ||
|
||||
this.friendLog.has(id) ||
|
||||
id === API.currentUser.id
|
||||
) {
|
||||
return;
|
||||
}
|
||||
var ref = API.cachedUsers.get(id);
|
||||
@@ -7111,7 +7136,7 @@ speechSynthesis.getVoices();
|
||||
created_at: new Date().toJSON(),
|
||||
type: 'Unfriend',
|
||||
userId: id,
|
||||
displayName: ctx.displayName
|
||||
displayName: ctx.displayName || id
|
||||
};
|
||||
this.friendLogTable.data.push(friendLogHistory);
|
||||
database.addFriendLogHistory(friendLogHistory);
|
||||
@@ -12671,6 +12696,14 @@ speechSynthesis.getVoices();
|
||||
D.visible = true;
|
||||
};
|
||||
|
||||
$app.methods.newInstanceTabClick = function (tab) {
|
||||
if (tab === '1') {
|
||||
this.buildInstance();
|
||||
} else {
|
||||
this.buildLegacyInstance();
|
||||
}
|
||||
};
|
||||
|
||||
$app.methods.makeHome = function (tag) {
|
||||
this.$confirm('Continue? Make Home', 'Confirm', {
|
||||
confirmButtonText: 'Confirm',
|
||||
@@ -13318,7 +13351,9 @@ speechSynthesis.getVoices();
|
||||
L.instanceType !== 'public' &&
|
||||
L.groupAccessType !== 'public'
|
||||
) {
|
||||
args.push(`vrchat://launch?id=${location}&shortName=${shortName}`);
|
||||
args.push(
|
||||
`vrchat://launch?ref=vrcx.app&id=${location}&shortName=${shortName}`
|
||||
);
|
||||
} else {
|
||||
// fetch shortName
|
||||
var newShortName = '';
|
||||
@@ -13335,10 +13370,10 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
if (newShortName) {
|
||||
args.push(
|
||||
`vrchat://launch?id=${location}&shortName=${newShortName}`
|
||||
`vrchat://launch?ref=vrcx.app&id=${location}&shortName=${newShortName}`
|
||||
);
|
||||
} else {
|
||||
args.push(`vrchat://launch?id=${location}`);
|
||||
args.push(`vrchat://launch?ref=vrcx.app&id=${location}`);
|
||||
}
|
||||
}
|
||||
var { launchArguments, vrcLaunchPathOverride } =
|
||||
@@ -22200,6 +22235,63 @@ speechSynthesis.getVoices();
|
||||
|
||||
$app.data.ossDialog = false;
|
||||
|
||||
// #region | App: Badges
|
||||
|
||||
API.updateBadge = function (params) {
|
||||
return this.call(
|
||||
`users/${API.currentUser.id}/badges/${params.badgeId}`,
|
||||
{
|
||||
method: 'PUT',
|
||||
params: {
|
||||
userId: API.currentUser.id,
|
||||
badgeId: params.badgeId,
|
||||
hidden: params.hidden,
|
||||
showcased: params.showcased
|
||||
}
|
||||
}
|
||||
).then((json) => {
|
||||
var args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
this.$emit('BADGE:UPDATE', args);
|
||||
return args;
|
||||
});
|
||||
};
|
||||
|
||||
API.$on('BADGE:UPDATE', function (args) {
|
||||
if (args.json) {
|
||||
$app.$message({
|
||||
message: 'Badge updated',
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$app.methods.toggleBadgeVisibility = function (badge) {
|
||||
if (badge.hidden) {
|
||||
badge.showcased = false;
|
||||
}
|
||||
API.updateBadge({
|
||||
badgeId: badge.badgeId,
|
||||
hidden: badge.hidden,
|
||||
showcased: badge.showcased
|
||||
});
|
||||
};
|
||||
|
||||
$app.methods.toggleBadgeShowcased = function (badge) {
|
||||
if (badge.showcased) {
|
||||
badge.hidden = false;
|
||||
}
|
||||
API.updateBadge({
|
||||
badgeId: badge.badgeId,
|
||||
hidden: badge.hidden,
|
||||
showcased: badge.showcased
|
||||
});
|
||||
};
|
||||
|
||||
// #endregion
|
||||
|
||||
// "$app" is being replaced by Vue, update references inside all the classes
|
||||
$app = new Vue($app);
|
||||
window.$app = $app;
|
||||
|
||||
Reference in New Issue
Block a user