Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/** @jsxImportSource https://esm.sh/preact */
import { fetch } from "https://esm.town/v/std/fetch";
import { render } from "npm:preact-render-to-string";
const getFeedUrl = (request: Request) => {
const search = new URL(request.url).searchParams;
return search.get("url");
};
export default async function(request: Request): Promise<Response> {
const feedUrl = getFeedUrl(request);
if (!feedUrl) {
return new Response(
render(
<form style="display: flex; gap: 5px" action="" method="get" class="form">
<label for="url">Enter your feed url:</label>
<input type="url" name="url" id="url" required />
<input type="submit" value="Submit" />
</form>,
),
{
headers: { "Content-Type": "text/html" },
},
);
}
return fetch(feedUrl);
}
lchtao26-rssproxy.web.val.run
January 1, 2024