File tree Expand file tree Collapse file tree 4 files changed +109
-3
lines changed Expand file tree Collapse file tree 4 files changed +109
-3
lines changed Original file line number Diff line number Diff line change 153153Ctrl
154154Cuep
155155customizable
156+ CustomJS
156157customResponse
157158cvIZPg
158159DaData
@@ -687,6 +688,7 @@ PropType
687688proto
688689PRs
689690Psw
691+ Puppoteer
690692Pushbullet
691693Pushsafer
692694Pushshift
Original file line number Diff line number Diff line change 1+ import customjs from "../../customjs.app.mjs" ;
2+ import fs from "fs" ;
3+ import { normalizeFilepath } from "../common/utils.mjs" ;
4+
5+ export default {
6+ key : "customjs-convert-html-to-png" ,
7+ name : "Convert HTML to PNG" ,
8+ description : "Converts an HTML string to a PNG image. [See the documentation](https://www.customjs.space/api/docs#_4-html-to-png)" ,
9+ version : "0.0.1" ,
10+ type : "action" ,
11+ props : {
12+ customjs,
13+ html : {
14+ type : "string" ,
15+ label : "HTML" ,
16+ description : "The HTML string to be converted to a PNG" ,
17+ } ,
18+ filename : {
19+ propDefinition : [
20+ customjs ,
21+ "filename" ,
22+ ] ,
23+ } ,
24+ } ,
25+ async run ( { $ } ) {
26+ const fileContent = await this . customjs . convertHtmlToPng ( {
27+ $,
28+ data : {
29+ input : this . html ,
30+ code : "const { HTML2PNG } = require('./utils'); return HTML2PNG(input);" ,
31+ returnBinary : "true" ,
32+ } ,
33+ } ) ;
34+
35+ const filepath = normalizeFilepath ( this . filename ) ;
36+ fs . writeFileSync ( filepath , Buffer . from ( fileContent ) ) ;
37+
38+ $ . export ( "$summary" , "Successfully converted HTML to PNG" ) ;
39+ return {
40+ filename : this . filename ,
41+ filepath,
42+ } ;
43+ } ,
44+ } ;
Original file line number Diff line number Diff line change 1+ import customjs from "../../customjs.app.mjs" ;
2+ import fs from "fs" ;
3+ import { normalizeFilepath } from "../common/utils.mjs" ;
4+
5+ export default {
6+ key : "customjs-run-puppoteer" ,
7+ name : "Run Puppoteer" ,
8+ description : "run-puppoteer. [See the documentation](https://www.customjs.space/api/docs#_5-run-puppoteer)" ,
9+ version : "0.0.1" ,
10+ type : "action" ,
11+ props : {
12+ customjs,
13+ code : {
14+ type : "string" ,
15+ label : "Code" ,
16+ description : "Enter code you want to run on puppeteer." ,
17+ } ,
18+ filename : {
19+ propDefinition : [
20+ customjs ,
21+ "filename" ,
22+ ] ,
23+ } ,
24+ } ,
25+ async run ( { $ } ) {
26+ const fileContent = await this . customjs . runPuppoteer ( {
27+ $,
28+ data : {
29+ input : this . code ,
30+ code : "const { PUPPETEER } = require('./utils'); return PUPPETEER(input);" ,
31+ returnBinary : "true" ,
32+ } ,
33+ } ) ;
34+
35+ const filepath = normalizeFilepath ( this . filename ) ;
36+ fs . writeFileSync ( filepath , Buffer . from ( fileContent ) ) ;
37+
38+ $ . export ( "$summary" , "Successfully run the puppoteer code." ) ;
39+ return {
40+ filename : this . filename ,
41+ filepath,
42+ } ;
43+ } ,
44+ } ;
Original file line number Diff line number Diff line change @@ -31,23 +31,39 @@ export default {
3131 convertHtmlToPdf ( opts = { } ) {
3232 return this . _makeRequest ( {
3333 headers : {
34- "customjs-origin" : "zapier/generatePDF" ,
34+ "customjs-origin" : "pipedream/generatePDF" ,
35+ } ,
36+ ...opts ,
37+ } ) ;
38+ } ,
39+ convertHtmlToPng ( opts = { } ) {
40+ return this . _makeRequest ( {
41+ headers : {
42+ "customjs-origin" : "pipedream/generatePNG" ,
3543 } ,
3644 ...opts ,
3745 } ) ;
3846 } ,
3947 createScreenshot ( opts = { } ) {
4048 return this . _makeRequest ( {
4149 headers : {
42- "customjs-origin" : "zapier /screenshot" ,
50+ "customjs-origin" : "pipedream /screenshot" ,
4351 } ,
4452 ...opts ,
4553 } ) ;
4654 } ,
4755 mergePdfs ( opts = { } ) {
4856 return this . _makeRequest ( {
4957 headers : {
50- "customjs-origin" : "zapier/mergePDFs" ,
58+ "customjs-origin" : "pipedream/mergePDFs" ,
59+ } ,
60+ ...opts ,
61+ } ) ;
62+ } ,
63+ runPuppoteer ( opts = { } ) {
64+ return this . _makeRequest ( {
65+ headers : {
66+ "customjs-origin" : "pipedream/puppeteer" ,
5167 } ,
5268 ...opts ,
5369 } ) ;
You can’t perform that action at this time.
0 commit comments