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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "@txtdot/server", "name": "@txtdot/server",
"version": "1.9.1", "version": "1.10.0",
"private": true, "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", "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", "main": "dist/app.js",
@ -18,28 +18,28 @@
"dev": "tsc-watch --onSuccess \"node ./dist/src/app.js\"" "dev": "tsc-watch --onSuccess \"node ./dist/src/app.js\""
}, },
"dependencies": { "dependencies": {
"@fastify/one-line-logger": "^2.0.0", "@fastify/one-line-logger": "^2.0.2",
"@fastify/static": "^8.0.1", "@fastify/static": "^8.1.0",
"@fastify/swagger": "^9.1.0", "@fastify/swagger": "^9.4.2",
"@fastify/swagger-ui": "^5.0.1", "@fastify/swagger-ui": "^5.2.1",
"@fastify/view": "^10.0.1", "@fastify/view": "^10.0.2",
"@txtdot/plugins": "workspace:*", "@txtdot/plugins": "workspace:*",
"@txtdot/sdk": "workspace:*", "@txtdot/sdk": "workspace:*",
"axios": "^1.7.7", "axios": "^1.7.9",
"dotenv": "^16.3.1", "dotenv": "^16.4.7",
"ejs": "^3.1.10", "ejs": "^3.1.10",
"fastify": "^5.0.0", "fastify": "^5.2.1",
"iconv-lite": "^0.6.3", "iconv-lite": "^0.6.3",
"ip-range-check": "^0.2.0", "ip-range-check": "^0.2.0",
"isomorphic-dompurify": "^2.16.0", "isomorphic-dompurify": "^2.21.0",
"json-schema-to-ts": "^3.1.0", "json-schema-to-ts": "^3.1.1",
"linkedom": "^0.18.0", "linkedom": "^0.18.9",
"micromatch": "^4.0.8", "micromatch": "^4.0.8",
"sharp": "^0.33.3" "sharp": "^0.33.5"
}, },
"devDependencies": { "devDependencies": {
"@types/ejs": "^3.1.5", "@types/ejs": "^3.1.5",
"@types/jsdom": "^21.1.6", "@types/jsdom": "^21.1.7",
"@types/micromatch": "^4.0.9", "@types/micromatch": "^4.0.9",
"clean-css-cli": "^5.6.3", "clean-css-cli": "^5.6.3",
"copyfiles": "^2.4.1" "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( generateRequestUrl(
request.protocol, request.protocol,
request.hostname, request.hostname,
request.port,
request.originalUrl request.originalUrl
), ),
request.query.engine request.query.engine

View File

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

View File

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

View File

@ -1,9 +1,16 @@
export function generateRequestUrl( export function generateRequestUrl(
protocol: string, protocol: string,
host: string, host: string,
port: number,
originalUrl: string originalUrl: string
): URL { ): 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( export function generateParserUrl(

780
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff