Vals using @valtown/sdk
Description from the NPM package:
The official TypeScript library for the Val Town API
jxnblk
gitHubSync
HTTP
GitHub Sync Sync vals from Val Town to GitHub and back What it does Using a fork of this val, you can specify a list of your own vals to export to a GitHub repo.
Log in to the web app rendered by this val to manually click the Export button,
which will read the contents of your vals and commit those vals as files to your GitHub repo. If you set up your repo to use the webhook in this val, any changes pushed to the GitHub repo
will be synced back to the vals in your list. How to use Fork this val Create a new repo on GitHub for syncing your vals to (it can be public or private as long as you use the appropriate token scope) Add a webhook to your repo that points to your val's /webhook route, e.g. https://jxnblk-githubsync.web.val.run/webhook Create a Secret for your webhook In your Val Town Settings , add that same secret as GHSYNC_WEBHOOK_SECRET On GitHub, create a new GitHub OAuth app Use your val's web URL for the Homepage URL Set your val's /auth route as the Authorization callback URL , e.g. https://jxnblk-githubsync.web.val.run/auth Copy your new OAuth app's Client ID and add that as the GHSYNC_CLIENT_ID env var in Val Town Create and copy a Client Secret and add that as the GHSYNC_CLIENT_SECRET env var in Val Town On GitHub, create a new personal access token Ensure the token has read access to Contents for your repo Copy the access token and add that as the GHSYNC_GITHUB_TOKEN env var in Val Town In your val, edit the config in the val to point to your repo's owner and repo Edit the valNames list to include the name of the vals you'd like to sync to the repo In your val's Settings , ensure that under Permissions , Vals has Read & Write access Open your val's web URL in a new tab and click Log in with GitHub You should see a page listing your vals to be exported and the GitHub repo to sync to (if not, see below ) Click the Export button to sync your vals to the GitHub repo. This can take a moment and you'll need to wait for the browser request to complete. Once your vals are in the GitHub repo, edit them on GitHub or push changes to ensure that the webhook is working.
You can check the Requests and Logs tabs for your val to debug any errors Demo This val is synced to GitHub: gitHubSyncDemoVal This is the GitHub repo: jxnblk/valtown-github-sync Troubleshooting If after logging in, you see a How to use GitHub Sync page,
ensure that the config.owner in your val matches your GitHub username If the webhook doesn't work, ensure you have the webhook properly configured
in the GitHub repo and that the GHSYNC_WEBHOOK_SECRET env var in Val Town
matches the value in your GitHub repo. Additional Features The following list are ideas for how to improve this val.
Feel free to implement some of these ideas.
I would consider accepting pull requests for these features. [ ] Check timestamps on Val Town and GitHub to prevent syncing when an older version would overwrite a newer one [ ] Add an authenticated webhook to sync from Val Town to GitHub (e.g. a Cron val could trigger export to keep vals synced) [ ] A "No-UI" version of this will only webhooks (authentication would need to be considered)
6
prashamtrivedi
valreadmegenerator
HTTP
Val Town README Generator Welcome to the Val Town README Generator ! 🚀 Get ready to effortlessly generate elegant and informative README files for your Val Projects. This tool leverages AI to create well-structured and insightful documentation for your Val code. Features Theme Awareness: 🌑🌞 Automatically adjusts to your system's dark/light mode preference. Responsive Layout: 📱🖥️ Built with a beautiful and modern UI using React and TailwindCSS, ensuring a pleasant experience across devices. Live Preview and Copy: 📋 Instantly view the generated README and easily copy it with just a click. Direct Readme Link: 🔗 Shareable link for each generated README for quick access. How It Works Follow these simple steps to generate a README: Enter Details: Provide your Val username and the Val name you want to generate a README for. Generate: Click on 'Generate README' and watch as the application swiftly fetches and processes the Val code to create a Markdown README. Copy and Share: Use the 'Copy' button to copy the README for your use, or share the link directly with peers. Technologies Used React: For building the interactive user interface. React DOM: To render components efficiently. TailwindCSS: For styling the application. Deno: The server-side environment. ValTown SDK: Integrated to fetch Val details. OpenAI GPT-4: To generate natural language README content. JavaScript Modules (ESM): For seamless module imports. Getting Started This project is actively deployed and accessible via the browser. Simply navigate to the running instance, input your details, and let the tool handle the rest. Enjoy generating READMEs without the need for local setup. Contributing While the project is not currently set up for local development, your interest and feedback are highly valued. Feel free to explore the code and suggest enhancements or improvements via pull requests or through the issue tracker. Contributions If you've made a substantial contribution to the project, feel free to add your name here! For any questions or guidance, join the discussions in our project repository. License MIT License. Feel free to use, modify, and distribute this application as per the terms of the license. We hope you find the Val Town README Generator a valuable tool in your development workflow. Happy Documenting! 🎉
0
peterqliu
selfDestruct
Script
💥 Deletes the val using it, or whatever url is fed it. Handy for sharing single-use scripts without cluttering people's accounts. If used in an HTTP val, this will run immediately when anyone forks it, making for a zero-click execution as long as ValTown immediately serves a preview of the forked val. Add this to your code last and then do not run it, or you will lose your work. Recommend first checking that the val owner isn't you, so that only forked copies will self-destruct. Usage selfDestruct(import.meta.url) Returns a promise of successful deletion, though the val would not be around to read it.
3
pomdtr
fetchValInfo
Script
Usage import { fetchValInfo } from "https://esm.town/v/pomdtr/fetchValInfo"
const val = await fetchValInfo(import.meta.url)
console.log(val.id) What's the difference with extractValInfo ? @pomdtr/extractValInfo get metadata synchronously by analysing the val import url, while @pomdtr/fetchValInfo perform an http call to the val.town REST api. Only use fetchValInfo if you need some metadata that are not available from extractValInfo .
1
pomdtr
webdavServer
Script
Webdav Manage your vals from a webdav client (ex: https://cyberduck.io/) ⚠️ some webdav operations are not supported, so support can vary between clients. Installation Click "Create Val" on the code block, and change it's type to http. import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth";
import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
import { serveVals } from "https://esm.town/v/pomdtr/webdavServer";
export default basicAuth(serveVals, {
verifyUser: (user) => {
return verifyToken(user);
},
}); Use a val town token as the username, and keep the password blank to authenticate.
5