Compare commits

...

16 Commits

Author SHA1 Message Date
ccbikai
12e3e7c7bc 0.1.4 2024-08-20 21:25:30 +08:00
ccbikai
233d366d6e Merge branch 'dev' 2024-08-20 21:25:06 +08:00
ccbikai
05eb3bfca3 feat: enhance error handling for unauthorized API calls
Implements automatic token removal and redirection to login upon 401 error status, improving user experience and security.
2024-08-20 21:24:32 +08:00
ccbikai
d8c92aa7a1 Merge branch 'preview' into dev 2024-08-18 20:06:16 +08:00
ccbikai
f2a2e00ce6 feat: add XIcon to dashboard metrics 2024-08-18 20:05:33 +08:00
ccbikai
20eed15967 Merge branch 'dev' into preview 2024-08-18 19:43:36 +08:00
ccbikai
53a6b5d403 refactor: remove duplicate icon mappings for clarity
Eliminated redundant entries in iconMaps to streamline the mapping process and enhance readability. This consolidation reduces clutter and ensures a more efficient and maintainable codebase.
2024-08-18 19:43:19 +08:00
ccbikai
36e7962b83 chore: update dependencies 2024-08-18 19:38:04 +08:00
ccbikai
b116d4c007 feat: enable AI integration and update dependencies
- Activated AI functionality in Nuxt configuration
- Updated AI model to a newer version for enhanced performance
- Bumped @nuxthub/core to 0.7.3 for critical bug fixes and improvements
2024-08-18 19:01:14 +08:00
ccbikai
55783573ef Merge branch 'master' into dev 2024-08-18 18:40:09 +08:00
面条
ef3e704d79
Merge pull request #28 from fqd511/feature/improve-slug-readability
feat: improve slug readability
2024-07-30 20:12:47 +08:00
面条
5cf1e89ce4
Merge branch 'master' into feature/improve-slug-readability 2024-07-30 20:12:34 +08:00
ccbikai
6d0a67d9b5 feat: enhance nanoid character set for better readability
Adjusted the character set used by nanoid to exclude ambiguous characters, improving readability and reducing potential user confusion.
2024-07-28 13:40:25 +08:00
ccbikai
b2e859107d chore: Update Twitter handle to reflect new username
Update Twitter URL across multiple files to point to the new username, ensuring consistency and accuracy in social media links.
2024-07-28 13:39:32 +08:00
v
08ed8da522 feat: improve slug readability
(cherry picked from commit d950387f8cc87b166fd24bd75276bf34e1c5daa5)
2024-07-26 19:22:47 +08:00
ccbikai
576eee43ca Merge branch 'dev' into preview 2024-07-20 20:23:37 +08:00
11 changed files with 1370 additions and 1170 deletions

View File

@ -113,5 +113,5 @@ We welcome your contributions and PRs.
## ☕ Sponsor
1. [Follow Me on X(Twitter)](https://x.com/xkaibi).
1. [Follow Me on X(Twitter)](https://x.com/0xKaiBi).
2. [Become a sponsor to on GitHub](https://github.com/sponsors/ccbikai).

View File

@ -114,8 +114,13 @@ async function onSubmit(formData) {
body: link,
})
dialogOpen.value = false
emit('update:link', newLink, isEdit ? 'edit' : 'create')
isEdit ? toast('Link updated successfully') : toast('Link created successfully')
emit('update:link', newLink)
if (isEdit) {
toast('Link updated successfully')
}
else {
toast('Link created successfully')
}
}
const { previewMode } = useRuntimeConfig().public

View File

@ -6,21 +6,24 @@ import {
DebianIcon,
FacebookIcon,
FirefoxBrowserIcon,
GnuIcon,
GoogleChromeIcon,
GoogleIcon,
HuaweiIcon,
IOsIcon,
InternetExplorerIcon,
// InternetExplorerIcon,
LinuxIcon,
MacOsIcon,
MicrosoftEdgeIcon,
// MicrosoftEdgeIcon,
OperaIcon,
SafariIcon,
SamsungIcon,
UbuntuIcon,
VivoIcon,
WeChatIcon,
WindowsIcon,
WearOsIcon,
// WindowsIcon,
XIcon,
XiaomiIcon,
YandexCloudIcon,
} from 'vue3-simple-icons'
@ -47,6 +50,7 @@ defineProps({
const iconMaps = {
'android': AndroidIcon,
'android browser': AndroidIcon,
'browser': Globe,
'chrome': GoogleChromeIcon,
'chrome headless': GoogleChromeIcon,
@ -55,15 +59,15 @@ const iconMaps = {
'curl': Terminal,
'debian': DebianIcon,
'desktop': MonitorCheck,
'edge': MicrosoftEdgeIcon,
'facebook': FacebookIcon,
'facebookexternalhit': FacebookIcon,
'firefox': FirefoxBrowserIcon,
'googlebot': GoogleIcon,
'googlebot-image': GoogleIcon,
'gnu': GnuIcon,
'harmonyos': HuaweiIcon,
'huawei browser': HuaweiIcon,
'ie': InternetExplorerIcon,
// 'ie': InternetExplorerIcon,
'ios': IOsIcon,
'ipad': AppleIcon,
'iphone': AppleIcon,
@ -82,10 +86,11 @@ const iconMaps = {
'safari': SafariIcon,
'samsung internet': SamsungIcon,
'tablet': Tablet,
'twitterbot': XIcon,
'ubuntu': UbuntuIcon,
'vivo browser': VivoIcon,
'wechat': WeChatIcon,
'windows': WindowsIcon,
'wearable': WearOsIcon,
'yandex': YandexCloudIcon,
}
</script>

View File

@ -5,7 +5,7 @@ import { ArrowRight } from 'lucide-vue-next'
<template>
<a
href="https://x.com/xkaibi"
href="https://x.com/0xKaiBi"
target="_blank"
title="X(Twitter)"
class="inline-flex items-center px-3 py-1 mx-auto my-4 space-x-1 text-sm font-medium rounded-lg bg-muted"

View File

@ -61,7 +61,7 @@ onMounted(() => {
</a>
<a
href="https://x.com/xkaibi"
href="https://x.com/0xKaiBi"
target="_blank"
title="Twitter"
class="text-gray-400 hover:text-gray-500"

View File

@ -27,7 +27,7 @@ export default defineNuxtConfig({
},
hub: {
// ai: true,
ai: true,
analytics: true,
blob: false,
cache: false,
@ -58,7 +58,7 @@ export default defineNuxtConfig({
cfAccountId: '',
cfApiToken: '',
dataset: 'sink',
aiModel: '@cf/meta/llama-3-8b-instruct',
aiModel: '@cf/meta/llama-3.1-8b-instruct',
aiPrompt: `You are a URL shortening assistant, please shorten the URL provided by the user into a SLUG. The SLUG information must come from the URL itself, do not make any assumptions. A SLUG is human-readable and should not exceed three words and can be validated using regular expressions {slugRegex} . Only the best one is returned, the format must be JSON reference {"slug": "example-slug"}`,
public: {
previewMode: '',

View File

@ -1,9 +1,9 @@
{
"name": "sink",
"type": "module",
"version": "0.1.3",
"version": "0.1.4",
"private": true,
"packageManager": "pnpm@9.5.0",
"packageManager": "pnpm@9.7.1",
"engines": {
"node": ">=20.11"
},
@ -21,42 +21,42 @@
"lint-staged": "lint-staged"
},
"dependencies": {
"@unovis/ts": "^1.4.2",
"@unovis/vue": "^1.4.2",
"@unovis/ts": "^1.4.4",
"@unovis/vue": "^1.4.4",
"@vee-validate/zod": "^4.13.2",
"@vueuse/core": "^10.11.0",
"@vueuse/core": "^11.0.0",
"intl-parse-accept-language": "^1.0.0",
"lucide-vue-next": "^0.401.0",
"lucide-vue-next": "^0.428.0",
"mysql-bricks": "^1.1.2",
"nanoid": "^5.0.7",
"pluralize": "^8.0.0",
"qr-code-styling": "1.6.0-rc.1",
"radix-vue": "^1.9.0",
"radix-vue": "^1.9.4",
"ua-parser-js": "next",
"vee-validate": "^4.13.2",
"virtua": "^0.33.2",
"vue-sonner": "^1.1.3",
"vue3-simple-icons": "^12.0.0",
"virtua": "^0.33.7",
"vue-sonner": "^1.1.4",
"vue3-simple-icons": "^13.2.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@antfu/eslint-config": "^2.21.3",
"@nuxt/eslint": "^0.3.13",
"@nuxt/eslint-config": "^0.3.13",
"@nuxthub/core": "^0.7.0",
"@nuxtjs/color-mode": "^3.4.2",
"@nuxtjs/tailwindcss": "^6.12.0",
"@antfu/eslint-config": "^2.26.0",
"@nuxt/eslint": "^0.5.0",
"@nuxt/eslint-config": "^0.5.0",
"@nuxthub/core": "^0.7.3",
"@nuxtjs/color-mode": "^3.4.4",
"@nuxtjs/tailwindcss": "^6.12.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"eslint": "^8.57.0",
"lint-staged": "^15.2.7",
"nuxt": "^3.12.3",
"eslint": "^9.9.0",
"lint-staged": "^15.2.9",
"nuxt": "^3.12.4",
"shadcn-nuxt": "^0.10.4",
"simple-git-hooks": "^2.11.1",
"tailwind-merge": "^2.4.0",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"vue-tsc": "^2.0.26",
"wrangler": "^3.63.1"
"vue-tsc": "^2.0.29",
"wrangler": "^3.72.0"
},
"simple-git-hooks": {
"pre-commit": "npm run lint-staged"

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ const { slugRegex } = useAppConfig()
const slugDefaultLength = +useRuntimeConfig().public.slugDefaultLength
export const nanoid = (length: number = slugDefaultLength) => customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', length)
export const nanoid = (length: number = slugDefaultLength) => customAlphabet('23456789abcdefghjkmnpqrstuvwxyz', length)
export const LinkSchema = z.object({
id: z.string().trim().max(26).default(nanoid(10)),

View File

@ -31,7 +31,8 @@ export default eventHandler(async (event) => {
content: url,
},
]
const { response } = await AI.run(aiModel, { messages })
// @ts-expect-error Workers AI is not typed
const { response } = await hubAI().run(aiModel, { messages })
return destr(response)
}
else {

View File

@ -7,6 +7,10 @@ export function useAPI(api: string, options?: object): Promise<unknown> {
Authorization: `Bearer ${localStorage.getItem('SinkSiteToken') || ''}`,
},
})).catch((error) => {
if (error?.status === 401) {
localStorage.removeItem('SinkSiteToken')
navigateTo('/dashboard/login')
}
if (error?.data?.statusMessage) {
toast(error?.data?.statusMessage)
}