swf-zsebhoki-publish-anime-post.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. {
  2. "active": true,
  3. "connections": [
  4. {
  5. "sourceNodeId": "input",
  6. "sourceOutput": "main",
  7. "targetInput": "data",
  8. "targetNodeId": "prep"
  9. },
  10. {
  11. "sourceNodeId": "trigger",
  12. "sourceOutput": "main",
  13. "targetInput": "data",
  14. "targetNodeId": "prep"
  15. },
  16. {
  17. "sourceNodeId": "prep",
  18. "sourceOutput": "main",
  19. "targetInput": "data",
  20. "targetNodeId": "upload"
  21. },
  22. {
  23. "sourceNodeId": "upload",
  24. "sourceOutput": "main",
  25. "targetInput": "data",
  26. "targetNodeId": "post"
  27. },
  28. {
  29. "sourceNodeId": "post",
  30. "sourceOutput": "main",
  31. "targetInput": "data",
  32. "targetNodeId": "tags_prep"
  33. },
  34. {
  35. "sourceNodeId": "tags_prep",
  36. "sourceOutput": "main",
  37. "targetInput": "data",
  38. "targetNodeId": "tags_loop"
  39. },
  40. {
  41. "sourceNodeId": "tags_loop",
  42. "sourceOutput": "loop",
  43. "targetInput": "data",
  44. "targetNodeId": "tag_item"
  45. },
  46. {
  47. "sourceNodeId": "tag_item",
  48. "sourceOutput": "main",
  49. "targetInput": "data",
  50. "targetNodeId": "tag_create"
  51. },
  52. {
  53. "sourceNodeId": "tag_create",
  54. "sourceOutput": "main",
  55. "targetInput": "data",
  56. "targetNodeId": "tag_find"
  57. },
  58. {
  59. "sourceNodeId": "tag_find",
  60. "sourceOutput": "main",
  61. "targetInput": "data",
  62. "targetNodeId": "tag_link_old"
  63. },
  64. {
  65. "sourceNodeId": "tag_link_old",
  66. "sourceOutput": "main",
  67. "targetInput": "data",
  68. "targetNodeId": "tags_loop"
  69. },
  70. {
  71. "sourceNodeId": "tags_loop",
  72. "sourceOutput": "done",
  73. "targetInput": "data",
  74. "targetNodeId": "out"
  75. }
  76. ],
  77. "name": "[SWF] zsebhoki - publish anime post",
  78. "nodes": [
  79. {
  80. "config": {
  81. "allowExtra": true,
  82. "fields": [
  83. {
  84. "description": "The image itself, as the binary object an image node or a download produces",
  85. "name": "file",
  86. "required": true
  87. },
  88. {
  89. "description": "Hungarian title",
  90. "name": "title_hu",
  91. "required": true
  92. },
  93. {
  94. "description": "English title",
  95. "name": "title_en",
  96. "required": true
  97. },
  98. {
  99. "description": "Hungarian body, markdown",
  100. "name": "content_hu",
  101. "required": true
  102. },
  103. {
  104. "description": "English body, markdown",
  105. "name": "content_en",
  106. "required": true
  107. },
  108. {
  109. "defaultValue": "",
  110. "description": "Left empty it is made from the English title. Must be unique on the site",
  111. "name": "slug",
  112. "required": false
  113. },
  114. {
  115. "defaultValue": "draft",
  116. "description": "draft or published. Draft by default - publishing needs both languages written",
  117. "name": "status",
  118. "required": false
  119. },
  120. {
  121. "defaultValue": "",
  122. "name": "cover_alt_hu",
  123. "required": false
  124. },
  125. {
  126. "defaultValue": "",
  127. "name": "cover_alt_en",
  128. "required": false
  129. },
  130. {
  131. "defaultValue": "https://8xlu0ewmcsjhdu7y.picobaas.eu",
  132. "description": "The site. Change to https://zsebhoki.hu once its DNS answers",
  133. "name": "baseUrl",
  134. "required": false
  135. },
  136. {
  137. "defaultValue": "png",
  138. "description": "Extension for the stored image - png or jpg",
  139. "name": "imageExtension",
  140. "required": false
  141. },
  142. {
  143. "defaultValue": [],
  144. "description": "Tags as [{slug, name_hu, name_en}]. Each is reused if the slug already exists, then linked to the post.",
  145. "name": "tags",
  146. "required": false
  147. },
  148. {
  149. "defaultValue": 0,
  150. "description": "1 for 18+ content, 0 for general audience. Required by the blog on every post; it records what the content is, whatever the site-wide check is set to.",
  151. "name": "is_adult",
  152. "required": false
  153. }
  154. ]
  155. },
  156. "disabled": false,
  157. "id": "input",
  158. "name": "Workflow Input",
  159. "position": {
  160. "x": 0,
  161. "y": 0
  162. },
  163. "type": "workflow-input"
  164. },
  165. {
  166. "config": {
  167. "label": "Execute"
  168. },
  169. "disabled": false,
  170. "id": "trigger",
  171. "name": "Click Trigger",
  172. "position": {
  173. "x": 300,
  174. "y": 0
  175. },
  176. "type": "click-trigger"
  177. },
  178. {
  179. "config": {
  180. "fields": [
  181. {
  182. "name": "slug",
  183. "value": "{{($node['Workflow Input'].slug || $node['Workflow Input'].title_en || 'post').toString().toLowerCase().normalize('NFD').replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 80)}}"
  184. },
  185. {
  186. "name": "mediaPath",
  187. "value": "{{'anime/' + new Date().getFullYear() + '/' + (($node['Workflow Input'].slug || $node['Workflow Input'].title_en || 'post').toString().toLowerCase().normalize('NFD').replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 60)) + '-' + Date.now() + '.' + ($node['Workflow Input'].imageExtension || 'png')}}"
  188. },
  189. {
  190. "name": "contentType",
  191. "value": "{{($node['Workflow Input'].imageExtension || 'png') === 'jpg' ? 'image/jpeg' : 'image/png'}}"
  192. },
  193. {
  194. "name": "baseUrl",
  195. "value": "{{$node['Workflow Input'].baseUrl}}"
  196. }
  197. ],
  198. "mode": "keep"
  199. },
  200. "disabled": false,
  201. "id": "prep",
  202. "name": "Prepare",
  203. "position": {
  204. "x": 160,
  205. "y": 180
  206. },
  207. "type": "set-fields"
  208. },
  209. {
  210. "config": {
  211. "authType": "credential",
  212. "bodyFrom": "file",
  213. "contentType": "other",
  214. "contentTypeCustom": "{{$node['Prepare'].contentType}}",
  215. "credentialId": "cred_c6b24bca-c3e9-4be5-a266-25ddc8538f36",
  216. "downloadCollection": "downloads",
  217. "downloadTtlHours": 24,
  218. "failOnErrorStatus": true,
  219. "followRedirects": true,
  220. "method": "POST",
  221. "responseMode": "json",
  222. "retries": 2,
  223. "retryDelayMs": 2000,
  224. "retryMaxDelayMs": 30000,
  225. "storeDownload": false,
  226. "timeout": 120000,
  227. "url": "{{$node['Prepare'].baseUrl}}/api/storage/media/{{$node['Prepare'].mediaPath}}?content_type={{$node['Prepare'].contentType}}"
  228. },
  229. "disabled": false,
  230. "id": "upload",
  231. "name": "Upload Image",
  232. "position": {
  233. "x": 160,
  234. "y": 360
  235. },
  236. "type": "http-request"
  237. },
  238. {
  239. "config": {
  240. "authType": "credential",
  241. "body": "{\n \"slug\": \"{{$node['Prepare'].slug}}\",\n \"is_adult\": {{Number($node['Workflow Input'].is_adult) === 1 ? 1 : 0}},\n \"title_hu\": \"{{$node['Workflow Input'].title_hu}}\",\n \"title_en\": \"{{$node['Workflow Input'].title_en}}\",\n \"content_hu\": \"{{$node['Workflow Input'].content_hu}}\",\n \"content_en\": \"{{$node['Workflow Input'].content_en}}\",\n \"status\": \"{{$node['Workflow Input'].status || 'draft'}}\",\n \"cover_url\": \"/storage/media/{{$node['Prepare'].mediaPath}}\",\n \"cover_alt_hu\": \"{{$node['Workflow Input'].cover_alt_hu || $node['Workflow Input'].title_hu}}\",\n \"cover_alt_en\": \"{{$node['Workflow Input'].cover_alt_en || $node['Workflow Input'].title_en}}\"\n}",
  242. "contentType": "application/json",
  243. "credentialId": "cred_c6b24bca-c3e9-4be5-a266-25ddc8538f36",
  244. "downloadCollection": "downloads",
  245. "downloadTtlHours": 24,
  246. "failOnErrorStatus": true,
  247. "followRedirects": true,
  248. "method": "POST",
  249. "responseMode": "json",
  250. "retries": 1,
  251. "retryDelayMs": 1000,
  252. "retryMaxDelayMs": 30000,
  253. "storeDownload": false,
  254. "timeout": 60000,
  255. "url": "{{$node['Prepare'].baseUrl}}/api/posts"
  256. },
  257. "disabled": false,
  258. "id": "post",
  259. "name": "Create Post",
  260. "position": {
  261. "x": 160,
  262. "y": 540
  263. },
  264. "type": "http-request"
  265. },
  266. {
  267. "config": {
  268. "fields": [
  269. {
  270. "name": "ok",
  271. "value": "{{$node['Create Post'].ok}}"
  272. },
  273. {
  274. "name": "status",
  275. "value": "{{$node['Create Post'].statusCode}}"
  276. },
  277. {
  278. "name": "postId",
  279. "value": "{{$node['Create Post'].body.id || ($node['Create Post'].body.data && $node['Create Post'].body.data.id) || ''}}"
  280. },
  281. {
  282. "name": "slug",
  283. "value": "{{$node['Prepare'].slug}}"
  284. },
  285. {
  286. "name": "coverUrl",
  287. "value": "{{$node['Prepare'].baseUrl}}/storage/media/{{$node['Prepare'].mediaPath}}"
  288. },
  289. {
  290. "name": "url",
  291. "value": "{{$node['Prepare'].baseUrl}}/hu/post/{{$node['Prepare'].slug}}"
  292. },
  293. {
  294. "name": "uploadStatus",
  295. "value": "{{$node['Upload Image'].statusCode}}"
  296. },
  297. {
  298. "name": "error",
  299. "value": "{{$node['Create Post'].body.error || $node['Create Post'].body.message || ''}}"
  300. }
  301. ],
  302. "source": "fields"
  303. },
  304. "disabled": false,
  305. "id": "out",
  306. "name": "Workflow Output",
  307. "position": {
  308. "x": 160,
  309. "y": 1800
  310. },
  311. "type": "workflow-output"
  312. },
  313. {
  314. "config": {
  315. "continueOnError": true,
  316. "indexVariableName": "index",
  317. "inputField": "data.tags",
  318. "itemVariableName": "item",
  319. "maxIterations": 20,
  320. "outputField": "results"
  321. },
  322. "disabled": false,
  323. "id": "tags_loop",
  324. "name": "Each Tag",
  325. "position": {
  326. "x": 160,
  327. "y": 900
  328. },
  329. "type": "loop"
  330. },
  331. {
  332. "config": {
  333. "authType": "credential",
  334. "contentType": "application/json",
  335. "credentialId": "cred_c6b24bca-c3e9-4be5-a266-25ddc8538f36",
  336. "downloadCollection": "downloads",
  337. "downloadTtlHours": 24,
  338. "failOnErrorStatus": true,
  339. "followRedirects": true,
  340. "method": "GET",
  341. "responseMode": "json",
  342. "retries": 1,
  343. "retryDelayMs": 1000,
  344. "retryMaxDelayMs": 30000,
  345. "storeDownload": false,
  346. "timeout": 30000,
  347. "url": "{{$node['Prepare'].baseUrl}}/api/tags?filter[slug]=eq.{{$node['This Tag'].slug}}"
  348. },
  349. "disabled": false,
  350. "id": "tag_find",
  351. "name": "Read Tag Back",
  352. "position": {
  353. "x": 200,
  354. "y": 1340
  355. },
  356. "type": "http-request"
  357. },
  358. {
  359. "config": {
  360. "authType": "credential",
  361. "body": "{\n \"slug\": \"{{$node['This Tag'].slug}}\",\n \"name_hu\": \"{{$node['This Tag'].name_hu}}\",\n \"name_en\": \"{{$node['This Tag'].name_en}}\"\n}",
  362. "contentType": "application/json",
  363. "credentialId": "cred_c6b24bca-c3e9-4be5-a266-25ddc8538f36",
  364. "downloadCollection": "downloads",
  365. "downloadTtlHours": 24,
  366. "failOnErrorStatus": false,
  367. "followRedirects": true,
  368. "method": "POST",
  369. "responseMode": "json",
  370. "retries": 1,
  371. "retryDelayMs": 1000,
  372. "retryMaxDelayMs": 30000,
  373. "storeDownload": false,
  374. "timeout": 30000,
  375. "url": "{{$node['Prepare'].baseUrl}}/api/tags"
  376. },
  377. "disabled": false,
  378. "id": "tag_create",
  379. "name": "Create Tag",
  380. "position": {
  381. "x": 200,
  382. "y": 1220
  383. },
  384. "type": "http-request"
  385. },
  386. {
  387. "config": {
  388. "authType": "credential",
  389. "body": "{\n \"post_id\": \"{{$node['Create Post'].body.id || ($node['Create Post'].body.data && $node['Create Post'].body.data.id)}}\",\n \"tag_id\": \"{{$node['Read Tag Back'].body.data[0].id}}\"\n}",
  390. "contentType": "application/json",
  391. "credentialId": "cred_c6b24bca-c3e9-4be5-a266-25ddc8538f36",
  392. "downloadCollection": "downloads",
  393. "downloadTtlHours": 24,
  394. "failOnErrorStatus": false,
  395. "followRedirects": true,
  396. "method": "POST",
  397. "responseMode": "json",
  398. "retries": 1,
  399. "retryDelayMs": 1000,
  400. "retryMaxDelayMs": 30000,
  401. "storeDownload": false,
  402. "timeout": 30000,
  403. "url": "{{$node['Prepare'].baseUrl}}/api/post_tags"
  404. },
  405. "disabled": false,
  406. "id": "tag_link_old",
  407. "name": "Link Tag",
  408. "position": {
  409. "x": 200,
  410. "y": 1480
  411. },
  412. "type": "http-request"
  413. },
  414. {
  415. "config": {
  416. "fields": [
  417. {
  418. "name": "tags",
  419. "value": "{{$node['Workflow Input'].tags || []}}"
  420. }
  421. ],
  422. "mode": "keep"
  423. },
  424. "disabled": false,
  425. "id": "tags_prep",
  426. "name": "Tags To Do",
  427. "position": {
  428. "x": 160,
  429. "y": 720
  430. },
  431. "type": "set-fields"
  432. },
  433. {
  434. "config": {
  435. "fields": [
  436. {
  437. "name": "slug",
  438. "value": "{{data.loop.item.slug}}"
  439. },
  440. {
  441. "name": "name_hu",
  442. "value": "{{data.loop.item.name_hu}}"
  443. },
  444. {
  445. "name": "name_en",
  446. "value": "{{data.loop.item.name_en}}"
  447. }
  448. ],
  449. "mode": "set"
  450. },
  451. "disabled": false,
  452. "id": "tag_item",
  453. "name": "This Tag",
  454. "position": {
  455. "x": 200,
  456. "y": 1080
  457. },
  458. "type": "set-fields"
  459. }
  460. ],
  461. "settings": {}
  462. }