@easy-cms/plugin-social 1.40.0 → 1.42.0
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/dist/index.js +23 -11
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -34,11 +34,11 @@ var X = logo(siX);
|
|
|
34
34
|
// src/facebook.ts
|
|
35
35
|
var version = () => process.env.FACEBOOK_GRAPH_VERSION ?? "v26.0";
|
|
36
36
|
var graph = () => `${(process.env.FACEBOOK_GRAPH_URL ?? "https://graph.facebook.com").replace(/\/+$/, "")}/${version()}`;
|
|
37
|
-
var app = () => {
|
|
38
|
-
const id =
|
|
39
|
-
const secret =
|
|
37
|
+
var app = (values) => {
|
|
38
|
+
const id = values.appId;
|
|
39
|
+
const secret = values.appSecret;
|
|
40
40
|
if (!id || !secret)
|
|
41
|
-
throw new Error("
|
|
41
|
+
throw new Error("Enter your Meta app\u2019s id and secret to connect Facebook Pages");
|
|
42
42
|
return { id, secret };
|
|
43
43
|
};
|
|
44
44
|
async function call(path, init) {
|
|
@@ -70,15 +70,27 @@ var facebook = {
|
|
|
70
70
|
category: "social",
|
|
71
71
|
icon: FACEBOOK,
|
|
72
72
|
description: {
|
|
73
|
-
en: "Posts to Facebook Pages you manage
|
|
74
|
-
th: "\u0E42\u0E1E\u0E2A\u0E15\u0E4C\u0E44\u0E1B\u0E22\u0E31\u0E07\u0E40\u0E1E\u0E08 Facebook \u0E17\u0E35\u0E48\u0E04\u0E38\u0E13\u0E14\u0E39\u0E41\u0E25 \
|
|
73
|
+
en: "Posts to Facebook Pages you manage, through a Meta app of your own.",
|
|
74
|
+
th: "\u0E42\u0E1E\u0E2A\u0E15\u0E4C\u0E44\u0E1B\u0E22\u0E31\u0E07\u0E40\u0E1E\u0E08 Facebook \u0E17\u0E35\u0E48\u0E04\u0E38\u0E13\u0E14\u0E39\u0E41\u0E25 \u0E1C\u0E48\u0E32\u0E19 Meta app \u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13\u0E40\u0E2D\u0E07"
|
|
75
75
|
},
|
|
76
76
|
docs: "https://easycms.dev/docs/social#facebook-page",
|
|
77
77
|
plugin: "@easy-cms/plugin-social",
|
|
78
78
|
kind: "oauth",
|
|
79
79
|
oauth: {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
app: {
|
|
81
|
+
fields: [
|
|
82
|
+
{ name: "appId", label: { en: "App ID", th: "App ID" }, required: true },
|
|
83
|
+
{
|
|
84
|
+
name: "appSecret",
|
|
85
|
+
label: { en: "App secret", th: "App secret" },
|
|
86
|
+
secret: true,
|
|
87
|
+
required: true
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
env: { appId: "META_APP_ID", appSecret: "META_APP_SECRET" }
|
|
91
|
+
},
|
|
92
|
+
authorizeUrl: ({ redirectUri, state, app: keys }) => {
|
|
93
|
+
const { id } = app(keys);
|
|
82
94
|
const dialog = (process.env.FACEBOOK_DIALOG_URL ?? "https://www.facebook.com").replace(
|
|
83
95
|
/\/+$/,
|
|
84
96
|
""
|
|
@@ -94,8 +106,8 @@ var facebook = {
|
|
|
94
106
|
},
|
|
95
107
|
// The code → a user token → a long-lived one → the Pages it manages, each with a Page token
|
|
96
108
|
// that doesn't expire (until the user takes it back).
|
|
97
|
-
exchange: async ({ code, redirectUri }) => {
|
|
98
|
-
const { id, secret } = app();
|
|
109
|
+
exchange: async ({ code, redirectUri, app: keys }) => {
|
|
110
|
+
const { id, secret } = app(keys);
|
|
99
111
|
const short = await call("/oauth/access_token", {
|
|
100
112
|
params: { client_id: id, client_secret: secret, redirect_uri: redirectUri, code }
|
|
101
113
|
});
|
|
@@ -326,7 +338,7 @@ var INFO = {
|
|
|
326
338
|
name: "@easy-cms/plugin-social",
|
|
327
339
|
// The plugin API it is written for (`PLUGIN_API_VERSION` of @easy-cms/core).
|
|
328
340
|
apiVersion: 1,
|
|
329
|
-
...true ? { version: "1.
|
|
341
|
+
...true ? { version: "1.42.0" } : {}
|
|
330
342
|
};
|
|
331
343
|
|
|
332
344
|
// src/shared.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-cms/plugin-social",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.0",
|
|
4
4
|
"description": "Social posts for Easy CMS: write a post once and send it to several channels (webhooks to Make, n8n or Zapier first), with schedules, retries and a status per channel",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@easy-cms/core": "^1.
|
|
20
|
+
"@easy-cms/core": "^1.42.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"happy-dom": "^21.0.4",
|
|
24
24
|
"simple-icons": "16.36.0",
|
|
25
|
-
"@easy-cms/core": "^1.
|
|
26
|
-
"@easy-cms/db-sqlite": "^1.
|
|
25
|
+
"@easy-cms/core": "^1.42.0",
|
|
26
|
+
"@easy-cms/db-sqlite": "^1.42.0"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=22.12"
|