From 393771631f1b52d4e7056e2c986343cc89111763 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Sun, 3 Nov 2024 12:52:25 +0800 Subject: [PATCH 01/10] chore: update social links to use a unified domain format --- app.config.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app.config.ts b/app.config.ts index 915f0a2..690d261 100644 --- a/app.config.ts +++ b/app.config.ts @@ -1,11 +1,11 @@ export default defineAppConfig({ title: 'Sink', - twitter: 'https://x.com/0xKaiBi', - github: 'https://github.com/ccbikai/sink', email: 'sink.cool@miantiao.me', - telegram: 'https://t.me/htmlzone', - mastodon: 'https://c.im/@mt', - blog: 'https://mt.ci', + twitter: 'https://sink.cool/kai', + github: 'https://sink.cool/github', + telegram: 'https://sink.cool/telegram', + mastodon: 'https://sink.cool/mastodon', + blog: 'https://sink.cool/blog', description: 'A Simple / Speedy / Secure Link Shortener with Analytics, 100% run on Cloudflare.', image: 'https://sink.cool/banner.png', previewTTL: 24 * 3600, // 24h From becd0a7ad62778de9e1555434d46877029d52687 Mon Sep 17 00:00:00 2001 From: ZL Asica <40444637+ZL-Asica@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:25:44 -0600 Subject: [PATCH 02/10] fix: standardize .node-version format Updated .node-version to remove 'v' prefix and ensure full three-part version (20.11.0) for compatibility with version managers. --- .node-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.node-version b/.node-version index 07533ba..8b0beab 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -v20.11 +20.11.0 From 11be9e3dba953490c39fea4566fd1fc7ee13a6c4 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Fri, 8 Nov 2024 19:42:23 +0800 Subject: [PATCH 03/10] fix: correct GitHub URL in app configuration --- app.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.config.ts b/app.config.ts index 690d261..d6419c0 100644 --- a/app.config.ts +++ b/app.config.ts @@ -1,8 +1,8 @@ export default defineAppConfig({ title: 'Sink', email: 'sink.cool@miantiao.me', + github: 'https://github.com/ccbikai/sink', twitter: 'https://sink.cool/kai', - github: 'https://sink.cool/github', telegram: 'https://sink.cool/telegram', mastodon: 'https://sink.cool/mastodon', blog: 'https://sink.cool/blog', From 7ebdbc0a4a667ddbd651086cb98a3d94b205e258 Mon Sep 17 00:00:00 2001 From: fatwang2 <134143178+fatwang2@users.noreply.github.com> Date: Mon, 25 Nov 2024 11:03:34 +0800 Subject: [PATCH 04/10] Add the sink shortcuts --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f51d1b2..14424b8 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,8 @@ We welcome your contributions and PRs. - [Sink Tool](https://github.com/zhuzhuyule/sink-extension) - [x] Raycast Extension - [Raycast-Sink](https://github.com/foru17/raycast-sink) -- [ ] Apple Shortcuts +- [x] Apple Shortcuts + - [Sink Shortcuts](https://s.search1api.com/sink001) - [ ] Enhanced Link Management (with Cloudflare D1) - [ ] Analytics Enhancements (Support for merging filter conditions) - [ ] Dashboard Performance Optimization (Infinite loading) From 83db9cd2bc355566333a0c0d2d1c0f00d21ab213 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Fri, 6 Dec 2024 13:49:58 +0800 Subject: [PATCH 05/10] fix: Fixes cursor handling for API link requests Replaces the cursor value in the API request with `undefined` if it is falsy. This prevents potential issues with null values being sent in the query, ensuring a more reliable API interaction. Improves overall stability when fetching link data from the server. --- components/dashboard/links/Index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dashboard/links/Index.vue b/components/dashboard/links/Index.vue index 35b6611..3409459 100644 --- a/components/dashboard/links/Index.vue +++ b/components/dashboard/links/Index.vue @@ -11,7 +11,7 @@ async function getLinks() { const data = await useAPI('/api/link/list', { query: { limit, - cursor, + cursor: cursor || undefined, }, }) links.value = links.value.concat(data.links).filter(Boolean) // Sometimes cloudflare will return null, filter out From 639368a8bad1c8586e46631a62353525e4e18eff Mon Sep 17 00:00:00 2001 From: ccbikai Date: Fri, 6 Dec 2024 18:47:49 +0800 Subject: [PATCH 06/10] 0.1.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0b0a947..9869c83 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "sink", "type": "module", - "version": "0.1.4", + "version": "0.1.5", "private": true, "packageManager": "pnpm@9.7.1", "engines": { From 19e18546dea507dd043039c9df81a60ac38f12f3 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Sun, 8 Dec 2024 11:37:04 +0800 Subject: [PATCH 07/10] fix: adjust cursor handling for KV pagination Moves undefined fallback from client to server side for cursor parameter Ensures consistent pagination behavior when fetching links from KV storage This prevents potential edge cases where undefined cursor values could be handled differently between client and server. --- components/dashboard/links/Index.vue | 2 +- server/api/link/list.get.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/dashboard/links/Index.vue b/components/dashboard/links/Index.vue index 3409459..35b6611 100644 --- a/components/dashboard/links/Index.vue +++ b/components/dashboard/links/Index.vue @@ -11,7 +11,7 @@ async function getLinks() { const data = await useAPI('/api/link/list', { query: { limit, - cursor: cursor || undefined, + cursor, }, }) links.value = links.value.concat(data.links).filter(Boolean) // Sometimes cloudflare will return null, filter out diff --git a/server/api/link/list.get.ts b/server/api/link/list.get.ts index f2ab7db..433029c 100644 --- a/server/api/link/list.get.ts +++ b/server/api/link/list.get.ts @@ -10,7 +10,7 @@ export default eventHandler(async (event) => { const list = await KV.list({ prefix: `link:`, limit, - cursor, + cursor: cursor || undefined, }) if (Array.isArray(list.keys)) { list.links = await Promise.all(list.keys.map(async (key: { name: string }) => { From 172956b532209c27302e1cc71abfee5cff02d7b1 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Sun, 8 Dec 2024 11:56:03 +0800 Subject: [PATCH 08/10] feat: add short link to create endpoint response Enhances the link creation API response by including a formatted short link URL Combines protocol, host, and slug to create a complete, ready-to-use short URL --- server/api/link/create.post.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/api/link/create.post.ts b/server/api/link/create.post.ts index 77d7753..8396629 100644 --- a/server/api/link/create.post.ts +++ b/server/api/link/create.post.ts @@ -23,6 +23,7 @@ export default eventHandler(async (event) => { }, }) setResponseStatus(event, 201) - return { link } + const shortLink = `${getRequestProtocol(event)}://${getRequestHost(event)}/${link.slug}` + return { ...link, shortLink } } }) From 337f8f174cbd373b540af33d80b08f3ab835db70 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Sun, 8 Dec 2024 12:01:17 +0800 Subject: [PATCH 09/10] fix: refine link creation response structure Returns link object separately from shortLink in response to maintain clearer API structure and prevent unnecessary data duplication in the response payload --- server/api/link/create.post.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/api/link/create.post.ts b/server/api/link/create.post.ts index 8396629..7734e67 100644 --- a/server/api/link/create.post.ts +++ b/server/api/link/create.post.ts @@ -24,6 +24,6 @@ export default eventHandler(async (event) => { }) setResponseStatus(event, 201) const shortLink = `${getRequestProtocol(event)}://${getRequestHost(event)}/${link.slug}` - return { ...link, shortLink } + return { link, shortLink } } }) From e7d71b35d334d8f4c0cbf3ca208616c68f81c838 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Sun, 8 Dec 2024 14:44:03 +0800 Subject: [PATCH 10/10] feat: add short link to edit link response Enhances link edit endpoint by including a fully-qualified short link URL in the response, constructed from request protocol and host alongside the slug --- server/api/link/edit.put.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/api/link/edit.put.ts b/server/api/link/edit.put.ts index ca52465..2b05285 100644 --- a/server/api/link/edit.put.ts +++ b/server/api/link/edit.put.ts @@ -30,6 +30,7 @@ export default eventHandler(async (event) => { }, }) setResponseStatus(event, 201) - return { link: newLink } + const shortLink = `${getRequestProtocol(event)}://${getRequestHost(event)}/${link.slug}` + return { link: newLink, shortLink } } })