Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all usage of userId #700

Merged
merged 2 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/components/__tests__/jellyfinApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ describe('creating basic urls', () => {
});

beforeEach(() => {
JellyfinApi.setServerInfo(
'thisIsUserId',
'thisIsAccessToken',
'thisIsServerAddress'
);
JellyfinApi.setServerInfo('thisIsAccessToken', 'thisIsServerAddress');
});

test('should return correct url', () => {
Expand Down Expand Up @@ -58,11 +54,7 @@ describe('creating image urls', () => {
});

beforeEach(() => {
JellyfinApi.setServerInfo(
'thisIsUserId',
'thisIsAccessToken',
'thisIsServerAddress'
);
JellyfinApi.setServerInfo('thisIsAccessToken', 'thisIsServerAddress');
});

test('should return correct url with all parameters provided', () => {
Expand Down
3 changes: 1 addition & 2 deletions src/components/documentManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ export abstract class DocumentManager {
const response = await getUserLibraryApi(
JellyfinApi.jellyfinApi
).getItem({
itemId,
userId: JellyfinApi.userId
itemId
});

DocumentManager.showItem(response.data);
Expand Down
6 changes: 2 additions & 4 deletions src/components/jellyfinActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ export async function getPlaybackInfo(
const query: PlaybackInfoDto = {
DeviceProfile: deviceProfile,
MaxStreamingBitrate: maxBitrate,
StartTimeTicks: startPosition || 0,
UserId: JellyfinApi.userId
StartTimeTicks: startPosition || 0
};

if (audioStreamIndex != null) {
Expand Down Expand Up @@ -310,8 +309,7 @@ export async function getLiveStream(
OpenToken: mediaSource.OpenToken,
PlaySessionId: playSessionId,
StartTimeTicks: startPosition || 0,
SubtitleStreamIndex: subtitleStreamIndex,
UserId: JellyfinApi.userId
SubtitleStreamIndex: subtitleStreamIndex
}
});

Expand Down
7 changes: 1 addition & 6 deletions src/components/jellyfinApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ axios.interceptors.response.use(

// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export abstract class JellyfinApi {
// userId that we are connecting as currently
public static userId: string | undefined;

// Security token to prove authentication
public static accessToken: string | undefined;

Expand All @@ -47,7 +44,6 @@ export abstract class JellyfinApi {
public static jellyfinApi: Api;

public static setServerInfo(
userId?: string,
accessToken?: string,
serverAddress?: string,
receiverName = ''
Expand All @@ -57,9 +53,8 @@ export abstract class JellyfinApi {
this.serverAddress !== serverAddress;

console.debug(
`JellyfinApi.setServerInfo: user:${userId}, token:${accessToken}, server:${serverAddress}, name:${receiverName}`
`JellyfinApi.setServerInfo: token:${accessToken}, server:${serverAddress}, name:${receiverName}`
);
this.userId = userId;
this.accessToken = accessToken;
this.serverAddress = serverAddress;

Expand Down
8 changes: 1 addition & 7 deletions src/components/maincontroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,7 @@ export async function reportDeviceCapabilities(): Promise<void> {
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function processMessage(data: any): void {
if (
!data.command ||
!data.serverAddress ||
!data.userId ||
!data.accessToken
) {
if (!data.command || !data.serverAddress || !data.accessToken) {
console.log('Invalid message sent from sender. Sending error response');

broadcastToMessageBus({
Expand All @@ -309,7 +304,6 @@ export function processMessage(data: any): void {
// Items will have properties - Id, Name, Type, MediaType, IsFolder

JellyfinApi.setServerInfo(
data.userId,
data.accessToken,
data.serverAddress,
data.receiverName
Expand Down