@skillful-ai/piece-skai-memes 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +34 -0
- package/src/index.d.ts +12 -0
- package/src/index.js +60 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/generate-meme-from-template.d.ts +12 -0
- package/src/lib/actions/generate-meme-from-template.js +111 -0
- package/src/lib/actions/generate-meme-from-template.js.map +1 -0
- package/src/lib/actions/generate-meme-with-ai.d.ts +8 -0
- package/src/lib/actions/generate-meme-with-ai.js +81 -0
- package/src/lib/actions/generate-meme-with-ai.js.map +1 -0
- package/src/lib/actions/get-trending-templates.d.ts +7 -0
- package/src/lib/actions/get-trending-templates.js +276 -0
- package/src/lib/actions/get-trending-templates.js.map +1 -0
- package/src/lib/actions/random-template.d.ts +7 -0
- package/src/lib/actions/random-template.js +161 -0
- package/src/lib/actions/random-template.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@skillful-ai/piece-skai-memes",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@activepieces/pieces-common": "^0.7.0",
|
|
9
|
+
"@activepieces/pieces-framework": "^0.20.1",
|
|
10
|
+
"@sinclair/typebox": "0.34.11",
|
|
11
|
+
"axios": "1.8.3",
|
|
12
|
+
"axios-retry": "4.4.1",
|
|
13
|
+
"deepmerge-ts": "7.1.0",
|
|
14
|
+
"mime-types": "2.1.35",
|
|
15
|
+
"nanoid": "3.3.8",
|
|
16
|
+
"semver": "7.6.0",
|
|
17
|
+
"tslib": "^2.3.0",
|
|
18
|
+
"zod": "3.25.76",
|
|
19
|
+
"@activepieces/shared": "0.22.0"
|
|
20
|
+
},
|
|
21
|
+
"overrides": {
|
|
22
|
+
"@tryfabric/martian": {
|
|
23
|
+
"@notionhq/client": "$@notionhq/client"
|
|
24
|
+
},
|
|
25
|
+
"vite": {
|
|
26
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
27
|
+
},
|
|
28
|
+
"undici": "6.19.8"
|
|
29
|
+
},
|
|
30
|
+
"resolutions": {
|
|
31
|
+
"rollup": "npm:@rollup/wasm-node",
|
|
32
|
+
"undici": "6.19.8"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const skaiMemesAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
imgflipUsername: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
imgflipPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>;
|
|
5
|
+
export type SkaiMemesAuthValue = {
|
|
6
|
+
imgflipUsername: string;
|
|
7
|
+
imgflipPassword: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const skaiMemes: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
+
imgflipUsername: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
11
|
+
imgflipPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
12
|
+
}>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.skaiMemes = exports.skaiMemesAuth = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const shared_1 = require("@activepieces/shared");
|
|
6
|
+
// Actions
|
|
7
|
+
const get_trending_templates_1 = require("./lib/actions/get-trending-templates");
|
|
8
|
+
const generate_meme_from_template_1 = require("./lib/actions/generate-meme-from-template");
|
|
9
|
+
const generate_meme_with_ai_1 = require("./lib/actions/generate-meme-with-ai");
|
|
10
|
+
const random_template_1 = require("./lib/actions/random-template");
|
|
11
|
+
const markdownDescription = `
|
|
12
|
+
## SKAI Memes
|
|
13
|
+
|
|
14
|
+
Generate **real viral memes** using popular templates from Imgflip.
|
|
15
|
+
|
|
16
|
+
### Setup
|
|
17
|
+
|
|
18
|
+
1. Create a free account at https://imgflip.com
|
|
19
|
+
2. For premium features (no watermark, AI memes), subscribe at https://imgflip.com/pro
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
- Access 1M+ viral meme templates (Drake, Distracted Boyfriend, etc.)
|
|
24
|
+
- Get trending templates that are hot right now
|
|
25
|
+
- AI-powered meme generation that picks the best template (Premium)
|
|
26
|
+
- Custom text positioning and styling
|
|
27
|
+
`;
|
|
28
|
+
exports.skaiMemesAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
29
|
+
description: markdownDescription,
|
|
30
|
+
required: true,
|
|
31
|
+
props: {
|
|
32
|
+
imgflipUsername: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'Imgflip Username',
|
|
34
|
+
description: 'Your Imgflip account username',
|
|
35
|
+
required: true,
|
|
36
|
+
}),
|
|
37
|
+
imgflipPassword: pieces_framework_1.PieceAuth.SecretText({
|
|
38
|
+
displayName: 'Imgflip Password',
|
|
39
|
+
description: 'Your Imgflip account password',
|
|
40
|
+
required: true,
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
exports.skaiMemes = (0, pieces_framework_1.createPiece)({
|
|
45
|
+
displayName: 'SKAI Memes',
|
|
46
|
+
description: 'Generate real viral memes using popular templates',
|
|
47
|
+
auth: exports.skaiMemesAuth,
|
|
48
|
+
minimumSupportedRelease: '0.36.1',
|
|
49
|
+
logoUrl: 'https://imgflip.com/favicon.ico',
|
|
50
|
+
authors: ['Skillful AI'],
|
|
51
|
+
categories: [shared_1.PieceCategory.MARKETING, shared_1.PieceCategory.CONTENT_AND_FILES],
|
|
52
|
+
actions: [
|
|
53
|
+
get_trending_templates_1.getTrendingTemplates,
|
|
54
|
+
random_template_1.randomTemplate,
|
|
55
|
+
generate_meme_from_template_1.generateMemeFromTemplate,
|
|
56
|
+
generate_meme_with_ai_1.generateMemeWithAI,
|
|
57
|
+
],
|
|
58
|
+
triggers: [],
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/custom/skai-memes/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAkF;AAClF,iDAAqD;AAErD,UAAU;AACV,iFAA4E;AAC5E,2FAAqF;AACrF,+EAAyE;AACzE,mEAA+D;AAE/D,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;CAgB3B,CAAC;AAEW,QAAA,aAAa,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC9C,WAAW,EAAE,mBAAmB;IAChC,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACH,eAAe,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,eAAe,EAAE,4BAAS,CAAC,UAAU,CAAC;YAClC,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;CACJ,CAAC,CAAC;AAOU,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACjC,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,mDAAmD;IAChE,IAAI,EAAE,qBAAa;IACnB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,iCAAiC;IAC1C,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,EAAE,sBAAa,CAAC,iBAAiB,CAAC;IACtE,OAAO,EAAE;QACL,6CAAoB;QACpB,gCAAc;QACd,sDAAwB;QACxB,0CAAkB;KACrB;IACD,QAAQ,EAAE,EAAE;CACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const generateMemeFromTemplate: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
imgflipUsername: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
imgflipPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
templateId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
text0: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
text1: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
text2: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
text3: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
font: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
11
|
+
maxFontSize: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateMemeFromTemplate = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const IMGFLIP_API_URL = 'https://api.imgflip.com';
|
|
9
|
+
exports.generateMemeFromTemplate = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.skaiMemesAuth,
|
|
11
|
+
name: 'generate_meme_from_template',
|
|
12
|
+
displayName: 'Generate Meme from Template',
|
|
13
|
+
description: 'Create a meme using a specific viral template (Drake, Distracted Boyfriend, etc.)',
|
|
14
|
+
props: {
|
|
15
|
+
templateId: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Template ID',
|
|
17
|
+
description: 'The Imgflip template ID (get from "Get Trending Templates" action). Common: 181913649 (Drake), 112126428 (Distracted Boyfriend)',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
text0: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Top Text / First Box',
|
|
22
|
+
description: 'Text for the first/top text box',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
text1: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Bottom Text / Second Box',
|
|
27
|
+
description: 'Text for the second/bottom text box',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
text2: pieces_framework_1.Property.ShortText({
|
|
31
|
+
displayName: 'Third Text Box',
|
|
32
|
+
description: 'Text for the third box (if template supports it)',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
text3: pieces_framework_1.Property.ShortText({
|
|
36
|
+
displayName: 'Fourth Text Box',
|
|
37
|
+
description: 'Text for the fourth box (if template supports it)',
|
|
38
|
+
required: false,
|
|
39
|
+
}),
|
|
40
|
+
font: pieces_framework_1.Property.StaticDropdown({
|
|
41
|
+
displayName: 'Font',
|
|
42
|
+
description: 'Font style for the meme text',
|
|
43
|
+
required: false,
|
|
44
|
+
defaultValue: 'impact',
|
|
45
|
+
options: {
|
|
46
|
+
options: [
|
|
47
|
+
{ label: 'Impact (Classic meme font)', value: 'impact' },
|
|
48
|
+
{ label: 'Arial', value: 'arial' },
|
|
49
|
+
{ label: 'Comic Sans MS', value: 'Comic Sans MS' },
|
|
50
|
+
{ label: 'Roboto', value: 'Roboto' },
|
|
51
|
+
{ label: 'Open Sans', value: 'Open Sans' },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
maxFontSize: pieces_framework_1.Property.Number({
|
|
56
|
+
displayName: 'Max Font Size',
|
|
57
|
+
description: 'Maximum font size in pixels (default: 50)',
|
|
58
|
+
required: false,
|
|
59
|
+
defaultValue: 50,
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
run(context) {
|
|
63
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const { templateId, text0, text1, text2, text3, font, maxFontSize } = context.propsValue;
|
|
65
|
+
const auth = context.auth;
|
|
66
|
+
// Build form body as plain string - most compatible approach for sandbox environments
|
|
67
|
+
const params = [
|
|
68
|
+
`template_id=${encodeURIComponent(templateId)}`,
|
|
69
|
+
`username=${encodeURIComponent(auth.imgflipUsername)}`,
|
|
70
|
+
`password=${encodeURIComponent(auth.imgflipPassword)}`,
|
|
71
|
+
];
|
|
72
|
+
// Use boxes array format for all text boxes (more flexible than text0/text1)
|
|
73
|
+
params.push(`boxes[0][text]=${encodeURIComponent(text0)}`);
|
|
74
|
+
if (text1)
|
|
75
|
+
params.push(`boxes[1][text]=${encodeURIComponent(text1)}`);
|
|
76
|
+
if (text2)
|
|
77
|
+
params.push(`boxes[2][text]=${encodeURIComponent(text2)}`);
|
|
78
|
+
if (text3)
|
|
79
|
+
params.push(`boxes[3][text]=${encodeURIComponent(text3)}`);
|
|
80
|
+
if (font)
|
|
81
|
+
params.push(`font=${encodeURIComponent(font)}`);
|
|
82
|
+
if (maxFontSize)
|
|
83
|
+
params.push(`max_font_size=${encodeURIComponent(String(maxFontSize))}`);
|
|
84
|
+
const formBody = params.join('&');
|
|
85
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
86
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
87
|
+
url: `${IMGFLIP_API_URL}/caption_image`,
|
|
88
|
+
headers: {
|
|
89
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
90
|
+
},
|
|
91
|
+
body: formBody,
|
|
92
|
+
});
|
|
93
|
+
if (!response.body.success) {
|
|
94
|
+
throw new Error(`Failed to generate meme: ${response.body.error_message || 'Unknown error'}`);
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
success: true,
|
|
98
|
+
imageUrl: response.body.data.url,
|
|
99
|
+
pageUrl: response.body.data.page_url,
|
|
100
|
+
templateId,
|
|
101
|
+
texts: {
|
|
102
|
+
text0,
|
|
103
|
+
text1: text1 || null,
|
|
104
|
+
text2: text2 || null,
|
|
105
|
+
text3: text3 || null,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=generate-meme-from-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-meme-from-template.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/skai-memes/src/lib/actions/generate-meme-from-template.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,uCAAgE;AAEhE,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAErC,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,mFAAmF;IAChG,KAAK,EAAE;QACH,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,iIAAiI;YAC9I,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,sBAAsB;YACnC,WAAW,EAAE,iCAAiC;YAC9C,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,0BAA0B;YACvC,WAAW,EAAE,qCAAqC;YAClD,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAA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AAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gBAChC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ;gBACpC,UAAU;gBACV,KAAK,EAAE;oBACH,KAAK;oBACL,KAAK,EAAE,KAAK,IAAI,IAAI;oBACpB,KAAK,EAAE,KAAK,IAAI,IAAI;oBACpB,KAAK,EAAE,KAAK,IAAI,IAAI;iBACvB;aACJ,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const generateMemeWithAI: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
imgflipUsername: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
imgflipPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
topic: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
6
|
+
model: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
prefixText: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateMemeWithAI = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const IMGFLIP_API_URL = 'https://api.imgflip.com';
|
|
9
|
+
exports.generateMemeWithAI = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.skaiMemesAuth,
|
|
11
|
+
name: 'generate_meme_with_ai',
|
|
12
|
+
displayName: 'Generate Meme with AI',
|
|
13
|
+
description: 'Let AI pick the best template and generate captions based on your topic (Imgflip Premium required)',
|
|
14
|
+
props: {
|
|
15
|
+
topic: pieces_framework_1.Property.LongText({
|
|
16
|
+
displayName: 'Topic / Theme',
|
|
17
|
+
description: 'What should the meme be about? E.g., "winning at the casino", "crypto going up", "Monday mornings"',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
model: pieces_framework_1.Property.StaticDropdown({
|
|
21
|
+
displayName: 'AI Model',
|
|
22
|
+
description: 'Which AI model to use for caption generation',
|
|
23
|
+
required: false,
|
|
24
|
+
defaultValue: 'openai',
|
|
25
|
+
options: {
|
|
26
|
+
options: [
|
|
27
|
+
{ label: 'GPT (Better captions, recommended)', value: 'openai' },
|
|
28
|
+
{ label: 'Classic (Random, can be funnier)', value: 'classic' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
prefixText: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'Prefix Text',
|
|
34
|
+
description: 'Optional text to include at the start (e.g., brand name, promo code)',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
},
|
|
38
|
+
run(context) {
|
|
39
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
const { topic, model, prefixText } = context.propsValue;
|
|
42
|
+
const auth = context.auth;
|
|
43
|
+
// Build form body as plain string - most compatible approach for sandbox environments
|
|
44
|
+
const params = [
|
|
45
|
+
`username=${encodeURIComponent(auth.imgflipUsername)}`,
|
|
46
|
+
`password=${encodeURIComponent(auth.imgflipPassword)}`,
|
|
47
|
+
`text=${encodeURIComponent(topic)}`,
|
|
48
|
+
];
|
|
49
|
+
if (model)
|
|
50
|
+
params.push(`model=${encodeURIComponent(model)}`);
|
|
51
|
+
if (prefixText)
|
|
52
|
+
params.push(`prefix_text=${encodeURIComponent(prefixText)}`);
|
|
53
|
+
const formBody = params.join('&');
|
|
54
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
55
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
56
|
+
url: `${IMGFLIP_API_URL}/ai_meme`,
|
|
57
|
+
headers: {
|
|
58
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
59
|
+
},
|
|
60
|
+
body: formBody,
|
|
61
|
+
});
|
|
62
|
+
if (!response.body.success) {
|
|
63
|
+
// Check if it's a premium required error
|
|
64
|
+
if (((_a = response.body.error_message) === null || _a === void 0 ? void 0 : _a.includes('premium')) || ((_b = response.body.error_message) === null || _b === void 0 ? void 0 : _b.includes('Premium'))) {
|
|
65
|
+
throw new Error('AI Meme generation requires Imgflip Premium subscription. Get it at https://imgflip.com/pro');
|
|
66
|
+
}
|
|
67
|
+
throw new Error(`Failed to generate AI meme: ${response.body.error_message || 'Unknown error'}`);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
success: true,
|
|
71
|
+
imageUrl: response.body.data.url,
|
|
72
|
+
pageUrl: response.body.data.page_url,
|
|
73
|
+
templateUsed: response.body.data.template || null,
|
|
74
|
+
generatedTexts: response.body.data.texts || null,
|
|
75
|
+
topic,
|
|
76
|
+
model: model || 'openai',
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=generate-meme-with-ai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-meme-with-ai.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/skai-memes/src/lib/actions/generate-meme-with-ai.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,uCAAgE;AAEhE,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAErC,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,oGAAoG;IACjH,KAAK,EAAE;QACH,KAAK,EAAE,2BAAQ,CA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QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,eAAe,UAAU;gBACjC,OAAO,EAAE;oBACL,cAAc,EAAE,mCAAmC;iBACtD;gBACD,IAAI,EAAE,QAAQ;aACjB,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACzB,yCAAyC;gBACzC,IAAI,CAAA,MAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,0CAAE,QAAQ,CAAC,SAAS,CAAC,MAAI,MAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,0CAAE,QAAQ,CAAC,SAAS,CAAC,CAAA,EAAE,CAAC;oBACvG,MAAM,IAAI,KAAK,CAAC,6FAA6F,CAAC,CAAC;gBACnH,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,CAAC,IAAI,CAAC,aAAa,IAAI,eAAe,EAAE,CAAC,CAAC;YACrG,CAAC;YAED,OAAO;gBACH,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gBAChC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ;gBACpC,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI;gBACjD,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI;gBAChD,KAAK;gBACL,KAAK,EAAE,KAAK,IAAI,QAAQ;aAC3B,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const getTrendingTemplates: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
imgflipUsername: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
imgflipPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
searchText: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
maxItems: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTrendingTemplates = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const IMGFLIP_API_URL = 'https://api.imgflip.com';
|
|
9
|
+
const TEMPLATE_INFO = {
|
|
10
|
+
// Top 50 most popular templates
|
|
11
|
+
'181913649': {
|
|
12
|
+
description: 'Drake Hotline Bling - Two panel comparison meme',
|
|
13
|
+
boxes: ['What Drake dislikes/rejects (top)', 'What Drake approves/prefers (bottom)'],
|
|
14
|
+
},
|
|
15
|
+
'87743020': {
|
|
16
|
+
description: 'Two Buttons - Person sweating while choosing between options',
|
|
17
|
+
boxes: ['Left button option', 'Right button option', 'Person label'],
|
|
18
|
+
},
|
|
19
|
+
'112126428': {
|
|
20
|
+
description: 'Distracted Boyfriend - Guy looking at other woman while girlfriend watches',
|
|
21
|
+
boxes: ['The other woman (what catches attention)', 'The boyfriend (who is distracted)', 'The girlfriend (what is being ignored)'],
|
|
22
|
+
},
|
|
23
|
+
'222403160': {
|
|
24
|
+
description: 'Bernie I Am Once Again Asking - Bernie Sanders asking for something',
|
|
25
|
+
boxes: ['Top text (optional)', 'What Bernie is asking for'],
|
|
26
|
+
},
|
|
27
|
+
'124822590': {
|
|
28
|
+
description: 'Left Exit 12 Off Ramp - Car swerving to take exit',
|
|
29
|
+
boxes: ['Highway sign (sensible choice)', 'Exit sign (tempting choice)', 'Car label'],
|
|
30
|
+
},
|
|
31
|
+
'131087935': {
|
|
32
|
+
description: 'Running Away Balloon - Person chasing balloon while ignoring something',
|
|
33
|
+
boxes: ['Person running', 'Balloon flying away', 'Small thing on ground', 'Another small thing', 'Fifth element'],
|
|
34
|
+
},
|
|
35
|
+
'217743513': {
|
|
36
|
+
description: 'UNO Draw 25 Cards - Choice between action or drawing 25 cards',
|
|
37
|
+
boxes: ['The action to avoid', 'Person label (who draws 25)'],
|
|
38
|
+
},
|
|
39
|
+
'252600902': {
|
|
40
|
+
description: 'Always Has Been - Astronaut realization meme',
|
|
41
|
+
boxes: ['What first astronaut sees/realizes', '"Always has been" (or response)'],
|
|
42
|
+
},
|
|
43
|
+
'135256802': {
|
|
44
|
+
description: 'Epic Handshake - Two arms agreeing on common ground',
|
|
45
|
+
boxes: ['Left arm label', 'Right arm label', 'Handshake label (shared thing)'],
|
|
46
|
+
},
|
|
47
|
+
'161865971': {
|
|
48
|
+
description: 'Marked Safe From - Facebook safety check parody',
|
|
49
|
+
boxes: ['Today I am marked safe from...', 'What you are safe from'],
|
|
50
|
+
},
|
|
51
|
+
'131940431': {
|
|
52
|
+
description: "Gru's Plan - Gru presenting plan with unexpected twist",
|
|
53
|
+
boxes: ['Step 1 of plan', 'Step 2 of plan', 'Unexpected bad outcome (shown twice)', 'Gru reacting to bad outcome'],
|
|
54
|
+
},
|
|
55
|
+
'97984': {
|
|
56
|
+
description: 'Disaster Girl - Girl smiling deviously in front of burning house',
|
|
57
|
+
boxes: ['Top text', 'Bottom text'],
|
|
58
|
+
},
|
|
59
|
+
'322841258': {
|
|
60
|
+
description: 'Anakin Padme 4 Panel - Anakin says something, Padme questions',
|
|
61
|
+
boxes: ['What Anakin says', 'Padme asks "Right?" (usually implied)', 'Anakin stares (silence confirms bad)'],
|
|
62
|
+
},
|
|
63
|
+
'80707627': {
|
|
64
|
+
description: 'Sad Pablo Escobar - Pablo sitting alone, waiting',
|
|
65
|
+
boxes: ['Top text', 'Middle text', 'Bottom text'],
|
|
66
|
+
},
|
|
67
|
+
'129242436': {
|
|
68
|
+
description: 'Change My Mind - Person at table challenging others',
|
|
69
|
+
boxes: ['The controversial opinion', 'Additional text (optional)'],
|
|
70
|
+
},
|
|
71
|
+
'4087833': {
|
|
72
|
+
description: 'Waiting Skeleton - Skeleton waiting forever',
|
|
73
|
+
boxes: ['What skeleton is waiting for', 'Bottom text'],
|
|
74
|
+
},
|
|
75
|
+
'309868304': {
|
|
76
|
+
description: 'Trade Offer - TikTok trade offer meme',
|
|
77
|
+
boxes: ['I receive (what you get)', 'You receive (what they get)', 'Title/context'],
|
|
78
|
+
},
|
|
79
|
+
'61544': {
|
|
80
|
+
description: 'Success Kid - Baby with fist pump celebrating',
|
|
81
|
+
boxes: ['Setup/situation', 'Successful outcome'],
|
|
82
|
+
},
|
|
83
|
+
'102156234': {
|
|
84
|
+
description: 'Mocking Spongebob - Spongebob mocking text',
|
|
85
|
+
boxes: ['Original statement', 'Mocked version (aLtErNaTiNg CaPs)'],
|
|
86
|
+
},
|
|
87
|
+
'438680': {
|
|
88
|
+
description: 'Batman Slapping Robin - Batman slaps Robin mid-sentence',
|
|
89
|
+
boxes: ['What Robin says (gets interrupted)', 'What Batman says (the correction)'],
|
|
90
|
+
},
|
|
91
|
+
'124055727': {
|
|
92
|
+
description: "Y'all Got Any More Of That - Tyrone Biggums asking for more",
|
|
93
|
+
boxes: ['Top text', "Y'all got any more of that..."],
|
|
94
|
+
},
|
|
95
|
+
'188390779': {
|
|
96
|
+
description: 'Woman Yelling At Cat - Woman yelling at confused cat',
|
|
97
|
+
boxes: ['Woman yelling (the complaint)', 'Cat response (confused/unbothered)'],
|
|
98
|
+
},
|
|
99
|
+
'91538330': {
|
|
100
|
+
description: 'X, X Everywhere - Buzz showing Woody something widespread',
|
|
101
|
+
boxes: ['Top text', 'X, X everywhere'],
|
|
102
|
+
},
|
|
103
|
+
'247375501': {
|
|
104
|
+
description: 'Buff Doge vs. Cheems - Strong vs weak dog comparison',
|
|
105
|
+
boxes: ['Buff Doge label (strong/old)', 'Buff Doge description', 'Cheems label (weak/new)', 'Cheems description'],
|
|
106
|
+
},
|
|
107
|
+
'178591752': {
|
|
108
|
+
description: 'Tuxedo Winnie The Pooh - Regular vs fancy version',
|
|
109
|
+
boxes: ['Regular/basic version (top)', 'Fancy/sophisticated version (bottom)'],
|
|
110
|
+
},
|
|
111
|
+
'61579': {
|
|
112
|
+
description: 'One Does Not Simply - Boromir explaining difficulty',
|
|
113
|
+
boxes: ['One does not simply...', 'The difficult thing'],
|
|
114
|
+
},
|
|
115
|
+
'93895088': {
|
|
116
|
+
description: 'Expanding Brain - Increasingly enlightened ideas',
|
|
117
|
+
boxes: ['Basic idea (small brain)', 'Better idea', 'Advanced idea', 'Galaxy brain idea'],
|
|
118
|
+
},
|
|
119
|
+
'100777631': {
|
|
120
|
+
description: 'Is This A Pigeon - Misidentifying something obvious',
|
|
121
|
+
boxes: ['The person (who is confused)', 'The object (what they see)', 'Is this a ___? (wrong identification)'],
|
|
122
|
+
},
|
|
123
|
+
'370867422': {
|
|
124
|
+
description: 'Megamind peeking - Megamind peeking creepily',
|
|
125
|
+
boxes: ['Top text', 'No ___? (what is missing)'],
|
|
126
|
+
},
|
|
127
|
+
'427308417': {
|
|
128
|
+
description: '0 days without (Lenny, Simpsons) - Counter reset to 0',
|
|
129
|
+
boxes: ['The number (usually 0)', 'What the counter is for'],
|
|
130
|
+
},
|
|
131
|
+
'101470': {
|
|
132
|
+
description: 'Ancient Aliens - Guy suggesting aliens as explanation',
|
|
133
|
+
boxes: ['Top text', 'Aliens'],
|
|
134
|
+
},
|
|
135
|
+
'79132341': {
|
|
136
|
+
description: 'Bike Fall - Person puts stick in own bike wheel',
|
|
137
|
+
boxes: ['Person on bike (who causes problem)', 'Stick in wheel (the self-sabotage)', 'Person on ground (result)'],
|
|
138
|
+
},
|
|
139
|
+
'177682295': {
|
|
140
|
+
description: 'You Guys are Getting Paid - Surprised someone gets paid',
|
|
141
|
+
boxes: ['Context', 'You guys are getting paid?'],
|
|
142
|
+
},
|
|
143
|
+
'252758727': {
|
|
144
|
+
description: 'Mother Ignoring Kid Drowning In A Pool - Priorities meme',
|
|
145
|
+
boxes: ['Drowning kid (ignored problem)', 'Mother (who ignores)', 'Skeleton underwater (long ignored)', 'Kid with floaties (what gets attention)'],
|
|
146
|
+
},
|
|
147
|
+
'110163934': {
|
|
148
|
+
description: "I Bet He's Thinking About Other Women - Couple in bed",
|
|
149
|
+
boxes: ['What she thinks he is thinking', 'What he is actually thinking about'],
|
|
150
|
+
},
|
|
151
|
+
'180190441': {
|
|
152
|
+
description: "They're The Same Picture - Pam from The Office",
|
|
153
|
+
boxes: ['First picture label', 'Second picture label', "Corporate wants you to find the difference / They're the same picture"],
|
|
154
|
+
},
|
|
155
|
+
'148909805': {
|
|
156
|
+
description: 'Monkey Puppet - Monkey looking away awkwardly',
|
|
157
|
+
boxes: ['Top text (awkward situation)', 'Bottom text'],
|
|
158
|
+
},
|
|
159
|
+
'3218037': {
|
|
160
|
+
description: "This Is Where I'd Put My Trophy If I Had One - Fairly OddParents",
|
|
161
|
+
boxes: ['This is where I would put my ___', 'If I had one'],
|
|
162
|
+
},
|
|
163
|
+
'27813981': {
|
|
164
|
+
description: 'Hide the Pain Harold - Man with forced smile hiding pain',
|
|
165
|
+
boxes: ['Top text (painful situation)', 'Bottom text'],
|
|
166
|
+
},
|
|
167
|
+
'28251713': {
|
|
168
|
+
description: 'Oprah You Get A - Oprah giving things to everyone',
|
|
169
|
+
boxes: ['You get a ___', 'Everyone gets a ___'],
|
|
170
|
+
},
|
|
171
|
+
'505705955': {
|
|
172
|
+
description: 'Absolute Cinema - Frame from movie being praised',
|
|
173
|
+
boxes: ['Top text', 'Absolute Cinema'],
|
|
174
|
+
},
|
|
175
|
+
'67452763': {
|
|
176
|
+
description: 'Squidward window - Squidward looking out at SpongeBob and Patrick',
|
|
177
|
+
boxes: ['Squidward (the observer/left out)', 'What SpongeBob and Patrick are enjoying'],
|
|
178
|
+
},
|
|
179
|
+
'195515965': {
|
|
180
|
+
description: 'Clown Applying Makeup - Becoming more of a clown',
|
|
181
|
+
boxes: ['First clown action', 'Second clown action', 'Third clown action', 'Full clown'],
|
|
182
|
+
},
|
|
183
|
+
'77045868': {
|
|
184
|
+
description: 'Pawn Stars Best I Can Do - Rick offering low amount',
|
|
185
|
+
boxes: ['Item/request', 'Best I can do is ___ (lowball offer)'],
|
|
186
|
+
},
|
|
187
|
+
'259237855': {
|
|
188
|
+
description: 'Laughing Leo - DiCaprio pointing and laughing',
|
|
189
|
+
boxes: ['Top text', 'Bottom text'],
|
|
190
|
+
},
|
|
191
|
+
'55311130': {
|
|
192
|
+
description: 'This Is Fine - Dog in burning room',
|
|
193
|
+
boxes: ['Top text', 'This is fine'],
|
|
194
|
+
},
|
|
195
|
+
'234202281': {
|
|
196
|
+
description: 'AJ Styles & Undertaker - AJ unaware of Undertaker behind',
|
|
197
|
+
boxes: ['AJ (unaware person)', 'Undertaker (looming threat)'],
|
|
198
|
+
},
|
|
199
|
+
'284929871': {
|
|
200
|
+
description: "They don't know - Person alone at party thinking",
|
|
201
|
+
boxes: ["They don't know...", 'What they secretly know/are'],
|
|
202
|
+
},
|
|
203
|
+
'29617627': {
|
|
204
|
+
description: 'Look At Me - Somali pirate "I am the captain now"',
|
|
205
|
+
boxes: ['Look at me', 'I am the ___ now'],
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
exports.getTrendingTemplates = (0, pieces_framework_1.createAction)({
|
|
209
|
+
auth: index_1.skaiMemesAuth,
|
|
210
|
+
name: 'get_trending_templates',
|
|
211
|
+
displayName: 'Get Trending Meme Templates',
|
|
212
|
+
description: 'Get the most popular meme templates from Imgflip (Drake, Distracted Boyfriend, etc.)',
|
|
213
|
+
props: {
|
|
214
|
+
searchText: pieces_framework_1.Property.ShortText({
|
|
215
|
+
displayName: 'Search Text',
|
|
216
|
+
description: 'Filter templates by name (case-insensitive, partial match). E.g., "drake", "dog", "button"',
|
|
217
|
+
required: false,
|
|
218
|
+
}),
|
|
219
|
+
maxItems: pieces_framework_1.Property.Number({
|
|
220
|
+
displayName: 'Max Items',
|
|
221
|
+
description: 'Maximum number of templates to retrieve (default: all available)',
|
|
222
|
+
required: false,
|
|
223
|
+
}),
|
|
224
|
+
},
|
|
225
|
+
run(context) {
|
|
226
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
227
|
+
const { searchText, maxItems } = context.propsValue;
|
|
228
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
229
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
230
|
+
url: `${IMGFLIP_API_URL}/get_memes`,
|
|
231
|
+
});
|
|
232
|
+
if (!response.body.success) {
|
|
233
|
+
throw new Error(`Failed to get meme templates: ${response.body.error_message || 'Unknown error'}`);
|
|
234
|
+
}
|
|
235
|
+
const memes = response.body.data.memes;
|
|
236
|
+
// Enrich templates with descriptions and box labels
|
|
237
|
+
let enrichedMemes = memes.map((meme) => {
|
|
238
|
+
const templateInfo = TEMPLATE_INFO[meme.id];
|
|
239
|
+
const defaultBoxLabels = Array.from({ length: meme.box_count }, (_, i) => `Box ${i + 1}`);
|
|
240
|
+
return {
|
|
241
|
+
id: meme.id,
|
|
242
|
+
name: meme.name,
|
|
243
|
+
url: meme.url,
|
|
244
|
+
width: meme.width,
|
|
245
|
+
height: meme.height,
|
|
246
|
+
boxCount: meme.box_count,
|
|
247
|
+
description: (templateInfo === null || templateInfo === void 0 ? void 0 : templateInfo.description) || `${meme.name} - ${meme.box_count} text boxes`,
|
|
248
|
+
boxLabels: (templateInfo === null || templateInfo === void 0 ? void 0 : templateInfo.boxes) || defaultBoxLabels,
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
// Apply search filter if specified (case-insensitive partial match)
|
|
252
|
+
if (searchText && searchText.trim()) {
|
|
253
|
+
const searchLower = searchText.toLowerCase().trim();
|
|
254
|
+
enrichedMemes = enrichedMemes.filter((meme) => meme.name.toLowerCase().includes(searchLower) ||
|
|
255
|
+
meme.description.toLowerCase().includes(searchLower));
|
|
256
|
+
}
|
|
257
|
+
// Apply maxItems limit if specified
|
|
258
|
+
if (maxItems && maxItems > 0) {
|
|
259
|
+
enrichedMemes = enrichedMemes.slice(0, maxItems);
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
success: true,
|
|
263
|
+
templates: enrichedMemes,
|
|
264
|
+
totalCount: enrichedMemes.length,
|
|
265
|
+
// Top templates for quick reference (up to 20 or maxItems if smaller)
|
|
266
|
+
topTemplates: enrichedMemes.slice(0, Math.min(20, enrichedMemes.length)).map((m) => ({
|
|
267
|
+
id: m.id,
|
|
268
|
+
name: m.name,
|
|
269
|
+
description: m.description,
|
|
270
|
+
boxLabels: m.boxLabels,
|
|
271
|
+
})),
|
|
272
|
+
};
|
|
273
|
+
});
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
//# sourceMappingURL=get-trending-templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-trending-templates.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/skai-memes/src/lib/actions/get-trending-templates.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,uCAA4C;AAE5C,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAQlD,MAAM,aAAa,GAAiC;IAChD,gCAAgC;IAChC,WAAW,EAAE;QACT,WAAW,EAAE,iDAAiD;QAC9D,KAAK,EAAE,CAAC,mCAAmC,EAAE,sCAAsC,CAAC;KACvF;IACD,UAAU,EAAE;QACR,WAAW,EAAE,8DAA8D;QAC3E,KAAK,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,cAAc,CAAC;KACvE;IACD,WAAW,EAAE;QACT,WAAW,EAAE,4EAA4E;QACzF,KAAK,EAAE,CAAC,0CAA0C,EAAE,mCAAmC,EAAE,wCAAwC,CAAC;KACrI;IACD,WAAW,EAAE;QACT,WAA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AI,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAyE,EAAE,EAAE,CAAC,CAAC;oBACzJ,EAAE,EAAE,CAAC,CAAC,EAAE;oBACR,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,WAAW,EAAE,CAAC,CAAC,WAAW;oBAC1B,SAAS,EAAE,CAAC,CAAC,SAAS;iBACzB,CAAC,CAAC;aACN,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const randomTemplate: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
imgflipUsername: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
imgflipPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
searchText: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
topOnly: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.randomTemplate = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const IMGFLIP_API_URL = 'https://api.imgflip.com';
|
|
9
|
+
const TEMPLATE_INFO = {
|
|
10
|
+
// Top 50 most popular templates
|
|
11
|
+
'181913649': {
|
|
12
|
+
description: 'Drake Hotline Bling - Two panel comparison meme',
|
|
13
|
+
boxes: ['What Drake dislikes/rejects (top)', 'What Drake approves/prefers (bottom)'],
|
|
14
|
+
},
|
|
15
|
+
'87743020': {
|
|
16
|
+
description: 'Two Buttons - Person sweating while choosing between options',
|
|
17
|
+
boxes: ['Left button option', 'Right button option', 'Person label'],
|
|
18
|
+
},
|
|
19
|
+
'112126428': {
|
|
20
|
+
description: 'Distracted Boyfriend - Guy looking at other woman while girlfriend watches',
|
|
21
|
+
boxes: ['The other woman (what catches attention)', 'The boyfriend (who is distracted)', 'The girlfriend (what is being ignored)'],
|
|
22
|
+
},
|
|
23
|
+
'222403160': {
|
|
24
|
+
description: 'Bernie I Am Once Again Asking - Bernie Sanders asking for something',
|
|
25
|
+
boxes: ['Top text (optional)', 'What Bernie is asking for'],
|
|
26
|
+
},
|
|
27
|
+
'124822590': {
|
|
28
|
+
description: 'Left Exit 12 Off Ramp - Car swerving to take exit',
|
|
29
|
+
boxes: ['Highway sign (sensible choice)', 'Exit sign (tempting choice)', 'Car label'],
|
|
30
|
+
},
|
|
31
|
+
'131087935': {
|
|
32
|
+
description: 'Running Away Balloon - Person chasing balloon while ignoring something',
|
|
33
|
+
boxes: ['Person running', 'Balloon flying away', 'Small thing on ground', 'Another small thing', 'Fifth element'],
|
|
34
|
+
},
|
|
35
|
+
'217743513': {
|
|
36
|
+
description: 'UNO Draw 25 Cards - Choice between action or drawing 25 cards',
|
|
37
|
+
boxes: ['The action to avoid', 'Person label (who draws 25)'],
|
|
38
|
+
},
|
|
39
|
+
'252600902': {
|
|
40
|
+
description: 'Always Has Been - Astronaut realization meme',
|
|
41
|
+
boxes: ['What first astronaut sees/realizes', '"Always has been" (or response)'],
|
|
42
|
+
},
|
|
43
|
+
'135256802': {
|
|
44
|
+
description: 'Epic Handshake - Two arms agreeing on common ground',
|
|
45
|
+
boxes: ['Left arm label', 'Right arm label', 'Handshake label (shared thing)'],
|
|
46
|
+
},
|
|
47
|
+
'161865971': {
|
|
48
|
+
description: 'Marked Safe From - Facebook safety check parody',
|
|
49
|
+
boxes: ['Today I am marked safe from...', 'What you are safe from'],
|
|
50
|
+
},
|
|
51
|
+
'131940431': {
|
|
52
|
+
description: "Gru's Plan - Gru presenting plan with unexpected twist",
|
|
53
|
+
boxes: ['Step 1 of plan', 'Step 2 of plan', 'Unexpected bad outcome (shown twice)', 'Gru reacting to bad outcome'],
|
|
54
|
+
},
|
|
55
|
+
'97984': {
|
|
56
|
+
description: 'Disaster Girl - Girl smiling deviously in front of burning house',
|
|
57
|
+
boxes: ['Top text', 'Bottom text'],
|
|
58
|
+
},
|
|
59
|
+
'322841258': {
|
|
60
|
+
description: 'Anakin Padme 4 Panel - Anakin says something, Padme questions',
|
|
61
|
+
boxes: ['What Anakin says', 'Padme asks "Right?" (usually implied)', 'Anakin stares (silence confirms bad)'],
|
|
62
|
+
},
|
|
63
|
+
'80707627': {
|
|
64
|
+
description: 'Sad Pablo Escobar - Pablo sitting alone, waiting',
|
|
65
|
+
boxes: ['Top text', 'Middle text', 'Bottom text'],
|
|
66
|
+
},
|
|
67
|
+
'129242436': {
|
|
68
|
+
description: 'Change My Mind - Person at table challenging others',
|
|
69
|
+
boxes: ['The controversial opinion', 'Additional text (optional)'],
|
|
70
|
+
},
|
|
71
|
+
'4087833': {
|
|
72
|
+
description: 'Waiting Skeleton - Skeleton waiting forever',
|
|
73
|
+
boxes: ['What skeleton is waiting for', 'Bottom text'],
|
|
74
|
+
},
|
|
75
|
+
'309868304': {
|
|
76
|
+
description: 'Trade Offer - TikTok trade offer meme',
|
|
77
|
+
boxes: ['I receive (what you get)', 'You receive (what they get)', 'Title/context'],
|
|
78
|
+
},
|
|
79
|
+
'61544': {
|
|
80
|
+
description: 'Success Kid - Baby with fist pump celebrating',
|
|
81
|
+
boxes: ['Setup/situation', 'Successful outcome'],
|
|
82
|
+
},
|
|
83
|
+
'102156234': {
|
|
84
|
+
description: 'Mocking Spongebob - Spongebob mocking text',
|
|
85
|
+
boxes: ['Original statement', 'Mocked version (aLtErNaTiNg CaPs)'],
|
|
86
|
+
},
|
|
87
|
+
'438680': {
|
|
88
|
+
description: 'Batman Slapping Robin - Batman slaps Robin mid-sentence',
|
|
89
|
+
boxes: ['What Robin says (gets interrupted)', 'What Batman says (the correction)'],
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
exports.randomTemplate = (0, pieces_framework_1.createAction)({
|
|
93
|
+
auth: index_1.skaiMemesAuth,
|
|
94
|
+
name: 'random_template',
|
|
95
|
+
displayName: 'Random Template Picker',
|
|
96
|
+
description: 'Get a random meme template, optionally filtered by search text',
|
|
97
|
+
props: {
|
|
98
|
+
searchText: pieces_framework_1.Property.ShortText({
|
|
99
|
+
displayName: 'Search Text (Optional)',
|
|
100
|
+
description: 'Filter templates before picking random. E.g., "dog", "button", "choice"',
|
|
101
|
+
required: false,
|
|
102
|
+
}),
|
|
103
|
+
topOnly: pieces_framework_1.Property.Checkbox({
|
|
104
|
+
displayName: 'Top Templates Only',
|
|
105
|
+
description: 'Only pick from top 50 most popular templates',
|
|
106
|
+
required: false,
|
|
107
|
+
defaultValue: true,
|
|
108
|
+
}),
|
|
109
|
+
},
|
|
110
|
+
run(context) {
|
|
111
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const { searchText, topOnly } = context.propsValue;
|
|
113
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
114
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
115
|
+
url: `${IMGFLIP_API_URL}/get_memes`,
|
|
116
|
+
});
|
|
117
|
+
if (!response.body.success) {
|
|
118
|
+
throw new Error(`Failed to get meme templates: ${response.body.error_message || 'Unknown error'}`);
|
|
119
|
+
}
|
|
120
|
+
let memes = response.body.data.memes;
|
|
121
|
+
// Limit to top 50 if requested
|
|
122
|
+
if (topOnly) {
|
|
123
|
+
memes = memes.slice(0, 50);
|
|
124
|
+
}
|
|
125
|
+
// Enrich with descriptions and box labels
|
|
126
|
+
let enrichedMemes = memes.map((meme) => {
|
|
127
|
+
const templateInfo = TEMPLATE_INFO[meme.id];
|
|
128
|
+
const defaultBoxLabels = Array.from({ length: meme.box_count }, (_, i) => `Box ${i + 1}`);
|
|
129
|
+
return {
|
|
130
|
+
id: meme.id,
|
|
131
|
+
name: meme.name,
|
|
132
|
+
url: meme.url,
|
|
133
|
+
width: meme.width,
|
|
134
|
+
height: meme.height,
|
|
135
|
+
boxCount: meme.box_count,
|
|
136
|
+
description: (templateInfo === null || templateInfo === void 0 ? void 0 : templateInfo.description) || `${meme.name} - ${meme.box_count} text boxes`,
|
|
137
|
+
boxLabels: (templateInfo === null || templateInfo === void 0 ? void 0 : templateInfo.boxes) || defaultBoxLabels,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
// Apply search filter if specified
|
|
141
|
+
if (searchText && searchText.trim()) {
|
|
142
|
+
const searchLower = searchText.toLowerCase().trim();
|
|
143
|
+
enrichedMemes = enrichedMemes.filter((meme) => meme.name.toLowerCase().includes(searchLower) ||
|
|
144
|
+
meme.description.toLowerCase().includes(searchLower));
|
|
145
|
+
}
|
|
146
|
+
if (enrichedMemes.length === 0) {
|
|
147
|
+
throw new Error(`No templates found${searchText ? ` matching "${searchText}"` : ''}`);
|
|
148
|
+
}
|
|
149
|
+
// Pick a random template
|
|
150
|
+
const randomIndex = Math.floor(Math.random() * enrichedMemes.length);
|
|
151
|
+
const selectedTemplate = enrichedMemes[randomIndex];
|
|
152
|
+
return {
|
|
153
|
+
success: true,
|
|
154
|
+
template: selectedTemplate,
|
|
155
|
+
poolSize: enrichedMemes.length,
|
|
156
|
+
message: `Randomly selected "${selectedTemplate.name}" from ${enrichedMemes.length} templates`,
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
//# sourceMappingURL=random-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random-template.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/skai-memes/src/lib/actions/random-template.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,uCAA4C;AAE5C,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAQlD,MAA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