From 6cf40960643e0074cceb16c40e8e841b9acf5135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=E1=BA=BF=20H=C6=B0ng?= Date: Sun, 13 Apr 2025 13:29:36 +0700 Subject: [PATCH] chore: fix running dist package in nodejs So we have to add ".js" to the import name... --- README.md | 7 +++++++ package.json | 2 +- src/index.ts | 6 +++--- src/proxy/reflect4.ts | 6 +++--- src/website/twitch.ts | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1710ac2..6fa2102 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,13 @@ Rice shirt rice money :( +## Notice + +> [!WARNING] +> This software is provided by the author as is, without any warranty. Use at your own risk + +The view buffed should be around 1/2 (or 2/5) of the amount of proxy you chosen in the worst case, and possibly near the amount in the best case. + ## Installation This project uses Bun for dependency management and Node.js (or Bun on UNIX platforms) for the app execution. diff --git a/package.json b/package.json index d841531..f84ddf2 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dev-bun": "bun ./src/index.ts", "start": "node ./dist/index.js", "start-bun": "bun ./dist/index.js", - "build": "swc ./src -d dist" + "build": "swc ./src -d dist --strip-leading-paths" }, "devDependencies": { "@swc-node/register": "^1.10.10", diff --git a/src/index.ts b/src/index.ts index b01eeea..a75bfa2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,8 @@ import { chromium, type Browser, type LaunchOptions } from "patchright"; import fs from 'node:fs'; -import * as reflect4 from "./proxy/reflect4"; -import logger from "./logger"; -import Config from "./config"; +import * as reflect4 from "./proxy/reflect4.js"; +import logger from "./logger.js"; +import Config from "./config.js"; const version = "0.1.0"; diff --git a/src/proxy/reflect4.ts b/src/proxy/reflect4.ts index e30369e..03be567 100644 --- a/src/proxy/reflect4.ts +++ b/src/proxy/reflect4.ts @@ -1,7 +1,7 @@ import { devices, type BrowserContext, type Locator } from "patchright"; -import logger from "../logger"; -import * as twitch from "../website/twitch"; -import * as constants from "../constants"; +import logger from "../logger.js"; +import * as twitch from "../website/twitch.js"; +import * as constants from "../constants.js"; async function spawn(context: BrowserContext, targetUrl: string, changeViewport: boolean = false, spawnId: string = "unknown") { const server = constants.REFLECT4_SERVERS[Math.floor(Math.random() * constants.REFLECT4_SERVERS.length)]; diff --git a/src/website/twitch.ts b/src/website/twitch.ts index dd00082..7aa74bd 100644 --- a/src/website/twitch.ts +++ b/src/website/twitch.ts @@ -1,5 +1,5 @@ import type { Page } from "patchright"; -import logger from "../logger"; +import logger from "../logger.js"; async function checkConsentButton(page: Page, spawnId: string = "unknown") { const consentButton = page.locator("button[data-a-target='consent-banner-accept']");