fix: try to fix everything

This commit is contained in:
Artemy Egorov 2025-02-15 11:09:27 +03:00
parent c182cdda88
commit 82f24e0c5c
13 changed files with 480 additions and 2885 deletions

View File

@ -1,7 +1,10 @@
FROM node:20-alpine as base
FROM node:23-alpine as base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN \
npm i -g corepack@latest \
corepack enable \
corepack use pnpm@latest-10
COPY . /app
WORKDIR /app
@ -16,7 +19,10 @@ FROM node:20-alpine as run
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN \
npm i -g corepack@latest \
corepack enable \
corepack use pnpm@latest-10
WORKDIR /app
COPY --from=prod-deps /app/node_modules /app/node_modules

View File

@ -7,13 +7,20 @@
"format:check": "prettier --check ."
},
"devDependencies": {
"@types/node": "^22.8.0",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"eslint": "^9.13.0",
"lerna": "^8.1.8",
"prettier": "^3.3.3",
"tsc-watch": "^6.2.0",
"typescript": "^5.6.3"
}
"@types/node": "^22.13.4",
"@typescript-eslint/eslint-plugin": "^8.24.0",
"@typescript-eslint/parser": "^8.24.0",
"eslint": "^9.20.1",
"lerna": "^8.1.9",
"prettier": "^3.5.1",
"tsc-watch": "^6.2.1",
"typescript": "^5.7.3"
},
"pnpm": {
"onlyBuiltDependencies": [
"nx",
"sharp"
]
},
"packageManager": "pnpm@10.4.0+sha512.6b849d0787d97f8f4e1f03a9b8ff8f038e79e153d6f11ae539ae7c435ff9e796df6a862c991502695c7f9e8fac8aeafc1ac5a8dab47e36148d183832d886dd52"
}

View File

@ -1,6 +1,6 @@
{
"name": "@txtdot/plugins",
"version": "2.0.0",
"version": "2.0.1",
"description": "Official txtdot plugins",
"main": "dist/lib.js",
"types": "dist/lib.d.ts",
@ -21,10 +21,9 @@
"@mozilla/readability": "^0.5.0",
"@txtdot/sdk": "workspace:*",
"html-to-text": "^9.0.5",
"linkedom": "^0.18.0"
"linkedom": "^0.18.9"
},
"devDependencies": {
"@types/html-to-text": "^9.0.4",
"typescript": "^5.4.5"
"@types/html-to-text": "^9.0.4"
}
}

View File

@ -30,8 +30,8 @@ async function search(
const articles_parsed = articles.map((a) => {
const parsed = {
url:
(a.getElementsByClassName('url_wrapper')[0] as HTMLAnchorElement)
.href || '',
(a.getElementsByClassName('url_header')[0] as HTMLAnchorElement).href ||
'',
title:
(a.getElementsByTagName('h3')[0] as HTMLHeadingElement).textContent ||
'',

View File

@ -1,7 +1,6 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
"incremental": true /* Save .tsbuildinfo files to allow for incremental compilation of projects. */,
// "composite": true /* Enable constraints that allow a TypeScript project to be used with project references. */,

View File

@ -18,11 +18,10 @@
],
"license": "MIT",
"dependencies": {
"linkedom": "^0.18.0",
"linkedom": "^0.18.9",
"route-parser": "^0.0.5"
},
"devDependencies": {
"@types/route-parser": "^0.1.7",
"typescript": "^5.4.5"
"@types/route-parser": "^0.1.7"
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@txtdot/server",
"version": "1.9.1",
"version": "1.10.0",
"private": true,
"description": "txtdot is an HTTP proxy that parses only text, links and pictures from pages reducing internet bandwidth usage, removing ads and heavy scripts",
"main": "dist/app.js",
@ -18,28 +18,28 @@
"dev": "tsc-watch --onSuccess \"node ./dist/src/app.js\""
},
"dependencies": {
"@fastify/one-line-logger": "^2.0.0",
"@fastify/static": "^8.0.1",
"@fastify/swagger": "^9.1.0",
"@fastify/swagger-ui": "^5.0.1",
"@fastify/view": "^10.0.1",
"@fastify/one-line-logger": "^2.0.2",
"@fastify/static": "^8.1.0",
"@fastify/swagger": "^9.4.2",
"@fastify/swagger-ui": "^5.2.1",
"@fastify/view": "^10.0.2",
"@txtdot/plugins": "workspace:*",
"@txtdot/sdk": "workspace:*",
"axios": "^1.7.7",
"dotenv": "^16.3.1",
"axios": "^1.7.9",
"dotenv": "^16.4.7",
"ejs": "^3.1.10",
"fastify": "^5.0.0",
"fastify": "^5.2.1",
"iconv-lite": "^0.6.3",
"ip-range-check": "^0.2.0",
"isomorphic-dompurify": "^2.16.0",
"json-schema-to-ts": "^3.1.0",
"linkedom": "^0.18.0",
"isomorphic-dompurify": "^2.21.0",
"json-schema-to-ts": "^3.1.1",
"linkedom": "^0.18.9",
"micromatch": "^4.0.8",
"sharp": "^0.33.3"
"sharp": "^0.33.5"
},
"devDependencies": {
"@types/ejs": "^3.1.5",
"@types/jsdom": "^21.1.6",
"@types/jsdom": "^21.1.7",
"@types/micromatch": "^4.0.9",
"clean-css-cli": "^5.6.3",
"copyfiles": "^2.4.1"

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@ export default async function parseRoute(fastify: FastifyInstance) {
generateRequestUrl(
request.protocol,
request.hostname,
request.port,
request.originalUrl
),
request.query.engine

View File

@ -17,6 +17,7 @@ export default async function rawHtml(fastify: FastifyInstance) {
generateRequestUrl(
request.protocol,
request.hostname,
request.port,
request.originalUrl
),
request.query.engine,

View File

@ -18,6 +18,7 @@ export default async function getRoute(fastify: FastifyInstance) {
generateRequestUrl(
request.protocol,
request.hostname,
request.port,
request.originalUrl
),
engine

View File

@ -1,9 +1,16 @@
export function generateRequestUrl(
protocol: string,
host: string,
port: number,
originalUrl: string
): URL {
return new URL(`${protocol}://${host}${originalUrl}`);
let actual_port =
protocol === 'https' && port === 443
? ''
: protocol === 'http' && port === 80
? ''
: `:${port}`;
return new URL(`${protocol}://${host}${actual_port}${originalUrl}`);
}
export function generateParserUrl(

780
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff