@quintype/framework 7.31.0-tiktok-task.0 → 7.31.1-fix-access-control.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/.vscode/settings.json +1 -1
- package/CHANGELOG.md +40 -0
- package/package.json +3 -3
- package/server/amp/handlers/story-page.js +16 -4
- package/server/data-loader-helpers.js +5 -1
- package/server/generate-routes.js +22 -0
- package/server/routes.js +254 -236
- package/test/integration/sketches-proxy-test.js +13 -0
- package/test/unit/generate-routes-test.js +325 -7
package/.vscode/settings.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [7.31.0](https://github.com/quintype/quintype-node-framework/compare/v7.30.9...v7.31.0) (2024-11-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **Preview:** support home & collection preview route ([#450](https://github.com/quintype/quintype-node-framework/issues/450)) ([0c34ec4](https://github.com/quintype/quintype-node-framework/commit/0c34ec406fbe8d9ee56de1215c2100b2bb3e6896))
|
|
11
|
+
|
|
12
|
+
### [7.30.9](https://github.com/quintype/quintype-node-framework/compare/v7.30.8...v7.30.9) (2024-11-22)
|
|
13
|
+
|
|
14
|
+
### [7.30.8](https://github.com/quintype/quintype-node-framework/compare/v7.30.7...v7.30.8) (2024-11-05)
|
|
15
|
+
|
|
16
|
+
### [7.30.7](https://github.com/quintype/quintype-node-framework/compare/v7.30.6...v7.30.7) (2024-10-30)
|
|
17
|
+
|
|
18
|
+
### [7.30.6](https://github.com/quintype/quintype-node-framework/compare/v7.30.5...v7.30.6) (2024-10-30)
|
|
19
|
+
|
|
20
|
+
### [7.30.5](https://github.com/quintype/quintype-node-framework/compare/v7.30.4...v7.30.5) (2024-10-22)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* **cache-tags:** fix amp cache tags ([#443](https://github.com/quintype/quintype-node-framework/issues/443)) ([009bbca](https://github.com/quintype/quintype-node-framework/commit/009bbcab7d42e70626d541ca80def10625ca021e))
|
|
26
|
+
|
|
27
|
+
### [7.30.4](https://github.com/quintype/quintype-node-framework/compare/v7.30.3...v7.30.4) (2024-10-22)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **publish time:** fix amp publish time ([#441](https://github.com/quintype/quintype-node-framework/issues/441)) ([fe22c6b](https://github.com/quintype/quintype-node-framework/commit/fe22c6b78e435b32a03da79bdf616197d4ecdb39))
|
|
33
|
+
|
|
34
|
+
### [7.30.3](https://github.com/quintype/quintype-node-framework/compare/v7.30.2...v7.30.3) (2024-09-30)
|
|
35
|
+
|
|
36
|
+
### [7.30.2](https://github.com/quintype/quintype-node-framework/compare/v7.30.1...v7.30.2) (2024-09-13)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **Amp story:** pass amp optimizer toggle to preload hero image ([#439](https://github.com/quintype/quintype-node-framework/issues/439)) ([c943095](https://github.com/quintype/quintype-node-framework/commit/c943095a25000377f94b709df1b75ccfed3983df))
|
|
42
|
+
|
|
43
|
+
### [7.30.1](https://github.com/quintype/quintype-node-framework/compare/v7.30.0...v7.30.1) (2024-08-14)
|
|
44
|
+
|
|
5
45
|
## [7.30.0](https://github.com/quintype/quintype-node-framework/compare/v7.29.1...v7.30.0) (2024-07-30)
|
|
6
46
|
|
|
7
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/framework",
|
|
3
|
-
"version": "7.31.
|
|
3
|
+
"version": "7.31.1-fix-access-control.0",
|
|
4
4
|
"description": "Libraries to help build Quintype Node.js apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"homepage": "https://github.com/quintype/quintype-node-framework#readme",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@ampproject/toolbox-optimizer": "2.8.3",
|
|
34
|
-
"@quintype/amp": "^2.20.0
|
|
35
|
-
"@quintype/backend": "2.
|
|
34
|
+
"@quintype/amp": "^2.20.0",
|
|
35
|
+
"@quintype/backend": "^2.6.0",
|
|
36
36
|
"@quintype/components": "^3.5.0",
|
|
37
37
|
"@quintype/prerender-node": "^3.2.26",
|
|
38
38
|
"@quintype/seo": "^1.46.1",
|
|
@@ -141,26 +141,38 @@ async function ampStoryPageHandler(
|
|
|
141
141
|
});
|
|
142
142
|
merge(mergedAdditionalConfig, additionalConfig, fetchedAdditionalConfig);
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
const optimizeAmpHtml = get(domainSpecificOpts, ["featureConfig", "optimizeAmpHtml"], true);
|
|
145
145
|
const ampHtml = ampifyStory({
|
|
146
146
|
story,
|
|
147
147
|
publisherConfig: config.config,
|
|
148
148
|
ampConfig: ampConfig.ampConfig,
|
|
149
149
|
additionalConfig: isEmpty(mergedAdditionalConfig) ? additionalConfig : mergedAdditionalConfig,
|
|
150
|
-
opts: { ...domainSpecificOpts, domainSlug },
|
|
150
|
+
opts: { ...domainSpecificOpts, domainSlug, optimizeAmpHtml },
|
|
151
151
|
seo: seoTags ? seoTags.toString() : "",
|
|
152
152
|
});
|
|
153
153
|
if (ampHtml instanceof Error) return next(ampHtml);
|
|
154
154
|
|
|
155
155
|
res.set("Content-Type", "text/html");
|
|
156
|
+
|
|
157
|
+
const pageCacheKey = `page/${config["publisher-id"]}/story-page`;
|
|
158
|
+
let cacheKeys = [storyToCacheKey(config["publisher-id"], story), pageCacheKey];
|
|
159
|
+
|
|
160
|
+
/* To cdn purge amp stories through custom tags, use getAdditionalCacheKeys function
|
|
161
|
+
to generate one or more cache tags, it should return cache tags as an array of strings. */
|
|
162
|
+
const getAdditionalCacheKeys = get(opts, ["featureConfig", "getAdditionalCacheKeys"]);
|
|
163
|
+
if (getAdditionalCacheKeys) {
|
|
164
|
+
const additionalCacheKeys = getAdditionalCacheKeys(config);
|
|
165
|
+
cacheKeys = cacheKeys.concat(additionalCacheKeys);
|
|
166
|
+
}
|
|
167
|
+
|
|
156
168
|
addCacheHeadersToResult({
|
|
157
169
|
res,
|
|
158
|
-
cacheKeys
|
|
170
|
+
cacheKeys,
|
|
159
171
|
cdnProvider,
|
|
160
172
|
config,
|
|
173
|
+
sMaxAge: "86400",
|
|
161
174
|
});
|
|
162
175
|
|
|
163
|
-
const optimizeAmpHtml = get(domainSpecificOpts, ["featureConfig", "optimizeAmpHtml"], true);
|
|
164
176
|
const finalResponse = optimizeAmpHtml ? await optimize(ampHtml) : ampHtml;
|
|
165
177
|
|
|
166
178
|
return res.send(finalResponse);
|
|
@@ -23,16 +23,20 @@ exports.homeCollectionOrStories = function homeCollectionOrStories(
|
|
|
23
23
|
customLayouts = [],
|
|
24
24
|
defaultNestedLimit = null
|
|
25
25
|
) {
|
|
26
|
+
const {qtInternalAppsKey = "", previewId = "", ...rest} = params || {};
|
|
27
|
+
|
|
26
28
|
return Collection.getCollectionBySlug(
|
|
27
29
|
client,
|
|
28
30
|
"home",
|
|
29
|
-
{ "item-type": "collection", ...
|
|
31
|
+
{ "item-type": "collection", ...rest },
|
|
30
32
|
{
|
|
31
33
|
depth,
|
|
32
34
|
...(getStoryLimits && { storyLimits: getStoryLimits() }),
|
|
33
35
|
collectionOfCollectionsIndexes,
|
|
34
36
|
customLayouts,
|
|
35
37
|
defaultNestedLimit,
|
|
38
|
+
qtInternalAppsKey,
|
|
39
|
+
previewId
|
|
36
40
|
}
|
|
37
41
|
).then((collection) => {
|
|
38
42
|
if (collection) return collection;
|
|
@@ -165,6 +165,28 @@ exports.generateCommonRoutes = function generateSectionPageRoutes(
|
|
|
165
165
|
},
|
|
166
166
|
]
|
|
167
167
|
: [],
|
|
168
|
+
[
|
|
169
|
+
{
|
|
170
|
+
path: '/preview/:previewId/collection/home',
|
|
171
|
+
pageType: 'home-page-preview',
|
|
172
|
+
exact: true,
|
|
173
|
+
skipPWA: true,
|
|
174
|
+
params: {
|
|
175
|
+
collectionSlug: config.getHomeCollectionSlug(domainSlug)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
[
|
|
180
|
+
{
|
|
181
|
+
path: '/preview/:previewId/collection/:collectionSlug',
|
|
182
|
+
pageType: 'collection-page-preview',
|
|
183
|
+
exact: true,
|
|
184
|
+
skipPWA: skipPWA.home || false,
|
|
185
|
+
params: {
|
|
186
|
+
collectionSlug: config.getHomeCollectionSlug(domainSlug)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
],
|
|
168
190
|
sectionPageRoutes ? sectionRoutes : [],
|
|
169
191
|
storyPageRoutes ? storyRoutes : []
|
|
170
192
|
);
|