Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
BHSPitMonkey committed Jun 2, 2024
1 parent 3ade0f7 commit 3be1f82
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 269 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.5.1
v22.2.0
240 changes: 98 additions & 142 deletions .pnp.cjs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20
FROM node:22

LABEL org.opencontainers.image.source=https://github.com/BHSPitMonkey/news2reader
LABEL org.opencontainers.image.description=" Serve online articles directly to your e-reader using OPDS"
Expand All @@ -7,7 +7,7 @@ LABEL org.opencontainers.image.licenses=MIT
WORKDIR /usr/src/app
COPY package.json yarn.lock ./

# Note: The node:18 image ships with Yarn 1.x, not 2/3
# Note: The node:22 image ships with Yarn 1.x, not 2/3
RUN yarn install --immutable --network-timeout 600000
COPY dist/ ./dist/

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ You will need to mount a config directory at `/root/.config/news2reader/` in the

### Run via Node.js

(Tested using Node 20.x)
(Tested using Node 22.x)

```shell
yarn install
Expand Down
9 changes: 8 additions & 1 deletion dist/epub.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import Epub from "epub-gen";
import jsdom from "jsdom";
import { Readability } from "@mozilla/readability";
import got from "got";
const HEADERS = {
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'cache-control': 'no-cache',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.3',
};
export async function articleToEpub(url, preferredTitle) {
var _a;
const urlObj = new URL(url);
Expand All @@ -12,7 +17,9 @@ export async function articleToEpub(url, preferredTitle) {
const outputPath = "/tmp/news2opds-out.epub";
const virtualConsole = new jsdom.VirtualConsole();
console.log(`Processing article at URL ${url} to path ${outputPath}`);
const { body } = await got(url);
const { body } = await got(url, {
headers: HEADERS
});
console.log(`Fetched ${body.length} chars from ${url}`);
// Create a JSDOM
const dom = new jsdom.JSDOM(body, { url, virtualConsole });
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
"./src/provider/pocket": "./dist/src/provider/pocket.js"
},
"engines": {
"node": ">= 20.0.0"
"node": ">= 22.0.0"
},
"dependencies": {
"@folder/xdg": "^4.0.1",
"@mozilla/readability": "^0.5.0",
"@types/jsdom": "^21.1.6",
"@types/jsdom": "^21.1.7",
"epub-gen": "^0.1.0",
"express": "^4.18.2",
"express": "^4.19.2",
"feed": "^4.2.2",
"got": "^12.6.1",
"jsdom": "^23.2.0",
"jsdom": "^24.1.0",
"xmlbuilder2": "^3.1.1"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/node": "^20.11.0",
"@types/node": "^20.13.0",
"concurrently": "^8.2.2",
"nodemon": "^3.0.2",
"nodemon": "^3.1.2",
"typescript": "^5.3.3"
}
}
10 changes: 9 additions & 1 deletion src/epub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import jsdom from "jsdom";
import { Readability } from "@mozilla/readability";
import got from "got";

const HEADERS = {
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'cache-control': 'no-cache',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.3',
};

export async function articleToEpub(
url: string,
preferredTitle: string | null
Expand All @@ -18,7 +24,9 @@ export async function articleToEpub(

console.log(`Processing article at URL ${url} to path ${outputPath}`);

const { body } = await got(url);
const { body } = await got(url, {
headers: HEADERS
});
console.log(`Fetched ${body.length} chars from ${url}`);

// Create a JSDOM
Expand Down
Loading

0 comments on commit 3be1f82

Please sign in to comment.