untitled-7953Botserver.ts1 match
31// This is a no-op if nothing's changed
32if (!isEndpointSet) {
33await bot.api.setWebhook(req.url, {
34secret_token: SECRET_TOKEN,
35});
Linear-to-Slack-Remindercron.ts2 matches
1415import { getActiveReminders, updateReminder } from "./backend/database.ts";
16import { getLinearTicket } from "./backend/linearApi.ts";
17import { sendDirectMessage } from "./backend/slackApi.ts";
18import { LinearTicket, Reminder } from "./backend/types.ts";
19
Linear-to-Slack-ReminderREADME.md5 matches
231. You'll need to these environment variables:
24- `SLACK_BOT_TOKEN` - Your Slack bot token (see Step 2 below)
25- `LINEAR_API_KEY` - Your Linear API key (see Step 3 below)
2627### Step 2: Create and Configure Slack App
28291. Go to [api.slack.com/apps](https://api.slack.com/apps) and click **"Create
30New App"**
312. Choose **"From scratch"** and name it (e.g., "Linear Reminder Bot")
55- **Request URL:** `https://[YOUR-VALTOWN-URL]/slack/interactive`
5657### Step 3: Get Your Linear API Key
58591. Open Linear and click your profile picture
602. Go to **Settings** → **Account** → **Security & access**
61- Direct link: `https://linear.app/YOUR-WORKSPACE/settings/account/security`
623. Under **"Personal API keys"**, click **"New API key"**
634. Name it something memorable (e.g., "Val Town Slack Reminder Bot")
645. Give it full permissions and team access for easiest set up
656. **Copy the key immediately** - you won't be able to see it again!
667. Add it to Val Town as the `LINEAR_API_KEY` environment variable
6768## Usage Guide
1import { WebClient } from "https://esm.sh/@slack/web-api@7.0.2";
2import { SlackUser } from "./types.ts";
3
blob_adminmain.tsx6 matches
1415// Public route without authentication
16app.get("/api/public/:id", async (c) => {
17const key = `__public/${c.req.param("id")}`;
18const { blob } = await import("https://esm.town/v/std/blob");
132};
133134app.get("/api/blobs", checkAuth, async (c) => {
135const prefix = c.req.query("prefix") || "";
136const limit = parseInt(c.req.query("limit") || "20", 10);
141});
142143app.get("/api/blob", checkAuth, async (c) => {
144const key = c.req.query("key");
145if (!key) return c.text("Missing key parameter", 400);
149});
150151app.put("/api/blob", checkAuth, async (c) => {
152const key = c.req.query("key");
153if (!key) return c.text("Missing key parameter", 400);
158});
159160app.delete("/api/blob", checkAuth, async (c) => {
161const key = c.req.query("key");
162if (!key) return c.text("Missing key parameter", 400);
166});
167168app.post("/api/blob", checkAuth, async (c) => {
169const { file, key } = await c.req.parseBody();
170if (!file || !key) return c.text("Missing file or key", 400);
blob_adminapp.tsx19 matches
70const menuRef = useRef(null);
71const isPublic = blob.key.startsWith("__public/");
72const publicUrl = isPublic ? `${window.location.origin}/api/public/${encodeURIComponent(blob.key.slice(9))}` : null;
7374useEffect(() => {
234setLoading(true);
235try {
236const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
237const data = await response.json();
238setBlobs(data);
261setBlobContentLoading(true);
262try {
263const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
264const content = await response.text();
265setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
275const handleSave = async () => {
276try {
277await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
278method: "PUT",
279body: editContent,
287const handleDelete = async (key) => {
288try {
289await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
290setBlobs(blobs.filter(b => b.key !== key));
291if (selectedBlob && selectedBlob.key === key) {
304const key = `${searchPrefix}${file.name}`;
305formData.append("key", encodeKey(key));
306await fetch("/api/blob", { method: "POST", body: formData });
307const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
308setBlobs([newBlob, ...blobs]);
326try {
327const fullKey = `${searchPrefix}${key}`;
328await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
329method: "PUT",
330body: "",
341const handleDownload = async (key) => {
342try {
343const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
344const blob = await response.blob();
345const url = window.URL.createObjectURL(blob);
360if (newKey && newKey !== oldKey) {
361try {
362const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
363const content = await response.blob();
364await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
365method: "PUT",
366body: content,
367});
368await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
369setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
370if (selectedBlob && selectedBlob.key === oldKey) {
380const newKey = `__public/${key}`;
381try {
382const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
383const content = await response.blob();
384await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
385method: "PUT",
386body: content,
387});
388await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
389setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
390if (selectedBlob && selectedBlob.key === key) {
399const newKey = key.slice(9); // Remove "__public/" prefix
400try {
401const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
402const content = await response.blob();
403await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
404method: "PUT",
405body: content,
406});
407await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
408setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
409if (selectedBlob && selectedBlob.key === key) {
554onClick={() =>
555copyToClipboard(
556`${window.location.origin}/api/public/${encodeURIComponent(selectedBlob.key.slice(9))}`,
557)}
558className="text-blue-400 hover:text-blue-300 text-sm"
577>
578<img
579src={`/api/blob?key=${encodeKey(selectedBlob.key)}`}
580alt="Blob content"
581className="max-w-full h-auto"
1718const formattedFontName = fontName.replace(/\s/g, "+");
19const cssUrl = `https://fonts.googleapis.com/css2?family=${formattedFontName}&display=swap`;
2021// Use a User-Agent that requests a TTF file from Google's API.
22const cssResponse = await fetch(cssUrl, {
23headers: {
akjususeProject.tsx2 matches
2import { useAuth } from "./useAuth.tsx";
34const PROJECT_ENDPOINT = "/api/project";
5const FILES_ENDPOINT = "/api/project-files";
67export function useProject (projectId: string, branchId?: string) {
akjususeProjects.tsx1 match
2import { useAuth } from "./useAuth.tsx";
34const ENDPOINT = "/api/projects-loader";
56export function useProjects () {
akjususeCreateProject.tsx1 match
3import { useAuth } from "./useAuth.tsx";
45const ENDPOINT = "/api/create-project";
67export function useCreateProject () {