GitHubSyncREADME.md1 match
42const url = Deno.env.get("PUSH_URL") as string;
4344async function pushValsToGitHub() {
45const body = "hello";
46const signature = await sign(body, secret);
GitHubSynchome1 match
4import type { Context } from "npm:hono";
56export default async function(c: Context) {
7return c.html(
8<html>
GitHubSyncgithub-push1 match
12const valtown = new ValTown();
1314export default async function GitHubPush(c: Context) {
15// auth check in /index
16const user = await valtown.me.profile.retrieve();
GitHubSynccommit-files2 matches
1819/**
20* General use function to commit files to GitHub
21*/
22export async function commitFiles({
23token,
24owner,
blob_adminapp.tsx7 matches
10}
1112function Tooltip({ children, content }: TooltipProps) {
13const [isVisible, setIsVisible] = useState(false);
14const tooltipRef = useRef<HTMLDivElement>(null);
49}
5051function formatBytes(bytes: number, decimals = 2) {
52if (bytes === 0) return "0 Bytes";
53const k = 1024;
58}
5960function copyToClipboard(text: string) {
61navigator.clipboard.writeText(text).then(() => {
62console.log("Text copied to clipboard");
66}
6768function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
69const [isOpen, setIsOpen] = useState(false);
70const menuRef = useRef(null);
7374useEffect(() => {
75function handleClickOutside(event) {
76if (menuRef.current && !menuRef.current.contains(event.target)) {
77event.stopPropagation();
155}
156157function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
158const [isLoading, setIsLoading] = useState(false);
159const decodedKey = decodeURIComponent(blob.key);
216}
217218function App({ initialEmail, initialProfile, sourceURL }) {
219const encodeKey = (key: string) => encodeURIComponent(key);
220const decodeKey = (key: string) => decodeURIComponent(key);
1920This points to the `jsx/jsx-runtime` module (the `jsx-runtime` name is important),
21which wraps the default React JSX runtime with a function that extracts an `sx` prop and applies it as the `style` prop.
2223When the client module requests the `App.tsx` file from Val Town, the JSX is compiled to vanilla JavaScript to run in the browser.
1/** @jsxImportSource ./jsx */
23export function App () {
4console.log("App");
5return (
5const MODULE_URL = import.meta.resolve("./client.tsx");
67export default async function () {
8const html = renderToString(
9<html>
20}
2122export function jsxs (type, props, key) {
23return jsx(type, props, key);
24}
30* Store a chat message in the database
31*/
32export async function storeChatMessage(
33chatId,
34senderId,
63* Retrieve chat history for a specific chat
64*/
65export async function getChatHistory(chatId, limit = 50) {
66try {
67const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
88* Format chat history for Anthropic API
89*/
90function formatChatHistoryForAI(history) {
91const messages = [];
92112* Analyze a Telegram message and extract memories from it
113*/
114async function analyzeMessageContent(
115anthropic,
116username,
487488// Handle webhook requests
489export default async function(req: Request): Promise<Response> {
490console.log("something happened");
491// Set webhook if it is not set yet