dsh-tg-bridge 1.12.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bridge.mjs +9 -1
- package/package.json +1 -1
package/bridge.mjs
CHANGED
|
@@ -329,7 +329,15 @@ function providerKeys(cfg) {
|
|
|
329
329
|
function findToken() {
|
|
330
330
|
const env = (process.env.DSH_TELEGRAM_BOT_TOKEN || '').trim();
|
|
331
331
|
if (env) return env;
|
|
332
|
-
|
|
332
|
+
// The suffixed name carries a random id of the machine that created the
|
|
333
|
+
// secret (DSH_TELEGRAM_BOT_TOKEN_<hex>), so it must not be spelled out here:
|
|
334
|
+
// any install is free to carry its own suffix. Try the plain name first, then
|
|
335
|
+
// whatever suffixed variants the credentials file actually holds.
|
|
336
|
+
const suffixes = [];
|
|
337
|
+
try {
|
|
338
|
+
for (const m of readFileSync(CRED, 'utf8').matchAll(/^\s*(DSH_TELEGRAM_BOT_TOKEN_[A-Z0-9_]+):/gm)) suffixes.push(m[1]);
|
|
339
|
+
} catch {}
|
|
340
|
+
for (const name of ['DSH_TELEGRAM_BOT_TOKEN', ...suffixes]) {
|
|
333
341
|
try {
|
|
334
342
|
const value = readSecret(name);
|
|
335
343
|
if (value) return value;
|
package/package.json
CHANGED