From 561d5af0dd6c2a30b0ec22c1bd3d8717ed3e54db Mon Sep 17 00:00:00 2001 From: Admin Date: Thu, 17 Sep 2026 08:32:43 +0000 Subject: [PATCH] Add visible v2 update badge --- wrapper.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 wrapper.js diff --git a/wrapper.js b/wrapper.js new file mode 100644 index 0000000..ba91bd1 --- /dev/null +++ b/wrapper.js @@ -0,0 +1,14 @@ +import http from 'node:http'; + +const originalEnd = http.ServerResponse.prototype.end; + +http.ServerResponse.prototype.end = function (chunk, encoding, callback) { + const type = String(this.getHeader('content-type') || ''); + if (typeof chunk === 'string' && type.startsWith('text/html') && chunk.includes('')) { + const badge = '
v2 ยท live update
'; + chunk = chunk.replace('', `${badge}`); + } + return originalEnd.call(this, chunk, encoding, callback); +}; + +await import('./server.js');