From 23cf81d0a59e4fc7728851632d3e7f83b18b6eb7 Mon Sep 17 00:00:00 2001 From: xream Date: Fri, 8 Mar 2024 14:20:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Node.js=20=E7=89=88=20/api/utils/env=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20meta=20=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/utils/env.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index 36ec5736c..95dbc163c 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.241", + "version": "2.14.242", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/utils/env.js b/backend/src/utils/env.js index 244d9b255..d0eca36ca 100644 --- a/backend/src/utils/env.js +++ b/backend/src/utils/env.js @@ -36,6 +36,21 @@ try { // eslint-disable-next-line no-undef meta.script = $script; } + if (isNode) { + meta.node = { + version: eval('process.version'), + argv: eval('process.argv'), + filename: eval('__filename'), + dirname: eval('__dirname'), + env: {}, + }; + const env = eval('process.env'); + for (const key in env) { + if (/^SUB_STORE_/.test(key)) { + meta.node.env[key] = env[key]; + } + } + } // eslint-disable-next-line no-empty } catch (e) {}