feat(rebase): rebase

This commit is contained in:
Aiden Vigue
2021-02-15 11:07:36 -05:00
parent d81e7cdbab
commit 3743edab8d
4 changed files with 213 additions and 6 deletions

View File

@@ -55,6 +55,9 @@ components:
plexToken: plexToken:
type: string type: string
readOnly: true readOnly: true
jellyfinAuthToken:
type: string
readOnly: true
userType: userType:
type: integer type: integer
example: 1 example: 1
@@ -124,6 +127,9 @@ components:
localLogin: localLogin:
type: boolean type: boolean
example: true example: true
mediaServerType:
type: string
example: 'PLEX | JELLYFIN'
defaultPermissions: defaultPermissions:
type: number type: number
example: 32 example: 32
@@ -292,6 +298,47 @@ components:
- provides - provides
- owned - owned
- connection - connection
JellyfinLibrary:
type: object
properties:
id:
type: string
name:
type: string
example: Movies
enabled:
type: boolean
example: false
required:
- id
- name
- enabled
JellyfinSettings:
type: object
properties:
name:
type: string
example: 'Main Server'
readOnly: true
hostname:
type: string
example: 'http://my.jellyfin.host'
adminUser:
type: string
example: 'admin'
adminPass:
type: string
example: 'mypassword'
libraries:
type: array
readOnly: true
items:
$ref: '#/components/schemas/JellyfinLibrary'
serverID:
type: string
readOnly: true
required:
- hostname
RadarrSettings: RadarrSettings:
type: object type: object
properties: properties:
@@ -1630,6 +1677,136 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/MainSettings' $ref: '#/components/schemas/MainSettings'
/settings/jellyfin:
get:
summary: Get Jellyfin settings
description: Retrieves current Jellyfin settings.
tags:
- settings
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/JellyfinSettings'
post:
summary: Update Jellyfin settings
description: Updates Jellyfin settings with the provided values.
tags:
- settings
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/JellyfinSettings'
responses:
'200':
description: 'Values were successfully updated'
content:
application/json:
schema:
$ref: '#/components/schemas/JellyfinSettings'
/settings/jellyfin/library:
get:
summary: Get Jellyfin libraries
description: Returns a list of Jellyfin libraries in a JSON array.
tags:
- settings
parameters:
- in: query
name: sync
description: Syncs the current libraries with the current Jellyfin server
schema:
type: string
nullable: true
- in: query
name: enable
explode: false
allowReserved: true
description: Comma separated list of libraries to enable. Any libraries not passed will be disabled!
schema:
type: string
nullable: true
responses:
'200':
description: 'Jellyfin libraries returned'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/JellyfinLibrary'
/settings/jellyfin/sync:
get:
summary: Get status of full Jellyfin library sync
description: Returns sync progress in a JSON array.
tags:
- settings
responses:
'200':
description: Status of Jellyfin sync
content:
application/json:
schema:
type: object
properties:
running:
type: boolean
example: false
progress:
type: number
example: 0
total:
type: number
example: 100
currentLibrary:
$ref: '#/components/schemas/JellyfinLibrary'
libraries:
type: array
items:
$ref: '#/components/schemas/JellyfinLibrary'
post:
summary: Start full Jellyfin library sync
description: Runs a full Jellyfin library sync and returns the progress in a JSON array.
tags:
- settings
requestBody:
content:
application/json:
schema:
type: object
properties:
cancel:
type: boolean
example: false
start:
type: boolean
example: false
responses:
'200':
description: Status of Jellyfin sync
content:
application/json:
schema:
type: object
properties:
running:
type: boolean
example: false
progress:
type: number
example: 0
total:
type: number
example: 100
currentLibrary:
$ref: '#/components/schemas/JellyfinLibrary'
libraries:
type: array
items:
$ref: '#/components/schemas/JellyfinLibrary'
/settings/plex: /settings/plex:
get: get:
summary: Get Plex settings summary: Get Plex settings
@@ -2638,6 +2815,36 @@ paths:
type: string type: string
required: required:
- authToken - authToken
/auth/jellyfin:
post:
summary: Sign in using a Jellyfin username and password
description: Takes the user's username and password to log the user in. Generates a session cookie for use in further requests. If the user does not exist, and there are no other users, then a user will be created with full admin privileges. If a user logs in with access to the main Plex server, they will also have an account created, but without any permissions.
security: []
tags:
- auth
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/User'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
username:
type: string
password:
type: string
hostname:
type: string
required:
- username
- password
/auth/local: /auth/local:
post: post:
summary: Sign in using a local account summary: Sign in using a local account

View File

@@ -120,8 +120,7 @@ app
}).connect(sessionRespository) as Store, }).connect(sessionRespository) as Store,
}) })
); );
//const apiDocs = YAML.load(API_SPEC_PATH); const apiDocs = YAML.load(API_SPEC_PATH);
/*
server.use('/api-docs', swaggerUi.serve, swaggerUi.setup(apiDocs)); server.use('/api-docs', swaggerUi.serve, swaggerUi.setup(apiDocs));
server.use( server.use(
OpenApiValidator.middleware({ OpenApiValidator.middleware({
@@ -134,7 +133,7 @@ app
* OpenAPI validator. Otherwise, they are treated as objects instead of strings * OpenAPI validator. Otherwise, they are treated as objects instead of strings
* and response validation will fail * and response validation will fail
*/ */
/*
server.use((_req, res, next) => { server.use((_req, res, next) => {
const original = res.json; const original = res.json;
res.json = function jsonp(json) { res.json = function jsonp(json) {
@@ -142,7 +141,6 @@ app
}; };
next(); next();
}); });
*/
server.use('/api/v1', routes); server.use('/api/v1', routes);
server.get('*', (req, res) => handle(req, res)); server.get('*', (req, res) => handle(req, res));
server.use( server.use(

View File

@@ -127,7 +127,7 @@ class JobJellyfinSync {
(hasOtherResolution || (has4k && !this.enable4kMovie)) && (hasOtherResolution || (has4k && !this.enable4kMovie)) &&
existing.jellyfinMediaID !== metadata.Id existing.jellyfinMediaID !== metadata.Id
) { ) {
existing.jellyfinMediaID !== metadata.Id; existing.jellyfinMediaID = metadata.Id;
changedExisting = true; changedExisting = true;
} }

View File

@@ -227,7 +227,9 @@ settingsRoutes.post('/plex/sync', (req, res) => {
settingsRoutes.get('/jellyfin', (_req, res) => { settingsRoutes.get('/jellyfin', (_req, res) => {
const settings = getSettings(); const settings = getSettings();
res.status(200).json(settings.jellyfin);
//DO NOT RETURN ADMIN USER CREDENTIALS!!
res.status(200).json(omit(settings.jellyfin, ['adminUser', 'adminPass']));
}); });
settingsRoutes.post('/jellyfin', (req, res) => { settingsRoutes.post('/jellyfin', (req, res) => {