Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #207

Merged
merged 70 commits into from
Jul 24, 2024
Merged

Dev #207

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
8ca194c
feat: big badge configuration
artegoser May 16, 2024
f23bd51
fix: remove google fonts
artegoser May 16, 2024
150e83e
fix(plugins, server): remove cdn
artegoser May 16, 2024
5ca900b
Build(deps-dev): Bump @typescript-eslint/eslint-plugin
dependabot[bot] May 20, 2024
7d1ee99
Build(deps-dev): Bump @typescript-eslint/parser from 7.8.0 to 7.9.0
dependabot[bot] May 20, 2024
5d931e1
Build(deps): Bump sharp from 0.33.3 to 0.33.4
dependabot[bot] May 20, 2024
3731bf6
Build(deps-dev): Bump @types/node from 20.12.11 to 20.12.12
dependabot[bot] May 20, 2024
75b81eb
ci: fix format ignore
artegoser May 21, 2024
f4931af
Merge pull request #166 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser May 21, 2024
14dfa04
Merge pull request #165 from TxtDot/dependabot/npm_and_yarn/dev/sharp…
artegoser May 22, 2024
e88d7cf
Merge pull request #164 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser May 22, 2024
e2217e7
Merge pull request #163 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser May 22, 2024
92c7040
feat(server): json configuration
artegoser May 22, 2024
83d0d47
feat: add search route for adding in browser
artegoser May 22, 2024
f166041
fix: add arm arch
artegoser May 22, 2024
13bd8fb
fix: docker action
artegoser May 22, 2024
48bdf53
Build(deps): Bump isomorphic-dompurify from 2.10.0 to 2.11.0
dependabot[bot] May 27, 2024
43401e7
Build(deps): Bump micromatch from 4.0.5 to 4.0.7
dependabot[bot] May 27, 2024
dc76339
Build(deps): Bump axios from 1.7.0 to 1.7.2
dependabot[bot] May 27, 2024
894e726
Build(deps-dev): Bump @typescript-eslint/eslint-plugin
dependabot[bot] May 27, 2024
2fddbff
Merge pull request #171 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser May 27, 2024
c8ffa74
Merge pull request #170 from TxtDot/dependabot/npm_and_yarn/dev/axios…
artegoser May 27, 2024
000fa21
Merge pull request #169 from TxtDot/dependabot/npm_and_yarn/dev/micro…
artegoser May 27, 2024
2669db8
Merge pull request #168 from TxtDot/dependabot/npm_and_yarn/dev/isomo…
artegoser May 27, 2024
d248ae8
Build(deps-dev): Bump @typescript-eslint/parser from 7.10.0 to 7.12.0
dependabot[bot] Jun 10, 2024
50b098c
Build(deps-dev): Bump prettier from 3.2.5 to 3.3.1
dependabot[bot] Jun 10, 2024
9830c33
Build(deps-dev): Bump @types/node from 20.12.12 to 20.14.2
dependabot[bot] Jun 10, 2024
948c2eb
Merge pull request #179 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jun 13, 2024
19aeeb0
Merge pull request #178 from TxtDot/dependabot/npm_and_yarn/dev/prett…
artegoser Jun 13, 2024
a2fc1e9
Merge pull request #177 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jun 13, 2024
5062798
Build(deps-dev): Bump @typescript-eslint/eslint-plugin
dependabot[bot] Jun 13, 2024
a327207
Merge pull request #181 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jun 13, 2024
e89baed
Build(deps-dev): Bump @typescript-eslint/parser from 7.12.0 to 7.13.0
dependabot[bot] Jun 13, 2024
282a884
Merge pull request #180 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jun 13, 2024
203d784
Build(deps): Bump @fastify/swagger-ui from 3.0.0 to 4.0.0
dependabot[bot] Jun 17, 2024
ea0056a
Build(deps-dev): Bump prettier from 3.3.1 to 3.3.2
dependabot[bot] Jun 17, 2024
8966aea
Merge pull request #183 from TxtDot/dependabot/npm_and_yarn/dev/prett…
artegoser Jun 17, 2024
87b206f
Merge pull request #182 from TxtDot/dependabot/npm_and_yarn/dev/fasti…
artegoser Jun 17, 2024
92a88c4
Build(deps-dev): Bump @typescript-eslint/eslint-plugin
dependabot[bot] Jun 24, 2024
a9c288a
Build(deps-dev): Bump @types/node from 20.14.2 to 20.14.8
dependabot[bot] Jun 24, 2024
91d936f
Merge pull request #188 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jun 27, 2024
60b1276
Merge pull request #187 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jun 27, 2024
231cd49
Build(deps-dev): Bump typescript from 5.4.5 to 5.5.2
dependabot[bot] Jun 27, 2024
2fd0b02
Merge pull request #186 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jun 27, 2024
03e1ca0
Build(deps-dev): Bump @typescript-eslint/parser from 7.13.0 to 7.14.1
dependabot[bot] Jun 27, 2024
8ddada9
Merge pull request #189 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jun 27, 2024
a2892ee
Build(deps-dev): Bump lerna from 8.1.3 to 8.1.6
dependabot[bot] Jul 8, 2024
79a7a21
Build(deps-dev): Bump @types/node from 20.14.8 to 20.14.10
dependabot[bot] Jul 8, 2024
77c6d70
Merge pull request #194 from TxtDot/dependabot/npm_and_yarn/dev/lerna…
artegoser Jul 17, 2024
82710c3
Merge pull request #196 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jul 17, 2024
2f80466
Build(deps-dev): Bump typescript from 5.4.5 to 5.5.3
dependabot[bot] Jul 17, 2024
e1c9b50
Merge pull request #197 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jul 17, 2024
a65182a
Build(deps-dev): Bump @typescript-eslint/parser from 7.14.1 to 7.16.1
dependabot[bot] Jul 17, 2024
8b09875
Merge pull request #201 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jul 17, 2024
1dd6e94
Build(deps-dev): Bump @typescript-eslint/eslint-plugin
dependabot[bot] Jul 17, 2024
ae981b9
Merge pull request #202 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jul 18, 2024
427d98e
fix: engines fallback
artegoser Jul 20, 2024
f591ec9
Build(deps-dev): Bump @types/node from 20.14.10 to 20.14.11
dependabot[bot] Jul 22, 2024
db744e4
Build(deps-dev): Bump prettier from 3.3.2 to 3.3.3
dependabot[bot] Jul 22, 2024
a16385f
Build(deps-dev): Bump lerna from 8.1.6 to 8.1.7
dependabot[bot] Jul 22, 2024
0532e62
Merge pull request #204 from TxtDot/dependabot/npm_and_yarn/dev/prett…
artegoser Jul 22, 2024
9765644
Merge pull request #205 from TxtDot/dependabot/npm_and_yarn/dev/lerna…
artegoser Jul 22, 2024
ffd5bc3
Merge pull request #203 from TxtDot/dependabot/npm_and_yarn/dev/types…
artegoser Jul 22, 2024
1df6c13
doc: change logo
artegoser Jul 23, 2024
c2cc925
doc: fix logo margin
artegoser Jul 23, 2024
e42f14c
doc: update version
artegoser Jul 23, 2024
6b28094
doc: change layout
artegoser Jul 23, 2024
af28065
dev: add dependabot groups
artegoser Jul 23, 2024
089be5c
Merge pull request #206 from TxtDot/artegoser-patch-1
artegoser Jul 23, 2024
fd52555
dev: fix dependabot and format
artegoser Jul 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
packages/**/dist/**/*
packages/**/node_modules/**/*
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ updates:
target-branch: 'dev'
schedule:
interval: 'weekly'
groups:
deps:
patterns:
- '*'
File renamed without changes.
53 changes: 0 additions & 53 deletions .github/workflows/deploy.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Create and publish a Docker image

on:
push:
branches:
- main
- dev
release:
types:
- published

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pnpm-lock.yaml
packages/**/dist/**/*
packages/**/dist/**/*
packages/**/node_modules/**/*
packages/server/static/third-party/**/*
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<h1 align="center">
<a href="https://github.com/TxtDot/txtdot"><img src="https://github.com/TxtDot/.github/blob/main/imgs/TXTDot%20gh.png?raw=true" alt="txt." width="200"></a>
<br>
<a href="https://txtdot.github.io/documentation"><img alt="Documentation" src="https://img.shields.io/badge/Documentation-green"></a>
<a href="https://github.com/TxtDot/instances"><img alt="Instances" src="https://img.shields.io/badge/Instances-green"></a>
<br>
<a href="https://github.com/TxtDot/txtdot/blob/main/LICENSE"><img alt="MIT license" src="https://img.shields.io/github/license/txtdot/txtdot?color=blue"></a>
<a href="https://github.com/TxtDot/txtdot/releases/latest"><img alt="Latest release" src="https://img.shields.io/github/v/release/TxtDot/txtdot?display_name=release"></a>
<a href="https://matrix.to/#/#txtdot:matrix.org"><img alt="Matrix chat" src="https://img.shields.io/badge/chat-matrix-blue"></a>
</h1>
<div align="center">

![txtdot logo](https://github.com/TxtDot/.github/raw/main/imgs/txtdot.png)

<a href="https://txtdot.github.io/documentation"><img alt="Documentation" src="https://img.shields.io/badge/Documentation-blue"></a>
<a href="https://github.com/TxtDot/instances"><img alt="Instances" src="https://img.shields.io/badge/Instances-blue"></a>
<br>
<a href="https://github.com/TxtDot/txtdot/blob/main/LICENSE"><img alt="MIT license" src="https://img.shields.io/github/license/txtdot/txtdot?color=blue"></a>
<a href="https://github.com/TxtDot/txtdot/releases/latest"><img alt="Latest release" src="https://img.shields.io/github/v/release/TxtDot/txtdot?display_name=release"></a>

# txtdot

</div>

HTTP proxy that parses only text, links and pictures from pages
reducing internet traffic, removing ads and heavy scripts.
Expand Down
10 changes: 4 additions & 6 deletions packages/plugins/src/middlewares/highlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ function Highlighter({ content }: { content: string }) {
return (
<>
<style>
@import
"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/styles/atom-one-light.min.css";
@import
"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/styles/atom-one-dark.min.css"
screen and (prefers-color-scheme: dark);
@import "/static/third-party/styles/atom-one-light.min.css"; @import
"/static/third-party/styles/atom-one-dark.min.css" screen and
(prefers-color-scheme: dark);
</style>
<script
src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/highlight.min.js"
src="/static/third-party/scripts/highlight.min.js"
DarkCat09 marked this conversation as resolved.
Show resolved Hide resolved
type="text/javascript"
/>
<script>hljs.highlightAll();</script>
Expand Down
8 changes: 4 additions & 4 deletions packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@txtdot/server",
"version": "1.8.0",
"version": "1.9.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",
Expand All @@ -12,7 +12,7 @@
"license": "MIT",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npm run clean-css && copyfiles ./templates/*.ejs ./templates/**/*.ejs .env ./dist/ && tsc",
"build": "npm run clean-css && copyfiles ./templates/*.ejs ./templates/**/*.ejs ./static/third-party/* ./static/third-party/**/* .env ./dist/ && tsc",
"start": "cd ./dist && node ./src/app.js",
"clean-css": "cleancss --batch static/*.css -o dist/static --batch-suffix \"\"",
"dev": "tsc-watch --onSuccess \"node ./dist/src/app.js\""
Expand All @@ -21,7 +21,7 @@
"@fastify/one-line-logger": "^1.3.0",
"@fastify/static": "^7.0.3",
"@fastify/swagger": "^8.14.0",
"@fastify/swagger-ui": "^3.0.0",
"@fastify/swagger-ui": "^4.0.0",
"@fastify/view": "^9.0.0",
"@txtdot/plugins": "workspace:*",
"@txtdot/sdk": "workspace:*",
Expand All @@ -32,7 +32,7 @@
"iconv-lite": "^0.6.3",
"ip-range-check": "^0.2.0",
"isomorphic-dompurify": "^2.10.0",
"json-schema-to-ts": "^3.0.1",
"json-schema-to-ts": "^3.1.0",
"linkedom": "^0.18.0",
"micromatch": "^4.0.5",
"sharp": "^0.33.3"
Expand Down
4 changes: 3 additions & 1 deletion packages/server/src/distributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ export class Distributor {
}
}

return await this.engines_fallback[0].handle(input);
return await this.engines_fallback[this.engines_fallback.length - 1].handle(
input
);
}

async processMiddlewares(
Expand Down
68 changes: 61 additions & 7 deletions packages/server/src/routes/browser/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,65 @@ import { indexSchema } from '../../types/requests/browser';
import config from '../../config';

export default async function configurationRoute(fastify: FastifyInstance) {
fastify.get('/configuration', { schema: indexSchema }, async (_, reply) => {
return reply.view('/templates/configuration.ejs', {
engines: distributor.engines_fallback,
middlewares: distributor.middles_fallback,
config,
});
});
fastify.get(
'/configuration',
{ schema: indexSchema },
async (request, reply) => {
return reply.view('/templates/configuration.ejs', {
engines: distributor.engines_fallback,
middlewares: distributor.middles_fallback,
config,
base_url: `(${request.protocol}) - ${request.hostname}`,
});
}
);

fastify.get(
'/configuration/json',
{ schema: indexSchema },
async (request, reply) => {
reply.header('content-type', 'application/json');

return {
protocol: request.protocol,
hostname: request.hostname,
version: config.package.version,
...{ ...config.env, host: undefined, port: undefined },
engines: distributor.engines_fallback.map((engine) => {
return {
...engine,
routes: engine.routes.map((route) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (route.route as any).spec;
}),
};
}),
middlewares: distributor.middles_fallback.map((middleware) => {
return {
...middleware,
routes: middleware.middles.map((middle) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (middle.route as any).spec;
}),
middles: undefined,
};
}),
routes: [...config.dyn.routes].map((route) => {
return route;
}),
};
}
);

fastify.get(
'/configuration/badges/big',
{ schema: indexSchema },
async (request, reply) => {
reply.header('content-type', 'image/svg+xml');
return reply.view('/templates/big_badge.ejs', {
config,
base_url: `(${request.protocol}) - ${request.hostname}`,
});
}
);
}
25 changes: 24 additions & 1 deletion packages/server/src/routes/browser/redirect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { FastifyInstance } from 'fastify';

import { redirectSchema, IRedirectSchema } from '../../types/requests/browser';
import {
redirectSchema,
IRedirectSchema,
ISearchSchema,
searchSchema,
} from '../../types/requests/browser';

import config from '../../config';

export default async function redirectRoute(fastify: FastifyInstance) {
fastify.get<IRedirectSchema>(
Expand All @@ -17,4 +24,20 @@ export default async function redirectRoute(fastify: FastifyInstance) {
);
}
);

if (config.env.third_party.searx_url) {
fastify.get<ISearchSchema>(
'/search',
{ schema: searchSchema },
async (request, reply) => {
reply.redirect(
`/get?url=${encodeURIComponent(
config.env.third_party.searx_url +
'/search?q=' +
encodeURIComponent(request.query.q)
)}`
);
}
);
}
}
Loading
Loading