Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
@technik-sde/foxy
Advanced tools
> Customizable frontend-proxy, supporting multiple handlers for input-urls
Customizable frontend-proxy, supporting multiple handlers for input-urls
import { Foxy, utils } from "foxy";
const proxy = new Foxy({
handlers: [
{
use({ url }) {
return myUrlFormat.test(url);
},
getImageURL({ url }) {
return Promise.resolve(buildMyUrlScheme(url));
},
getImageInfo({ url }) {
return utils.loadImage(buildMyUrlScheme(url))
}
}
]
});
const finalUrl = await proxy.getImageURL({ url: 1234 });
const imageMetadata = await proxy.getImageInfo({ url: 1234 });
Multiple handlers are supported and are resolved from first to last index. The first handler returning true
on use, will be selected, if the given method-name is defined:
import { Foxy } from "foxy";
const proxy = new Foxy({
handlers: [
{
use({ url }) {
return myUrlFormat.test(url);
},
getImageURL({ url }) {
return Promise.resolve(buildMyUrlScheme(url));
}
},
{
use: () => true,
// overwrites default exception to always return false
getImageURL({ url }) { return Promise.resolve(false); }
}
]
});
const finalUrl = await proxy.getImageURL({ url: "abc" }); // false, when not myUrlFormat
Per default the following methods are supported via api: getImageURL, getImageInfo, getVideoURL, getVideoInfo
. The
generic method get(methodName: string, requestData: AnyObject)
may be used to access any custom methods defined on
handlers. e.g.
import { Foxy } from "foxy";
const proxy = new Foxy({
handlers: [
{
use({ url }) {
return myUrlFormat.test(url);
},
getJSON({ url }) {
return fetch(buildMyUrlScheme(url)).then(response => response.json());
}
}
]
});
const json = await proxy.get("getJSON", { url: "my-json-url" });
FAQs
> Customizable frontend-proxy, supporting multiple handlers for input-urls
The npm package @technik-sde/foxy receives a total of 1 weekly downloads. As such, @technik-sde/foxy popularity was classified as not popular.
We found that @technik-sde/foxy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 48 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.