Port the Fuc 0.12.0 frontend and default-off VIP plugin. Include the previously approved password-reset token revocation. Deploy only to an independent FUC-XB test instance; no production cutover.
16 lines
1.5 KiB
JavaScript
16 lines
1.5 KiB
JavaScript
// Node absorbs speculative idle browser connections; one PHP kernel remains isolated.
|
|
import http from 'node:http';
|
|
import net from 'node:net';
|
|
import {spawn} from 'node:child_process';
|
|
import {fileURLToPath} from 'node:url';
|
|
const root=fileURLToPath(new URL('../../',import.meta.url));
|
|
for(const port of [8594,8595])await new Promise((resolve,reject)=>{const probe=net.createServer();probe.once('error',reject);probe.listen(port,'127.0.0.1',()=>probe.close(resolve));});
|
|
const php=spawn('/usr/local/bin/php',['-S','127.0.0.1:8595',root+'scripts/theme-fuc/integration-router.php'],{cwd:root,stdio:['ignore','ignore','ignore']});
|
|
const server=http.createServer((req,res)=>{
|
|
const upstream=http.request({hostname:'127.0.0.1',port:8595,path:req.url,method:req.method,headers:{...req.headers,connection:'close'},agent:false},response=>{res.writeHead(response.statusCode,response.headers);response.pipe(res);});
|
|
upstream.setTimeout(30000,()=>upstream.destroy());upstream.on('error',()=>{if(!res.headersSent)res.writeHead(502);res.end('Acceptance backend unavailable');});req.on('aborted',()=>upstream.destroy());req.pipe(upstream);
|
|
});
|
|
let stopping=false;function stop(){if(stopping)return;stopping=true;server.close();server.closeAllConnections();php.kill();}
|
|
process.on('SIGINT',stop);process.on('SIGTERM',stop);php.on('exit',stop);php.on('error',stop);server.on('error',stop);
|
|
server.listen(8594,'127.0.0.1',()=>console.log('Fuc isolated XB acceptance: loopback 8594; no live data.'));
|