Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ea1fa8cc3 | ||
|
|
738c1a56d0 | ||
|
|
9d03d489e0 | ||
|
|
b4af1397b7 | ||
|
|
11cea53dab | ||
|
|
35e8b60684 | ||
|
|
da7a01a1c1 | ||
|
|
dbf2d342a7 |
No files matched your search
@@ -0,0 +1,42 @@
|
||||
# Node.js CI for news-platform bridge
|
||||
# Runs on: PR and push to main/develop
|
||||
# Checks: TypeScript build and type checking
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
|
||||
env:
|
||||
CI: "true"
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18, 20]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
working-directory: bridge
|
||||
|
||||
- name: TypeScript build
|
||||
run: npm run build
|
||||
working-directory: bridge
|
||||
if: always()
|
||||
|
||||
- name: TypeScript type checking
|
||||
run: npm run typecheck
|
||||
working-directory: bridge
|
||||
if: always()
|
||||
@@ -53,4 +53,13 @@ _c="$(code_for "$BASE_URL/wp-json/wp/v2/")"
|
||||
[[ "$_c" == "200" ]] || fail "GET $BASE_URL/wp-json/wp/v2/ expected 200, got $_c (WP andebol :8081)"
|
||||
ok "GET /wp-json/wp/v2/ → $_c"
|
||||
|
||||
# Auth redirects — /entrar and /registar must NOT land on / (BIT-22298)
|
||||
_final_entrar="$(curl -fsS -o /dev/null -w '%{url_effective}' --max-time 25 -L -H "Host: $HOST_HEADER" "$BASE_URL/entrar" 2>/dev/null || true)"
|
||||
[[ "$_final_entrar" == *"wp-login"* ]] || fail "/entrar final URL must contain wp-login; got: $_final_entrar"
|
||||
ok "GET /entrar → $_final_entrar"
|
||||
|
||||
_final_registar="$(curl -fsS -o /dev/null -w '%{url_effective}' --max-time 25 -L -H "Host: $HOST_HEADER" "$BASE_URL/registar" 2>/dev/null || true)"
|
||||
[[ "$_final_registar" == *"wp-login"* ]] || fail "/registar final URL must contain wp-login; got: $_final_registar"
|
||||
ok "GET /registar → $_final_registar"
|
||||
|
||||
echo "All smokes passed for BASE_URL=$BASE_URL (host: $HOST_HEADER)"
|
||||
@@ -29,7 +29,7 @@ See [`docs/ANDEBOL_EDITORIAL_BRIEF.md`](ANDEBOL_EDITORIAL_BRIEF.md) for detailed
|
||||
- **Per feed:** a failing RSS URL is logged in `metrics.errors`; other feeds still run.
|
||||
- **Per URL (legacy comparison):** failed HTML fetch does not block the cycle; aggregator metrics still apply for production reads.
|
||||
- **WP publish:** if credentials are missing, the cycle completes with a clear error string and **no** draft creation.
|
||||
- **Featured image (BIT-22288 / BIT-22292):** drafts require a rights-cleared image. The pipeline uses RSS enclosure / `og:image` / `twitter:image` first. If none are present, it can **list a WebDAV collection** (authenticated Basic auth) and pick the best-matching filename against the headline, then upload to WP with caption/alt. Configure with `WRITER_WEBDAV_*` env vars (see `deploy/systemd/writer-andebol.env.example`). If WebDAV is enabled but PROPFIND/GET fails, draft creation for that item fails with an explicit error (no silent fallback to a random web image).
|
||||
- **Featured image (BIT-22288 / BIT-22292):** drafts require a rights-cleared image. The pipeline uses RSS enclosure / `og:image` / `twitter:image` first. If none are present, it can **list a WebDAV collection** (authenticated Basic auth) and pick the best-matching filename against the headline, then upload to WP with caption/alt. Configure with `WRITER_WEBDAV_*` env vars (see `deploy/systemd/writer-andebol.env.example`). If WebDAV is enabled but PROPFIND/GET fails, draft creation for **that URL** fails with an explicit error (no silent fallback to a random web image). **`run-cycle`** catches per-item publish errors: the failure is appended to `metrics.errors` and the rest of the cycle (other feeds, other shortlist items) still completes.
|
||||
|
||||
## Commands
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
import { getDomainConfig } from '../lib/domain.js';
|
||||
|
||||
const config = getDomainConfig(Astro.url.hostname);
|
||||
if (!config.auth_links) {
|
||||
if (config.auth_links === false) {
|
||||
return Astro.redirect('/', 302);
|
||||
}
|
||||
Astro.response.headers.set('Cache-Control', 'no-store');
|
||||
return Astro.redirect('/wp-login.php', 302);
|
||||
---
|
||||
@@ -2,8 +2,9 @@
|
||||
import { getDomainConfig } from '../lib/domain.js';
|
||||
|
||||
const config = getDomainConfig(Astro.url.hostname);
|
||||
if (!config.auth_links) {
|
||||
if (config.auth_links === false) {
|
||||
return Astro.redirect('/', 302);
|
||||
}
|
||||
Astro.response.headers.set('Cache-Control', 'no-store');
|
||||
return Astro.redirect('/wp-login.php?action=register', 302);
|
||||
---
|
||||
@@ -24,6 +24,15 @@ test('parsePropfindImageHrefs skips collection root and lists image files', () =
|
||||
assert.equal(rows[0].lastMod, 'Wed, 01 Jan 2025 12:00:00 GMT');
|
||||
});
|
||||
|
||||
test('parsePropfindImageHrefs handles ns0: namespace prefix (WsgiDAV / Python ElementTree)', () => {
|
||||
const xml = `<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ns0:multistatus xmlns:ns0="DAV:"><ns0:response><ns0:href>/</ns0:href><ns0:propstat><ns0:prop><ns0:getlastmodified>Thu, 14 May 2026 16:11:04 GMT</ns0:getlastmodified><ns0:resourcetype><ns0:collection /></ns0:resourcetype></ns0:prop><ns0:status>HTTP/1.1 200 OK</ns0:status></ns0:propstat></ns0:response><ns0:response><ns0:href>/Foto_FPA___duplo-embate-croacia-m20-euro.jpg</ns0:href><ns0:propstat><ns0:prop><ns0:getlastmodified>Thu, 14 May 2026 16:11:26 GMT</ns0:getlastmodified><ns0:resourcetype /></ns0:prop><ns0:status>HTTP/1.1 200 OK</ns0:status></ns0:propstat></ns0:response></ns0:multistatus>`;
|
||||
const rows = parsePropfindImageHrefs(xml, 'http://127.0.0.1:8088/');
|
||||
assert.equal(rows.length, 1);
|
||||
assert.match(rows[0].href, /Foto_FPA___duplo-embate-croacia-m20-euro\.jpg$/);
|
||||
assert.equal(rows[0].lastMod, 'Thu, 14 May 2026 16:11:26 GMT');
|
||||
});
|
||||
|
||||
test('pickBestArchiveImage prefers hrefs whose path matches title tokens', () => {
|
||||
const item: AggregatedItem = {
|
||||
id: '1',
|
||||
|
||||
@@ -29,14 +29,14 @@ function decodeXmlText(s: string): string {
|
||||
export function parsePropfindImageHrefs(xml: string, collectionUrl: string): { href: string; lastMod?: string }[] {
|
||||
const base = new URL(collectionUrl.endsWith('/') ? collectionUrl : `${collectionUrl}/`);
|
||||
const out: { href: string; lastMod?: string }[] = [];
|
||||
const reResponse = /<(?:[a-z]+:)?response[^>]*>([\s\S]*?)<\/(?:[a-z]+:)?response>/gi;
|
||||
const reResponse = /<(?:[a-z][a-z0-9]*:)?response[^>]*>([\s\S]*?)<\/(?:[a-z][a-z0-9]*:)?response>/gi;
|
||||
let m: RegExpExecArray | null;
|
||||
while ((m = reResponse.exec(xml))) {
|
||||
const block = m[1];
|
||||
const hrefM = /<(?:[a-z]+:)?href>([^<]+)<\/(?:[a-z]+:)?href>/i.exec(block);
|
||||
const hrefM = /<(?:[a-z][a-z0-9]*:)?href>([^<]+)<\/(?:[a-z][a-z0-9]*:)?href>/i.exec(block);
|
||||
if (!hrefM) continue;
|
||||
const hrefRaw = decodeXmlText(hrefM[1].trim());
|
||||
const lmM = /<(?:[a-z]+:)?getlastmodified>([^<]+)<\/(?:[a-z]+:)?getlastmodified>/i.exec(block);
|
||||
const lmM = /<(?:[a-z][a-z0-9]*:)?getlastmodified>([^<]+)<\/(?:[a-z][a-z0-9]*:)?getlastmodified>/i.exec(block);
|
||||
const lastMod = lmM ? decodeXmlText(lmM[1].trim()) : undefined;
|
||||
if (!IMAGE_EXT_RE.test(hrefRaw)) continue;
|
||||
let abs: string;
|
||||
|
||||
Reference in new issue
Block a user