Skip to content

Commit

Permalink
Changed from username and password to api key
Browse files Browse the repository at this point in the history
  • Loading branch information
conner-replogle committed Jan 14, 2024
1 parent c799226 commit 1304144
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
28 changes: 12 additions & 16 deletions src/server/api/routers/media-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,12 @@ export const mediaServerRouter = createTRPCRouter({
const handleServer = async (app: ConfigAppType): Promise<GenericMediaServer | undefined> => {
switch (app.integration?.type) {
case 'jellyfin': {
const username = findAppProperty(app, 'username');
const apiKey = findAppProperty(app, 'apiKey');

if (!username) {
return {
appId: app.id,
serverAddress: app.url,
sessions: [],
type: 'jellyfin',
version: undefined,
success: false,
};
}


const password = findAppProperty(app, 'password');

if (!password) {
if ( !apiKey) {
return {
appId: app.id,
serverAddress: app.url,
Expand All @@ -97,10 +87,16 @@ const handleServer = async (app: ConfigAppType): Promise<GenericMediaServer | un
};
}

const api = jellyfin.createApi(app.url);

const api = jellyfin.createApi(app.url, apiKey);
const infoApi = await getSystemApi(api).getPublicSystemInfo();
await api.authenticateUserByName(username, password);
const sessionApi = await getSessionApi(api);
const sessionApi = getSessionApi(api);






const { data: sessions } = await sessionApi.getSessions();
return {
type: 'jellyfin',
Expand Down
2 changes: 1 addition & 1 deletion src/types/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const integrationFieldProperties: {
nzbGet: ['username', 'password'],
qBittorrent: ['username', 'password'],
transmission: ['username', 'password'],
jellyfin: ['username', 'password'],
jellyfin: ["apiKey"],
plex: ['apiKey'],
pihole: ['apiKey'],
adGuardHome: ['username', 'password'],
Expand Down

0 comments on commit 1304144

Please sign in to comment.