feat(planning): grille hebdomadaire complète avec API et filtres
- Connexion API via proxy Angular (résolution CORS, base path /api) - Import CSS ng-zorro global pour les modales et composants - Filtres Camion/Show câblés sur l'affichage de la grille - Camions affichés via TrucksService (linkés au show du même créneau) - Panneau de détails : spectacles + camions du jour sélectionné - Modale de création de spectacle stylisée avec fond et centrage - Positionnement précis des events à la minute dans leur créneau - Auto-scroll vers l'heure courante au chargement - Ligne "maintenant" sur la colonne du jour actuel - Régénération des services OpenAPI (nouveaux noms de types) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+8
-55
@@ -1,5 +1,4 @@
|
||||
const { Readable } = require('stream')
|
||||
const { EnvHttpProxyAgent } = require('undici')
|
||||
const fetch = require('make-fetch-happen')
|
||||
const { promises: fs } = require('graceful-fs')
|
||||
const log = require('./log')
|
||||
|
||||
@@ -11,65 +10,19 @@ async function download (gyp, url) {
|
||||
'User-Agent': `node-gyp v${gyp.version} (node ${process.version})`,
|
||||
Connection: 'keep-alive'
|
||||
},
|
||||
dispatcher: await createDispatcher(gyp)
|
||||
proxy: gyp.opts.proxy,
|
||||
noProxy: gyp.opts.noproxy
|
||||
}
|
||||
|
||||
let res
|
||||
try {
|
||||
res = await fetch(url, requestOpts)
|
||||
} catch (err) {
|
||||
// Built-in fetch wraps low-level errors in "TypeError: fetch failed" with
|
||||
// the underlying error on .cause. Callers inspect .code (e.g. ENOTFOUND).
|
||||
if (err.cause) {
|
||||
throw err.cause
|
||||
}
|
||||
throw err
|
||||
const cafile = gyp.opts.cafile
|
||||
if (cafile) {
|
||||
requestOpts.ca = await readCAFile(cafile)
|
||||
}
|
||||
|
||||
const res = await fetch(url, requestOpts)
|
||||
log.http(res.status, res.url)
|
||||
|
||||
const body = res.body ? Readable.fromWeb(res.body) : Readable.from([])
|
||||
return {
|
||||
status: res.status,
|
||||
url: res.url,
|
||||
body,
|
||||
text: async () => {
|
||||
let data = ''
|
||||
body.setEncoding('utf8')
|
||||
for await (const chunk of body) {
|
||||
data += chunk
|
||||
}
|
||||
return data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function createDispatcher (gyp) {
|
||||
const env = process.env
|
||||
const hasProxyEnv = env.http_proxy || env.HTTP_PROXY || env.https_proxy || env.HTTPS_PROXY
|
||||
if (!gyp.opts.proxy && !gyp.opts.cafile && !hasProxyEnv) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const opts = {}
|
||||
if (gyp.opts.cafile) {
|
||||
const ca = await readCAFile(gyp.opts.cafile)
|
||||
// EnvHttpProxyAgent forwards opts to both its internal Agent (direct) and
|
||||
// ProxyAgent (proxied). Agent reads TLS config from `connect`; ProxyAgent
|
||||
// reads it from `requestTls` (origin) / `proxyTls` (proxy). Set all three
|
||||
// so the custom CA is applied regardless of which path a request takes.
|
||||
opts.connect = { ca }
|
||||
opts.requestTls = { ca }
|
||||
opts.proxyTls = { ca }
|
||||
}
|
||||
if (gyp.opts.proxy) {
|
||||
opts.httpProxy = gyp.opts.proxy
|
||||
opts.httpsProxy = gyp.opts.proxy
|
||||
}
|
||||
if (gyp.opts.noproxy) {
|
||||
opts.noProxy = gyp.opts.noproxy
|
||||
}
|
||||
return new EnvHttpProxyAgent(opts)
|
||||
return res
|
||||
}
|
||||
|
||||
async function readCAFile (filename) {
|
||||
|
||||
Reference in New Issue
Block a user