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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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. "followRedirects": true,
  219. "method": "POST",
  220. "responseMode": "json",
  221. "retries": 2,
  222. "retryDelayMs": 2000,
  223. "retryMaxDelayMs": 30000,
  224. "storeDownload": false,
  225. "timeout": 120000,
  226. "url": "{{$node['Prepare'].baseUrl}}/api/storage/media/{{$node['Prepare'].mediaPath}}?content_type={{$node['Prepare'].contentType}}"
  227. },
  228. "disabled": false,
  229. "id": "upload",
  230. "name": "Upload Image",
  231. "position": {
  232. "x": 160,
  233. "y": 360
  234. },
  235. "type": "http-request"
  236. },
  237. {
  238. "config": {
  239. "authType": "credential",
  240. "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\": \"{{$node['Prepare'].baseUrl}}/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}",
  241. "contentType": "application/json",
  242. "credentialId": "cred_c6b24bca-c3e9-4be5-a266-25ddc8538f36",
  243. "downloadCollection": "downloads",
  244. "downloadTtlHours": 24,
  245. "followRedirects": true,
  246. "method": "POST",
  247. "responseMode": "json",
  248. "retries": 1,
  249. "retryDelayMs": 1000,
  250. "retryMaxDelayMs": 30000,
  251. "storeDownload": false,
  252. "timeout": 60000,
  253. "url": "{{$node['Prepare'].baseUrl}}/api/posts"
  254. },
  255. "disabled": false,
  256. "id": "post",
  257. "name": "Create Post",
  258. "position": {
  259. "x": 160,
  260. "y": 540
  261. },
  262. "type": "http-request"
  263. },
  264. {
  265. "config": {
  266. "fields": [
  267. {
  268. "name": "ok",
  269. "value": "{{$node['Create Post'].ok}}"
  270. },
  271. {
  272. "name": "status",
  273. "value": "{{$node['Create Post'].statusCode}}"
  274. },
  275. {
  276. "name": "postId",
  277. "value": "{{$node['Create Post'].body.id || ($node['Create Post'].body.data && $node['Create Post'].body.data.id) || ''}}"
  278. },
  279. {
  280. "name": "slug",
  281. "value": "{{$node['Prepare'].slug}}"
  282. },
  283. {
  284. "name": "coverUrl",
  285. "value": "{{$node['Prepare'].baseUrl}}/storage/media/{{$node['Prepare'].mediaPath}}"
  286. },
  287. {
  288. "name": "url",
  289. "value": "{{$node['Prepare'].baseUrl}}/hu/post/{{$node['Prepare'].slug}}"
  290. },
  291. {
  292. "name": "uploadStatus",
  293. "value": "{{$node['Upload Image'].statusCode}}"
  294. },
  295. {
  296. "name": "error",
  297. "value": "{{$node['Create Post'].body.error || $node['Create Post'].body.message || ''}}"
  298. }
  299. ],
  300. "source": "fields"
  301. },
  302. "disabled": false,
  303. "id": "out",
  304. "name": "Workflow Output",
  305. "position": {
  306. "x": 160,
  307. "y": 1800
  308. },
  309. "type": "workflow-output"
  310. },
  311. {
  312. "config": {
  313. "continueOnError": true,
  314. "indexVariableName": "index",
  315. "inputField": "data.tags",
  316. "itemVariableName": "item",
  317. "maxIterations": 20,
  318. "outputField": "results"
  319. },
  320. "disabled": false,
  321. "id": "tags_loop",
  322. "name": "Each Tag",
  323. "position": {
  324. "x": 160,
  325. "y": 900
  326. },
  327. "type": "loop"
  328. },
  329. {
  330. "config": {
  331. "authType": "credential",
  332. "contentType": "application/json",
  333. "credentialId": "cred_c6b24bca-c3e9-4be5-a266-25ddc8538f36",
  334. "downloadCollection": "downloads",
  335. "downloadTtlHours": 24,
  336. "followRedirects": true,
  337. "method": "GET",
  338. "responseMode": "json",
  339. "retries": 1,
  340. "retryDelayMs": 1000,
  341. "retryMaxDelayMs": 30000,
  342. "storeDownload": false,
  343. "timeout": 30000,
  344. "url": "{{$node['Prepare'].baseUrl}}/api/tags?filter[slug]=eq.{{$node['This Tag'].slug}}"
  345. },
  346. "disabled": false,
  347. "id": "tag_find",
  348. "name": "Read Tag Back",
  349. "position": {
  350. "x": 200,
  351. "y": 1340
  352. },
  353. "type": "http-request"
  354. },
  355. {
  356. "config": {
  357. "authType": "credential",
  358. "body": "{\n \"slug\": \"{{$node['This Tag'].slug}}\",\n \"name_hu\": \"{{$node['This Tag'].name_hu}}\",\n \"name_en\": \"{{$node['This Tag'].name_en}}\"\n}",
  359. "contentType": "application/json",
  360. "credentialId": "cred_c6b24bca-c3e9-4be5-a266-25ddc8538f36",
  361. "downloadCollection": "downloads",
  362. "downloadTtlHours": 24,
  363. "failOnErrorStatus": false,
  364. "followRedirects": true,
  365. "method": "POST",
  366. "responseMode": "json",
  367. "retries": 1,
  368. "retryDelayMs": 1000,
  369. "retryMaxDelayMs": 30000,
  370. "storeDownload": false,
  371. "timeout": 30000,
  372. "url": "{{$node['Prepare'].baseUrl}}/api/tags"
  373. },
  374. "disabled": false,
  375. "id": "tag_create",
  376. "name": "Create Tag",
  377. "position": {
  378. "x": 200,
  379. "y": 1220
  380. },
  381. "type": "http-request"
  382. },
  383. {
  384. "config": {
  385. "authType": "credential",
  386. "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}",
  387. "contentType": "application/json",
  388. "credentialId": "cred_c6b24bca-c3e9-4be5-a266-25ddc8538f36",
  389. "downloadCollection": "downloads",
  390. "downloadTtlHours": 24,
  391. "failOnErrorStatus": false,
  392. "followRedirects": true,
  393. "method": "POST",
  394. "responseMode": "json",
  395. "retries": 1,
  396. "retryDelayMs": 1000,
  397. "retryMaxDelayMs": 30000,
  398. "storeDownload": false,
  399. "timeout": 30000,
  400. "url": "{{$node['Prepare'].baseUrl}}/api/post_tags"
  401. },
  402. "disabled": false,
  403. "id": "tag_link_old",
  404. "name": "Link Tag",
  405. "position": {
  406. "x": 200,
  407. "y": 1480
  408. },
  409. "type": "http-request"
  410. },
  411. {
  412. "config": {
  413. "fields": [
  414. {
  415. "name": "tags",
  416. "value": "{{$node['Workflow Input'].tags || []}}"
  417. }
  418. ],
  419. "mode": "keep"
  420. },
  421. "disabled": false,
  422. "id": "tags_prep",
  423. "name": "Tags To Do",
  424. "position": {
  425. "x": 160,
  426. "y": 720
  427. },
  428. "type": "set-fields"
  429. },
  430. {
  431. "config": {
  432. "fields": [
  433. {
  434. "name": "slug",
  435. "value": "{{data.loop.item.slug}}"
  436. },
  437. {
  438. "name": "name_hu",
  439. "value": "{{data.loop.item.name_hu}}"
  440. },
  441. {
  442. "name": "name_en",
  443. "value": "{{data.loop.item.name_en}}"
  444. }
  445. ],
  446. "mode": "set"
  447. },
  448. "disabled": false,
  449. "id": "tag_item",
  450. "name": "This Tag",
  451. "position": {
  452. "x": 200,
  453. "y": 1080
  454. },
  455. "type": "set-fields"
  456. }
  457. ],
  458. "settings": {}
  459. }