URL shortener service based on Cloudflare Workers and D1 database.
Deploy your own duan API service on Cloudflare Workers.
Install the Raycast extension from the Raycast Extension Store.
Or manual installation:
git clone https://github.com/insv23/duan-raycast-extension.git && cd duan-raycast-extension
npm install && npm run dev
Configure the extension with your API host and token.
Start using the extension to shorten and manage your links.
.
├── README.md
├── package.json
├── src/
│ ├── components/
│ │ ├── LinkDetail.tsx # Link edit form
│ │ └── LinkItem.tsx # List item component
│ ├── hooks/
│ │ └── useLinks.ts # Data fetching hook
│ ├── services/
│ │ ├── api/
│ │ │ ├── client.ts # API client implementation
│ │ │ ├── config.ts # API configuration
│ │ │ ├── endpoints/
│ │ │ │ ├── links.ts # Links API endpoints
│ │ │ │ └── slugs.ts # Slugs API endpoints
│ │ │ └── index.ts # API exports
│ │ ├── filter.ts # Link filtering logic
│ │ ├── pin.ts # Pin management
│ │ ├── search.ts # Search utilities
│ │ ├── sort.ts # Sorting logic
│ │ └── validation/
│ │ ├── slug/
│ │ │ ├── cache.ts # Slug cache management
│ │ │ ├── index.ts # Slug validation logic
│ │ │ └── types.ts # Slug validation types
│ │ ├── url/
│ │ │ ├── index.ts # URL validation logic
│ │ │ └── types.ts # URL validation types
│ │ └── index.ts # Validation exports
│ ├── types/
│ │ └── index.ts # TypeScript definitions
│ ├── utils/
│ │ └── random.ts # Random slug generation
│ ├── list-links.tsx # List links command
│ └── shorten-link.tsx # Create link command
The extension provides a powerful search feature that allows users to find links by:
Search implementation supports:
Example:
// Search across all fields
const results = searchLinks(links, "github");
// Will match:
// - Short code: "gh-repo"
// - URL: "https://github.com/..."
// - Description: "My GitHub repository"
⌘ Enter
- Copy short link to clipboard⌘ E
- Edit link details⌘ ⌫
- Delete link⌘ T
- Show last visited time (toast)⌘ ⇧ P
- Pin/Unpin link⌘ ⇧ ↑
- Move pinned link up (only for pinned links)⌘ ⇧ ↓
- Move pinned link down (only for pinned links)⌘ ⇧ C
- Sort by creation time⌘ ⇧ L
- Sort by last visited time⌘ ⇧ N
- Sort by visit count⌘ P
- Open filter dropdownThe extension provides powerful organization features:
Pinning System
Smart Sorting
Quick Filtering
Data Processing Pipeline
Original Links → Filter → Sort → Search → Display
YYYY-MM-DD HH:MM:SS
(no T
/Z
/offset).YYYY-MM-DDTHH:MM:SSZ
) and renders them in the user's local timezone via toLocaleString()
.Raycast provides three different caching mechanisms, each suited for specific use cases:
To demonstrate how to choose the appropriate caching mechanism, here are two concrete examples from our project:
useCachedPromise
Cache
(low-level API)