View public project history

Project URL: https://rewind-view.glitch.me/

Sample: https://rewind-view.glitch.me/glitch-hello-node/log-p

View source: Glitch :・゚✧

The “what”

The history of public projects is public. They lock out the “Rewind” panel when it’s not your project, but that’s probably just a technical limitation. You can still look, either by remixing the project and opening the Rewind panel or cloning the project through Git and viewing the log. Both of these are slightly more cumbersome than viewing it on a webpage though.

So here’s this program for cloning and showing the Git log—with diffs too :open_mouth:—in a webpage.

This was surprisingly easy

All I had to do was write the shell commands, git init, git fetch, git log, and hooking it up was as easy as doing a require('child_process').spawn(...) and piping the stdout+stderr into the server’s res stream :clap: .

The giving up on being reasonable

You know what would have been a reasonable thing to do? For this to get only the recent few commits and to display those. But somehow doing a “shallow” fetch from a project on Glitch freezes for about a minute. It turns out to be faster just to fetch the whole history. Glitch projects are limited to like 200 MB anyway, right? So currently it displays the whole history :grimacing: .

The nonexistent frontend

We can kind of infer the format Glitch’s special commit messages. It has a list of (filename, user ID, number of lines changed) records. But I ended up not building a parser for this. It was just too easy to ship without this.

Above I said this displays the log in a “webpage,” but it’s not HTML. It’s plaintext :skull:.

The goodness of Glitch

By the way,

I don’t have to worry if this somehow leaks memory. Glitch will kill it if it uses too much RAM.

I don’t have to worry if the server crashes. Glitch will restart it.

I don’t have to worry if the janky cleanup logic breaks. Glitch will discard the stuff in /tmp once in a while.

I don’t have to worry (too much) if there’s some shell injection. Glitch runs this thing in its own project container with no special authentication secrets to any of my other stuff.

I don’t have to worry about deleting this project to make room for other ideas. Glitch doesn’t track a total storage quota on my account. Yet.

I don’t have to worry about this being too popular. If it uses too many requests per hour, that’s the project’s own quota, and it won’t lock me out of my other projects.

8 Likes

This is so cool!

:ship: https://far-noon-brick.glitch.me/

3 Likes

aw brilliant

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.