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" + ] }