diff --git a/content/docs/examples/zeabur.mdx b/content/docs/examples/zeabur.mdx index 55ae9d8..37c4019 100644 --- a/content/docs/examples/zeabur.mdx +++ b/content/docs/examples/zeabur.mdx @@ -1,4 +1,12 @@ --- title: Zeabur Custom Domain description: Free parsing of Zeabur custom domain names. ---- \ No newline at end of file +--- + +Follow these steps: + +![](/_static/examples/zeabur_01.png) + +![](/_static/examples/zeabur_02.png) + +![](/_static/examples/zeabur_03.png) \ No newline at end of file diff --git a/content/docs/short-urls.mdx b/content/docs/short-urls.mdx index 49d0771..79b56ea 100644 --- a/content/docs/short-urls.mdx +++ b/content/docs/short-urls.mdx @@ -13,3 +13,17 @@ description: Create and manage your short URLs. 2. **Input Long URL**: Paste or type the URL you want to shorten into the provided input box. 3. **Generate Short Link**: Click the "Generate" button, and the system will automatically create a short link for you. 4. **Copy and Use**: Click the "Copy" button to copy the short link to your clipboard, and you can use it wherever needed. + +## URL Stats + +- **Clicks**: The number of times the short link has been clicked. +- **Visitors**: The number of unique visitors who have visited the short link. + +WR.DO provides a simple access statistics feature that can be used to track the click count and visitor count of the short link. + +## Expiration + +- **No Expiration**: The short link will never expire. +- **Expiration**: The short link will expire after the specified time. + +Once the generated short chain becomes invalid, it will not be deleted. When accessing the short chain again, it will be redirected to this page. Users can reset the short chain validity period to activate. diff --git a/lib/validations/url.ts b/lib/validations/url.ts index 8259010..6437524 100644 --- a/lib/validations/url.ts +++ b/lib/validations/url.ts @@ -14,7 +14,7 @@ import * as z from "zod"; */ const urlPattern = /^(?!-)[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(? { try { const ip = req.headers.get("X-Forwarded-For"); if (req.url.includes("/s/")) { - const match = req.url.match(/[^/]+$/); + const match = req.url.match(/([^/?]+)(?:\?.*)?$/); if (match) { const geo = geolocation(req); @@ -32,7 +32,7 @@ export default auth(async (req) => { "Content-Type": "application/json", }, body: JSON.stringify({ - slug: match[0], + slug: match[1], referer, ip, city: geo?.city, diff --git a/next.config.js b/next.config.js index a3364e0..218b251 100644 --- a/next.config.js +++ b/next.config.js @@ -39,12 +39,12 @@ const nextConfig = { }, { source: "/0", - destination: "https://www.oiov.dev", + destination: "https://wr.do/s/0", permanent: true, }, { source: "/9", - destination: "https://f8dd841.webp.li/IMG20240703084254.jpg", + destination: "https://wr.do/s/9", permanent: true, }, { @@ -59,22 +59,22 @@ const nextConfig = { }, { source: "/x", - destination: "https://x.com/yesmoree", + destination: "https://wr.do/s/x", permanent: true, }, { source: "/solo", - destination: "https://solo.oiov.dev", + destination: "https://wr.do/s/solo", permanent: true, }, { source: "/rmbg", - destination: "https://remover.wr.do", + destination: "https://wr.do/s/rmbg", permanent: true, }, { source: "/llk", - destination: "https://www.oiov.dev/blog/llk", + destination: "https://wr.do/s/llk", permanent: true, }, ]; diff --git a/public/_static/examples/zeabur_01.png b/public/_static/examples/zeabur_01.png new file mode 100644 index 0000000..96231f7 Binary files /dev/null and b/public/_static/examples/zeabur_01.png differ diff --git a/public/_static/examples/zeabur_02.png b/public/_static/examples/zeabur_02.png new file mode 100644 index 0000000..ba87f82 Binary files /dev/null and b/public/_static/examples/zeabur_02.png differ diff --git a/public/_static/examples/zeabur_03.png b/public/_static/examples/zeabur_03.png new file mode 100644 index 0000000..cbfe67e Binary files /dev/null and b/public/_static/examples/zeabur_03.png differ