{"id":40,"date":"2024-06-22T19:39:09","date_gmt":"2024-06-22T17:39:09","guid":{"rendered":"https:\/\/thomaswormann.com\/?p=40"},"modified":"2024-06-22T19:39:09","modified_gmt":"2024-06-22T17:39:09","slug":"libre-js","status":"publish","type":"post","link":"https:\/\/thomaswormann.com\/?p=40","title":{"rendered":"How to add Libre JS licenses to your javascript files"},"content":{"rendered":"<p>The easiest way to add a license to an external Javascript file is through the use of the @license annotation in a source code comment.<\/p>\n<pre><code class=\"language-javascript\">\/\/ @license [magnet link] [identifier]\n\n[your code]\n\n\/\/ @license-end<\/code><\/pre>\n<p>A <a href=\"https:\/\/en.wikipedia.org\/wiki\/Magnet_URI_scheme\" rel=\"noreferrer\">magnet link<\/a> is a URI scheme that identifies a file by content on a peer-to-peer network via cryptographic hashing. In this case, it specifies a file on the Bittorrent network.<\/p>\n<p>A common license to link would be, e.g. the GPL-3 license, which would look like this.<\/p>\n<pre><code class=\"language-javascript\">\/\/ @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&amp;dn=gpl-3.0.txt GPL-3.0\n\n[your GPL-3 licensed code]\n\n\/\/ @license-end<\/code><\/pre>\n<p>A list of common licenses is available on the <a href=\"https:\/\/www.gnu.org\/software\/librejs\/manual\/librejs.html#JavaScript-Detection\" rel=\"noreferrer\">LibreJS documentation<\/a> website or if you like the most up-to-date list you can take a look at the plugin repository, more specifically the <a href=\"https:\/\/git.savannah.gnu.org\/cgit\/librejs.git\/tree\/common\/license_definitions.json\" rel=\"noreferrer\">.\/common\/license-definitions.json<\/a>.<\/p>\n<p>The LibreJS browser plugin should now pick up on the licenses and allow execution of it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Although the LibreJS project slipped a bit out of public sight, being clear about the licenses of our frontend Javascript code should be common sense. Here is how to easily report your codes license to users.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"federated","footnotes":""},"categories":[1],"tags":[2],"class_list":["post-40","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-javascript"],"_links":{"self":[{"href":"https:\/\/thomaswormann.com\/index.php?rest_route=\/wp\/v2\/posts\/40","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thomaswormann.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thomaswormann.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thomaswormann.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thomaswormann.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=40"}],"version-history":[{"count":0,"href":"https:\/\/thomaswormann.com\/index.php?rest_route=\/wp\/v2\/posts\/40\/revisions"}],"wp:attachment":[{"href":"https:\/\/thomaswormann.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=40"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thomaswormann.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=40"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thomaswormann.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=40"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}