From 7ad2527e320b29416e17584c3d6c6c80496f4d93 Mon Sep 17 00:00:00 2001 From: Dnny44 Date: Mon, 6 Apr 2026 12:50:59 -0500 Subject: [PATCH] Inititalize Repo --- .gitea/workflows/build.yml | 41 ++++++++++++++++++++++++++ credentials/JellyfinApi.credentials.ts | 32 ++++++++++++++++++++ nodes/Jellyfin/Jellyfin.node.ts | 35 ++++++++++++++++++++++ package.json | 29 ++++++++++++++++++ tsconfig.json | 16 ++++++++++ 5 files changed, 153 insertions(+) create mode 100644 .gitea/workflows/build.yml create mode 100644 credentials/JellyfinApi.credentials.ts create mode 100644 nodes/Jellyfin/Jellyfin.node.ts create mode 100644 package.json create mode 100644 tsconfig.json diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..de5b5e5 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -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" \ No newline at end of file diff --git a/credentials/JellyfinApi.credentials.ts b/credentials/JellyfinApi.credentials.ts new file mode 100644 index 0000000..334c43e --- /dev/null +++ b/credentials/JellyfinApi.credentials.ts @@ -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}}' + } + }, + }; +} \ No newline at end of file diff --git a/nodes/Jellyfin/Jellyfin.node.ts b/nodes/Jellyfin/Jellyfin.node.ts new file mode 100644 index 0000000..0115d93 --- /dev/null +++ b/nodes/Jellyfin/Jellyfin.node.ts @@ -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', + }, + }, + }; +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..8726b0f --- /dev/null +++ b/package.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" + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..1f31194 --- /dev/null +++ b/tsconfig.json @@ -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" + ] +} \ No newline at end of file