@getquick/content 0.4.1 → 0.5.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/README.md +39 -3
- package/dist/client-ip-cnqPLdDa.js +203 -0
- package/dist/consent-astro.d.ts +2 -36
- package/dist/consent-astro.js +1 -93
- package/dist/consent-html.d.ts +36 -0
- package/dist/consent-html.js +94 -0
- package/dist/consent-server.d.ts +7 -0
- package/dist/consent-server.js +3 -2
- package/dist/consent.js +1 -1
- package/dist/{site-language-BCGjkpWY.js → design-fonts-B0ts54vY.js} +3764 -1
- package/dist/forms-server.d.ts +7 -0
- package/dist/forms-server.js +4 -3
- package/dist/index.d.ts +2 -17
- package/dist/index.js +2 -2
- package/dist/server.d.ts +1 -1
- package/dist/server.js +88 -3556
- package/dist/{version-Co2JJcK_.js → version-CmdZGJvZ.js} +1 -1
- package/dist/{wordpress-BvkTDMA0.d.ts → wordpress-OWJxnbAF.d.ts} +113 -2
- package/package.json +5 -1
- package/dist/request-guards-BUPr_vA4.js +0 -46
package/dist/forms-server.d.ts
CHANGED
|
@@ -49,6 +49,13 @@ export interface FormsServerConfig {
|
|
|
49
49
|
bindings: () => FormsBindings | Promise<FormsBindings>;
|
|
50
50
|
/** The Site's public origin(s), when the Worker sees another (a proxy). */
|
|
51
51
|
siteOrigins?: readonly string[];
|
|
52
|
+
/**
|
|
53
|
+
* The reverse proxies the Site runs in front of the Worker, as IPv4/IPv6
|
|
54
|
+
* addresses or CIDRs. Only a request whose `CF-Connecting-IP` is one of
|
|
55
|
+
* them has its client IP taken from the proxy's `X-Forwarded-For` /
|
|
56
|
+
* `X-Real-IP` (docs/client-ip.md).
|
|
57
|
+
*/
|
|
58
|
+
trustedProxies?: readonly string[];
|
|
52
59
|
/** The page language for the handler's own messages (`pt-PT`, `en`). */
|
|
53
60
|
language?: string;
|
|
54
61
|
/** Milliseconds Gravity Forms and Turnstile have to answer (15 s). */
|
package/dist/forms-server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as formDiagnostics, t as FORMS_PATH } from "./descriptor-x8kHFQ79.js";
|
|
2
|
-
import {
|
|
2
|
+
import { i as readBoundedBody, n as rateLimitKey, r as isSameOrigin, t as clientAddressResolver } from "./client-ip-cnqPLdDa.js";
|
|
3
3
|
import { n as honeypotFilled, r as validateSubmission } from "./validate-wRgYUNxN.js";
|
|
4
4
|
import { c as formStateLocation, n as formsCopyLanguage, o as formStateCookie, t as FORMS_COPY } from "./copy-DLto_bWj.js";
|
|
5
5
|
//#region frontend/src/forms/server.ts
|
|
@@ -24,6 +24,7 @@ function createFormsServer(config) {
|
|
|
24
24
|
const restRoot = (config.restRoot ?? `${cms.origin}/wp-json`).replace(/\/+$/, "");
|
|
25
25
|
if (new URL(restRoot).origin !== cms.origin) throw new Error("restRoot must be on the CMS's origin");
|
|
26
26
|
const origins = new Set((config.siteOrigins ?? []).map((origin) => new URL(origin).origin));
|
|
27
|
+
const clientAddress = clientAddressResolver(config.trustedProxies);
|
|
27
28
|
const timeoutMs = config.timeoutMs ?? 15e3;
|
|
28
29
|
const fetcher = config.fetch ?? globalThis.fetch.bind(globalThis);
|
|
29
30
|
const copy = FORMS_COPY[formsCopyLanguage(config.language)];
|
|
@@ -150,7 +151,7 @@ function createFormsServer(config) {
|
|
|
150
151
|
}, source);
|
|
151
152
|
}
|
|
152
153
|
const token = params.get("cf-turnstile-response") ?? "";
|
|
153
|
-
if (!token || token.length > 2048 || !await verifyTurnstile(secret, token, request
|
|
154
|
+
if (!token || token.length > 2048 || !await verifyTurnstile(secret, token, clientAddress(request))) return outcome(request, {
|
|
154
155
|
formId,
|
|
155
156
|
status: "verification",
|
|
156
157
|
values: checked.values
|
|
@@ -253,7 +254,7 @@ function createFormsServer(config) {
|
|
|
253
254
|
if (!SOURCE.test(source) || source.length > 2048) return json(400, { error: "The form's page (gq_source) isn't a path on this Site." });
|
|
254
255
|
const limiter = bindings.FORMS_RATE_LIMITER;
|
|
255
256
|
if (limiter) {
|
|
256
|
-
const { success } = await limiter.limit({ key: `${formId}:${request
|
|
257
|
+
const { success } = await limiter.limit({ key: `${formId}:${rateLimitKey(clientAddress(request))}` });
|
|
257
258
|
if (!success) return outcome(request, {
|
|
258
259
|
formId,
|
|
259
260
|
status: "too-many"
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as Delivery, A as SqlDatabase, At as
|
|
1
|
+
import { $ as Delivery, A as SqlDatabase, At as DesignThemeOverrides, B as DesignBlockRenderer, Bt as DesignPreloadedPosts, C as Moved, Ct as PresentationTheme, D as SearchPage, Dt as presentationStyleSheet, E as SearchItem, Et as presentationModel, F as isLanguageHome, Ft as DesignFonts, G as escapeHtml, Gt as designQueryItems, H as DesignRenderContext, Ht as DesignQueryRenderContext, I as languageSubject, It as DesignTextStyles, J as Archives, Jt as renderDesignQuery, K as parseDesignBlocks, Kt as preloadDesignQueryPosts, L as routeLanguage, Lt as ResolvedLogoImage, M as SiteLanguage, Mt as designThemeVariables, N as WordPressLanguages, Nt as resolveDesignTheme, O as SearchQuery, Ot as presentationVariables, P as htmlLang, Pt as resolvePresentationToken, Q as CollectionTerm, R as siteLanguages, Rt as DesignPostContext, S as HomePublication, St as PresentationTargets, T as SearchDelivery, Tt as createPresentationModel, U as DesignRenderOptions, Ut as DesignQueryResolverOptions, V as DesignPattern, Vt as DesignQueryItem, W as designMenuItems, Wt as designPostContext, X as CmsFailureReason, Xt as renderDesignText, Y as CmsFailure, Yt as DesignTextContext, Z as CollectionMembership, Zt as safeDesignRichText, _ as EntryDelivery, _t as designFontsHead, a as ContentExtension, at as Missing, b as HomeDelivery, bt as PresentationBreakpoint, ct as Translation, d as CollectionListing, dt as WordPressMenuItem, et as DesignPresets, f as CollectionPage, ft as WordPressPost, g as DeliveryFailureReason, gt as designFontStyleSheet, h as CollectionTermListing, ht as designFontPreloads, i as ContentConsentConfig, it as HomeContent, j as SqlStatement, jt as designThemeStyleSheet, k as ContentBindings, kt as DesignTheme, l as Alternate, lt as Unavailable, m as CollectionTermCount, mt as DesignTypography, n as CollectionConfig, nt as Extended, o as ContentRuntime, ot as PublishedEntry, p as CollectionQuery, pt as WordPressSettings, q as renderDesignPattern, qt as renderDesignPostBlock, r as ContentConfig, rt as Found, s as ExtensionNode, st as SiteChrome, t as WordPressClient, tt as EntryContent, u as CollectionItem, ut as WordPressImage, v as EntryPage, vt as designTextStyleSheet, w as NotServed, wt as Property, x as HomePage, xt as PresentationModel, y as EntryPublication, yt as Presentation, z as DesignBlock, zt as DesignPostRecord } from "./wordpress-OWJxnbAF.js";
|
|
2
2
|
//#region frontend/src/cover-video-html.d.ts
|
|
3
3
|
/** Native decorative Cover video must not start before motion preferences are
|
|
4
4
|
* known. Retain every source, poster, child and independent video attribute. */
|
|
@@ -55,21 +55,6 @@ export declare function hasDesignCarousel(blocks: WordPressBlock[]): boolean;
|
|
|
55
55
|
export declare function hasVideoHero(blocks: WordPressBlock[]): boolean;
|
|
56
56
|
export declare function renderWordPressBlocks(blocks: WordPressBlock[]): string;
|
|
57
57
|
//#endregion
|
|
58
|
-
/**
|
|
59
|
-
* A Branding logo image resolved from the media library when the layout is built.
|
|
60
|
-
*/
|
|
61
|
-
interface ResolvedLogoImage {
|
|
62
|
-
id: number;
|
|
63
|
-
url: string;
|
|
64
|
-
/**
|
|
65
|
-
* The attachment's alt text, or the plain-text site title when that is empty.
|
|
66
|
-
*/
|
|
67
|
-
alt: string;
|
|
68
|
-
width: number | null;
|
|
69
|
-
height: number | null;
|
|
70
|
-
mimeType: string;
|
|
71
|
-
}
|
|
72
|
-
//#endregion
|
|
73
58
|
interface SiteLogoSelection {
|
|
74
59
|
/** Which delivered value to render: an image attribute or the Site Title. */
|
|
75
60
|
source: "logoDark" | "logo" | "siteTitle";
|
|
@@ -201,4 +186,4 @@ export declare function renderDesignNavigation(name: string, attrs: Attributes,
|
|
|
201
186
|
/** Interaction styles only. Include canonical presentationStyleSheet separately. */
|
|
202
187
|
export declare function navigationStyleSheet(theme?: DesignThemeOverrides): string;
|
|
203
188
|
//#endregion
|
|
204
|
-
export { Alternate, Archives, CmsFailure, CmsFailureReason, type CollectionConfig, CollectionItem, CollectionListing, CollectionMembership, CollectionPage, CollectionQuery, CollectionTerm, CollectionTermCount, CollectionTermListing, ContentBindings, type ContentConfig, type ContentConsentConfig, type ContentExtension, type ContentRuntime, Delivery, DeliveryFailureReason, DesignBlock, DesignBlockRenderer, DesignPattern, type DesignPostContext, type DesignPostRecord, type DesignPreloadedPosts, DesignPresets, type DesignQueryItem, type DesignQueryRenderContext, type DesignQueryResolverOptions, DesignRenderContext, DesignRenderOptions, type DesignTextContext, type DesignTheme, type DesignThemeOverrides, EntryContent, EntryDelivery, EntryPage, EntryPublication, Extended, type ExtensionNode, Found, HomeContent, HomeDelivery, HomePage, HomePublication, Missing, Moved, NotServed, type Presentation, type PresentationBreakpoint, type PresentationModel, type Property as PresentationProperty, type PresentationTargets, type PresentationTheme, PublishedEntry, SearchDelivery, SearchItem, SearchPage, SearchQuery, SiteChrome, SiteLanguage, SqlDatabase, SqlStatement, Translation, Unavailable, type VideoHeroFit, type VideoHeroPosition, type WordPressClient, WordPressImage, WordPressLanguages, WordPressMenuItem, WordPressPost, WordPressSettings, createPresentationModel, designMenuItems, designPostContext, designQueryItems, designThemeStyleSheet, designThemeVariables, escapeHtml, htmlLang, isLanguageHome, languageSubject, parseDesignBlocks, preloadDesignQueryPosts, presentationModel, presentationStyleSheet, presentationVariables, renderDesignPattern, renderDesignPostBlock, renderDesignQuery, renderDesignText, resolveDesignTheme, resolvePresentationToken, routeLanguage, safeDesignRichText, siteLanguages };
|
|
189
|
+
export { Alternate, Archives, CmsFailure, CmsFailureReason, type CollectionConfig, CollectionItem, CollectionListing, CollectionMembership, CollectionPage, CollectionQuery, CollectionTerm, CollectionTermCount, CollectionTermListing, ContentBindings, type ContentConfig, type ContentConsentConfig, type ContentExtension, type ContentRuntime, Delivery, DeliveryFailureReason, DesignBlock, DesignBlockRenderer, type DesignFonts, DesignPattern, type DesignPostContext, type DesignPostRecord, type DesignPreloadedPosts, DesignPresets, type DesignQueryItem, type DesignQueryRenderContext, type DesignQueryResolverOptions, DesignRenderContext, DesignRenderOptions, type DesignTextContext, type DesignTextStyles, type DesignTheme, type DesignThemeOverrides, type DesignTypography, EntryContent, EntryDelivery, EntryPage, EntryPublication, Extended, type ExtensionNode, Found, HomeContent, HomeDelivery, HomePage, HomePublication, Missing, Moved, NotServed, type Presentation, type PresentationBreakpoint, type PresentationModel, type Property as PresentationProperty, type PresentationTargets, type PresentationTheme, PublishedEntry, SearchDelivery, SearchItem, SearchPage, SearchQuery, SiteChrome, SiteLanguage, SqlDatabase, SqlStatement, Translation, Unavailable, type VideoHeroFit, type VideoHeroPosition, type WordPressClient, WordPressImage, WordPressLanguages, WordPressMenuItem, WordPressPost, WordPressSettings, createPresentationModel, designFontPreloads, designFontStyleSheet, designFontsHead, designMenuItems, designPostContext, designQueryItems, designTextStyleSheet, designThemeStyleSheet, designThemeVariables, escapeHtml, htmlLang, isLanguageHome, languageSubject, parseDesignBlocks, preloadDesignQueryPosts, presentationModel, presentationStyleSheet, presentationVariables, renderDesignPattern, renderDesignPostBlock, renderDesignQuery, renderDesignText, resolveDesignTheme, resolvePresentationToken, routeLanguage, safeDesignRichText, siteLanguages };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as VIDEO_HERO_BLOCK, A as formatDate, B as renderDesignPostBlock, C as siteLanguages, D as renderDesignPattern, E as parseDesignBlocks, F as uriPath, G as renderWordPressBlocks, H as hasDesignCarousel, I as renderDesignCover, J as DESIGN_CAROUSEL_ITEM, K as designGridStyle, L as designPostContext, M as responseStatus, N as routeOf, O as cmsTime, P as stripHtml, Q as renderDesignCarouselItem, R as designQueryItems, S as routeLanguage, T as escapeHtml, U as hasVideoHero, V as renderDesignQuery, W as parseWordPressBlocks, X as designCarouselStyle, Y as DESIGN_CAROUSEL_NAVIGATION, Z as renderDesignCarousel, _t as selectSiteLogo, a as designTextStyleSheet, at as enhanceDesignNavigationHtml, b as isLanguageHome, ct as presentationHtml, dt as presentationStyleSheet, et as renderDesignVideoHero, ft as presentationVariables, gt as resolvePresentationToken, ht as resolveDesignTheme, it as safeDesignRichText, j as menuItemHref, k as decodeEntities, lt as createPresentationModel, mt as designThemeVariables, n as designFontStyleSheet, nt as renderDesignImage, ot as navigationStyleSheet, pt as designThemeStyleSheet, q as DESIGN_CAROUSEL, r as designFontsHead, rt as renderDesignText, st as renderDesignNavigation, t as designFontPreloads, tt as youtubeVideoId, ut as presentationModel, w as designMenuItems, x as languageSubject, y as htmlLang, yt as enhanceDesignCoverVideosHtml, z as preloadDesignQueryPosts } from "./design-fonts-B0ts54vY.js";
|
|
2
2
|
import { n as videoHeroStyleSheet, t as videoHeroFrameGeometry } from "./video-hero-D8AcMR4q.js";
|
|
3
3
|
//#region frontend/src/wp-block-styles.ts
|
|
4
4
|
const validSlug = (slug) => /^[a-z0-9][a-z0-9-]*$/.test(slug);
|
|
@@ -43,4 +43,4 @@ function containerLayoutHtml(html, attributes) {
|
|
|
43
43
|
return presentationHtml("getquick-design/container", html || "<div class=\"wp-block-getquick-design-container\"></div>", attributes.presentation, { attributes });
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
|
-
export { DESIGN_CAROUSEL, DESIGN_CAROUSEL_ITEM, DESIGN_CAROUSEL_NAVIGATION, VIDEO_HERO_BLOCK, blockPresetStyles, cmsTime, containerLayoutHtml, createPresentationModel, decodeEntities, designCarouselStyle, designGridStyle, designMenuItems, designPostContext, designQueryItems, designThemeStyleSheet, designThemeVariables, enhanceDesignCoverVideosHtml, enhanceDesignNavigationHtml, escapeHtml, formatDate, hasDesignCarousel, hasVideoHero, htmlLang, isLanguageHome, languageSubject, menuItemHref, navigationStyleSheet, parseDesignBlocks, parseWordPressBlocks, preloadDesignQueryPosts, presentationHtml, presentationModel, presentationStyleSheet, presentationVariables, presetRootStyle, renderDesignCarousel, renderDesignCarouselItem, renderDesignCover, renderDesignImage, renderDesignNavigation, renderDesignPattern, renderDesignPostBlock, renderDesignQuery, renderDesignText, renderDesignVideoHero, renderWordPressBlocks, resolveDesignTheme, resolvePresentationToken, responseStatus, routeLanguage, routeOf, safeDesignRichText, selectSiteLogo, siteLanguages, stripHtml, uriPath, videoHeroFrameGeometry, videoHeroStyleSheet, youtubeVideoId };
|
|
46
|
+
export { DESIGN_CAROUSEL, DESIGN_CAROUSEL_ITEM, DESIGN_CAROUSEL_NAVIGATION, VIDEO_HERO_BLOCK, blockPresetStyles, cmsTime, containerLayoutHtml, createPresentationModel, decodeEntities, designCarouselStyle, designFontPreloads, designFontStyleSheet, designFontsHead, designGridStyle, designMenuItems, designPostContext, designQueryItems, designTextStyleSheet, designThemeStyleSheet, designThemeVariables, enhanceDesignCoverVideosHtml, enhanceDesignNavigationHtml, escapeHtml, formatDate, hasDesignCarousel, hasVideoHero, htmlLang, isLanguageHome, languageSubject, menuItemHref, navigationStyleSheet, parseDesignBlocks, parseWordPressBlocks, preloadDesignQueryPosts, presentationHtml, presentationModel, presentationStyleSheet, presentationVariables, presetRootStyle, renderDesignCarousel, renderDesignCarouselItem, renderDesignCover, renderDesignImage, renderDesignNavigation, renderDesignPattern, renderDesignPostBlock, renderDesignQuery, renderDesignText, renderDesignVideoHero, renderWordPressBlocks, resolveDesignTheme, resolvePresentationToken, responseStatus, routeLanguage, routeOf, safeDesignRichText, selectSiteLogo, siteLanguages, stripHtml, uriPath, videoHeroFrameGeometry, videoHeroStyleSheet, youtubeVideoId };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ContentExtension, c as createContentRuntime, i as ContentConsentConfig, k as ContentBindings, n as CollectionConfig, o as ContentRuntime, r as ContentConfig, s as ExtensionNode, t as WordPressClient } from "./wordpress-
|
|
1
|
+
import { a as ContentExtension, c as createContentRuntime, i as ContentConsentConfig, k as ContentBindings, n as CollectionConfig, o as ContentRuntime, r as ContentConfig, s as ExtensionNode, t as WordPressClient } from "./wordpress-OWJxnbAF.js";
|
|
2
2
|
export { CollectionConfig, type ContentBindings, ContentConfig, ContentConsentConfig, ContentExtension, ContentRuntime, ExtensionNode, type WordPressClient, createContentRuntime };
|