Compare commits

...

12 Commits

Author SHA1 Message Date
inkch
8639b3ae40 feature: allow local resources
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
2025-02-24 17:52:12 +09:00
Artemy Egorov
220182dd42 Merge pull request #258 from TxtDot/dev
Some checks are pending
Create and publish a Docker image / build-and-push-image (push) Waiting to run
Fix: #257
2025-02-15 16:59:44 +03:00
Artemy Egorov
d705ddc9a8 update version 2025-02-15 16:57:22 +03:00
Artemy Egorov
d640f90318 fix: port 2025-02-15 16:55:49 +03:00
Andrey
881025ad22 Merge pull request #255 from TxtDot/dev
Fix docker issues, update dependencies, fix searx links
2025-02-15 10:15:42 +00:00
Artemy Egorov
97fed8e476 fix: remove package manager from package.json 2025-02-15 11:45:16 +03:00
Artemy Egorov
c0d749a21f fix: workflow check, format 2025-02-15 11:44:04 +03:00
Artemy Egorov
a3de90a9cd fix: docker image build 2025-02-15 11:40:40 +03:00
Artemy Egorov
82f24e0c5c fix: try to fix everything 2025-02-15 11:09:27 +03:00
Artemy Egorov
c182cdda88 Notice 2025-02-14 19:29:26 +03:00
Artemy Egorov
91e5cbf19d Merge pull request #252 from TxtDot/dependabot/npm_and_yarn/deps-27632a851a
Build(deps): Bump the deps group across 1 directory with 7 updates
2025-02-05 14:39:39 +03:00
dependabot[bot]
81f2aaebbf Build(deps): Bump the deps group across 1 directory with 7 updates
Bumps the deps group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `22.10.7` | `22.13.0` |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `8.20.0` | `8.22.0` |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `8.20.0` | `8.22.0` |
| [eslint](https://github.com/eslint/eslint) | `9.18.0` | `9.19.0` |
| [linkedom](https://github.com/WebReflection/linkedom) | `0.18.6` | `0.18.7` |
| [@fastify/static](https://github.com/fastify/fastify-static) | `8.0.4` | `8.1.0` |
| [isomorphic-dompurify](https://github.com/kkomelin/isomorphic-dompurify) | `2.20.0` | `2.21.0` |



Updates `@types/node` from 22.10.7 to 22.13.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `@typescript-eslint/eslint-plugin` from 8.20.0 to 8.22.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.22.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 8.20.0 to 8.22.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.22.0/packages/parser)

Updates `eslint` from 9.18.0 to 9.19.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.18.0...v9.19.0)

Updates `linkedom` from 0.18.6 to 0.18.7
- [Commits](https://github.com/WebReflection/linkedom/compare/v0.18.6...v0.18.7)

Updates `@fastify/static` from 8.0.4 to 8.1.0
- [Release notes](https://github.com/fastify/fastify-static/releases)
- [Commits](https://github.com/fastify/fastify-static/compare/v8.0.4...v8.1.0)

Updates `isomorphic-dompurify` from 2.20.0 to 2.21.0
- [Release notes](https://github.com/kkomelin/isomorphic-dompurify/releases)
- [Commits](https://github.com/kkomelin/isomorphic-dompurify/compare/v2.20.0...2.21.0)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: linkedom
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: "@fastify/static"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: isomorphic-dompurify
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-03 04:14:49 +00:00
16 changed files with 542 additions and 2945 deletions

View File

@@ -14,7 +14,7 @@ jobs:
- uses: pnpm/action-setup@v4
with:
version: 9
version: 10
- name: Install dependencies
run: pnpm install

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
@@ -12,11 +15,14 @@ FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build
FROM node:20-alpine as run
FROM node:23-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

@@ -1,3 +1,6 @@
> [!WARNING]
> The project is frozen for a while. txtdot needs a complete rewrite in rust and dalet integration, which is not finished yet.
<div align="center">
![txtdot logo](https://github.com/TxtDot/.github/raw/main/imgs/txtdot.png)

View File

@@ -7,13 +7,19 @@
"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.2"
},
"pnpm": {
"onlyBuiltDependencies": [
"nx",
"sharp"
]
}
}

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.1",
"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,6 +1,4 @@
import origAxios, { CreateAxiosDefaults } from 'axios';
import { isLocalResource, isLocalResourceURL } from '../utils/islocal';
import { LocalResourceError } from '../errors/main';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const config: CreateAxiosDefaults<any> = {
@@ -14,18 +12,8 @@ const config: CreateAxiosDefaults<any> = {
const axios = origAxios.create(config);
axios.interceptors.response.use(
(response) => {
if (isLocalResource(response.request.socket.remoteAddress)) {
throw new LocalResourceError();
}
return response;
},
async (error) => {
if (await isLocalResourceURL(new URL(error.config?.url))) {
throw new LocalResourceError();
}
(response) => response,
(error) => {
throw error;
}
);

View File

@@ -1,9 +1,12 @@
export function generateRequestUrl(
protocol: string,
host: string,
port: number,
originalUrl: string
): URL {
return new URL(`${protocol}://${host}${originalUrl}`);
return new URL(
`${protocol}://${host}${port === null ? '' : `:${port}`}${originalUrl}`
);
}
export function generateParserUrl(

886
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff