* ci: add build check to pull requests

* Build(deps-dev): Bump @types/node from 20.10.6 to 20.11.24 (#91)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.10.6 to 20.11.24.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: image compression (#101)

* feat: image compression

* fix: not compress svg

Maybe we should add a function to disable this fix. Since I noticed that if you compress svg in webp it becomes magically smaller.

* Configuration page (#104)

* feat: image compression

* feat: configuration page

* refactor: json stringify

and change engine buttons to ordered list

* fix: engine distributor matching

* fix: formatting

* build: update txtdot version to 1.7.0

* fix: configuration page title

* doc: features (#102)

* fix: delete islocal from proxy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Artemy Egorov 2024-03-07 15:43:29 +03:00 committed by GitHub
parent 7c72d985f7
commit 2fd7ec55c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,18 +5,11 @@ import sharp from 'sharp';
import getConfig from '../../config/main'; import getConfig from '../../config/main';
import { UnsupportedMimetypeError } from '../../errors/main'; import { UnsupportedMimetypeError } from '../../errors/main';
import isLocalResource from '../../utils/islocal';
import { LocalResourceError } from '../../errors/main';
export default async function proxyRoute(fastify: FastifyInstance) { export default async function proxyRoute(fastify: FastifyInstance) {
fastify.get<IProxySchema>( fastify.get<IProxySchema>(
'/proxy', '/proxy',
{ schema: ProxySchema }, { schema: ProxySchema },
async (request, reply) => { async (request, reply) => {
if (await isLocalResource(new URL(request.query.url))) {
throw new LocalResourceError();
}
const response = await axios.get(request.query.url); const response = await axios.get(request.query.url);
const mime: string | undefined = const mime: string | undefined =
response.headers['content-type']?.toString(); response.headers['content-type']?.toString();