User Script Hosting: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Gholk (talk | contribs)
hack url and using pastebin
Undo revision 8508 by Yingdaomayi (talk) A giant mess. Somebody just put a userscript here.
Tags: Replaced Undo
 
(2 intermediate revisions by 2 users not shown)
Line 27: Line 27:
Any server across the entire web may host user scripts.
Any server across the entire web may host user scripts.
For Greasemonkey, the only requirement is that the (entire) URL ends with <code>.user.js</code> and that it is not served with a <code>text/html</code> content type.
For Greasemonkey, the only requirement is that the (entire) URL ends with <code>.user.js</code> and that it is not served with a <code>text/html</code> content type.
This even works in the fragment, so you can append <code>#.user.js</code> to any URL serving a script to trigger installation.
Servers supporting HTTPS are best, in order to be compatible with Greasemonkey's built in update checker.
Servers supporting HTTPS are best, in order to be compatible with Greasemonkey's built in update checker.
=== Hack the URL ===
If you host your script on some websites that you can not custom url, you can append the url with '''query string''' or '''hash fragment''' ,
making it ending with <code>.user.js</code> , so greasemonkey could recognize it.
Most websites just skip unexpected query string in url, so it will not result in error in accessing webpage.
Because hash fragment only works in client side, adding hash fragment will not crash webpage, too.
(if website had not stored information in hash fragment for client side routing or what.)
For example, a webpage with url <code>https://pastebin.com/raw/zxASqw12</code> :
* Add <code>?somename.user.js</code> , so url become <code>https://pastebin.com/raw/zxASqw12?somename.user.js</code> .
* If you want to follow general query string style, you can add <code>?file=somename.user.js</code> or something else, and url become <code>https://pastebin.com/raw/zxASqw12?file=somename.user.js</code> .
* Add <code>&file=somename.user.js</code> if url already has query string, and make sure that it is at the end of url: <code>https://pastebin.com/raw/zxASqw12?download=0&file=somename.user.js</code>
* Add <code>#somename.user.js</code> , so url become <code>https://pastebin.com/raw/zxASqw12#somename.user.js</code> .
Therefore, url end with <code>*.user.js</code> , and greasemonkey will recognize it.


=== pastebin ===
=== pastebin ===
Line 49: Line 34:
https://pastebin.com/
https://pastebin.com/


The advantage of pastebin is that it does not require regist, allowing anonymous paste, so you can host user script anonymous.
To make the URL end with <code>.user.js</code> you can add the fragment, as mentioned above.
 
When you make a paste on pastebin, you will get a url with hash, like <code>https://pastebin.com/zxASqw12</code>, which link to a webpage containing your code.
However, the page is a ''webpage'' but not responsed without <code>Content-Type: text/html</code> , and its url is not ending with <code>*.user.js</code>
 
To get a url responsed without <code>Content-Type: text/html</code> and containing only user script code,
you should click the ''raw'' button on the webpage, or add <code>/raw</code> to url, like <code>https://pastebin.com/raw/zxASqw12</code>
 
To make url end with <code>*.user.js</code> , you can add querystring or hash fragment.
Add query string: <code>https://pastebin.com/raw/zxASqw12?file=somename.user.js</code>

Latest revision as of 11:54, 11 June 2023

Greasy Fork

https://greasyfork.org/

Created by the maintainer of http://userstyles.org/. HTTPS is available and enforced by default. Open source, hosted on GitHub.

OpenUserJS.org

https://openuserjs.org/

"The home of FOSS user scripts." Only HTTPS is available. Open source, hosted on GitHub.

Gist

https://gist.github.com/

Gist is GitHub's "paste" service, where any set of simple files can be pasted into a web form and saved. Gist files may be named. If they are given the .user.js suffix, then the raw link for the gist will serve perfectly as an install. HTTPS is available and used by default.

The Whole Internet

Any server across the entire web may host user scripts. For Greasemonkey, the only requirement is that the (entire) URL ends with .user.js and that it is not served with a text/html content type. This even works in the fragment, so you can append #.user.js to any URL serving a script to trigger installation. Servers supporting HTTPS are best, in order to be compatible with Greasemonkey's built in update checker.

pastebin

https://pastebin.com/

To make the URL end with .user.js you can add the fragment, as mentioned above.