mirror of
https://github.com/txtdot/txtdot
synced 2024-10-18 14:40:19 +03:00
v1.7.0 (#105)
* 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:
parent
7c72d985f7
commit
2fd7ec55c8
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user