Giter VIP home page Giter VIP logo

navnedia / link-shortener Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 754 KB

A simple open-source and self-hosted URL shortener to make sharing easy! Built for personal use, and to explore new technologies.

Home Page: https://minil.app

License: GNU Affero General Public License v3.0

TypeScript 36.07% HTML 15.18% JavaScript 36.48% CSS 12.27%
api express for-fun google-authentication link-shortener mongodb mongoose nodejs rest-api restful-api

link-shortener's Introduction

Welcome to My GitHub Profile!

All Language Stats

WakaTime - Past Week Language Stats

From: 17 June 2024 - To: 24 June 2024

Total Time: 18 hrs 42 mins

TypeScript    11 hrs 30 mins  ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣤⣀⣀⣀⣀⣀⣀⣀⣀⣀   61.46 %
JSON          4 hrs 52 mins   ⣿⣿⣿⣿⣿⣿⣦⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀   26.06 %
JavaScript    1 hr 28 mins    ⣿⣿⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀   07.85 %
Bash          20 mins         ⣦⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀   01.83 %
HTML          9 mins          ⣄⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀   00.85 %

link-shortener's People

Contributors

dependabot[bot] avatar navnedia avatar

Stargazers

 avatar

Watchers

 avatar

link-shortener's Issues

Rebrand to Mini Link

Change the repository name, folder/file names, comments, documentation, and database collections.

Error 404 Page

Currently, the Error 404 page is JSON which is not great for a web application. I think this can be improved by using this JSON page for API route errors, but the main error page, especially the shortID not found page should be HTML.

General Todo List

  • Refactor the short link controller to make the code cleaner and more reusable.
  • Switch document models to typegoose?
  • Do I need to use indexes for MongoDB?
  • Change some of the generic object types to more strongly typed references.
  • Add users and authentication.
  • Build a simple front end.
  • Make front end responsive.
  • Upload & update design documentation.
  • Update project license.
  • Update README.
  • Add any needed comments for code clarity.
  • Clean up extra comments and commented out code.
  • Improve front end to be more responsive for Mobile.
  • Add low security message
  • Move more of the error messages into a config to make it configurable.
  • Maybe set Defaults for properties like the name to untitled before sending the API response.
  • Handle route without specified ID (Show error)

Improve Google Auth

Instead of the image button with a callback, I would love to redo the login to use Googles official button. The should also be a clear way to log out.

Dashboard links ordering

After the changes in commit 5b443e2 to use the database indexes the links stopped sorting my most recently created in the dashboard. I think all I need to do is sort the results before sending them.

Internal users mode

Make a system so that it can be restricted to only certain users creating an account. This would make it ideal for use as an internal link shortener that a company may want to deploy for their use only. This might mean adding support for local accounts, or locking the sign-ups to a specific email domain. Alternatively, this could involve an admin or approval system to verify new accounts first, or require that the admin makes the account.

Add Multi-threading

Guest Mode

Add the option to use the application in a guest mode. In this mode the features would be restricted, here are some possible ideas:

  • One time links only
  • Expire quickly
  • Account and links disappear after the short guest session.

Add Abuse Moderation

To fix the production Demo I will want to add some features that allow me to better moderate and block bad actors trying to abuse the demo service.
The biggest thing would be adding checks on the destination links users use to ensure they are not malicious/harmful scams. This can be accomplished using either the the Google Safe Browsing API (Demo) or the Google Web Risk API to check these links against a known list. If users is found to be abusing the service with a harmful link there should be a way to configure the response behavior with multiple different options:

  • Obviously ban the user
    • Ban Google account
    • Block IP address
    • Block device
    • Shadow ban
  • Maybe even block known bad IPs beforehand
  • Report User to Google
  • Page for users to report malicious links for review.
  • Link Managing (how to change the link)
    • Remove short link completely (blacklist the nickname)
    • Redirect to a specified safe page, this could be used to inform a victim that this link is a part of a scam.

In addition, I think it could be valuable to add ability to disable/block accounts with a message for the user. Maybe add additional tracking for stuff like click times. I could also block links to other link shorteners. Maybe we could make use of reCAPTCHA here as well. A more extreme approach maybe to make the demo more temporary when everything only lasts a short time before it gets removed, but this would be an additionally measure on top of the other security improvements above.

Another more extreme approach would be to put the demo in a demo mode with a feature flag that doesn't actually redirect to the URL, but simple displays a page saying the URL and that it won't actually redirect due to abuse. This demo mode could also offer several other restricting features like fast expiring links or one time use, IDK.

Address possible memory issuse

There seems like there might be a possible memory leak accruing on the front end. I assume it has something to do with the adding and removing of our shadow DOM components. Anyways, this is a slow leak, but ideally, this would be fixed...

Subdomain Hosting

What if there was an option to simplify the self hosting process. Instead of clients hosting the code base on their own servers, there could be a paid feature where we can host the application and simply make a subdomain to host a client specific version of the application. In this version all the links would be separate from the main link pool so different subdomains can share the same short ID. Then all the client would need to do is add some stuff to their DNS records on their chosen custom domain.

https://tanbt.medium.com/subdomain-web-server-implementation-with-node-js-431359574f7e

Improve Mobile UI Responsiveness

Currently the site is not built to be responsive for mobile devices. Some parts even seem to be broken and fail to load on the IOS Safari browser.

Host the frontend as static

Have the front end be hosted as static on the express backend. With this also make sure to add a 404 page

Add documentation for the project

Write an organized README and potentially other documents detailing information about the project:

  • What is the project?
  • What's the purpose of the project? Why was this project developed?
  • What tools and concepts were used to develop this project?
  • Skills and tools learned and developed along the way
  • Document the components of the project
    • The API endpoints
  • Describe how to install and use the application

Click Counter Reset on Properties Change

I was thinking about whether it would make sense for the click counter to reset after specific properties like the shortID or the destination URL change. This is just something to think about.

Link Peeking

Apparently, bit.ly has a feature where you can add a + to the end of a shortened URL and it will launch a page that shows you where the link goes rather than actually launching it. I think it would be cool to add this feature for link peaking in the same way.

There could also be an endpoint /peek/{shortID} or /preview/{shortID}. If you don't supply a shortID in the url, then the page should give an input box to look up.

Additionally, there should be the same endpoints under /api/shortlink so you can get a JSON response.

Improve errors messages and handling on the front and backend

Now that I've built out a frontend I feel like the error messages returned from the backend could be improved to make them more useful for displaying on the frontend. It would also be nice to make error handling more modular, reusable, and clean. It would be cool if we returned all the errors in the input rather than just the first error we find. After backend error messages are improved I would like to refactor the front end to use these messages more effectively for informing the user of issues.

Keep Old Short ID Active

Restructure the database to allow for old shortID's to remain active after it's been manually changed.

Feature Ideas

  • Add a QRCode endpoint.
  • Add tags
  • API access (Add API Token Support)
  • Query sorting, limiting, and pagination
  • Ordering items
  • Search by name
  • Favorite links
  • Use limit (Dashboard deletion prompt when limit reached)
  • Expiration time
  • Password protected link
  • Temporarily deactivate a link
  • Maintain old shortID(s) after the change and allow them to continue redirecting (either with a duplicate entry, a different type of schema or with a new property on the schema)
  • Max link limit per user
  • Creation date
  • Can't shorten it's own shortlinks
  • Delete Confirmation by typing the name
  • Prank link, redirects to. Fake location if the user is a specific IP address.
  • Add guest mode
  • Automatically fetch link page titles on the server side (maybe using a serverside fetch package)

Fix Validation Regex Infinite Loop Bug (High Priority)

There is a huge issue with some of the regex expressions used to validate the inputs on the front and backend. I have experienced this infinite loop issue, particularly with the URL Validation regex when you enter many of the same characters. This bug may also apply to some of the other regex expressions.

Perhaps this could be fixed by switching to using some form of validation library, IDK.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.