Fix path.

This commit is contained in:
Yunzhe 2024-08-06 11:24:58 +08:00
parent 7cd0705120
commit 521da81f57
2 changed files with 11 additions and 5 deletions

View file

@ -1,11 +1,12 @@
const fs = require('fs/promises') const fs = require('fs/promises')
const path = require('path')
const { JSDOM, VirtualConsole } = require('jsdom') const { JSDOM, VirtualConsole } = require('jsdom')
const { url, userAgent } = require('./consts') const { url, userAgent } = require('./consts')
const createTask = async (visitorData) => { const createTask = async (visitorData) => {
const domContent = await fs.readFile('vendor/index.html', 'utf-8') const domContent = await fs.readFile(path.join(__dirname, '..', 'vendor', 'index.html'), 'utf-8')
const baseContent = await fs.readFile(`vendor/base.js`, 'utf-8') const baseContent = await fs.readFile(path.join(__dirname, '..', 'vendor', 'base.js'), 'utf-8')
const baseAppendContent = await fs.readFile(`lib/inject.js`, 'utf-8') const baseAppendContent = await fs.readFile(path.join(__dirname, 'inject.js'), 'utf-8')
let destroy = undefined let destroy = undefined
return { return {
stop: () => destroy?.(), stop: () => destroy?.(),

View file

@ -1,6 +1,6 @@
{ {
"name": "youtube-po-token-generator", "name": "youtube-po-token-generator",
"version": "0.1.0", "version": "0.2.0",
"author": "Yunzhe <yunzhe@zju.edu.cn>", "author": "Yunzhe <yunzhe@zju.edu.cn>",
"description": "It generates a valid poToken with visitorData fetched from YouTube.", "description": "It generates a valid poToken with visitorData fetched from YouTube.",
"keywords": [ "keywords": [
@ -20,5 +20,10 @@
}, },
"engines": { "engines": {
"node": ">=18.0" "node": ">=18.0"
} },
"files": [
"vendor/",
"lib/",
"index.js"
]
} }