Likes
94
pomdtr
lastloginHono
Script
See @pomdtr/lastlogin for more informations about the middleware Example /** @jsxImportSource npm:hono@3/jsx */
import { lastlogin } from "https://esm.town/v/pomdtr/lastloginHono";
import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail"
import { Hono } from "npm:hono";
const app = new Hono();
const lastloginMiddleware = lastlogin({
verifyEmail: verifyUserEmail
});
// required for the auth pages to work
app.use("/auth/*", lastloginMiddleware);
// this page is public
app.get("/", async (c) => {
return c.html(
<div>
There is a secret message for you if you{" "}<a href="/secret">login</a>
</div>,
);
});
// this page requires the user to signup
app.get("/secret", lastloginMiddleware, async (c) => {
const email = c.req.header("X-User-Email");
return c.html(
<div>
I think {email} is a really silly email address, actually.
</div>,
);
});
export default app.fetch;
1
iamseeley
resumeConfig
Script
⚙️ configuration for hello, resume this guide will help you configure and use the resume builder to create your resume page. Ensure that your resume is formatted according to the JSON Resume standard . This is crucial for the resume builder to interpret and render your resume correctly. If you don't want to take the time to manually format your resume content and set up hosting, try using this: Resume to JSON 1. Configure the Resume JSON You have two options to provide your resume data: Resume JSON URL : Point this to your raw resume JSON hosted online. Recommended setups include using Val Town or a GitHub Gist. Example: resumeJsonUrl: 'https://example.com/resume.json' Paste Resume JSON : Provide the resume JSON directly within the configuration. Example: resumeJson: {
"basics": { "name": "John Doe" },
"work": [ ... ]
} 2. Choose a Theme Select a theme for your resume. You can use the predefined themes or create your own: Predefined Themes : starterTheme oceanTheme Custom Theme : Customize the styles in the starterTheme or create a new one and import it. 3. Custom Styles (Optional) If you want to add additional styles, provide a URL to a custom stylesheet: Example: customStyleUrl: 'https://example.com/styles.css' 4. Set the Section Order Customize the order of the sections in your resume: Default order: sectionOrder: ['header', 'summary', 'education', 'work', 'projects', 'volunteer', 'awards', 'certificates', 'publications', 'skills', 'languages', 'interests', 'references'] Example custom order: sectionOrder: ['header', 'summary', 'projects', 'education', 'work'] 5. Add Custom Sections (Optional) Override any default sections with custom sections: Example: customSections: {
header: customHeader
} 6. Show/Hide "Save as PDF" Button Control the visibility of the "Save asPDF" button: Example: savePDFIsVisible: true 7. View Your Resume Copy this resumeConfig's module URL and import it in your resumeHandler . Visit the resumeHandler HTTP endpoint to view your resume!
2
mux
dubLinkMaker
HTTP
Dub Shortlink Slackbot We started using dub.co for shortlinks at Mux, so we made a quick Slackbot to make it easier! Usage Fork this thing to your account Set up a Slack bot/app and have the webhooks point at your forked Val Add the following environment variables to Val.town: DUB_API_KEY your Dub API key DUB_WORKSPACE_ID your Dub workspace ID SLACK_MUX_LINK_SIGNING_SECRET Signing secret for the app you created Update the LINK_DOMAIN variable to be the one you want to use (needs to be set up in Dub, of course) Use the command you created in your Slack app! For us, it looks like this: /mux.link https://example.com neat-example This is a quick link for an example.
2
pomdtr
lastlogin
Script
Lastlogin Authentication for val.town Looking for an hono integration ? See @pomdtr/lastloginHono Support login in trough: Email Link QR Code Google Oauth Github Oauth Gitlab Oauth Facebook Oauth Demo You can try a demo at https://pomdtr-lastloginhonoexample.web.val.run (see @pomdtr/lastLoginHonoExample for code) Usage Wrap your http handlers in a lastlogin middleware (sessions will be persisted in the lastlogin_session table on your sqlite account). If you want to be the only one able to access your val, you can use @pomdtr/verifyUserEmail. import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin";
import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail";
export default lastlogin((req) => {
return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`);
}, {
// check that the user email match your val town email
verifyEmail: verifyUserEmail
}); If you want to customize how is allowed to signup, you can set the verifyEmail option: import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin";
export default lastlogin((req) => {
return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`);
}, {
verifyEmail: (email) => { email == "steve@valtown" }
}); You can allow anyone to signup by returning a boolean from the verifyEmail function: import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin";
export default lastlogin((req) => {
return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`);
}, {
verifyEmail: (_email) => true
}); Public Routes import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin";
import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail";
export default lastlogin(() => {
return new Response("Hi!");
}, {
verifyEmail: verifyUserEmail,
public_routes: ["/", "/public/*"],
}); See the URLPattern API for reference. Logout Just redirect the user to /auth/logout
10
maxm
staticChess
HTTP
Check it out here: https://chess.maxmcd.com Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves? Functionality is quite limited, and things might be broken. Please let me know if you find bugs! Inspired by this HN discussion about sites that have all possible game states of tic-tac-toe. I plan on extending this to support real gameplay. I think it could be a nice simple interface for long form games with friends. Might also be fun to add a static AI to play against. Feel free to PR any changes if you'd like to see something added.
30