-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Current shorter supports mappings like "d": "/discord".
Can support this with a new command, maybe call it alias?
- While
shorter addrequires a valid URL to map to a slug,shorter aliaswould map a new slug to an existing one- Validate that existing slug exists first
Plan as of 2/25
New alias command with syntax:
/shorter alias <slug> <destination>
Reason: creates distinct separation from existing add command which requires http:// or https:// in the URI.
Changes to service package
New endpoint:
POST /links/alias
{
"slug": "newSlug",
"aliasTo": "existingSlug",
"isPermanent?": false
}Omitting PUT and DELETE resources here intentionally. Existing DELETE/{slug} should be able to work with this, and a new PUT doesn't seem necessary for such a simple operation.
KV Schema will be slightly modified such that URL can be something like /myAlias. The server will capture this slug and query KV again to find the true URL.
Limitations
There will be a limit to deeply nested a redirect can be. I'm thinking that limiting this to 1 level deep would create minimal complexity and not be that much of a limitation.
Future additions
Update GET /list html to cleanly display all a shortlink's aliases underneath it.
Changes to bot package
Implement aforementioned alias subcommand
- Either explicitly disallow leading/trailing slashes or internally discard them.