vegeta897/snow-stamp

Use routing instead of query params

Opened this issue · 2 comments

I am wary of people sharing Snow-Stamp links and cutting off query parameters, thinking they are useless. Most websites have taught us that they are, because they're most often used for tracking data.

Query parameters are currently used for everything in Snow-Stamp:

s: snowflake
f: encoded snowflake
t: encoded time-zone
l: locale

I should try to replace as much of these as possible with routing. The snowflake can go right after the url, e.g. pixelatomy.com/snow-stamp/86913608335773696. I will have to figure out how to differentiate an encoded snowflake from an un-encoded one.

The time-zone and locale don't fit the routing paradigm as well as the snowflake does. Maybe it would be better for those to remain as query parameters. If anyone knows of a better solution, I'd appreciate your input!

Also, I have to remember to keep the site backwards compatible with query parameters so old links still function

I will have to figure out how to diferentiate an encoded snowflake from an un-encoded one.

Two ideas. For all examples, I'm going to use f=1thoka as a starting point:

  1. Change the encoding scheme to a modified base 26, so that all encoded snowflakes are letters. In regular base 26, our stamp becomes 96ido6.
    a. First example, shift all digits by 10. The example stamp becomes ifsnyf.
    b. Second example, shift numeric digits by 26. The example stamp becomes yvidoy.
  2. Prefix encoded snowflakes with an f or some other specific indicator. The example stamp becomes f1thoka.

In either case, leave the query parameter version as base 36, without a prefix, for backwards compatibility.

The time-zone and locale don't fit the routing paradigm as well as the snowflake does. Maybe it would be better for those to remain as query parameters. If anyone knows of a better solution, I'd appreciate your input!

Those could be the second and third routing parameters, omissible if empty (or - for empty time zone without empty locale). Also, I think they should be empty by default. If someone from Germany sends me (Eastern US) their link, I'd still like to view the site in English with an Eastern Time stamp, not German with Central European Time.

I appreciate your input! That makes sense.

The time-zone and locale would not affect what you see upon visiting the link; the URL would immediately be overwritten when you open the page with whatever sharing settings you have set (either defaults or loaded from localstorage). You can already see this behavior by visiting a snowsta.mp link with someone else's locale and time-zone. This information is only used to generate localized embeds for places like Discord or Twitter. That's why I think it might make more sense for them to remain as query params, since they're not used for changing the page itself like a routing should; they're essentially just some meta-data for the purpose of embeds.