1import { Request, Response, NextFunction } from "express";
2import jwt from "jsonwebtoken";
3import { UserRole } from "../entities";
16}
1718export const authenticate = (req: Request, res: Response, next: NextFunction) => {
19try {
20const authHeader = req.headers.authorization;
4445export const authorize = (roles: UserRole[]) => {
46return (req: Request, res: Response, next: NextFunction) => {
47if (!req.user) {
48return res.status(401).json({ message: "Authentication required" });
useraccessmanagementREADME.md3 matches
30โ โ โโโ routes/ # API routes
31โ โ โโโ services/ # Business logic
32โ โ โโโ utils/ # Helper functions
33โ โ โโโ app.ts # Express app setup
34โ โ โโโ index.ts # Entry point
42โ โ โโโ contexts/ # React contexts (Auth)
43โ โ โโโ pages/ # Page components
44โ โ โโโ services/ # API service functions
45โ โ โโโ types/ # TypeScript interfaces
46โ โ โโโ utils/ # Helper functions
47โ โ โโโ App.tsx # Main app component
48โ โ โโโ index.tsx # Entry point
1import { blob } from "https://esm.town/v/std/blob";
2export default async function(req: Request): Promise<Response> {
3if (req.method.toUpperCase() === "POST") {
4await blob.setJSON("DBX", await req.json());
globeindex.html9 matches
113
114<script>
115// Status update function
116function updateStatus(message) {
117document.getElementById('status').textContent = message;
118console.log(message);
120
121// Wait for DOM to be fully loaded
122document.addEventListener('DOMContentLoaded', function() {
123updateStatus('DOM loaded, initializing globe...');
124
184];
185
186// Function to convert lat/lng to 3D position
187function latLngToVector3(lat, lng, radius) {
188const phi = (90 - lat) * (Math.PI / 180);
189const theta = (lng + 180) * (Math.PI / 180);
251
252// Mouse move event for raycasting
253container.addEventListener('mousemove', function(event) {
254const rect = container.getBoundingClientRect();
255mouse.x = ((event.clientX - rect.left) / container.clientWidth) * 2 - 1;
258
259// Click event for selecting regions
260container.addEventListener('click', function() {
261raycaster.setFromCamera(mouse, camera);
262const intersects = raycaster.intersectObjects(markers);
289
290// Window resize event
291window.addEventListener('resize', function() {
292camera.aspect = container.clientWidth / container.clientHeight;
293camera.updateProjectionMatrix();
296
297// Animation loop
298function animate() {
299requestAnimationFrame(animate);
300
3import { OrbitControls } from 'https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/controls/OrbitControls.js';
45// Debug function
6function debug(message) {
7const debugElement = document.getElementById('debug');
8if (debugElement) {
MiniAppStarterui.tsx8 matches
3import { useEffect, useState } from "https://esm.sh/react@19";
45export function Section({ children, ...props }: any) {
6const sectionClass = `p-5 rounded-3xl bg-neutral-400/15 ${props.className || ""}`;
7return <div class={sectionClass}>{children}</div>;
93};
9495// export function Input(props: any) {
96// const inputClass = "dark:bg-white dark:text-black bg-black text-white rounded-md px-3 py-1 ";
97// return <input class={inputClass} {...props} />;
98// }
99100// export function Button(props: any) {
101// const buttonClass = "dark:bg-white dark:text-black bg-black text-white rounded-md px-3 py-1 ";
102// return <button class={buttonClass} {...props} />;
103// }
104105export function MonoButton(props: any) {
106return (
107<Button {...props}>
111}
112113export function MonoButtonWithStatus(props: any) {
114const [status, setStatus] = useState<any>();
115const handleClick = async () => {
132}
133134export function formatJSON(json: any) {
135return JSON.stringify(json, null, 2);
136}
146};
147148export function BackButton({}) {
149return <ArrowLeft className="w-5 h-5 m-2 cursor-pointer opacity-50" onClick={() => window.location.href = "/"} />;
150}
151152export function ShareButton({ onClick }) {
153return <Share className="w-5 h-5 m-2 cursor-pointer opacity-50" onClick={onClick} />;
154}
MiniAppStarterneynar.ts7 matches
1const baseUrl = "https://api.neynar.com/v2/farcaster/";
23export async function fetchNeynarGet(path: string) {
4const res = await fetch(baseUrl + path, {
5method: "GET",
14}
1516export function fetchUser(username: string) {
17return fetchNeynarGet(`user/by_username?username=${username}`).then(r => r.user);
18}
19export function fetchUsersById(fids: string) {
20return fetchNeynarGet(`user/bulk?fids=${fids}`).then(r => r.users);
21}
2223export function fetchUserFeed(fid: number) {
24return fetchNeynarGet(
25`feed?feed_type=filter&filter_type=fids&fids=${fid}&with_recasts=false&with_replies=false&limit=100&cursor=`,
27}
2829export function fetchChannel(channelId: string) {
30return fetchNeynarGet(`channel?id=${channelId}`).then(r => r.channel);
31}
3233export function fetchChannelFeed(channelId: string) {
34return fetchNeynarGet(
35`feed/channels?channel_ids=${channelId}&with_recasts=false&limit=100`,
37}
3839export function fetchChannelsFeed(channelIds: array) {
40return fetchNeynarGet(
41`feed/channels?channel_ids=${channelIds.join(",")}&with_recasts=false&limit=100`,
MiniAppStarterindex.tsx1 match
35});
3637function generateHtml(baseUrl: string, path: string = "/"): any {
38return (
39<html>
MiniAppStarterimage.tsx4 matches
5import satori from "npm:satori";
67export function handleImageEndpoints(app: Hono) {
8const headers = {
9"Content-Type": "image/png",
18}
1920export async function homeImage() {
21return await ogImage(
22<div tw="w-full h-full flex justify-start items-end text-[100px] bg-black text-white p-[50px]">
31}
3233export async function iconImage() {
34return await ogImage(
35<div tw="w-full h-full flex justify-center items-center text-[100px] bg-black text-white p-[50px]">
45//////////
4647export async function ogImage(body, options = {}) {
48const svg = await satori(
49body,
MiniAppStarterHome.tsx1 match
9import { fetchUsersById } from "../util/neynar.ts";
1011export function Home() {
12return (
13<div class="p-5 mb-8">