brikr / bthles Goto Github PK
View Code? Open in Web Editor NEWURL shortener for the people
Home Page: https://bthl.es
URL shortener for the people
Home Page: https://bthl.es
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.
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.
When someone authenticates after #9, all of their anonymous links should change owner to their logged in owner.
(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:
owner
field (nobody will be able to edit these)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.
Example URL:
longashellurl.txt
The UI is usable on mobile, but there should be some CSS adjustments to make it a bit nicer.
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.
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.
When visiting bthl.es/<id>
, need to do a redirect to the destination link
In the future we plan on viewing all links per user, so an index here should be added before there is a ton of usage.
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.
(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)
There should be some extra backend validation to ensure we don't get any nasty links. This might include:
We should be logging frontend exceptions. Perhaps use Rollbar (https://rollbar.com/) or see if there is an easy GCP solution.
Have a nice page that shows some cool global stats like total links created/clicked.
Need to decide if master
commits should deploy to prod or staging, but CloudBuild will be nice regardless.
Link creation/redirecting, "cold boot" problem, etc.
A user should be able to delete any links they have created.
Key points:
Right now it's feasible for a crafty individual to spoof their owner
ID when creating a link. The backend should be responsible for setting this value when a link is created.
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.
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.
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.
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.
A user shouldn't be able to make more than x links per minute/hour. Figure out what x is.
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.
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.
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.
Setup GA and add the appropriate stuff to FE
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.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.