@gonzih/cc-tg 0.3.4 → 0.3.5
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/dist/index.js +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19,7 +19,9 @@ import { unlinkSync } from "fs";
|
|
|
19
19
|
import { tmpdir } from "os";
|
|
20
20
|
import { join } from "path";
|
|
21
21
|
import { CcTgBot } from "./bot.js";
|
|
22
|
-
|
|
22
|
+
// Make lock socket unique per bot token so multiple users on the same machine don't collide
|
|
23
|
+
const _tokenHash = Buffer.from(process.env.TELEGRAM_BOT_TOKEN ?? "default").toString("base64").replace(/[^a-z0-9]/gi, "").slice(0, 16);
|
|
24
|
+
const LOCK_SOCKET = join(tmpdir(), `cc-tg-${_tokenHash}.sock`);
|
|
23
25
|
function acquireLock() {
|
|
24
26
|
return new Promise((resolve) => {
|
|
25
27
|
const server = createServer();
|