mirror of
https://github.com/YuzuZensai/VRC-Circle.git
synced 2026-09-13 19:08:52 +00:00
✨ feat: FriendList context menu
This commit is contained in:
@@ -29,7 +29,11 @@ function hubBinaries(): string[] {
|
||||
case "darwin":
|
||||
return ["/Applications/Unity Hub.app"];
|
||||
default:
|
||||
return ["/usr/bin/unityhub", "/opt/unityhub/unityhub", join(home, ".local", "bin", "unityhub")];
|
||||
return [
|
||||
"/usr/bin/unityhub",
|
||||
"/opt/unityhub/unityhub",
|
||||
join(home, ".local", "bin", "unityhub"),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@ const handlers = {
|
||||
"user:search": (query) => guard(() => users.searchUsers(query)),
|
||||
|
||||
"friends:list": () => guard(() => friends.listFriends()),
|
||||
"friends:unfriend": (userId) => guard(() => friends.unfriend(userId)),
|
||||
"friends:invite": (p) => guard(() => friends.inviteUser(p.userId, p.instanceLocation)),
|
||||
"friends:requestInvite": (userId) => guard(() => friends.requestInvite(userId)),
|
||||
|
||||
"world:byUser": (userId) =>
|
||||
guard(async () => {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { requireActiveClient } from "./client";
|
||||
import { toUserProfile } from "./mappers";
|
||||
import { currentUser, userCache } from "./userService";
|
||||
import { cacheKeys, policies } from "../cache/policies";
|
||||
import { entityStore } from "../store/entityStore";
|
||||
|
||||
const order: Record<string, number> = {
|
||||
"join me": 0,
|
||||
@@ -35,3 +36,23 @@ export async function listFriends(): Promise<UserProfile[]> {
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export async function unfriend(userId: string): Promise<void> {
|
||||
const vrc = requireActiveClient();
|
||||
await vrc.unfriend({ path: { userId }, throwOnError: true });
|
||||
entityStore.removeFriend(userId);
|
||||
}
|
||||
|
||||
export async function inviteUser(userId: string, instanceLocation: string): Promise<void> {
|
||||
const vrc = requireActiveClient();
|
||||
await vrc.inviteUser({
|
||||
path: { userId },
|
||||
body: { instanceId: instanceLocation },
|
||||
throwOnError: true,
|
||||
});
|
||||
}
|
||||
|
||||
export async function requestInvite(userId: string): Promise<void> {
|
||||
const vrc = requireActiveClient();
|
||||
await vrc.requestInvite({ path: { userId }, throwOnError: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user