This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
name: Build Jellyfin n8n Node
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * 0' # Run automatically every Sunday
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
|
- name: Fetch Latest Jellyfin OpenAPI Spec
|
||||||
|
run: |
|
||||||
|
mkdir -p nodes/Jellyfin
|
||||||
|
echo "Downloading latest stable spec..."
|
||||||
|
curl -sL https://api.jellyfin.org/openapi/jellyfin-openapi-stable.json -o nodes/Jellyfin/jellyfin-openapi-stable.json
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Build TypeScript
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Pack NPM Package
|
||||||
|
run: npm pack
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: n8n-nodes-jellyfin-package
|
||||||
|
path: "*.tgz"
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { ICredentialType, INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
|
export class JellyfinApi implements ICredentialType {
|
||||||
|
name = 'jellyfinApi';
|
||||||
|
displayName = 'Jellyfin API';
|
||||||
|
documentationUrl = 'https://api.jellyfin.org/';
|
||||||
|
|
||||||
|
properties: INodeProperties[] = [
|
||||||
|
{
|
||||||
|
displayName: 'Server URL',
|
||||||
|
name: 'url',
|
||||||
|
type: 'string',
|
||||||
|
default: 'http://localhost:8096',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'API Key',
|
||||||
|
name: 'apiKey',
|
||||||
|
type: 'string',
|
||||||
|
typeOptions: { password: true },
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
authenticate = {
|
||||||
|
type: 'generic',
|
||||||
|
properties: {
|
||||||
|
headers: {
|
||||||
|
'Authorization': '={{"MediaBrowser Token=" + $credentials.apiKey}}'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||||
|
import { N8NPropertiesBuilder } from '@devlikeapro/n8n-openapi-node';
|
||||||
|
import * as openApiSpec from './jellyfin-openapi-stable.json'; // Downloaded by Gitea Actions
|
||||||
|
|
||||||
|
const parser = new N8NPropertiesBuilder(openApiSpec, {});
|
||||||
|
const properties = parser.build();
|
||||||
|
|
||||||
|
export class Jellyfin implements INodeType {
|
||||||
|
description: INodeTypeDescription = {
|
||||||
|
displayName: 'Jellyfin',
|
||||||
|
name: 'jellyfin',
|
||||||
|
icon: 'file:jellyfin.svg',
|
||||||
|
group: ['transform'],
|
||||||
|
version: 1,
|
||||||
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||||
|
description: 'Auto-generated Jellyfin API Node',
|
||||||
|
defaults: { name: 'Jellyfin' },
|
||||||
|
inputs: ['main'],
|
||||||
|
outputs: ['main'],
|
||||||
|
credentials: [
|
||||||
|
{
|
||||||
|
name: 'jellyfinApi',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
properties: properties,
|
||||||
|
requestDefaults: {
|
||||||
|
baseURL: '={{$credentials.url}}',
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "jellyfin-n8n",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Auto-generated n8n node for Jellyfin",
|
||||||
|
"main": "dist/nodes/Jellyfin/Jellyfin.node.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc && gulp copy:icons",
|
||||||
|
"dev": "tsc -w"
|
||||||
|
},
|
||||||
|
"n8n": {
|
||||||
|
"n8nNodesApiVersion": 1,
|
||||||
|
"credentials": [
|
||||||
|
"dist/credentials/JellyfinApi.credentials.js"
|
||||||
|
],
|
||||||
|
"nodes": [
|
||||||
|
"dist/nodes/Jellyfin/Jellyfin.node.js"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^18.0.0",
|
||||||
|
"gulp": "^4.0.2",
|
||||||
|
"n8n-core": "*",
|
||||||
|
"n8n-workflow": "*",
|
||||||
|
"typescript": "^4.8.4"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@devlikeapro/n8n-openapi-node": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es2019",
|
||||||
|
"lib": ["es2019"],
|
||||||
|
"outDir": "dist",
|
||||||
|
"rootDir": "./",
|
||||||
|
"strict": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"resolveJsonModule": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"nodes/**/*.ts",
|
||||||
|
"credentials/**/*.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user