Current shorter supports mappings like "d": "/discord".
Can support this with a new command, maybe call it alias?
- While
shorter add requires a valid URL to map to a slug, shorter alias would 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:
{
"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.
Current shorter supports mappings like
"d": "/discord".Can support this with a new command, maybe call it
alias?shorter addrequires a valid URL to map to a slug,shorter aliaswould map a new slug to an existing onePlan as of 2/25
New
aliascommand with syntax:Reason: creates distinct separation from existing
addcommand which requireshttp://orhttps://in the URI.Changes to
servicepackageNew endpoint:
POST /links/alias{ "slug": "newSlug", "aliasTo": "existingSlug", "isPermanent?": false }Omitting
PUTandDELETEresources here intentionally. ExistingDELETE/{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 /listhtml to cleanly display all a shortlink's aliases underneath it.Changes to
botpackageImplement aforementioned
aliassubcommand