Skip to content

Commit 5462e24

Browse files
committed
feat: handle geo routing and optional fields in import utility
1 parent 419a5b6 commit 5462e24

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

server/api/link/import.post.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ defineRouteMeta({
3434
title: { type: 'string', description: 'Custom title for link preview' },
3535
description: { type: 'string', description: 'Custom description for link preview' },
3636
image: { type: 'string', description: 'Custom image for link preview' },
37+
apple: { type: 'string', description: 'Apple App Store redirect URL' },
38+
google: { type: 'string', description: 'Google Play Store redirect URL' },
39+
cloaking: { type: 'boolean', description: 'Enable link cloaking (mask destination URL)' },
40+
redirectWithQuery: { type: 'boolean', description: 'Append query parameters to destination URL' },
41+
password: { type: 'string', description: 'Password protection for the link' },
42+
unsafe: { type: 'boolean', description: 'Mark link as unsafe, showing a warning page before redirect' },
43+
geo: { type: 'object', additionalProperties: { type: 'string' }, description: 'Geo-routing rules (country code to URL)' },
3744
},
3845
},
3946
},
@@ -93,16 +100,11 @@ export default eventHandler(async (event) => {
93100

94101
const now = Math.floor(Date.now() / 1000)
95102
const link = {
103+
...linkData,
96104
id: linkData.id || nanoid(10)(),
97-
url: linkData.url,
98105
slug,
99-
comment: linkData.comment,
100106
createdAt: linkData.createdAt || now,
101107
updatedAt: linkData.updatedAt || now,
102-
expiration: linkData.expiration,
103-
title: linkData.title,
104-
description: linkData.description,
105-
image: linkData.image,
106108
}
107109

108110
await putLink(event, link)

0 commit comments

Comments
 (0)