Repository navigation
Site: English version, PHP and statuses guides, per-page share images - #14
Conversation
English version (#9) - en/ mirrors the home page and the 8 carrier pages, written for English searches; every page carries reciprocal hreflang (fr, en, x-default) and an FR/EN switch in the navigation. - build-site.sh publishes en/ and writes the hreflang alternates into sitemap.xml; the 404 page is bilingual. Docs on the site (#10) - php/ and en/php/: the PHP / Laravel guide (from docs/guide-php.md). - statuts/ and en/statuses/: unified statuses, models and error codes (from docs/CONTRACT.md). - Each carrier page gets a native → unified status table (from docs/PROVIDERS.md); site links to guide-php.md and CONTRACT.md now point to these pages. Share images (#11) - scripts/og/generate.mjs renders one 1200x630 image per page and language into assets/og/ with headless Chrome; og:image and twitter:image use them. CI: scripts/check-site.mjs checks canonicals, reciprocal hreflang, share images and relative links in the built site. Closes #9, closes #10, closes #11 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying dz-delivery with
|
| Latest commit: |
394c4df
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a31d4700.dz-delivery.pages.dev |
| Branch Preview URL: | https://seo-english-site.dz-delivery.pages.dev |
There was a problem hiding this comment.
All reported issues were addressed across 49 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
View guided diff | Turn on auto-fix | Re-trigger cubic
Pages (FR and EN), checked against packages/ts and packages/php: - Maystro webhook example checks a URL secret with hash_equals before reading the body (Maystro does not sign requests). - ZRExpressProvider examples wrap options in ClientOptions::fromArray(). - Carrier pages and FAQ: the shared interface does not mean every carrier supports every operation (NOT_SUPPORTED, link to the matrix). - Home matrix and notes: Maystro track/cancelParcel and Yalidine/Maystro listParcels are supported; MDM orderId filtering is per page in the SDK (use allPages). - NoEST status table lists the exact keys instead of wildcards the mappers do not implement. - Statuses page: Yalidine origin option, PHP interface imports, provider-specific credential transport. - Examples: quantity on every product line, [] fallback for the Laravel config, ISO string for updatedSince, SDK calls inside try blocks. Scripts: - check-site requires exactly fr/en/x-default alternates pointing to built pages, resolves folder links to index.html (a directory no longer passes as a file), and checks links in 404.html. - build-site rewrites sitemap alternates to SITE_URL. - og/generate rejects unknown keys and lists the unknown status. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
3 issues found across 27 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="index.html">
<violation number="1" location="index.html:843">
P2: This table incorrectly documents Maystro webhook support: `mapMaystroStatus` only maps a webhook payload’s status and does not provide or verify a Maystro webhook endpoint. Describe it as status mapping instead, so integrators do not assume Maystro webhooks are supported by the SDK.</violation>
</file>
<file name="en/php/index.html">
<violation number="1" location="en/php/index.html:582">
P2: The webhook secret is carried in the query string, making it likely to leak through access logs and proxy tracing; anyone who obtains it can forge `OrderStatusChanged` requests. Use a non-logged authentication mechanism (for example a provider-supported header/signature) or protect a random path with equivalent server-side controls, and document the required configuration.</violation>
</file>
<file name="scripts/build-site.sh">
<violation number="1" location="scripts/build-site.sh:76">
P2: This substitution can abort the build for `SITE_URL` values that pass the validator, because `sed` interprets backslash sequences in the replacement. Escape the replacement value or reject backslashes (and other control characters) during origin validation.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
|
||
| <span class="c-cmt">// Shared secret: register the URL as /maystro-webhook.php?key=<MAYSTRO_WEBHOOK_SECRET></span> | ||
| <span class="c-var">$secret</span> = (<span class="c-type">string</span>) <span class="c-fn">getenv</span>(<span class="c-str">'MAYSTRO_WEBHOOK_SECRET'</span>); | ||
| <span class="c-var">$given</span> = (<span class="c-type">string</span>) (<span class="c-var">$_GET</span>[<span class="c-str">'key'</span>] ?? <span class="c-str">''</span>); |
There was a problem hiding this comment.
P2: The webhook secret is carried in the query string, making it likely to leak through access logs and proxy tracing; anyone who obtains it can forge OrderStatusChanged requests. Use a non-logged authentication mechanism (for example a provider-supported header/signature) or protect a random path with equivalent server-side controls, and document the required configuration.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At en/php/index.html, line 582:
<comment>The webhook secret is carried in the query string, making it likely to leak through access logs and proxy tracing; anyone who obtains it can forge `OrderStatusChanged` requests. Use a non-logged authentication mechanism (for example a provider-supported header/signature) or protect a random path with equivalent server-side controls, and document the required configuration.</comment>
<file context>
@@ -576,6 +577,14 @@ <h2 id="maystro-webhooks-title">7. Maystro webhooks</h2>
+<span class="c-cmt">// Shared secret: register the URL as /maystro-webhook.php?key=<MAYSTRO_WEBHOOK_SECRET></span>
+<span class="c-var">$secret</span> = (<span class="c-type">string</span>) <span class="c-fn">getenv</span>(<span class="c-str">'MAYSTRO_WEBHOOK_SECRET'</span>);
+<span class="c-var">$given</span> = (<span class="c-type">string</span>) (<span class="c-var">$_GET</span>[<span class="c-str">'key'</span>] ?? <span class="c-str">''</span>);
+<span class="c-key">if</span> (<span class="c-var">$secret</span> === <span class="c-str">''</span> || !<span class="c-fn">hash_equals</span>(<span class="c-var">$secret</span>, <span class="c-var">$given</span>)) {
+ <span class="c-fn">http_response_code</span>(<span class="c-num">401</span>);
</file context>
- Maystro webhook example (FR/EN): keep the URL secret check, but treat the event only as a signal and read the order back with track(), so a forged event cannot set a status; document keeping the query string out of logs. - Home page: mapMaystroStatus is described as converting a pushed status code, not as SDK webhook support. - build-site.sh rejects backslashes and control characters in SITE_URL, which is also used as a sed replacement. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
1 issue found across 5 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="php/index.html">
<violation number="1" location="php/index.html:610">
P2: The new lookup runs without validating `$orderId` or catching `ShippingError`, so a malformed or stale `OrderStatusChanged` payload produces an uncaught 500 instead of a deliberate webhook response. Reject missing IDs and handle provider failures before acknowledging the event.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
|
||
| <span class="c-cmt">// Ne faites pas confiance au statut reçu : relisez la commande chez Maystro.</span> | ||
| <span class="c-var">$maystro</span> = <span class="c-type">ClientFactory</span>::<span class="c-fn">create</span>(<span class="c-str">'maystro'</span>, [<span class="c-str">'apiToken'</span> => <span class="c-fn">getenv</span>(<span class="c-str">'MAYSTRO_API_TOKEN'</span>)]); | ||
| <span class="c-var">$parcel</span> = <span class="c-var">$maystro</span>-><span class="c-fn">track</span>(<span class="c-var">$orderId</span>)-><span class="c-var">parcel</span>; <span class="c-cmt">// accepte l'UUID de la commande</span> |
There was a problem hiding this comment.
P2: The new lookup runs without validating $orderId or catching ShippingError, so a malformed or stale OrderStatusChanged payload produces an uncaught 500 instead of a deliberate webhook response. Reject missing IDs and handle provider failures before acknowledging the event.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At php/index.html, line 610:
<comment>The new lookup runs without validating `$orderId` or catching `ShippingError`, so a malformed or stale `OrderStatusChanged` payload produces an uncaught 500 instead of a deliberate webhook response. Reject missing IDs and handle provider failures before acknowledging the event.</comment>
<file context>
@@ -604,13 +604,16 @@ <h2 id="maystro-webhooks-title">7. Webhooks Maystro</h2>
- <span class="c-cmt">// mettre à jour votre commande dont carrier_id = $orderId ...</span>
+ <span class="c-cmt">// Ne faites pas confiance au statut reçu : relisez la commande chez Maystro.</span>
+ <span class="c-var">$maystro</span> = <span class="c-type">ClientFactory</span>::<span class="c-fn">create</span>(<span class="c-str">'maystro'</span>, [<span class="c-str">'apiToken'</span> => <span class="c-fn">getenv</span>(<span class="c-str">'MAYSTRO_API_TOKEN'</span>)]);
+ <span class="c-var">$parcel</span> = <span class="c-var">$maystro</span>-><span class="c-fn">track</span>(<span class="c-var">$orderId</span>)-><span class="c-var">parcel</span>; <span class="c-cmt">// accepte l'UUID de la commande</span>
+
+ <span class="c-cmt">// mettre à jour votre commande dont carrier_id = $orderId avec $parcel->status ...</span>
</file context>
Closes #9, closes #10, closes #11.
English version (#9)
en/contains the home page and the 8 carrier pages, written for English searches ("Yalidine API for Node.js and PHP", etc.), not translated word for word.hreflanglinks (fr,en,x-default→ FR), plusog:localeandog:locale:alternate, and a FR / EN button in the navigation.build-site.shpublishesen/, andsitemap.xmlnow lists thexhtml:linkalternates (22 URLs).Docs on the site (#10)
php/↔en/php/: the PHP / Laravel guide (fromdocs/guide-php.md).statuts/↔en/statuses/: the 7 unified statuses, models, error codes, theShippingProviderinterface and client construction (fromdocs/CONTRACT.md).docs/PROVIDERS.md. ZRExpress is marked as a draft, as in the source.guide-php.mdandCONTRACT.mdnow point to these pages.PROVIDERS.mdandZREXPRESS.mdstay on GitHub because they are contributor docs.Share images (#11)
scripts/og/generate.mjsuses headless Chrome to generate one 1200×630 image per page and language (21 images inassets/og/, about 2 MB), with no npm dependencies.og:imageandtwitter:imagenow point to these images. The FR home page keepsassets/og.png.CI
scripts/check-site.mjschecks the built site: canonical URL = own URL,hreflangtargets exist and point back, share images exist, and every relative link and asset resolves. Locally: 22 pages OK.To check after merging
🤖 Generated with Claude Code
Summary by cubic
Adds an English version of the website, publishes the PHP guide and unified statuses as web pages, and generates one share image per page and language. Closes #9, #10, and #11.
New Features
en/mirrors the home page and 8 carrier pages, written for English searches; every page pairs with its French version via reciprocalhreflanglinks and a FR/EN nav switch, andsitemap.xmllists all 22 URLs.php/andstatuts/(plus English variants) bringguide-php.mdandCONTRACT.mdonto the site; each carrier page gains a native → unified status table.scripts/og/generate.mjsrenders one 1200×630 image per page and language with headless Chrome and no npm dependencies.scripts/check-site.mjsruns in CI and validates canonicals, reciprocalhreflang, share images, and relative links in the built site.Bug Fixes
packages/tsandpackages/php: webhook secret handling,ClientOptionswrapping, status tables with exact mapper keys, and try-block SDK calls.track(), so a forged event cannot set a status.check-siterequires exactly the fr/en/x-default alternates and checks404.html;og/generaterejects unknown keys;build-siterewrites sitemap alternates toSITE_URLand rejects backslashes in it.Written for commit 394c4df. Summary will update on new commits.