GitHubSyncsign-webhook1 match
1/**
2* Use this function along with your valtown webhook secret to create
3* the x-val-signature header when posting to the /export webhook
4*/
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.
steamforumscannermain.tsx15 matches
29}
3031async function sendErrorEmail(gameName: string, error: Error, context: string) {
32const subject = `Error in Steam Forum Scanner for ${gameName}`;
33const text = `An error occurred while ${context} for ${gameName}:\n\n${error.message}\n\n${error.stack}`;
41}
4243function constructSteamUrl(steamId: string): string {
44return `https://steamcommunity.com/app/${steamId}/discussions/`;
45}
4647export default async function scanSteamForums({
48gameName,
49steamId,
98}
99100async function cleanupDebugHtmlBlobs(gameName: string) {
101try {
102const debugBlobs = await blob.list(`steam_html_debug_${gameName}_`);
115}
116117async function fetchSteamDiscussionsPage(url: string): Promise<string> {
118const response = await fetch(url, {
119headers: {
133}
134135async function saveDebugHtml(gameName: string, html: string) {
136const key = `steam_html_debug_${gameName}_${Date.now()}`;
137await blob.set(key, html);
139}
140141async function getStoredThreads(gameName: string): Promise<SteamThread[]> {
142const storageKey = `steam_threads_${gameName}`;
143return await blob.getJSON(storageKey) ?? [];
144}
145146function identifyThreadsToNotify(currentThreads: SteamThread[], storedThreads: SteamThread[]): SteamThread[] {
147return currentThreads.filter(currentThread => {
148const storedThread = storedThreads.find(st => st.id === currentThread.id);
151}
152153async function sendDiscordNotifications(
154gameName: string,
155threads: SteamThread[],
182}
183184async function updateStoredThreads(gameName: string, storedThreads: SteamThread[], currentThreads: SteamThread[]) {
185const currentThreadMap = new Map(currentThreads.map(thread => [thread.id, thread]));
186208}
209210function parseThreads(html: string): SteamThread[] {
211const $ = cheerio.load(html);
212259}
260261function cleanTitle(title: string): string {
262return title.replace(/\t/g, "").trim();
263}
264265function parseForumTopic($: cheerio.Root, el: cheerio.Element): SteamThread {
266const threadNameEl = $(el).find(".forum_topic_name");
267const link = $(el).find(".forum_topic_overlay");
283}
284285function parseForumTopicName($: cheerio.Root, el: cheerio.Element): SteamThread {
286const link = $(el).find("a");
287const url = link.attr("href") ?? "";
303}
304305async function sendDiscordWebhook(
306gameName: string,
307threads: SteamThread[],
steamforumscannerREADME.md1 match
10import scanSteamForums from "https://esm.town/v/dreww/steamforumscanner";
1112export default async function(interval: Interval) {
13const dota2Threads = await scanSteamForums({
14gameName: "Dota 2",
1/** @jsxImportSource ./jsx */
23export function App () {
4console.log("App");
5return (