Giter VIP home page Giter VIP logo

urlpages's Introduction

URL Pages

jstrieb.github.io/urlpages

About

  • Create web pages in the simple, fast editor
  • Share code that others can edit and modify
  • Clone web pages with the bookmarklet (under active development)
  • "Publish" web pages instantaneously
  • Published links never stop working and cannot be taken down function as long as this site is trusted and extant
  • No dependencies
  • No signups
  • No tracking
  • No hosting
  • No cost
  • No commitment
  • A few hundred total lines of clear, well-documented HTML, CSS, and JavaScript

Read the Hacker News Discussion here

Encrypt

It is now possible to encrypt URL Pages using Link Lock. This static, distributed web application uses AES in the browser to encrypt the URL without transmitting any data. The encrypted link is then stored in a Link Lock URL, which, when visited, can only be unlocked with a password.

How it works

As hinted by its name, URL Pages works by storing the entire contents of a web page in the URL.

Thus, as long as the URL exists, so does the page it points to. The rest of the URL Pages program is responsible for translating between web page code (HTML/CSS/JavaScript) and an "encoded" URL.

  • The main page takes encoded data from the URL, decodes it into regular web page format, and displays it to the user
  • The editor encodes user-created web page data as a link that can be shared
  • The bookmarklet takes a page that already exists and encodes it as a link that can be shared

When the main page is visited, the data is encoded in the URL using base 64 encoding via JavaScript's atob and btoa functions in conjunction with its encodeURIComponent and decodeURIComponent functions. The encoded data is stored in the hash portion of the URL.

In the editor, data is similarly encoded, except that the HTML, CSS, and JavaScript portions are stored separately in one object that is converted to a JSON string before being base 64 encoded.

The obvious downside of URL Pages is that the links get very long very quickly. Luckily, some URL shorteners are able to accommodate fairly long URLs (shoutout to TinyUrl). In a strange way, this effectively means the link shortener is acting as the web host since it is responsible for storing the record of the web page's data. For simple web pages (and even simple page hierarchies), URL Pages have proven reasonably easy and effective to use, however it quickly becomes infeasible to use for large sites or large embedded images.

Disclaimer

This just becomes a toy if I am the only one hosting a running version of this repository. If you believe it has real potential, clone it or fork your own version that addresses any non-fundamental problems you have with it, and host your own. The only way this actually becomes robust is if there is no single point of failure (i.e. my GitHub Pages)

Web pages in URLs are definitely not how things on the web were meant to be done, so don't be surprised if trying to use URL Pages causes unexpected issues. For example, sharing these links may cause chat programs, email clients, and unsuspecting individuals to get confused, raise exceptions, or complain. Likewise, copy-pasting these links may take a long time, if it works at all. I've also noticed my browser running a little hotter while I've got 5MB links in the URL bar.

Furthermore, URL Pages is very much a proof of concept, and should not be relied upon for anything consequential.

Read the code and understand it before using so that you understand any associated risks. The codebase was written with readers in-mind. Since the codebase is intentionally short, it can be read and digested fairly quickly if you have prior experience with client-side web applications.

I originally conceived this as a simple, static CodePen clone, but I felt the "publishing" of pages as URLs was an interesting idea. So I decided to present that aspect of it front and center, even though it wasn't really the point of the project at the beginning. About a year ago, I had a proof of concept version that I ended up using fairly frequently for sharing quick HTML/CSS/JavaScript experiments (never as a means of seriously publishing and sharing censorship-proof content). I found that if its use is limited to that case, it is actually very handy and robust!

Examples

The following examples were made and "published" using the provided code editor.

  • My personal website
    • Code in the code editor here
    • "Published" version here
  • Bookmarklet setup page
    • Code in the code editor here
    • "Published" version here
  • A page with embedded images (no external image host)
    • Code in the code editor here
    • "Published" page here

The following examples were cloned from existing pages using the bookmarklet.

  • My dad's food blog here
  • The entire editor encoded in the URL here
  • This GitHub project page here
  • A cloned New York Times Article here

Bookmarklet

Currently, the bookmarklet is very much in-development (read: mostly doesn't work). Feel free to try it anyway by visiting the link below and following the instructions.

Code for the bookmarklet can be found in bookmarklet.js.

The bookmarklet enables some of the most interesting and promising opportunities for URL Pages. Namely: cloning pages for archival purposes, sharing restricted information to bypass censorship, bypassing paywalls, storing entire pages in bookmarks, etc.

Related Projects

Since its original creation, it has been forked many times. Please open an issue if you would like me to link back to a fork or mirror.

  • One particularly improved version is JSPen

Similar in some ways (though unrelated) to the following projects

Project Status

This project is actively maintained. If there are no recent commits, it means that everything has been running smoothly! URL Pages is designed to be 100% backwards-compatible, so your links will never break.

Even if something were to happen to me, and I could not continue to work on the project, URL Pages will continue to work as long as my GitHub account is open and the jstrieb.github.io domain is online.

To-do

  • Improve the bookmarklet -- it's mostly unusable as of right now
    • Fix relative vs absolute linking
    • Maybe try embedding images
    • Import all srced scripts directly
  • Improve UI in general and editors beyond simple textarea (perhaps integrate Ace or CodeMirror)
  • Make the buttons better/more efficient (don't update href on every key press)
  • Figure out and publish max URL sizes for various URL shorteners
  • Implement URL compression using Brotli for shorter URLs
  • Add option to "publish" pages using base65536 as suggested here
  • Upload examples of multi-page sites (tree hierarchy)

urlpages's People

Contributors

amrrs avatar jstrieb avatar vatsalojha 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

urlpages's Issues

Some Suggestions

Suggestions

  • I think We should move it an orgnization site

  • My other suggestion is to Make a Wiki for proper documentation

  • My third and last suggestion is to embed css in html for saving no of requsts and improving loading content

Syntax Highlighting for HTML/CSS/JS textareas

Hey Jacob,
I saw this on Hacker News, and think it's such an innovative idea; I'd love to help out with adding syntax highlighting to the textareas you have at the moment.
Is this something you'd like to be implemented? We could use Codemirror or Prism for the syntax highlighting, and add various themes to the editor as a result.

Missing sections in ReadMe.md leads to open questions

When I came on this Repo, I was asking myself two questions and found no Answer:

  • What is this (urlpages)?
  • What problem does it solve?

I followed the link in the headline description but only landed inside a HTML/JS/CSS editor.

A short introduction that answers at least the the two questions would improve the ReadMe.

Feel free to link to my similar projects

Hello! I've made one that doesn't require JavaScript (or a backend) either (could be enhanced to provide for a noJS online-IDE as well if there was demand):

And one to be used for safely previewing or embedding snippets of others:

And finally, here's a full stack version of this same concept where the URI may contain both the backend and the frontend:

Preprocessors support?

Preprocessors support?

Hi, I'm here to ask, is there anyway to add Preprocessor support?
maybe like first 9 letters after representing Preprocessors?

UI Design

Nice site, I could see myself using this regularly for quick snippets, ideas, etc.

Taking a look through, the functionality is great but could do with a nice slick UI. I've done quite a bit of design and am comfortable with writing the CSS, it looks like a fairly small project, but I like to get involved with projects like this. Overall, I was wondering if you'd like some help with the design and styling (if required) Something I did recently can be seen here:

screely-1561898600446

Let me know your thoughts.

Thanks,
Tobias

Safari Issues

Something with Safari (Mojave) doesn't work. See here.

I lack access to a device running Safari and therefore cannot replicate the issue.

Optimize compression by utilizing the Huffman algorithm

Huffman is an algorithm for compressing textual data. It consumes a string and creates another string, which makes it perfect for this application. An example I found describes it as such:

Huffman encoding is based on the principle that letters that appear more frequently should have a smaller code than the ones that are used less often. So, in the English language, vowels would be used more than the letter 'z', and would get shorter codes.

Please note that while using the aforementioned example, you will likely see an extreme increase in size when compressing small strings. This is because it generates not only

JavaScript implementations of this include wilkerlucio's

I tested this a bit locally and got good results. For instance, a string that was 32 bytes compressed with base64, turned out to be only 24 after being compressed with Huffman.

This would work well for this program as the data being compressed is code, which, being english based should be compressed nicely by huffman.

published URL larger than editor URL?

hi @jstrieb is it possible that the editor version of the URL is smaller (in kb) than the published version? I've noticed that on a project I'm working on that editor weights 43k and published 63k...

ie. in the examples/ embed-code.html is slightly smaller than embed-page.html

History is wrecked

Can you use history.replaceState so the browser history doesn't get filled with spam after each keystroke in the editor? :)

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.