Created
March 18, 2025 16:58
-
-
Save eallion/cba91187d0349070308cb8554250023c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "SinkBlogtoMastodon", | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "owner": { | |
| "__rl": true, | |
| "value": "eallion", | |
| "mode": "name" | |
| }, | |
| "repository": { | |
| "__rl": true, | |
| "value": "eallion.com", | |
| "mode": "name" | |
| }, | |
| "events": [ | |
| "push" | |
| ], | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.githubTrigger", | |
| "typeVersion": 1, | |
| "position": [ | |
| -340, | |
| -120 | |
| ], | |
| "id": "6ea99614-9c0f-49a7-88db-f552dbac7952", | |
| "name": "Github Trigger", | |
| "webhookId": "b33dca07-0939-4107-a315-231bfab13df3", | |
| "credentials": { | |
| "githubApi": { | |
| "id": "8qzxqmikk9WEzTtg", | |
| "name": "GitHub account" | |
| } | |
| } | |
| }, | |
| { | |
| "parameters": { | |
| "url": "https://www.eallion.com/index.xml", | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.rssFeedRead", | |
| "typeVersion": 1.1, | |
| "position": [ | |
| -60, | |
| -120 | |
| ], | |
| "id": "b48c23ba-ef9a-4c2a-8d0d-e73c0de35ec1", | |
| "name": "BlogRSS", | |
| "alwaysOutputData": true, | |
| "executeOnce": true, | |
| "retryOnFail": true, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "url": "={{ $json.newLink }}", | |
| "options": { | |
| "response": { | |
| "response": { | |
| "fullResponse": true, | |
| "neverError": true | |
| } | |
| } | |
| } | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [ | |
| 460, | |
| -120 | |
| ], | |
| "id": "9fe05f54-5107-40e4-b979-2e22e029d4cc", | |
| "name": "FetchNewURL", | |
| "alwaysOutputData": true, | |
| "executeOnce": true, | |
| "retryOnFail": true, | |
| "notesInFlow": true, | |
| "onError": "continueErrorOutput", | |
| "notes": "Fetch New URL" | |
| }, | |
| { | |
| "parameters": { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "loose", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "id": "84ba6f92-1023-4902-997c-c6e3efd6ea38", | |
| "leftValue": "={{ $json.statusCode }}", | |
| "rightValue": "404", | |
| "operator": { | |
| "type": "string", | |
| "operation": "equals" | |
| } | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "looseTypeValidation": true, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.if", | |
| "typeVersion": 2.2, | |
| "position": [ | |
| 720, | |
| -120 | |
| ], | |
| "id": "fdf2464c-12c2-4ea8-85f5-f38ad9d0ff2a", | |
| "name": "CheckSlugExists", | |
| "executeOnce": true, | |
| "retryOnFail": true, | |
| "notesInFlow": true, | |
| "onError": "continueErrorOutput", | |
| "notes": "Check if 404" | |
| }, | |
| { | |
| "parameters": { | |
| "method": "POST", | |
| "url": "https://s.e5n.cc/api/link/create", | |
| "sendHeaders": true, | |
| "headerParameters": { | |
| "parameters": [ | |
| { | |
| "name": "authorization", | |
| "value": "Bearer eth000000" | |
| }, | |
| { | |
| "name": "content-type", | |
| "value": "application/json" | |
| } | |
| ] | |
| }, | |
| "sendBody": true, | |
| "bodyParameters": { | |
| "parameters": [ | |
| { | |
| "name": "url", | |
| "value": "={{ $json.body.uri }}" | |
| }, | |
| { | |
| "name": "slug", | |
| "value": "={{ $('ConvertBlogPost').item.json.slug }}" | |
| } | |
| ] | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [ | |
| 1240, | |
| -120 | |
| ], | |
| "id": "0b8ed4aa-ddba-4d1e-af96-24c39acb0b30", | |
| "name": "SinkAPICreate", | |
| "executeOnce": true, | |
| "retryOnFail": true, | |
| "notesInFlow": true, | |
| "notes": "Shorter the link with Sink" | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "// 获取 RSS 节点的第一条数据的 link\nconst originalTitle = $input.all()[0].json.title;\nconst originalLink = $input.all()[0].json.link;\nconst originalContent = $input.all()[0].json.content;\n\n// 替换域名为 s.e5n.cc\nconst newLink = originalLink.replace('www.eallion.com', 's.e5n.cc');\n\n// 提取 slug(例如 nas-building)\n// 使用字符串方法提取路径部分\nconst path = originalLink.split('/').slice(3).join('/'); // 移除协议和域名部分\nconst slug = path.replace(/\\/$/, ''); // 去除末尾的斜杠\n\n// 返回 newLink、originalLink 和 slug\nreturn [\n {\n json: {\n originalTitle,\n newLink,\n originalLink,\n slug,\n originalContent,\n },\n },\n];" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [ | |
| 200, | |
| -120 | |
| ], | |
| "id": "2750e5ce-1a04-4cfd-bc53-27cd0aff166a", | |
| "name": "ConvertBlogPost", | |
| "executeOnce": true, | |
| "retryOnFail": true, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "method": "POST", | |
| "url": "https://e5n.cc/api/v1/statuses", | |
| "authentication": "genericCredentialType", | |
| "genericAuthType": "oAuth2Api", | |
| "sendBody": true, | |
| "bodyParameters": { | |
| "parameters": [ | |
| { | |
| "name": "status", | |
| "value": "=大大的小蜗牛的博客发布新文章:《{{ $('ConvertBlogPost').item.json.originalTitle }}》\n{{ $('ConvertBlogPost').item.json.originalLink }}\n{{ $('ConvertBlogPost').item.json.originalContent }}" | |
| }, | |
| { | |
| "name": "visibility", | |
| "value": "public" | |
| } | |
| ] | |
| }, | |
| "options": { | |
| "response": { | |
| "response": { | |
| "fullResponse": true, | |
| "neverError": true | |
| } | |
| } | |
| } | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [ | |
| 980, | |
| -120 | |
| ], | |
| "id": "6f734551-c959-41e2-b05e-8691e76a265d", | |
| "name": "POSTtoMastodon", | |
| "notesInFlow": true, | |
| "executeOnce": true, | |
| "retryOnFail": true, | |
| "alwaysOutputData": true, | |
| "credentials": { | |
| "oAuth2Api": { | |
| "id": "GqNI5NcHBoCsIywV", | |
| "name": "Mastodon e5n" | |
| } | |
| }, | |
| "onError": "continueErrorOutput", | |
| "notes": "POST to Mastodon statuses" | |
| }, | |
| { | |
| "parameters": {}, | |
| "type": "n8n-nodes-base.manualTrigger", | |
| "typeVersion": 1, | |
| "position": [ | |
| -340, | |
| 160 | |
| ], | |
| "id": "f38321ef-5d2b-46b6-ad80-bb9ddda155eb", | |
| "name": "手动(测试用)", | |
| "disabled": true | |
| } | |
| ], | |
| "pinData": {}, | |
| "connections": { | |
| "Github Trigger": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "BlogRSS", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "BlogRSS": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "ConvertBlogPost", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "FetchNewURL": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "CheckSlugExists", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "CheckSlugExists": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "POSTtoMastodon", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [], | |
| [] | |
| ] | |
| }, | |
| "ConvertBlogPost": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "FetchNewURL", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "POSTtoMastodon": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "SinkAPICreate", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "手动(测试用)": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "BlogRSS", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| } | |
| }, | |
| "active": true, | |
| "settings": { | |
| "executionOrder": "v1" | |
| }, | |
| "versionId": "d770f441-b5d1-4f44-a596-31b8520295d4", | |
| "meta": { | |
| "templateCredsSetupCompleted": true, | |
| "instanceId": "f9ad6c4f03ea7c2c4f16a8dda8e47b847dcd27971aa32eadc1b11bbd6ff7d9f5" | |
| }, | |
| "id": "KzVqqCxAGWaVZAmG", | |
| "tags": [] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment