Fix jellyfin auth endpoint
This commit is contained in:
parent
bb27758310
commit
9b5bce34a0
3 changed files with 7 additions and 3 deletions
|
@ -22,7 +22,7 @@ export const contract = c.router({
|
||||||
authenticate: {
|
authenticate: {
|
||||||
body: jfType._parameters.authenticate,
|
body: jfType._parameters.authenticate,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
path: 'auth/login',
|
path: 'users/authenticatebyname',
|
||||||
responses: {
|
responses: {
|
||||||
200: jfType._response.authenticate,
|
200: jfType._response.authenticate,
|
||||||
400: jfType._response.error,
|
400: jfType._response.error,
|
||||||
|
|
|
@ -44,6 +44,7 @@ import {
|
||||||
import { jfApiClient } from '/@/renderer/api/jellyfin/jellyfin-api';
|
import { jfApiClient } from '/@/renderer/api/jellyfin/jellyfin-api';
|
||||||
import { jfNormalize } from './jellyfin-normalize';
|
import { jfNormalize } from './jellyfin-normalize';
|
||||||
import { jfType } from '/@/renderer/api/jellyfin/jellyfin-types';
|
import { jfType } from '/@/renderer/api/jellyfin/jellyfin-types';
|
||||||
|
import packageJson from '../../../../package.json';
|
||||||
|
|
||||||
const formatCommaDelimitedString = (value: string[]) => {
|
const formatCommaDelimitedString = (value: string[]) => {
|
||||||
return value.join(',');
|
return value.join(',');
|
||||||
|
@ -60,9 +61,12 @@ const authenticate = async (
|
||||||
|
|
||||||
const res = await jfApiClient({ server: null, url: cleanServerUrl }).authenticate({
|
const res = await jfApiClient({ server: null, url: cleanServerUrl }).authenticate({
|
||||||
body: {
|
body: {
|
||||||
Password: body.password,
|
Pw: body.password,
|
||||||
Username: body.username,
|
Username: body.username,
|
||||||
},
|
},
|
||||||
|
headers: {
|
||||||
|
'X-Emby-Authorization': `MediaBrowser Client="Feishin", Device="PC", DeviceId="Feishin", Version="${packageJson.version}"`,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
|
|
|
@ -265,7 +265,7 @@ const user = z.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
const authenticateParameters = z.object({
|
const authenticateParameters = z.object({
|
||||||
Password: z.string(),
|
Pw: z.string(),
|
||||||
Username: z.string(),
|
Username: z.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Reference in a new issue