check authentication for all servers on initialization and update permission roles

This commit is contained in:
jeffvli
2025-12-07 17:53:26 -08:00
parent 4ddada1fe3
commit c82762a3fc
10 changed files with 283 additions and 44 deletions
+10 -2
View File
@@ -7,9 +7,13 @@ const baseResponse = z.object({
}),
});
const authenticate = z.object({
const userParameters = z.object({
id: z.string(),
});
const user = z.object({
user: z.object({
adminRoles: z.boolean(),
adminRole: z.boolean(),
commentRole: z.boolean(),
coverArtRole: z.boolean(),
downloadRole: z.boolean(),
@@ -26,6 +30,8 @@ const authenticate = z.object({
}),
});
const authenticate = user;
const authenticateParameters = z.object({
c: z.string(),
f: z.string(),
@@ -641,6 +647,7 @@ export const ssType = {
structuredLyrics: structuredLyricsParameters,
topSongsList: topSongsListParameters,
updatePlaylist: updatePlaylistParameters,
user: userParameters,
},
_response: {
album,
@@ -683,5 +690,6 @@ export const ssType = {
song,
structuredLyrics,
topSongsList,
user,
},
};
+15 -1
View File
@@ -1276,7 +1276,6 @@ export type ControllerEndpoint = {
getAlbumInfo?: (args: AlbumDetailArgs) => Promise<AlbumInfo>;
getAlbumList: (args: AlbumListArgs) => Promise<AlbumListResponse>;
getAlbumListCount: (args: AlbumListCountArgs) => Promise<number>;
// getArtistInfo?: (args: any) => void;
getArtistList: (args: ArtistListArgs) => Promise<ArtistListResponse>;
getArtistListCount: (args: ArtistListCountArgs) => Promise<number>;
getDownloadUrl: (args: DownloadArgs) => string;
@@ -1299,6 +1298,8 @@ export type ControllerEndpoint = {
getStructuredLyrics?: (args: StructuredLyricsArgs) => Promise<StructuredLyric[]>;
getTagList?: (args: TagListArgs) => Promise<TagListResponse>;
getTopSongs: (args: TopSongListArgs) => Promise<TopSongListResponse>;
// getArtistInfo?: (args: any) => void;
getUserInfo: (args: UserInfoArgs) => Promise<UserInfoResponse>;
getUserList?: (args: UserListArgs) => Promise<UserListResponse>;
movePlaylistItem?: (args: MoveItemArgs) => Promise<void>;
removeFromPlaylist: (args: RemoveFromPlaylistArgs) => Promise<RemoveFromPlaylistResponse>;
@@ -1393,6 +1394,7 @@ export type InternalControllerEndpoint = {
) => Promise<StructuredLyric[]>;
getTagList?: (args: ReplaceApiClientProps<TagListArgs>) => Promise<TagListResponse>;
getTopSongs: (args: ReplaceApiClientProps<TopSongListArgs>) => Promise<TopSongListResponse>;
getUserInfo: (args: ReplaceApiClientProps<UserInfoArgs>) => Promise<UserInfoResponse>;
getUserList?: (args: ReplaceApiClientProps<UserListArgs>) => Promise<UserListResponse>;
movePlaylistItem?: (args: ReplaceApiClientProps<MoveItemArgs>) => Promise<void>;
removeFromPlaylist: (
@@ -1509,6 +1511,18 @@ export type TagListResponse = {
};
};
export type UserInfoArgs = BaseEndpointArgs & { query: UserInfoQuery };
export type UserInfoQuery = {
id: string;
};
export type UserInfoResponse = {
id: string;
isAdmin: boolean;
name: string;
};
type BaseEndpointArgsWithServer = {
apiClientProps: {
server: null | ServerListItemWithCredential;