feat: blocking frontend (#6911)

* feat: blocking api interfaces

* feat: block action on user pages + shared instance flows

* feat: safety settings subpage

* feat: interaction source settings

* feat: finish social settings

* feat: profile settings xplat

* fix: prepr

* feat: click on friends

* default instance -> game options & fix feature flag width

* fix: scroll indicators

---------

Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
Calum H.
2026-07-28 20:02:58 +00:00
committed by GitHub
co-authored by Prospector
parent cbb31f31c0
commit f89c116bf8
103 changed files with 2166 additions and 1075 deletions
+4
View File
@@ -24,6 +24,8 @@ import { LabrinthAttributionInternalModule } from './labrinth/attribution/intern
import { LabrinthAuthInternalModule } from './labrinth/auth/internal'
import { LabrinthAuthV2Module } from './labrinth/auth/v2'
import { LabrinthBillingInternalModule } from './labrinth/billing/internal'
import { LabrinthBlockedUsersInternalModule } from './labrinth/blocked-users/internal'
import { LabrinthBlockedUsersV3Module } from './labrinth/blocked-users/v3'
import { LabrinthCampaignInternalModule } from './labrinth/campaign/internal'
import { LabrinthCollectionsModule } from './labrinth/collections'
import { LabrinthContentV3Module } from './labrinth/content/v3'
@@ -100,6 +102,8 @@ export const MODULE_REGISTRY = {
labrinth_auth_v2: LabrinthAuthV2Module,
labrinth_attribution_internal: LabrinthAttributionInternalModule,
labrinth_billing_internal: LabrinthBillingInternalModule,
labrinth_blocked_users_internal: LabrinthBlockedUsersInternalModule,
labrinth_blocked_users_v3: LabrinthBlockedUsersV3Module,
labrinth_campaign_internal: LabrinthCampaignInternalModule,
labrinth_collections: LabrinthCollectionsModule,
labrinth_content_v3: LabrinthContentV3Module,
@@ -0,0 +1,25 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Labrinth } from '../types'
export class LabrinthBlockedUsersInternalModule extends AbstractModule {
public getModuleID(): string {
return 'labrinth_blocked_users_internal'
}
/**
* Check whether one user has blocked another.
*/
public async getStatus(
userId: string,
targetId: string,
): Promise<Labrinth.BlockedUsers.Internal.BlockStatus> {
return this.client.request<Labrinth.BlockedUsers.Internal.BlockStatus>(
`/block/${encodeURIComponent(userId)}/${encodeURIComponent(targetId)}`,
{
api: 'labrinth',
version: 'internal',
method: 'GET',
},
)
}
}
@@ -0,0 +1,45 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Labrinth } from '../types'
export class LabrinthBlockedUsersV3Module extends AbstractModule {
public getModuleID(): string {
return 'labrinth_blocked_users_v3'
}
/**
* List the users blocked by the authenticated user.
*/
public async list(): Promise<Labrinth.BlockedUsers.v3.BlockedUserId[]> {
return this.client.request<Labrinth.BlockedUsers.v3.BlockedUserId[]>('/blocks', {
api: 'labrinth',
version: 3,
method: 'GET',
})
}
/**
* Block a user.
*
* @param idOrUsername - The target user's ID or username
*/
public async block(idOrUsername: string): Promise<void> {
return this.client.request(`/block/${encodeURIComponent(idOrUsername)}`, {
api: 'labrinth',
version: 3,
method: 'POST',
})
}
/**
* Unblock a user.
*
* @param idOrUsername - The target user's ID or username
*/
public async unblock(idOrUsername: string): Promise<void> {
return this.client.request(`/block/${encodeURIComponent(idOrUsername)}`, {
api: 'labrinth',
version: 3,
method: 'DELETE',
})
}
}
@@ -1691,6 +1691,18 @@ export namespace Labrinth {
}
}
export namespace BlockedUsers {
export namespace Internal {
export type BlockStatus = {
blocked: boolean
}
}
export namespace v3 {
export type BlockedUserId = string
}
}
export namespace ServerPing {
export namespace Internal {
export type MinecraftJavaPingRequest = {
@@ -168,7 +168,7 @@ export class LabrinthUsersV2Module extends AbstractModule {
*/
public async patch(
idOrUsername: string,
data: Partial<Pick<Labrinth.Users.v2.User, 'badges' | 'role'>>,
data: Partial<Pick<Labrinth.Users.v2.User, 'badges' | 'bio' | 'role' | 'username'>>,
): Promise<void> {
return this.client.request(`/user/${idOrUsername}`, {
api: 'labrinth',
@@ -177,4 +177,34 @@ export class LabrinthUsersV2Module extends AbstractModule {
body: data,
})
}
/**
* Change a user's avatar.
*
* @param idOrUsername - The user's ID or username
* @param file - Image file to upload
* @param ext - File extension (e.g., 'png', 'jpeg', 'gif', 'webp')
*/
public async changeIcon(idOrUsername: string, file: Blob, ext: string): Promise<void> {
return this.client.request(`/user/${idOrUsername}/icon`, {
api: 'labrinth',
version: 2,
method: 'PATCH',
params: { ext },
body: file,
})
}
/**
* Delete a user's avatar.
*
* @param idOrUsername - The user's ID or username
*/
public async deleteIcon(idOrUsername: string): Promise<void> {
return this.client.request(`/user/${idOrUsername}/icon`, {
api: 'labrinth',
version: 2,
method: 'DELETE',
})
}
}