backend-manager 5.0.21 → 5.0.23
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/firebase-debug.log
CHANGED
|
@@ -6,3 +6,19 @@
|
|
|
6
6
|
[debug] [2025-10-20T05:12:15.299Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
7
7
|
[debug] [2025-10-20T05:12:15.299Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
8
8
|
[debug] [2025-10-20T05:12:15.299Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
9
|
+
[debug] [2025-10-20T07:15:36.351Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
10
|
+
[debug] [2025-10-20T07:15:36.355Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
11
|
+
[debug] [2025-10-20T07:15:36.354Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
12
|
+
[debug] [2025-10-20T07:15:36.354Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
13
|
+
[debug] [2025-10-20T07:15:36.354Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
14
|
+
[debug] [2025-10-20T07:15:36.357Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
15
|
+
[debug] [2025-10-20T07:15:36.358Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
16
|
+
[debug] [2025-10-20T07:15:36.358Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
17
|
+
[debug] [2025-10-20T23:59:40.560Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
18
|
+
[debug] [2025-10-20T23:59:40.561Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
19
|
+
[debug] [2025-10-20T23:59:40.562Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
20
|
+
[debug] [2025-10-20T23:59:40.563Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
21
|
+
[debug] [2025-10-20T23:59:40.563Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
22
|
+
[debug] [2025-10-20T23:59:40.562Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
23
|
+
[debug] [2025-10-20T23:59:40.563Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
24
|
+
[debug] [2025-10-20T23:59:40.563Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
package/package.json
CHANGED
|
@@ -8,13 +8,9 @@ const path = require('path');
|
|
|
8
8
|
const { Octokit } = require('@octokit/rest');
|
|
9
9
|
|
|
10
10
|
const POST_TEMPLATE = jetpack.read(`${__dirname}/templates/post.html`);
|
|
11
|
-
const
|
|
12
|
-
const IMAGE_PATH_SRC = `assets/_src/images/blog/posts/post-{id}/`;
|
|
13
|
-
// const IMAGE_PATH_REG = `/assets/images/blog/posts/post-{id}/`;
|
|
14
|
-
const AD_TAG = `{% include /master/modules/adunits/adsense-in-article.html index="{index}" %}`;
|
|
11
|
+
const IMAGE_PATH_SRC = `src/assets/images/blog/posts/post-{id}/`;
|
|
15
12
|
|
|
16
13
|
const IMAGE_REGEX = /(?:!\[(.*?)\]\((.*?)\))/img;
|
|
17
|
-
const LINK_REGEX = /(?:\[(.*?)\]\((.*?)\))/img;
|
|
18
14
|
|
|
19
15
|
function Module() {
|
|
20
16
|
|
|
@@ -51,8 +47,8 @@ Module.prototype.main = function () {
|
|
|
51
47
|
return reject(assistant.errorify(`Missing required parameter: title`, {code: 400}));
|
|
52
48
|
} else if (!payload.data.payload.url) {
|
|
53
49
|
return reject(assistant.errorify(`Missing required parameter: url`, {code: 400}));
|
|
54
|
-
} else if (!payload.data.payload.
|
|
55
|
-
return reject(assistant.errorify(`Missing required parameter:
|
|
50
|
+
} else if (!payload.data.payload.description) {
|
|
51
|
+
return reject(assistant.errorify(`Missing required parameter: description`, {code: 400}));
|
|
56
52
|
} else if (!payload.data.payload.headerImageURL) {
|
|
57
53
|
return reject(assistant.errorify(`Missing required parameter: headerImageURL`, {code: 400}));
|
|
58
54
|
} else if (!payload.data.payload.body) {
|
|
@@ -91,7 +87,7 @@ Module.prototype.main = function () {
|
|
|
91
87
|
payload.data.payload.layout = payload.data.payload.layout || 'app/blog/post';
|
|
92
88
|
payload.data.payload.date = moment(payload.data.payload.date || now).subtract(1, 'days').format('YYYY-MM-DD');
|
|
93
89
|
payload.data.payload.id = payload.data.payload.id || Math.round(new Date(now).getTime() / 1000);
|
|
94
|
-
payload.data.payload.path = `_posts/${moment(now).format('YYYY')}/${payload.data.payload.path || 'guest'}`;
|
|
90
|
+
payload.data.payload.path = `src/_posts/${moment(now).format('YYYY')}/${payload.data.payload.path || 'guest'}`;
|
|
95
91
|
payload.data.payload.githubUser = payload.data.payload.githubUser || bemRepo.user;
|
|
96
92
|
payload.data.payload.githubRepo = payload.data.payload.githubRepo || bemRepo.name;
|
|
97
93
|
|
|
@@ -107,14 +103,8 @@ Module.prototype.main = function () {
|
|
|
107
103
|
formatClone(payload.data.payload),
|
|
108
104
|
);
|
|
109
105
|
|
|
110
|
-
// Insert ads
|
|
111
|
-
const articleWithAds = insertAds(formattedContent, 6, 4000);
|
|
112
|
-
|
|
113
|
-
// Log
|
|
114
|
-
assistant.log(`main(): articleWithAds`, articleWithAds);
|
|
115
|
-
|
|
116
106
|
// Upload post
|
|
117
|
-
const uploadPost = await self.uploadPost(
|
|
107
|
+
const uploadPost = await self.uploadPost(formattedContent);
|
|
118
108
|
|
|
119
109
|
// Log
|
|
120
110
|
assistant.log(`main(): uploadPost`, uploadPost);
|
|
@@ -139,19 +129,15 @@ Module.prototype.extractImages = function () {
|
|
|
139
129
|
// Extract images
|
|
140
130
|
const matches = payload.data.payload.body.matchAll(IMAGE_REGEX);
|
|
141
131
|
const images = Array.from(matches).map(match => ({
|
|
142
|
-
full: match[0] || '',
|
|
143
132
|
src: match[2] || '',
|
|
144
133
|
alt: match[1] || uuidv4(),
|
|
145
|
-
replace: true,
|
|
146
134
|
header: false,
|
|
147
135
|
}));
|
|
148
136
|
|
|
149
137
|
// Add heading image to beginning of images
|
|
150
138
|
images.unshift({
|
|
151
|
-
full: '',
|
|
152
139
|
src: payload.data.payload.headerImageURL,
|
|
153
140
|
alt: payload.data.payload.url,
|
|
154
|
-
replace: false,
|
|
155
141
|
header: true,
|
|
156
142
|
});
|
|
157
143
|
|
|
@@ -202,18 +188,6 @@ Module.prototype.extractImages = function () {
|
|
|
202
188
|
continue;
|
|
203
189
|
}
|
|
204
190
|
}
|
|
205
|
-
|
|
206
|
-
// Create new image tag
|
|
207
|
-
const tag = powertools.template(IMAGE_TAG, {name: download.filename, alt: image.alt});
|
|
208
|
-
|
|
209
|
-
// Replace image in body
|
|
210
|
-
if (image.replace) {
|
|
211
|
-
payload.data.payload.body = payload.data.payload.body
|
|
212
|
-
.replace(image.full, tag);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Log
|
|
216
|
-
assistant.log(`extractImages(): tag`, tag);
|
|
217
191
|
}
|
|
218
192
|
|
|
219
193
|
// Resolve
|
|
@@ -406,26 +380,4 @@ function hyphenate(s) {
|
|
|
406
380
|
.toLowerCase();
|
|
407
381
|
}
|
|
408
382
|
|
|
409
|
-
function insertAds(article, paragraphsPerAd, minCharsBetweenAds) {
|
|
410
|
-
const paragraphs = article.split('\n\n');
|
|
411
|
-
const newParagraphs = [];
|
|
412
|
-
let charCount = 0;
|
|
413
|
-
let adCount = 0;
|
|
414
|
-
|
|
415
|
-
for (let i = 0, total = paragraphs.length; i < total; i++) {
|
|
416
|
-
const collection = paragraphs[i];
|
|
417
|
-
|
|
418
|
-
charCount += collection.length;
|
|
419
|
-
|
|
420
|
-
newParagraphs.push(collection);
|
|
421
|
-
|
|
422
|
-
if (i >= paragraphsPerAd && charCount >= minCharsBetweenAds) {
|
|
423
|
-
newParagraphs.push(powertools.template(AD_TAG, {index: adCount++}));
|
|
424
|
-
charCount = 0;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
return newParagraphs.join('\n\n');
|
|
429
|
-
}
|
|
430
|
-
|
|
431
383
|
module.exports = Module;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
### ALL PAGES ###
|
|
3
|
-
layout: {layout}
|
|
3
|
+
layout: { layout }
|
|
4
4
|
|
|
5
5
|
### POST ONLY ###
|
|
6
6
|
post:
|
|
7
|
-
title: "{title}"
|
|
8
|
-
|
|
9
|
-
author: {author}
|
|
10
|
-
id: {id}
|
|
11
|
-
tags: {tags}
|
|
12
|
-
categories: {categories}
|
|
13
|
-
affiliate-search-term: {affiliate}
|
|
7
|
+
title: "{ title }"
|
|
8
|
+
description: "{ description }"
|
|
9
|
+
author: { author }
|
|
10
|
+
id: { id }
|
|
11
|
+
tags: { tags }
|
|
12
|
+
categories: { categories }
|
|
14
13
|
---
|
|
15
14
|
|
|
16
|
-
{body}
|
|
15
|
+
{ body }
|
|
@@ -91,7 +91,7 @@ Usage.prototype.init = function (assistant, options) {
|
|
|
91
91
|
// TODO: Make it request using .where() query so it doesnt use a read if it doesnt have to
|
|
92
92
|
foundUsage = await Manager.libraries.admin.firestore().doc(`usage/${self.key}`)
|
|
93
93
|
.get()
|
|
94
|
-
.then((r) =>
|
|
94
|
+
.then((r) => r.data())
|
|
95
95
|
.catch((e) => {
|
|
96
96
|
assistant.errorify(`Usage.init(): Error fetching usage data: ${e}`, {code: 500, sentry: true});
|
|
97
97
|
});
|
|
@@ -316,9 +316,7 @@ Usage.prototype.update = function () {
|
|
|
316
316
|
if (self.useUnauthenticatedStorage) {
|
|
317
317
|
if (self.options.unauthenticatedMode === 'firestore') {
|
|
318
318
|
admin.firestore().doc(`usage/${self.key}`)
|
|
319
|
-
.set({
|
|
320
|
-
usage: self.user.usage,
|
|
321
|
-
}, {merge: true})
|
|
319
|
+
.set(self.user.usage, { merge: true })
|
|
322
320
|
.then(() => {
|
|
323
321
|
self.log(`Usage.update(): Updated user.usage in firestore`, self.user.usage);
|
|
324
322
|
|
|
@@ -338,7 +336,7 @@ Usage.prototype.update = function () {
|
|
|
338
336
|
admin.firestore().doc(`users/${self.user.auth.uid}`)
|
|
339
337
|
.set({
|
|
340
338
|
usage: self.user.usage,
|
|
341
|
-
}, {merge: true})
|
|
339
|
+
}, { merge: true })
|
|
342
340
|
.then(() => {
|
|
343
341
|
self.log(`Usage.update(): Updated user.usage in firestore`, self.user.usage);
|
|
344
342
|
|