From 521da81f57b1859b53716e8526eb75206d06dda8 Mon Sep 17 00:00:00 2001 From: Yunzhe Date: Tue, 6 Aug 2024 11:24:58 +0800 Subject: [PATCH] Fix path. --- lib/task.js | 7 ++++--- package.json | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/task.js b/lib/task.js index 7fa0dfa..c49ce76 100644 --- a/lib/task.js +++ b/lib/task.js @@ -1,11 +1,12 @@ const fs = require('fs/promises') +const path = require('path') const { JSDOM, VirtualConsole } = require('jsdom') const { url, userAgent } = require('./consts') const createTask = async (visitorData) => { - const domContent = await fs.readFile('vendor/index.html', 'utf-8') - const baseContent = await fs.readFile(`vendor/base.js`, 'utf-8') - const baseAppendContent = await fs.readFile(`lib/inject.js`, 'utf-8') + const domContent = await fs.readFile(path.join(__dirname, '..', 'vendor', 'index.html'), 'utf-8') + const baseContent = await fs.readFile(path.join(__dirname, '..', 'vendor', 'base.js'), 'utf-8') + const baseAppendContent = await fs.readFile(path.join(__dirname, 'inject.js'), 'utf-8') let destroy = undefined return { stop: () => destroy?.(), diff --git a/package.json b/package.json index 3fa51f6..e8f9e7c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "youtube-po-token-generator", - "version": "0.1.0", + "version": "0.2.0", "author": "Yunzhe ", "description": "It generates a valid poToken with visitorData fetched from YouTube.", "keywords": [ @@ -20,5 +20,10 @@ }, "engines": { "node": ">=18.0" - } + }, + "files": [ + "vendor/", + "lib/", + "index.js" + ] }