hook.io icon indicating copy to clipboard operation
hook.io copied to clipboard

Add code highlighter and editor for `/source` route

Open Marak opened this issue 10 years ago • 5 comments

If the /source for a hook is requested and has the appropriate accept headers, a pretty html view should be rendered with highlighted source code.

The page should also contain a code editor for making modifications if the owner is logged in and accessing the hook.

Marak avatar Aug 11 '15 14:08 Marak

I just stumbled accross this. Should that also be possible with hooks sourced from secret gists? I'm in no way defending security by obscurity (that's what env is for), just something developers need to be aware of.

wherget avatar Aug 18 '15 14:08 wherget

@l337r007 -

Missed your comment!

All hooks will actually be public by default. You can always access their /source. Try: http://hook.io/Marak/echo/source

To make Hooks private you will need to upgrade to a paid account.

You should already be able to use private gists? Also, our code editor should be deployed in the next week, so you can store your source code securely in our database.

Marak avatar Sep 05 '15 02:09 Marak

@Marak - thanks for clarifying. Yes, private gists work. On second thought, I also see that /source doesn't change anything about the "private" aspect, one just needs to keep both (hook and gist) URLs non-public. I think I was merely confused, since IIRC the differences between development and paid accounts hadn't been published when I wrote my first reply.

Looking forward to pretty-printed source.

wherget avatar Sep 14 '15 10:09 wherget

If you want privacy, you will have to upgrade to a paid account.

Since all hooks may be publicly listed. Keeping the url a secret isn't going to protect it.

Marak avatar Sep 14 '15 19:09 Marak

@l337r007 -

FYI, as of a few days ago you can now change the source of hook directly on the site without having to use Github Gist at all.

A dedicated /editor page doesn't exist yet, but when creating a /new hook or using the /admin on an existing hook, you now have the ability to select "Code Editor" as the source of the service.

Cheers!

Marak avatar Sep 14 '15 19:09 Marak