54 query: topic,
55 pages: 2,
56 apiKey: Deno.env.get("BROWSERBASE_API_KEY") ?? "",
57 });
58}
63 maxResults: 10,
64 daysBack: 1,
65 apiKey: Deno.env.get("TWITTER_BEARER_TOKEN") ?? "",
66 });
67}
98
99 if (!response.ok) {
100 throw new Error(`Slack API error: ${response.status} ${response.statusText}`);
101 }
102
7## Getting Started
8To run Slack Scout, you’ll need a
9- Browserbase API key
10- Slack Webhook URL: setup [here](https://docs.val.town/integrations/slack/send-messages-to-slack/)
11- Twitter Developer API key
12
13### Browserbase
19### Twitter
20
21We’ve decided to use the Twitter API to include Twitter post results. It costs $100 / month to have a Basic Twitter Developer account. _If you decide to use Browserbase, we can lend our token. Comment below for access._
22
23Once you have the `SLACK_WEBHOOK_URL`, `BROWSERBASE_API_KEY`, and `TWITTER_BEARER_TOKEN`, input all of these as [Val Town Environment Variables](https://www.val.town/settings/environment-variables).
24
25---
2
3/**
4 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
5 */
6export class OpenAI {
8
9 /**
10 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
11 *
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
17 * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
18 * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
19 */
20 constructor(options: Omit<ClientOptions, "baseURL" | "apiKey" | "organization"> = {}) {
21 this.rawOpenAIClient = new RawOpenAI({
22 ...options,
23 baseURL: "https://std-openaiproxy.web.val.run/v1",
24 apiKey: Deno.env.get("valtown"),
25 organization: null,
26 });
9 hello: {
10 type: GraphQLString,
11 resolve: () => "Hello from Val Town GraphQL API!",
12 },
13 },
16 hello: {
17 type: GraphQLString,
18 resolve: () => "Hello from Val Town GraphQL API!",
19 },
20 },
49```
50
51↑ [https://www.val.town/v/flesch/graphqlAPIEndpoint](https://www.val.town/v/flesch/graphqlAPIEndpoint)
52
53
204 <title>${accountId}'s Profile</title>
205 <meta name="viewport" content="width=device-width, initial-scale=1">
206 <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap" rel="stylesheet">
207 <script src="https://cdn.tailwindcss.com"></script>
208 <script>
14/**
15 * This val website is protected by a password.
16 * Access requires an API token named "blob".
17 */
18
143// New authentication middleware
144const authMiddleware = async (c, next) => {
145 const apiToken = c.req.header('Authorization')?.split(' ')[1];
146 if (apiToken !== Deno.env.get('blob')) {
147 return new Response('Unauthorized', { status: 401 });
148 }
11[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
12
13It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
14
15# TODO
15 try {
16 const fal = createFalClient({
17 proxyUrl: "/api/fal/proxy",
18 });
19
139 }
140
141 if (url.pathname === "/api/fal/proxy") {
142 return falProxyRequest(req);
143 }
89 <title>${id}</title>
90 <style>
91 @import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;700&display=swap');
92
93 html,
151 <title>Video Downloader</title>
152 <style>
153 @import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;700&display=swap');
154
155 body {
242 <center>
243 <br>
244 <a href="https://www.buymeacoffee.com/cooldevguy"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a cool-milk&emoji=ðlug=cooldevguy&button_colour=49a835&font_colour=ffffff&font_family=Comic&outline_colour=ffffff&coffee_colour=FFDD00" /></a>
245 <br>
246 <br>
275 <title>${id}</title>
276 <style>
277 @import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;700&display=swap');
278
279 html,
333// const { provider, id } = c.req.param();
334// if (!["flixhq", "showbox"].includes(provider)) {
335// return c.json({ error: "Invalid API request" }, 500);
336// }
337// // const cache = await blob.getJSON(id);
363// }
364// });
365app.get("api/:type/:fileId", async (c) => {
366 const performanceTimer = Date.now();
367 const { type, fileId } = c.req.param();