Giter VIP home page Giter VIP logo

snow-stamp's Introduction

❄️ Snow-Stamp

I couldn't find a page anywhere that let you paste in a Discord snowflake to get the timestamp.

So I made one.

🔗 https://snowsta.mp

👩‍💻 If you're a developer looking for the conversion code, check out src/convert.js

Contribute

Pull requests and issues are welcome! Check the help wanted tag.

Develop

  1. npm install && npm run dev
  2. Write code
  3. npm run format && npm run test

Deploy

You can deploy a static site or run the included server. The benefit of using the server is that links containing snowflakes will show the timestamp in embeds when posted on services like Discord.

For either deployment, you must first build:

npm run build

To deploy a static site, copy or host the contents of /build

Otherwise, start the server:

npm start

The server runs on port 3000 by default, but you can set PORT in your environment variables. You can create a .env file in root to set this variable.

Custom Epoch

You can use a custom epoch instead of Discord's by setting environment variable SNOWFLAKE_EPOCH to the desired integer or with an .env file.

Sponsors

You can sponsor me on GitHub to have your name added here, or on snowsta.mp itself!


MadeWithSvelte.com shield

snow-stamp's People

Contributors

asportnoy avatar bela333 avatar dependabot-preview[bot] avatar dependabot[bot] avatar ultirequiem avatar vegeta897 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

snow-stamp's Issues

Support custom epochs client-side

I don't see any reason not to allow visitors to change the epoch, as long as it doesn't interfere with or clutter normal usage.

Presets could be provided for Discord and Twitter, as well as allowing any arbitrary input date.

Sharing timestamp links would have to include the custom epoch in the URL.

Add snowflake anonymizing

A button or checkbox should be added that anonymizes the input snowflake by assigning random bits to all of the non-datetime bits in the snowflake. This would allow users to share their snowflake URL without their exact ID. I know these IDs are not really private information, but some users may want to use this function.

Display timestamp in link embed (dynamic OpenGraph tags)

Hello,
As title says,
Whenever i copy the link generated by pasting message id, users have to open their browser to check it
Im asking if its possible for the link to instant timestamp embedded in discord channel
Thanks in advance

Parse and display multiple snowflakes

When you hold shift on a message it opens a new context menu that lets one quickly copy the id but the return value is different
image
returns
423250272316293120-938804470408699954 (channel_id-message-id) instead of just 938803791346679809 (message-id)
currently using this will yield
image

CORS header "Access-Control-Allow-Origin" missing

I don't know what that means but Firefox reported that it couldn't load the fonts because of it.

downloadable font: download failed (font-family: "Icons" style:normal weight:400 stretch:100 src index:1): bad URI or cross-site access not allowed source: https://pixelatomy.com/snow-stamp/static/media/icons.af7ae505.woff2

downloadable font: download failed (font-family: "Icons" style:normal weight:400 stretch:100 src index:2): bad URI or cross-site access not allowed source: https://pixelatomy.com/snow-stamp/static/media/icons.fee66e71.woff

downloadable font: download failed (font-family: "Icons" style:normal weight:400 stretch:100 src index:3): bad URI or cross-site access not allowed source: https://pixelatomy.com/snow-stamp/static/media/icons.b06871f2.ttf

Generated image cards in social embeds

Extending #59, generate images for Discord/Twitter embeds instead of the current text timestamp. It should look something like the top part of the current output on the site. The image URLs don't have to be short so we can use a nice long URL containing the time zone and locale to cache images to avoid repeated generation.

Allow URLs in input box

Channels, forum posts, threads, and messages have direct links that are accessible without developer mode enabled. For messages, there is a right-click menu option labeled "Copy Message Link", and it's also accessible in the holding-shift button bar atop messages. For all the others, the option is just "Copy Link".

On mobile, message links are also available via sharing, but my discord client is woefully outdated so I don't know exactly what that looks like.

On Discord's web client, channel links are also available as the current address.

Those links look like one of these (snowflakes anonymized just in case):

  • For a channel, thread, or forum post: https://discord.com/channels/299000000000000000/1058000000000000000
  • For a message: https://discord.com/channels/1039000000000000000/1039000000000000000/1109000000000000000

If such a URL is pasted in the textbox, the snowflake should just be detected as the last section of the URL.

Perhaps the other snowflakes in the URL could be analyzed as well and displayed in a smaller font size? Note that the first snowflake, the guild ID, may instead be replaced with @me in a valid Discord URL when the channel is a DM or Group DM.

Add time-zone selection

Allow the user to choose any time-zone for the output, regardless of their device's time-zone.

Create a better logo

The giant-emoji-as-logo approach is fun but creates an inconsistent look across platforms.

The ideal logo would be an SVG to keep file size to a minimum, and it should look good on light and dark backgrounds.

The logo will also be used in embeds and the favicon.

Convert to TypeScript

I like TS and the only reason this project isn't written in it is because I started it before learning TS.

Doesn't detect snowflake

The problem

Doesn't recognise the snowflake I pasted.

image

The conclusion

Overall, it works great and does what it's supposed to.
10/10 would recommend.

Add coder help section

A number of people have asked me how they can use the snow-stamp site in their code to convert snowflakes to timestamps. There is an impression that whatever my site is doing it can't be done locally in one line of code.

An expandable info section should be added to the page that explains how to derive the unix milliseconds from snowflake IDs. A JS code snippet could be included like so:

let timestamp = new Date(mySnowflake / 4194304 + 1420070400000)

Add dropdown for discord timestamp format flag

By providing some flags in the discord timestamp like

<t:timestamp:flag>

Discord will change thre apperance of the timestamp.
I think it would be great, if snow-stamp would offer a dropdown menu next to the field where you can copy that timestamp to select, which flag to use.
This way users can just copy their desired timestamp in one go and don't have to edit it afterwards.

Accessibility

I have no idea how accessible the site is, which likely means it is not very.

I don't have any experience in this area so I'll have to get some research done.

I'm not asking anyone to do this work for me but if anyone has a hot tip, a good svelte library, or any helpful comment, I'd be so grateful to hear about it!

Incorrect timezone text displayed, but time is correct for correct timezone.

For example, for the snowflake 875220877896200262, it displays as
Central Standard Time
8/11/2021, 10:35:18 PM
when it should instead be displaying as
Central Daylight Time
8/11/2021, 10:35:18 PM

(It's showing the correct UTC-5 time for CDT, but not quite the correct timezone text for it.)

Simply using the ambiguous "Central Time" rather than coding it to show the correct Standard/Daylight text would probably be an acceptable solution with less work involved, though a less precise solution.

Add server-side URL shortener

Use a library like nanoid to generate short hashes for all URL parameters on the server if the user requests a shortened URL. These would have to be stored in a database. Tutorial?

Also, get a custom domain name for Snow-Stamp. If you have any good ideas for one, leave a comment here!
I'm going with snowsta.mp!

Use routing instead of query params

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

Snowflake timestamp in the future

Hi!
I have written a discord_chat hook with selenium,
when I compare the snowflake with the timestamp of the received message, the snowflake timestamp is in the future, it differs by 600ms.

Log: chat-messages___chat-messages-828248808311357441
2021-04-04T12:45:03.476Z : Incoming msg: [ 14:45 ] ergo : hh>

Diff: received-ts: 2021-04-04T12:45:03.476Z minus sf-ts:2021-04-04T12:45:04.020Z = -544.15625ms

Strange because, yesterday it worked, today it doesn't. My Local Time is in sync!

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.