1645 lines
53 KiB
JSON
1645 lines
53 KiB
JSON
{
|
|
"name": "pruefen-und-importieren",
|
|
"nodes": [
|
|
{
|
|
"parameters": {},
|
|
"type": "n8n-nodes-base.manualTrigger",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
-460,
|
|
100
|
|
],
|
|
"id": "1672e3ce-2e45-48a3-bb31-dd70e8e01e66",
|
|
"name": "Manuell starten"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "pruefen-und-importieren",
|
|
"responseMode": "onReceived",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.webhook",
|
|
"typeVersion": 2.1,
|
|
"position": [
|
|
-460,
|
|
280
|
|
],
|
|
"id": "2f61cedf-09a4-4f7f-9c5d-6a85778f4206",
|
|
"name": "Webhook Start",
|
|
"webhookId": "6363e34d-b371-47ab-b48a-2b8fff7e3e1d"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "manual",
|
|
"assignments": {
|
|
"assignments": [
|
|
{
|
|
"id": "626dcb0d-2f72-4a9a-9a5d-d503f5282fb3",
|
|
"name": "nw_base",
|
|
"value": "https://app.neuronwriter.com/neuron-api/0.5/writer",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "d5cd20b9-8924-45ec-8676-be4d6967d696",
|
|
"name": "gitea_base",
|
|
"value": "https://gitea.lucas-orth.de",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "4cf84d9a-b123-454b-997a-8a729c8e822f",
|
|
"name": "gitea_owner",
|
|
"value": "lucas.orth",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "669399d0-fc3a-4732-9ca4-b54c3bb3cb99",
|
|
"name": "gitea_repo",
|
|
"value": "Skrift-Auto-Article",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "3fe40194-e6f0-4c2b-a2c2-09ce14e72628",
|
|
"name": "branch",
|
|
"value": "main",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "e192fbf8-a43f-425e-84fc-326e1adfd371",
|
|
"name": "artikel_ordner",
|
|
"value": "artikel",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "c05fc266-62af-40fa-af34-9ff78d737b7c",
|
|
"name": "brief_ordner",
|
|
"value": "briefe",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "7ba0d52a-562d-458e-8174-3668839dc51e",
|
|
"name": "nachbessern_ordner",
|
|
"value": "nachbessern",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "f0ed3f23-e06d-44f6-8552-a39e18f6c940",
|
|
"name": "status_pfad",
|
|
"value": "status-importe.json",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "1f58adf1-dd6d-41cf-a968-1fbd42a67d92",
|
|
"name": "wp_base",
|
|
"value": "https://skrift.de",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"id": "66ba99ca-640b-4c7f-a62a-10a156413eeb",
|
|
"name": "score_ziel",
|
|
"value": 72,
|
|
"type": "number"
|
|
},
|
|
{
|
|
"id": "ae433f97-9f29-45d1-b246-6c798e871818",
|
|
"name": "pause_zwischen_artikeln",
|
|
"value": 5,
|
|
"type": "number"
|
|
},
|
|
{
|
|
"id": "99d6bffe-713d-485e-8f97-42a550d97705",
|
|
"name": "benachrichtigung_an",
|
|
"value": "privat@lucas-orth.de",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.set",
|
|
"typeVersion": 3.4,
|
|
"position": [
|
|
-240,
|
|
190
|
|
],
|
|
"id": "24f0589f-6595-434f-887d-ea4f514fe2f2",
|
|
"name": "Konfiguration"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "GET",
|
|
"url": "={{ $json.gitea_base }}/api/v1/repos/{{ $json.gitea_owner }}/{{ $json.gitea_repo }}/contents/{{ $json.artikel_ordner }}?ref={{ $json.branch }}",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": true,
|
|
"fullResponse": true
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
-20,
|
|
190
|
|
],
|
|
"id": "9339e23d-346d-41ce-afd3-a54b156d45f4",
|
|
"name": "Artikelordner lesen",
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"id": "VOD4JM5zwpSC8wAr",
|
|
"name": "Gitea Skrift Auto Article"
|
|
}
|
|
},
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 3000
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst antwort = $input.first().json;\nif (antwort.statusCode === 404) {\n return [{ json: { leer: true, grund: 'Ordner \"artikel\" existiert noch nicht im Repo.' } }];\n}\nif (antwort.statusCode !== 200) {\n throw new Error('Artikelordner konnte nicht gelesen werden (HTTP ' + antwort.statusCode\n + '). Antwort: ' + JSON.stringify(antwort.body).slice(0, 400));\n}\nconst dateien = (antwort.body || []).filter(e =>\n e.type === 'file' && /^artikel-.+\\.json$/.test(e.name));\n\nif (!dateien.length) {\n return [{ json: { leer: true, grund: 'Keine Dateien nach Muster artikel-<slug>.json gefunden.' } }];\n}\nreturn dateien.map(d => ({ json: {\n name: d.name, pfad: d.path, sha: d.sha,\n slug: d.name.replace(/^artikel-/, '').replace(/\\.json$/, ''),\n}}));\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
200,
|
|
190
|
|
],
|
|
"id": "09bd880f-76b6-4789-89ba-847550dfd368",
|
|
"name": "Artikeldateien filtern"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "loose",
|
|
"version": 2
|
|
},
|
|
"conditions": [
|
|
{
|
|
"id": "8ab83719-1d1d-45ac-baed-72435ed39667",
|
|
"leftValue": "={{ $json.leer === true }}",
|
|
"rightValue": "",
|
|
"operator": {
|
|
"type": "boolean",
|
|
"operation": "true",
|
|
"singleValue": true
|
|
}
|
|
}
|
|
],
|
|
"combinator": "and"
|
|
},
|
|
"looseTypeValidation": true,
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 2.2,
|
|
"position": [
|
|
420,
|
|
190
|
|
],
|
|
"id": "73a94681-412a-4c21-8da2-4f57b69e1f66",
|
|
"name": "Artikel vorhanden?"
|
|
},
|
|
{
|
|
"parameters": {},
|
|
"type": "n8n-nodes-base.noOp",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
640,
|
|
40
|
|
],
|
|
"id": "c3a5e351-bfc7-4071-abf1-955f6a06f5bb",
|
|
"name": "Nichts zu tun"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"batchSize": 1,
|
|
"options": {
|
|
"reset": false
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.splitInBatches",
|
|
"typeVersion": 3,
|
|
"position": [
|
|
640,
|
|
320
|
|
],
|
|
"id": "1ea30d47-559f-4acc-bc05-7545a71690a6",
|
|
"name": "Artikel nacheinander"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "GET",
|
|
"url": "={{ $('Konfiguration').first().json.gitea_base }}/api/v1/repos/{{ $('Konfiguration').first().json.gitea_owner }}/{{ $('Konfiguration').first().json.gitea_repo }}/contents/{{ $json.pfad }}?ref={{ $('Konfiguration').first().json.branch }}",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": false
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
900,
|
|
420
|
|
],
|
|
"id": "8b6d1d9e-eaf9-411e-a440-6faedbd3e306",
|
|
"name": "Artikeldatei laden",
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"id": "VOD4JM5zwpSC8wAr",
|
|
"name": "Gitea Skrift Auto Article"
|
|
}
|
|
},
|
|
"onError": "continueErrorOutput",
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 3000
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst a = $('Artikel nacheinander').first().json;\nreturn [{ json: { slug: a.slug, ergebnis: 'fehler', stufe: 'artikel-laden',\n meldung: 'Artikeldatei ' + a.pfad + ' konnte nicht geladen werden: '\n + JSON.stringify($input.first().json).slice(0, 400) }}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
900,
|
|
640
|
|
],
|
|
"id": "67a6dc51-5a69-4a7e-b2f7-4cb0f160bc7b",
|
|
"name": "Fehler Artikeldatei",
|
|
"onError": "continueRegularOutput"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "GET",
|
|
"url": "={{ $('Konfiguration').first().json.gitea_base }}/api/v1/repos/{{ $('Konfiguration').first().json.gitea_owner }}/{{ $('Konfiguration').first().json.gitea_repo }}/contents/{{ $('Konfiguration').first().json.brief_ordner }}/brief-{{ $('Artikel nacheinander').first().json.slug }}.json?ref={{ $('Konfiguration').first().json.branch }}",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": true,
|
|
"fullResponse": true
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
1120,
|
|
420
|
|
],
|
|
"id": "c03ef3a0-aa7b-49a6-8cd4-d0c61c4c7f6a",
|
|
"name": "Brief laden",
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"id": "VOD4JM5zwpSC8wAr",
|
|
"name": "Gitea Skrift Auto Article"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst meta = $('Artikel nacheinander').first().json;\nconst artRoh = $('Artikeldatei laden').first().json;\nconst briefAntwort = $input.first().json;\n\nlet artikel;\ntry { artikel = JSON.parse(Buffer.from(artRoh.content, 'base64').toString('utf8')); }\ncatch (e) { throw new Error('artikel-' + meta.slug + '.json ist kein gueltiges JSON: ' + e.message); }\n\nconst pflicht = ['slug', 'titel', 'query_id', 'kategorie', 'content_html'];\nconst fehlt = pflicht.filter(f => !artikel[f]);\nif (fehlt.length) {\n throw new Error('artikel-' + meta.slug + '.json fehlen Pflichtfelder: ' + fehlt.join(', ')\n + '. Erwartetes Format siehe README Abschnitt \"Vertrag Cowork -> Workflow 2\".');\n}\nif (artikel.slug !== meta.slug) {\n throw new Error('Slug im Dateinamen (' + meta.slug + ') und im JSON (' + artikel.slug + ') stimmen nicht ueberein.');\n}\n\nlet brief = null;\nif (briefAntwort.statusCode === 200 && briefAntwort.body && briefAntwort.body.content) {\n try { brief = JSON.parse(Buffer.from(briefAntwort.body.content, 'base64').toString('utf8')); }\n catch (e) { brief = null; }\n}\n\nreturn [{ json: { slug: meta.slug, artikel, brief, brief_vorhanden: !!brief } }];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1340,
|
|
420
|
|
],
|
|
"id": "bfb21a1d-46f8-4fd1-aa04-d99fa7760db1",
|
|
"name": "Artikel pruefen"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "={{ $('Konfiguration').first().json.nw_base }}/evaluate-content",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": false
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ JSON.stringify({ query: $json.artikel.query_id, html: $json.artikel.content_html, title: $json.artikel.seo_titel || $json.artikel.titel, description: $json.artikel.seo_beschreibung || '' }) }}",
|
|
"sendHeaders": true,
|
|
"specifyHeaders": "json",
|
|
"jsonHeaders": "={\"Content-Type\":\"application/json\"}"
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
1560,
|
|
420
|
|
],
|
|
"id": "496e71b7-c180-4672-a9d2-f07f41770d64",
|
|
"name": "Score ermitteln",
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"id": "U23n2O980GKWocWq",
|
|
"name": "NeuronWriter API"
|
|
}
|
|
},
|
|
"onError": "continueErrorOutput",
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 3000
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst p = $('Artikel pruefen').first().json;\nreturn [{ json: { slug: p.slug, ergebnis: 'fehler', stufe: 'evaluate-content',\n meldung: 'NeuronWriter /evaluate-content fehlgeschlagen. Haeufigste Ursache: query_id \"'\n + p.artikel.query_id + '\" existiert nicht oder gehoert zu einem anderen Projekt. Antwort: '\n + JSON.stringify($input.first().json).slice(0, 400) }}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1560,
|
|
640
|
|
],
|
|
"id": "1d96b2cf-36d5-4297-b898-8e2228575372",
|
|
"name": "Fehler Score",
|
|
"onError": "continueRegularOutput"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst p = $('Artikel pruefen').first().json;\nconst e = $input.first().json;\nconst ziel = $('Konfiguration').first().json.score_ziel;\n\nif (typeof e.content_score !== 'number') {\n throw new Error('NeuronWriter lieferte kein numerisches content_score. Antwort: '\n + JSON.stringify(e).slice(0, 300));\n}\nreturn [{ json: { ...p, score: e.content_score, score_ziel: ziel, bestanden: e.content_score >= ziel } }];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1780,
|
|
420
|
|
],
|
|
"id": "4cb5e1f7-2dce-4946-9a06-4f40599a26dd",
|
|
"name": "Score auswerten"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "loose",
|
|
"version": 2
|
|
},
|
|
"conditions": [
|
|
{
|
|
"id": "ab5cb32a-2031-4584-a8d7-651e68611b93",
|
|
"leftValue": "={{ $json.bestanden }}",
|
|
"rightValue": "",
|
|
"operator": {
|
|
"type": "boolean",
|
|
"operation": "true",
|
|
"singleValue": true
|
|
}
|
|
}
|
|
],
|
|
"combinator": "and"
|
|
},
|
|
"looseTypeValidation": true,
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 2.2,
|
|
"position": [
|
|
2000,
|
|
420
|
|
],
|
|
"id": "b33eb7d4-7c48-4f5a-befe-323da4dbca8d",
|
|
"name": "Score erreicht?"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\n// /evaluate-content liefert nur {status, content_score}, keine Begriffsliste.\n// Die Luecken werden deshalb gegen den Brief aus Workflow 1 selbst berechnet.\nconst s = $input.first().json;\nconst brief = s.brief;\n\nconst text = String(s.artikel.content_html || '')\n .replace(/<script[\\s\\S]*?<\\/script>/gi, ' ')\n .replace(/<style[\\s\\S]*?<\\/style>/gi, ' ')\n .replace(/<[^>]+>/g, ' ')\n .replace(/ /g, ' ')\n .replace(/\\s+/g, ' ')\n .toLowerCase();\n\nconst zaehle = (begriff) => {\n const b = String(begriff).toLowerCase().trim();\n if (!b) return 0;\n return text.split(b).length - 1;\n};\n\nconst pruefe = (liste) => (liste || []).map(e => {\n const ist = zaehle(e.begriff);\n const min = e.min ?? 1;\n return { begriff: e.begriff, soll_min: min, soll_max: e.max ?? null, ist,\n fehlt: ist < min, luecke: Math.max(0, min - ist) };\n});\n\nlet pflicht = [], erweitert = [], fragen_offen = [];\nif (brief) {\n pflicht = pruefe(brief.begriffe_pflicht).filter(x => x.fehlt);\n erweitert = pruefe(brief.begriffe_erweitert).filter(x => x.fehlt);\n fragen_offen = (brief.fragen || [])\n .filter(f => f.gewicht && f.gewicht >= 6)\n .filter(f => {\n const kern = String(f.frage).toLowerCase()\n .replace(/[?.,!]/g, '').split(' ').filter(w => w.length > 5).slice(0, 3);\n return kern.length ? !kern.every(w => text.includes(w)) : false;\n })\n .map(f => ({ frage: f.frage, gewicht: f.gewicht }));\n}\n\nconst woerter = text.split(' ').filter(Boolean).length;\n\nconst bericht = {\n slug: s.slug,\n titel: s.artikel.titel,\n query_id: s.artikel.query_id,\n score: s.score,\n score_ziel: s.score_ziel,\n geprueft_am: new Date().toISOString(),\n brief_vorhanden: s.brief_vorhanden,\n wortzahl: { ist: woerter, ziel: brief ? brief.wortzahl_ziel : null,\n differenz: brief && brief.wortzahl_ziel ? woerter - brief.wortzahl_ziel : null },\n fehlende_pflichtbegriffe: pflicht,\n fehlende_zusatzbegriffe: erweitert,\n unbeantwortete_fragen: fragen_offen,\n hinweis: s.brief_vorhanden\n ? 'Begriffe gegen briefe/brief-' + s.slug + '.json abgeglichen. Zaehlung als Teilstring, Komposita zaehlen mit.'\n : 'Kein Brief gefunden, daher nur der Score. Workflow 1 fuer diesen Slug erneut laufen lassen.',\n};\n\nconst konf = $('Konfiguration').first().json;\nreturn [{ json: { slug: s.slug, score: s.score, bericht,\n pfad: konf.nachbessern_ordner + '/nachbessern-' + s.slug + '.json',\n anzahl_pflicht: pflicht.length, anzahl_erweitert: erweitert.length }}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
2220,
|
|
640
|
|
],
|
|
"id": "00bcc501-e2f3-4902-ae1e-55d22c470b07",
|
|
"name": "Fehlende Begriffe ermitteln"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "GET",
|
|
"url": "={{ $('Konfiguration').first().json.gitea_base }}/api/v1/repos/{{ $('Konfiguration').first().json.gitea_owner }}/{{ $('Konfiguration').first().json.gitea_repo }}/contents/{{ $json.pfad }}?ref={{ $('Konfiguration').first().json.branch }}",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": true,
|
|
"fullResponse": true
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
2440,
|
|
640
|
|
],
|
|
"id": "a192685f-1936-4bfa-944b-23f9a5eee52f",
|
|
"name": "Nachbesserung vorhanden?",
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"id": "VOD4JM5zwpSC8wAr",
|
|
"name": "Gitea Skrift Auto Article"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst n = $('Fehlende Begriffe ermitteln').first().json;\nconst p = $input.first().json;\nconst da = p.statusCode === 200 && p.body && p.body.sha;\nconst konf = $('Konfiguration').first().json;\nreturn [{ json: { ...n, methode: da ? 'PUT' : 'POST', commit_body: JSON.stringify({\n content: Buffer.from(JSON.stringify(n.bericht, null, 2), 'utf8').toString('base64'),\n message: `Nachbesserung ${n.slug}: Score ${n.score} unter Ziel`,\n branch: konf.branch, ...(da ? { sha: p.body.sha } : {}),\n})}}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
2660,
|
|
640
|
|
],
|
|
"id": "ab3c50cd-468d-42b6-bb76-99b0ad4dea68",
|
|
"name": "Nachbesserung vorbereiten"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "={{ $json.methode }}",
|
|
"url": "={{ $('Konfiguration').first().json.gitea_base }}/api/v1/repos/{{ $('Konfiguration').first().json.gitea_owner }}/{{ $('Konfiguration').first().json.gitea_repo }}/contents/{{ $json.pfad }}",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": false
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ $json.commit_body }}",
|
|
"sendHeaders": true,
|
|
"specifyHeaders": "json",
|
|
"jsonHeaders": "={\"Content-Type\":\"application/json\"}"
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
2880,
|
|
640
|
|
],
|
|
"id": "c67daa49-e5a9-4651-8148-4d314360cb44",
|
|
"name": "Nachbesserung committen",
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"id": "VOD4JM5zwpSC8wAr",
|
|
"name": "Gitea Skrift Auto Article"
|
|
}
|
|
},
|
|
"onError": "continueErrorOutput",
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 3000
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst n = $('Fehlende Begriffe ermitteln').first().json;\nreturn [{ json: { slug: n.slug, ergebnis: 'fehler', stufe: 'nachbessern-commit', score: n.score,\n meldung: 'Nachbesserungsdatei konnte nicht geschrieben werden: '\n + JSON.stringify($input.first().json).slice(0, 400) }}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
2880,
|
|
860
|
|
],
|
|
"id": "66596b5c-ae26-4588-9559-6dab3042104c",
|
|
"name": "Fehler Nachbesserung",
|
|
"onError": "continueRegularOutput"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst n = $('Fehlende Begriffe ermitteln').first().json;\nreturn [{ json: { slug: n.slug, ergebnis: 'nachbessern', score: n.score,\n score_ziel: n.bericht.score_ziel, pfad: n.pfad,\n anzahl_pflicht: n.anzahl_pflicht, anzahl_erweitert: n.anzahl_erweitert,\n wortzahl: n.bericht.wortzahl,\n meldung: `Score ${n.score} unter Ziel ${n.bericht.score_ziel}. `\n + `${n.anzahl_pflicht} Pflichtbegriffe fehlen, ${n.anzahl_erweitert} Zusatzbegriffe.` }}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
3100,
|
|
640
|
|
],
|
|
"id": "54395aa6-a6d9-4d20-8fdd-2f979b1238ea",
|
|
"name": "Nachbesserung gemerkt"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "={{ $('Konfiguration').first().json.nw_base }}/import-content",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": false
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ JSON.stringify({ query: $json.artikel.query_id, html: $json.artikel.content_html, title: $json.artikel.seo_titel || $json.artikel.titel, description: $json.artikel.seo_beschreibung || '' }) }}",
|
|
"sendHeaders": true,
|
|
"specifyHeaders": "json",
|
|
"jsonHeaders": "={\"Content-Type\":\"application/json\"}"
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
2220,
|
|
240
|
|
],
|
|
"id": "9a8d7b0b-a088-4bad-85b5-1b58060dd76b",
|
|
"name": "Revision zu NeuronWriter",
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"id": "U23n2O980GKWocWq",
|
|
"name": "NeuronWriter API"
|
|
}
|
|
},
|
|
"onError": "continueErrorOutput",
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 3000
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst s = $('Score auswerten').first().json;\nreturn [{ json: { ...s, import_warnung: 'Revision konnte nicht zu NeuronWriter gespeichert werden: '\n + JSON.stringify($input.first().json).slice(0, 300) }}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
2220,
|
|
60
|
|
],
|
|
"id": "8f65fab0-fde9-41a2-9af7-22c94311bd8c",
|
|
"name": "Fehler Revision",
|
|
"onError": "continueRegularOutput"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "GET",
|
|
"url": "={{ $('Konfiguration').first().json.wp_base }}/wp-json/wp/v2/posts?slug={{ $('Score auswerten').first().json.slug }}&status=publish,draft,pending,future,private&context=edit",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpBasicAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": true,
|
|
"fullResponse": true
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
2440,
|
|
240
|
|
],
|
|
"id": "038f803f-0e6f-46f5-919c-2481224a8dc4",
|
|
"name": "Beitrag vorhanden?",
|
|
"credentials": {
|
|
"httpBasicAuth": {
|
|
"id": "WIN05TZgM0K5VOGy",
|
|
"name": "WP skrift.de Redakteur"
|
|
}
|
|
},
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 3000
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "GET",
|
|
"url": "={{ $('Konfiguration').first().json.wp_base }}/wp-json/wp/v2/categories?search={{ encodeURIComponent($('Score auswerten').first().json.artikel.kategorie) }}&per_page=100",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpBasicAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": true,
|
|
"fullResponse": true
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
2660,
|
|
240
|
|
],
|
|
"id": "73d6a0e6-7d2e-4a40-8115-769f2d25ed0e",
|
|
"name": "Kategorie suchen",
|
|
"credentials": {
|
|
"httpBasicAuth": {
|
|
"id": "WIN05TZgM0K5VOGy",
|
|
"name": "WP skrift.de Redakteur"
|
|
}
|
|
},
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 3000
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst s = $('Score auswerten').first().json;\nconst gesucht = String(s.artikel.kategorie).trim();\nconst antwort = $input.first().json;\nconst treffer = (antwort.statusCode === 200 && Array.isArray(antwort.body))\n ? antwort.body.find(c => c.name.toLowerCase() === gesucht.toLowerCase()) : null;\nreturn [{ json: { ...s, kategorie_id: treffer ? treffer.id : null,\n kategorie_name: gesucht, kategorie_fehlt: !treffer } }];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
2880,
|
|
240
|
|
],
|
|
"id": "62618b8c-8712-4547-a27c-c041ae3497a1",
|
|
"name": "Kategorie pruefen"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "loose",
|
|
"version": 2
|
|
},
|
|
"conditions": [
|
|
{
|
|
"id": "3144ce37-9b76-4e0e-9d3e-07f4367a7f4d",
|
|
"leftValue": "={{ $json.kategorie_fehlt }}",
|
|
"rightValue": "",
|
|
"operator": {
|
|
"type": "boolean",
|
|
"operation": "true",
|
|
"singleValue": true
|
|
}
|
|
}
|
|
],
|
|
"combinator": "and"
|
|
},
|
|
"looseTypeValidation": true,
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 2.2,
|
|
"position": [
|
|
3100,
|
|
240
|
|
],
|
|
"id": "89ff9876-f1c2-4497-a9d7-6b53323acc56",
|
|
"name": "Kategorie anlegen?"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "={{ $('Konfiguration').first().json.wp_base }}/wp-json/wp/v2/categories",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpBasicAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": false
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ JSON.stringify({ name: $json.kategorie_name }) }}",
|
|
"sendHeaders": true,
|
|
"specifyHeaders": "json",
|
|
"jsonHeaders": "={\"Content-Type\":\"application/json\"}"
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
3320,
|
|
140
|
|
],
|
|
"id": "d79e1c1f-3de8-4287-85ed-aa6c61a11f85",
|
|
"name": "Kategorie anlegen",
|
|
"credentials": {
|
|
"httpBasicAuth": {
|
|
"id": "WIN05TZgM0K5VOGy",
|
|
"name": "WP skrift.de Redakteur"
|
|
}
|
|
},
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 3000
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst s = $('Kategorie pruefen').first().json;\nconst e = $input.first().json;\nconst id = s.kategorie_id || e.id || null;\nif (!id) {\n throw new Error('Kategorie \"' + s.kategorie_name + '\" konnte weder gefunden noch angelegt werden. '\n + 'Antwort: ' + JSON.stringify(e).slice(0, 300));\n}\nreturn [{ json: { ...s, kategorie_id: id } }];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
3540,
|
|
240
|
|
],
|
|
"id": "3e297808-4e25-4a32-96b8-bd85fd99195b",
|
|
"name": "Kategorie festlegen"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst s = $input.first().json;\nconst dup = $('Beitrag vorhanden?').first().json;\nconst a = s.artikel;\n\n// Duplikatspruefung: exakter Slug-Treffer entscheidet ueber anlegen oder aktualisieren.\nconst treffer = (dup.statusCode === 200 && Array.isArray(dup.body))\n ? dup.body.find(p => p.slug === s.slug) : null;\n\nconst heute = new Date().toISOString().slice(0, 10);\n\nconst meta = {\n kurzantwort: a.kurzantwort || '',\n cta_ziel: a.cta_ziel || '',\n stand_datum: a.stand_datum || heute,\n faq: Array.isArray(a.faq)\n ? a.faq.filter(f => f && f.frage).map(f => ({ frage: String(f.frage), antwort: String(f.antwort || '') }))\n : [],\n _seopress_titles_title: a.seo_titel || a.titel,\n _seopress_titles_desc: a.seo_beschreibung || '',\n _seopress_analysis_target_kw: a.keyword || '',\n};\n\nconst body = {\n title: a.titel,\n slug: s.slug,\n content: a.content_html,\n status: 'draft', // harte Vorgabe: nie automatisch veroeffentlichen\n categories: [s.kategorie_id],\n meta,\n};\nif (a.auszug) body.excerpt = a.auszug;\n\nreturn [{ json: {\n ...s,\n vorhanden: !!treffer,\n post_id: treffer ? treffer.id : null,\n alter_status: treffer ? treffer.status : null,\n wp_url: treffer\n ? `${$('Konfiguration').first().json.wp_base}/wp-json/wp/v2/posts/${treffer.id}`\n : `${$('Konfiguration').first().json.wp_base}/wp-json/wp/v2/posts`,\n wp_body: JSON.stringify(body),\n}}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
3760,
|
|
240
|
|
],
|
|
"id": "13917c1b-ac7f-4c89-9758-1dd677a4607b",
|
|
"name": "WordPress-Body bauen"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "={{ $json.wp_url }}",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpBasicAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": false
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ $json.wp_body }}",
|
|
"sendHeaders": true,
|
|
"specifyHeaders": "json",
|
|
"jsonHeaders": "={\"Content-Type\":\"application/json\"}"
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
3980,
|
|
240
|
|
],
|
|
"id": "5ced40d2-3597-4511-b744-f26b97a3631e",
|
|
"name": "Beitrag anlegen oder aktualisieren",
|
|
"credentials": {
|
|
"httpBasicAuth": {
|
|
"id": "WIN05TZgM0K5VOGy",
|
|
"name": "WP skrift.de Redakteur"
|
|
}
|
|
},
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 3000
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst v = $('WordPress-Body bauen').first().json;\nconst p = $input.first().json;\n\nif (!p.id) {\n throw new Error('WordPress lieferte keine Beitrags-ID zurueck. Antwort: '\n + JSON.stringify(p).slice(0, 400));\n}\nif (p.status !== 'draft') {\n throw new Error('Beitrag ' + p.id + ' hat Status \"' + p.status\n + '\" statt \"draft\". Der Workflow darf nie veroeffentlichen. Bitte pruefen.');\n}\n\n// Gegenprobe: sind die Meta-Felder wirklich angekommen?\nconst m = p.meta || {};\nconst fehlend = ['kurzantwort', 'cta_ziel', 'stand_datum', 'faq']\n .filter(k => m[k] === undefined);\nconst faq_ok = Array.isArray(m.faq) ? m.faq.length : -1;\n\nconst konf = $('Konfiguration').first().json;\nreturn [{ json: {\n slug: v.slug, ergebnis: 'importiert', score: v.score, score_ziel: v.score_ziel,\n post_id: p.id, aktion: v.vorhanden ? 'aktualisiert' : 'neu angelegt',\n alter_status: v.alter_status, status: p.status,\n kategorie: v.kategorie_name, kategorie_id: v.kategorie_id,\n vorschau_url: `${konf.wp_base}/?p=${p.id}&preview=true`,\n bearbeiten_url: `${konf.wp_base}/wp-admin/post.php?post=${p.id}&action=edit`,\n meta_warnung: fehlend.length\n ? 'Diese Meta-Felder kamen nicht zurueck: ' + fehlend.join(', ')\n + '. Mu-Plugin skrift-ratgeber-felder.php installiert?'\n : null,\n faq_eintraege: faq_ok,\n seo_titel: (p.meta || {})._seopress_titles_title || null,\n}}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
4200,
|
|
240
|
|
],
|
|
"id": "a3cd590e-9170-4ff7-9b38-75a0ad5d662a",
|
|
"name": "Ergebnis pruefen"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "={{ $('Konfiguration').first().json.wp_base }}/wp-json/seopress/v1/commands/clear-cache",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpBasicAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": true,
|
|
"fullResponse": true
|
|
}
|
|
},
|
|
"timeout": 30000
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ JSON.stringify({}) }}",
|
|
"sendHeaders": true,
|
|
"specifyHeaders": "json",
|
|
"jsonHeaders": "={\"Content-Type\":\"application/json\"}"
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
4420,
|
|
240
|
|
],
|
|
"id": "6482a2c3-28f6-407a-8228-ca1fc2b56436",
|
|
"name": "Cache leeren",
|
|
"credentials": {
|
|
"httpBasicAuth": {
|
|
"id": "WIN05TZgM0K5VOGy",
|
|
"name": "WP skrift.de Redakteur"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst r = $('Ergebnis pruefen').first().json;\nconst c = $input.first().json;\nreturn [{ json: { ...r,\n cache_geleert: c.statusCode === 200,\n cache_hinweis: c.statusCode === 200 ? null\n : 'Cache-Endpunkt antwortete mit HTTP ' + c.statusCode + '. Kein Abbruchgrund.' }}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
4640,
|
|
240
|
|
],
|
|
"id": "0976c724-324f-4969-9e37-bae30d40d852",
|
|
"name": "Importergebnis merken"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"amount": "={{ $('Konfiguration').first().json.pause_zwischen_artikeln }}",
|
|
"unit": "seconds"
|
|
},
|
|
"type": "n8n-nodes-base.wait",
|
|
"typeVersion": 1.1,
|
|
"position": [
|
|
4860,
|
|
420
|
|
],
|
|
"id": "b643ef48-5c52-4524-96bf-d3d794fdcceb",
|
|
"name": "Pause Rate Limit",
|
|
"webhookId": "8ccb2087-3c7e-44bc-9d71-facd6a9569cb"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst alle = $input.all().map(i => i.json);\nconst importiert = alle.filter(r => r.ergebnis === 'importiert');\nconst nachbessern = alle.filter(r => r.ergebnis === 'nachbessern');\nconst fehler = alle.filter(r => r.ergebnis === 'fehler');\n\nconst zeilen = importiert.map(r => ({\n slug: r.slug, score: r.score, datum: new Date().toISOString(),\n post_id: r.post_id, vorschau_url: r.vorschau_url,\n aktion: r.aktion, kategorie: r.kategorie,\n}));\n\nreturn [{ json: { alle, importiert, nachbessern, fehler,\n neue_zeilen: zeilen,\n anzahl_importiert: importiert.length,\n anzahl_nachbessern: nachbessern.length,\n anzahl_fehler: fehler.length }}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
900,
|
|
80
|
|
],
|
|
"id": "d667118f-4d70-4d35-b448-522228a05542",
|
|
"name": "Ergebnisse sammeln"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "GET",
|
|
"url": "={{ $('Konfiguration').first().json.gitea_base }}/api/v1/repos/{{ $('Konfiguration').first().json.gitea_owner }}/{{ $('Konfiguration').first().json.gitea_repo }}/contents/{{ $('Konfiguration').first().json.status_pfad }}?ref={{ $('Konfiguration').first().json.branch }}",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": true,
|
|
"fullResponse": true
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
1120,
|
|
80
|
|
],
|
|
"id": "fb4d8e22-bfd5-41fe-8041-53b9ddffe489",
|
|
"name": "Statustabelle lesen",
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"id": "VOD4JM5zwpSC8wAr",
|
|
"name": "Gitea Skrift Auto Article"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst s = $('Ergebnisse sammeln').first().json;\nconst p = $input.first().json;\nconst konf = $('Konfiguration').first().json;\n\nlet bestand = [];\nlet sha = null;\nif (p.statusCode === 200 && p.body && p.body.content) {\n sha = p.body.sha;\n try { bestand = JSON.parse(Buffer.from(p.body.content, 'base64').toString('utf8')); }\n catch (e) { bestand = []; }\n if (!Array.isArray(bestand)) bestand = [];\n}\n\n// Je Slug nur die juengste Zeile behalten.\nconst neu = [...bestand];\ns.neue_zeilen.forEach(z => {\n const i = neu.findIndex(x => x.slug === z.slug);\n if (i >= 0) neu[i] = z; else neu.push(z);\n});\n\nreturn [{ json: { ueberspringen: s.neue_zeilen.length === 0, commit_body: JSON.stringify({\n content: Buffer.from(JSON.stringify(neu, null, 2), 'utf8').toString('base64'),\n message: `Import: ${s.anzahl_importiert} Beitrag/Beitraege als Entwurf`,\n branch: konf.branch, ...(sha ? { sha } : {}),\n}), methode: sha ? 'PUT' : 'POST' }}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1340,
|
|
80
|
|
],
|
|
"id": "594685bf-86df-4d55-bd5f-beb7e1496d08",
|
|
"name": "Statustabelle fortschreiben"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "loose",
|
|
"version": 2
|
|
},
|
|
"conditions": [
|
|
{
|
|
"id": "b1e74a2a-5318-4b76-a2c4-60d4862daf23",
|
|
"leftValue": "={{ $json.ueberspringen }}",
|
|
"rightValue": "",
|
|
"operator": {
|
|
"type": "boolean",
|
|
"operation": "true",
|
|
"singleValue": true
|
|
}
|
|
}
|
|
],
|
|
"combinator": "and"
|
|
},
|
|
"looseTypeValidation": true,
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 2.2,
|
|
"position": [
|
|
1560,
|
|
80
|
|
],
|
|
"id": "5eb207fb-6109-47ff-9bad-0f4d66cb9b10",
|
|
"name": "Gab es Importe?"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "={{ $json.methode }}",
|
|
"url": "={{ $('Konfiguration').first().json.gitea_base }}/api/v1/repos/{{ $('Konfiguration').first().json.gitea_owner }}/{{ $('Konfiguration').first().json.gitea_repo }}/contents/{{ $('Konfiguration').first().json.status_pfad }}",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": false
|
|
}
|
|
},
|
|
"timeout": 60000
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ $json.commit_body }}",
|
|
"sendHeaders": true,
|
|
"specifyHeaders": "json",
|
|
"jsonHeaders": "={\"Content-Type\":\"application/json\"}"
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
1780,
|
|
160
|
|
],
|
|
"id": "ba55974d-bc96-498e-aab2-129eff4f76eb",
|
|
"name": "Statustabelle schreiben",
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"id": "VOD4JM5zwpSC8wAr",
|
|
"name": "Gitea Skrift Auto Article"
|
|
}
|
|
},
|
|
"onError": "continueErrorOutput",
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 3000
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nreturn [{ json: { statustabelle_warnung: 'Statustabelle konnte nicht geschrieben werden: '\n + JSON.stringify($input.first().json).slice(0, 300) }}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1780,
|
|
340
|
|
],
|
|
"id": "d88cb84c-6b1b-4cef-ade5-8a4462928248",
|
|
"name": "Fehler Statustabelle",
|
|
"onError": "continueRegularOutput"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "runOnceForAllItems",
|
|
"jsCode": "\nconst s = $('Ergebnisse sammeln').first().json;\nconst z = [];\nz.push(`Importiert: ${s.anzahl_importiert} | Nachbessern: ${s.anzahl_nachbessern} | Fehler: ${s.anzahl_fehler}`);\nz.push('');\n\nif (s.importiert.length) {\n z.push('Als Entwurf in WordPress:');\n s.importiert.forEach(r => {\n z.push(` ${r.slug} (Score ${r.score}, ${r.aktion})`);\n z.push(` Vorschau: ${r.vorschau_url}`);\n z.push(` Bearbeiten: ${r.bearbeiten_url}`);\n if (r.meta_warnung) z.push(` ACHTUNG: ${r.meta_warnung}`);\n if (r.cache_hinweis) z.push(` Hinweis: ${r.cache_hinweis}`);\n });\n z.push('');\n}\nif (s.nachbessern.length) {\n z.push('Score zu niedrig, Nachbesserung liegt im Repo:');\n s.nachbessern.forEach(r => {\n z.push(` ${r.slug}: Score ${r.score} von ${r.score_ziel}`);\n z.push(` ${r.anzahl_pflicht} Pflichtbegriffe fehlen, ${r.anzahl_erweitert} Zusatzbegriffe`);\n if (r.wortzahl && r.wortzahl.differenz !== null) {\n z.push(` Wortzahl ${r.wortzahl.ist} von ${r.wortzahl.ziel} (${r.wortzahl.differenz > 0 ? '+' : ''}${r.wortzahl.differenz})`);\n }\n z.push(` Datei: ${r.pfad}`);\n });\n z.push('');\n}\nif (s.fehler.length) {\n z.push('Fehler:');\n s.fehler.forEach(r => z.push(` ${r.slug || '?'} [${r.stufe}]: ${r.meldung}`));\n z.push('');\n}\nz.push('Kein Beitrag wurde veroeffentlicht. Alle Importe stehen auf Entwurf.');\n\nreturn [{ json: {\n betreff: `Skrift Ratgeber: ${s.anzahl_importiert} Entwurf/Entwuerfe`\n + (s.anzahl_nachbessern ? `, ${s.anzahl_nachbessern} zum Nachbessern` : '')\n + (s.anzahl_fehler ? `, ${s.anzahl_fehler} Fehler` : ''),\n text: z.join('\\n') }}];\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
2000,
|
|
80
|
|
],
|
|
"id": "a462adda-f0fa-4290-a9bc-e234cb02dc55",
|
|
"name": "Meldung formulieren"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"fromEmail": "",
|
|
"toEmail": "={{ $('Konfiguration').first().json.benachrichtigung_an }}",
|
|
"subject": "={{ $json.betreff }}",
|
|
"emailFormat": "text",
|
|
"text": "={{ $json.text }}",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.emailSend",
|
|
"typeVersion": 2.1,
|
|
"position": [
|
|
2220,
|
|
80
|
|
],
|
|
"id": "005be690-894e-45cb-915e-c8c80e6c3214",
|
|
"name": "Benachrichtigung",
|
|
"disabled": true,
|
|
"notes": "SMTP-Credential zuweisen, Absender eintragen, dann aktivieren."
|
|
}
|
|
],
|
|
"connections": {
|
|
"Manuell starten": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Konfiguration",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Webhook Start": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Konfiguration",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Konfiguration": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Artikelordner lesen",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Artikelordner lesen": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Artikeldateien filtern",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Artikeldateien filtern": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Artikel vorhanden?",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Artikel vorhanden?": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Nichts zu tun",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Artikel nacheinander",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Artikel nacheinander": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Ergebnisse sammeln",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Artikeldatei laden",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Artikeldatei laden": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Brief laden",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fehler Artikeldatei",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Brief laden": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Artikel pruefen",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Artikel pruefen": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Score ermitteln",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Score ermitteln": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Score auswerten",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fehler Score",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Score auswerten": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Score erreicht?",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Score erreicht?": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Revision zu NeuronWriter",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fehlende Begriffe ermitteln",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fehlende Begriffe ermitteln": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Nachbesserung vorhanden?",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Nachbesserung vorhanden?": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Nachbesserung vorbereiten",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Nachbesserung vorbereiten": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Nachbesserung committen",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Nachbesserung committen": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Nachbesserung gemerkt",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fehler Nachbesserung",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Revision zu NeuronWriter": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Beitrag vorhanden?",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fehler Revision",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fehler Revision": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Beitrag vorhanden?",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Beitrag vorhanden?": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Kategorie suchen",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Kategorie suchen": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Kategorie pruefen",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Kategorie pruefen": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Kategorie anlegen?",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Kategorie anlegen?": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Kategorie anlegen",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Kategorie festlegen",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Kategorie anlegen": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Kategorie festlegen",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Kategorie festlegen": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "WordPress-Body bauen",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"WordPress-Body bauen": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Beitrag anlegen oder aktualisieren",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Beitrag anlegen oder aktualisieren": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Ergebnis pruefen",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Ergebnis pruefen": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Cache leeren",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Cache leeren": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Importergebnis merken",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Importergebnis merken": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Pause Rate Limit",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Nachbesserung gemerkt": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Pause Rate Limit",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fehler Nachbesserung": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Pause Rate Limit",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fehler Artikeldatei": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Pause Rate Limit",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fehler Score": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Pause Rate Limit",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Pause Rate Limit": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Artikel nacheinander",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Ergebnisse sammeln": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Statustabelle lesen",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Statustabelle lesen": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Statustabelle fortschreiben",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Statustabelle fortschreiben": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Gab es Importe?",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Gab es Importe?": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Meldung formulieren",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Statustabelle schreiben",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Statustabelle schreiben": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Meldung formulieren",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fehler Statustabelle",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fehler Statustabelle": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Meldung formulieren",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Meldung formulieren": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Benachrichtigung",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"settings": {
|
|
"executionOrder": "v1",
|
|
"saveManualExecutions": true,
|
|
"callerPolicy": "workflowsFromSameOwner"
|
|
}
|
|
} |