harshithtunuguntla / project-osus

HacktoberFest OpenSource URLShortener Application - Participate in Hacktoberfest by contributing to any Open Source project on GitHub! Here is a starter project for first time contributors. #hacktoberfest
https://project-osus.vercel.app
3 stars 7 forks source link

URL Expiry Feature #13

Open harshithtunuguntla opened 4 hours ago

harshithtunuguntla commented 4 hours ago

Description

I would like to request a feature for adding an expiry time to the shortened URLs. This feature would allow users to set a specific expiration time (e.g., in hours, days, or weeks) for each URL they shorten. After the expiration time has passed, the URL should be marked as expired, and users trying to access it will see a message indicating that the URL has expired.


Motivation

This feature is important because it enhances the control users have over their shortened URLs. Many users may want their URLs to be active only for a specific period of time, such as for promotions, time-sensitive content, or temporary access. Without an expiry feature, URLs remain active indefinitely, which can lead to misuse or unintended sharing of outdated content.


Proposed Solution

  1. Backend Implementation:

    • Add a new field for expiry time in the URL shortening service database (e.g., set expiration in hours, days, or specific date).
    • Validate and check the expiration time during URL shortening and URL access.
    • If the URL has expired, return a response indicating that the URL is no longer active and display an appropriate message.
  2. Frontend Changes:

    • Update the URL shortening form to allow users to input an expiry time (optional field).
    • Show an error message or alert when users try to shorten a URL without valid expiry information (if required).
    • Upon trying to open an expired URL, display a message to users indicating that the URL has expired.
  3. Validation:

    • Ensure that the expiry time is validated during the shortening process (e.g., correct format for time input).
    • Add validation for expired URLs when someone tries to access the URL. If expired, show a proper notification/message.

Additional Context

This feature will significantly improve the usability of the URL shortening service for users needing time-limited access to their links.