@ever-works/mastodon-connector-plugin 1.0.3 → 1.0.6
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.cjs +28 -1
- package/dist/index.js +28 -1
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,26 @@ var PLUGIN_CAPABILITIES = {
|
|
|
26
26
|
// external events into the platform ingest pipeline. See
|
|
27
27
|
// capabilities/event-source.interface.ts.
|
|
28
28
|
EVENT_SOURCE: "event-source"};
|
|
29
|
+
var GITHUB_FULL_SCOPES_ALL = [
|
|
30
|
+
"user:email",
|
|
31
|
+
"read:user",
|
|
32
|
+
"repo",
|
|
33
|
+
"delete_repo",
|
|
34
|
+
"workflow",
|
|
35
|
+
"write:repo_hook",
|
|
36
|
+
"read:org",
|
|
37
|
+
"project"
|
|
38
|
+
];
|
|
39
|
+
var GITHUB_DELETE_REPO_SCOPE = "delete_repo";
|
|
40
|
+
function isGithubDeleteRepoScopeEnabled(env = readEnv()) {
|
|
41
|
+
return (env?.GITHUB_OAUTH_DELETE_REPO_SCOPE_ENABLED ?? "").trim().toLowerCase() === "true";
|
|
42
|
+
}
|
|
43
|
+
function readEnv() {
|
|
44
|
+
return typeof process !== "undefined" ? process.env : void 0;
|
|
45
|
+
}
|
|
46
|
+
Object.freeze(
|
|
47
|
+
GITHUB_FULL_SCOPES_ALL.filter((scope) => scope !== GITHUB_DELETE_REPO_SCOPE || isGithubDeleteRepoScopeEnabled())
|
|
48
|
+
);
|
|
29
49
|
function isSafeWebhookUrl(rawUrl) {
|
|
30
50
|
let url;
|
|
31
51
|
try {
|
|
@@ -151,7 +171,14 @@ function truncateText(text) {
|
|
|
151
171
|
}
|
|
152
172
|
function stripStatusHtml(html) {
|
|
153
173
|
if (typeof html !== "string" || html.length === 0) return void 0;
|
|
154
|
-
|
|
174
|
+
let stripped = html.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n\n");
|
|
175
|
+
let previous;
|
|
176
|
+
let passes = 0;
|
|
177
|
+
do {
|
|
178
|
+
previous = stripped;
|
|
179
|
+
stripped = stripped.replace(/<[^<>]+>/g, "");
|
|
180
|
+
} while (stripped !== previous && ++passes < 32);
|
|
181
|
+
const text = stripped.replace(/(?<!<)<+(?=[a-z/!?])/gi, "").replace(/ /g, " ").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&").trim();
|
|
155
182
|
return text.length > 0 ? text : void 0;
|
|
156
183
|
}
|
|
157
184
|
function resolveVisibility(value) {
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,26 @@ var PLUGIN_CAPABILITIES = {
|
|
|
22
22
|
// external events into the platform ingest pipeline. See
|
|
23
23
|
// capabilities/event-source.interface.ts.
|
|
24
24
|
EVENT_SOURCE: "event-source"};
|
|
25
|
+
var GITHUB_FULL_SCOPES_ALL = [
|
|
26
|
+
"user:email",
|
|
27
|
+
"read:user",
|
|
28
|
+
"repo",
|
|
29
|
+
"delete_repo",
|
|
30
|
+
"workflow",
|
|
31
|
+
"write:repo_hook",
|
|
32
|
+
"read:org",
|
|
33
|
+
"project"
|
|
34
|
+
];
|
|
35
|
+
var GITHUB_DELETE_REPO_SCOPE = "delete_repo";
|
|
36
|
+
function isGithubDeleteRepoScopeEnabled(env = readEnv()) {
|
|
37
|
+
return (env?.GITHUB_OAUTH_DELETE_REPO_SCOPE_ENABLED ?? "").trim().toLowerCase() === "true";
|
|
38
|
+
}
|
|
39
|
+
function readEnv() {
|
|
40
|
+
return typeof process !== "undefined" ? process.env : void 0;
|
|
41
|
+
}
|
|
42
|
+
Object.freeze(
|
|
43
|
+
GITHUB_FULL_SCOPES_ALL.filter((scope) => scope !== GITHUB_DELETE_REPO_SCOPE || isGithubDeleteRepoScopeEnabled())
|
|
44
|
+
);
|
|
25
45
|
function isSafeWebhookUrl(rawUrl) {
|
|
26
46
|
let url;
|
|
27
47
|
try {
|
|
@@ -147,7 +167,14 @@ function truncateText(text) {
|
|
|
147
167
|
}
|
|
148
168
|
function stripStatusHtml(html) {
|
|
149
169
|
if (typeof html !== "string" || html.length === 0) return void 0;
|
|
150
|
-
|
|
170
|
+
let stripped = html.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n\n");
|
|
171
|
+
let previous;
|
|
172
|
+
let passes = 0;
|
|
173
|
+
do {
|
|
174
|
+
previous = stripped;
|
|
175
|
+
stripped = stripped.replace(/<[^<>]+>/g, "");
|
|
176
|
+
} while (stripped !== previous && ++passes < 32);
|
|
177
|
+
const text = stripped.replace(/(?<!<)<+(?=[a-z/!?])/gi, "").replace(/ /g, " ").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&").trim();
|
|
151
178
|
return text.length > 0 ? text : void 0;
|
|
152
179
|
}
|
|
153
180
|
function resolveVisibility(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ever-works/mastodon-connector-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Mastodon social connector plugin for Ever Works platform (outbound statuses via the masto SDK, and event-source pull of mentions/notifications plus the account's own statuses into the event-ingest pipeline, with opt-in historical backfill)",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ever Co. LTD",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"test:watch": "vitest"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@ever-works/contracts": "^1.
|
|
36
|
-
"@ever-works/plugin": "^1.2.
|
|
35
|
+
"@ever-works/contracts": "^1.1.1",
|
|
36
|
+
"@ever-works/plugin": "^1.2.28",
|
|
37
37
|
"masto": "^7.12.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
@@ -99,16 +99,16 @@
|
|
|
99
99
|
},
|
|
100
100
|
"repository": {
|
|
101
101
|
"type": "git",
|
|
102
|
-
"url": "git+https://github.com/ever-
|
|
102
|
+
"url": "git+https://github.com/ever-co/ever-works.git",
|
|
103
103
|
"directory": "packages/plugins/mastodon-connector"
|
|
104
104
|
},
|
|
105
|
-
"homepage": "https://github.com/ever-
|
|
105
|
+
"homepage": "https://github.com/ever-co/ever-works/tree/main/packages/plugins/mastodon-connector#readme",
|
|
106
106
|
"bugs": {
|
|
107
|
-
"url": "https://github.com/ever-
|
|
107
|
+
"url": "https://github.com/ever-co/ever-works/issues"
|
|
108
108
|
},
|
|
109
109
|
"everworksRelease": {
|
|
110
|
-
"contentHash": "sha256:
|
|
111
|
-
"commit": "
|
|
112
|
-
"source": "https://github.com/ever-
|
|
110
|
+
"contentHash": "sha256:1fc65567f9e52bdadc472fbf7b1d95034b4e23ce475ee8afa3bac036d9fd35b0",
|
|
111
|
+
"commit": "2288ff7e91562b0f079c365348ba08ab3a16f1dd",
|
|
112
|
+
"source": "https://github.com/ever-co/ever-works/tree/2288ff7e91562b0f079c365348ba08ab3a16f1dd/packages/plugins/mastodon-connector"
|
|
113
113
|
}
|
|
114
114
|
}
|