Code Monkey home page Code Monkey logo

bthles's People

Contributors

brikr avatar connerdodge avatar dependabot[bot] avatar

Watchers

 avatar  avatar

bthles's Issues

Create shared "types" file

Firestore functions and FE will share a lot of object types (Links, Meta, User). Create a shared location where we can define these types that both code areas have access to.

Find solution for shared types file that doesn't involve symlink

With #19 we created a shared types.ts that both Angular and Firestore functions could use, but due to the nature of compiling Typescript, including this types.ts that is a few directories above index.ts causes the
JavaScript output to match the directory structure and breaks package.json's "main" field. We could make "main" point to lib/functions/src/index.js, but this also feels bad. There should be a nice way to make the types file not blow up the directory structure.

Link migration from v1 to v3

(This is the last thing that should be done before MVP is rolled out).
Need to migrate old links of bthl.es to the new backend so that links aren't lost when we upgrade to v3.

Basic plan:

  • Set DNS TTL for current bthl.es IP to something really low like 5 minutes
  • Display a banner on v1 saying that the site will be readonly for 24 hours on whatever date
  • Once site is put into readonly mode, export the v1 links/hits from the database
  • Import the v1 links/hits into the new database with some dummy owner field (nobody will be able to edit these)
  • (Optional) Don't import the v1 links that had zero hits
  • Update DNS to point to new frontend

There will be a very small window where v3 might be up and users might still hit v1 because of DNS caching. This should only be a problem if someone makes a link in v3 and tries to share it with someone that just happens to hit v1, and that problem will only exist for a few minutes.

Mobile UI

The UI is usable on mobile, but there should be some CSS adjustments to make it a bit nicer.

Unfurl Support

v1 used HTTP redirects to route short links which means unfurls (like in Discord or Slack) would just be the destination site. Since we are using the frontend to route these requests now, we should include some good info in the unfurl for when links are shared in rich chat programs.
The unfurl doesn't need to display the content of the destination like before, but it should include the URL that the link redirects to.

View all links created by user

A user should be able to view all of the links they've created, and see stats about them. This should work fine even if you are using anonymous auth, although you won't be guaranteed to see all the links you've made as the anonymous auth could change.

Redirection page

When visiting bthl.es/<id>, need to do a redirect to the destination link

Add CONTRIBUTING.md

Once v3 MVP is met, we can let others help contribute. CONTRIBUTING.md should cover code style, local project setup, links to help wanted issue tag, etc.

Link creation page

(The landing page)
Needs basic validation of URLs, and once the create button is clicked, it should show the shortened URL in big text with a quick way to copy to clipboard (just like v1)

Backend validation

There should be some extra backend validation to ensure we don't get any nasty links. This might include:

  • Verify that a redirect link is a valid URL
  • Verify that a custom link is a valid path
  • Verify that text content isn't too long (figure out what this is)

Global stats page

Have a nice page that shows some cool global stats like total links created/clicked.

Setup CloudBuild

Need to decide if master commits should deploy to prod or staging, but CloudBuild will be nice regardless.

Delete links

A user should be able to delete any links they have created.

Key points:

  • The short URL is not freed, it just won't point anywhere anymore
  • A user should not be able to edit links, only delete

Text content

Instead of just links, you should also be able to create pastebin-like text content that is accessible via the short URL. Viewing a text link displays the text content on bthl.es rather than redirecting anywhere.

Consider/research: Use Firestore http function to handle redirects instead of frontend

v1 worked by issuing 301 responses to its shortened URLs which let people redirect faster and made short links unfurl to their destination. I think this is feasible with Firestore functions so that we don't have to query the database via Angular and redirect (which takes about a half second). Just need to decide if that's something we want to do or not. Tracking here in the mean time.

Increment link count via AngularFirestore instead of function

It's possible for the security rules to allow updating a link document iff the hit count was incremented by 1. Make them allow this, and then change link content page to update the link doc itself instead of hitting the cloud function. This should resolve the issues with the cloud function not being called before the redirect resulting in no hits counted.

View stats on a link

Have a way to view the stats on a specific link, like how many times it's been clicked.

The "hit count" should be handled through a Firestore function that is invoked whenever someone goes to the link page. Using a function means it won't always be immediately accurate, but eventually consistent is totally fine here. Make sure there aren't any weird gotchas like race conditions if a million people are clicking a link.

Rate limiting

A user shouldn't be able to make more than x links per minute/hour. Figure out what x is.

Decouple Firebase project config

Currently the project is hardcoded to work with the bthles-dev Firebase project. It's fine to have the config/keys in the repo (not a security risk), but it would be better if we set it up such that it was easy to use your own database for local development, so that people could more easily test features that affect the database and be able to work with a database they have admin permissions in.

Setup Angular routing

Need to make use of Angular routing for pointing to main page (creating links), and redirection page (following links)

Additionally, there needs to be some scheme that allows us to have pages off of bthl.es that aren't shortened links. Probably a path that uses a character that can't be used in short links.

Custom links

When creating a link, you should be able to specify what you want the path to be. It needs to follow the same restrictions as the automatic links.

More Auth options

Right now the FE automatically logs in via Anonymous auth. We should have a way to sign-in via Google or some of the other ways Firebase supports (GitHub, Twitter, etc.)

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.