Database-less link shortener and compressor

rfarley041 pts0 comments

GitHub - p2r3/ha.mr: Static URL compressor and QR code optimizer · GitHub

/" data-turbo-transient="true" />

Skip to content

Search/

Sign in<br>Sign upAppearance settings

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

p2r3

ha.mr

Public

Notifications<br>You must be signed in to change notification settings

Fork<br>55

Star<br>551

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>27 Commits<br>27 Commits

404.html

404.html

CNAME

CNAME

Dockerfile

Dockerfile

LICENSE

LICENSE

README.md

README.md

alphabets.js

alphabets.js

compose.yml

compose.yml

compress.js

compress.js

index.html

index.html

main.js

main.js

nginx.conf

nginx.conf

qrcode.js

qrcode.js

standalone.js

standalone.js

View all files

Repository files navigation

ha.mr

Compresses links and optimizes QR codes entirely in the browser, without a back-end database.

How

Common parts of the link (e.g. protocol, www. prefix, index.html) are manually detected and reduced to individual bits. If present, the port is encoded as a raw numeric value.

Second-level and top-level domains are matched against a Huffman-coded dictionary of the most common websites and TLDs.

The rest of the link is split into parts, and each segment is either fitted to a predefined character set, or Huffman coded.

For links, the output is encoded in the full character set of a URL. (I've been informed that square brackets [] are not supposed to be a part of this set, but it's too late to change that now.)

For QR codes, the output uses the alphanumeric character set to remove overhead compared to other QR code generators.

Contributing

Keep the scope small. This is a simple project, and it should stay that way. I welcome bug fixes or standard maintenance, but I do not wish to stack features upon features or refactor everything into the newest web framework. One day, this project might reach a state where nothing has to be changed, and that's fine.

Discuss, then code. Search through past issues, or create a new issue if needed, to assess whether the change is necessary. Only then make a pull request. Even if you put a lot of work into your code, please understand that I'm not obligated to merge it if it doesn't align with the project's scope or goals. If the change hasn't been discussed and isn't trivial, I will simply close the pull request and direct you to this here paragraph.

Be transparent about tool use. Look, I wrote this project by hand as a learning exercise, so obviously I'd prefer if it remained "pure". However, banning AI would just lead to people sneaking it in regardless, or worse, out of spite. Instead, I offer a compromise - if you're upfront about where AI was used, if the generated code fits in stylistically, and if you can explain (in your own words) how your change works, I will allow it. If I suspect that you're trying to pass off AI-generated work as your own, I will block you from the repository.

Acknowledgements

https://www.npmjs.com/package/qrcode

https://github.com/smythp/reddit_links_dataset

https://github.com/ada-url/url-dataset

About<br>Static URL compressor and QR code optimizer<br>ha.mr<br>Resources<br>Readme<br>MIT license<br>Activity<br>Stars<br>551 stars<br>Watchers<br>0 watching<br>Forks<br>55 forks<br>Report repository

Releases

Contributors

Languages

You can’t perform that action at this time.

code change html github project link

Related Articles