Skip to content

Support nested redirects #19

@TheJolman

Description

@TheJolman

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:

  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions