mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-12 17:52:13 +02:00
Update README.md
This commit is contained in:
parent
4459477a6d
commit
1efeb53ba8
45
README.md
45
README.md
@ -1,5 +1,4 @@
|
||||
<p align="center"><img src="https://raw.githubusercontent.com/Stirling-Tools/Stirling-PDF/main/docs/stirling.png" width="80" ></p>
|
||||
<h1 align="center">Stirling-PDF</h1>
|
||||
<h1 align="center">Konfuzio PDF Tools</h1>
|
||||
|
||||
[](https://hub.docker.com/r/frooodle/s-pdf)
|
||||
[](https://discord.gg/Cn8pWhQRxZ)
|
||||
@ -343,6 +342,48 @@ To add new users go to the bottom of Account settings and hit 'Admin Settings',
|
||||
|
||||
For API usage you must provide a header with 'X-API-Key' and the associated API key for that user.
|
||||
|
||||
## Konfuzio.com Deployment
|
||||
|
||||
This repo is publically served via konfuzio.com/tools. A Cloudflare Worker (https://dash.cloudflare.com/c3a4e203bd542436b2abc5f2a93bb812/workers/services/edit/konfuzio-pdf-tools/production) is used to redirect traffic to "/tools".
|
||||
|
||||
```
|
||||
const myBlog = {
|
||||
hostname: "tools.konfuzio.com",
|
||||
targetSubdirectory: "/tools"
|
||||
}
|
||||
|
||||
async function handleRequest(request) {
|
||||
const parsedUrl = new URL(request.url);
|
||||
const requestMatches = match => new RegExp(match).test(parsedUrl.pathname);
|
||||
|
||||
// Create a new URL based on the condition
|
||||
const targetUrl = requestMatches(myBlog.targetSubdirectory) ?
|
||||
`https://${myBlog.hostname}${parsedUrl.pathname}` :
|
||||
request.url;
|
||||
|
||||
// Check if the request is a POST request
|
||||
if (request.method === "POST") {
|
||||
// Forward the POST request with its body and headers
|
||||
const response = await fetch(targetUrl, {
|
||||
method: 'POST', // Set method to POST
|
||||
headers: request.headers, // Forward the headers
|
||||
body: request.body // Forward the body
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
// For other types of requests (GET, PUT, DELETE, etc.), simply forward the request as is
|
||||
return fetch(targetUrl, {
|
||||
method: request.method, // Use the original request method
|
||||
headers: request.headers // Forward the headers
|
||||
});
|
||||
}
|
||||
|
||||
addEventListener("fetch", event => {
|
||||
event.respondWith(handleRequest(event.request));
|
||||
});
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### Q1: What are your planned features?
|
||||
|
Loading…
Reference in New Issue
Block a user