diff options
author | Jesús <heckyel@hyperbola.info> | 2019-12-06 21:42:46 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2019-12-06 21:42:46 -0500 |
commit | f9412b3ba4245b15253ea192aa79f51f661b7eda (patch) | |
tree | eb47cc0f89816d89a0d6ee7681f926a26c28eb45 | |
parent | 61fb5b9d81ead3846f1886520f333dad9a9c1e02 (diff) | |
download | book-f9412b3ba4245b15253ea192aa79f51f661b7eda.tar.lz book-f9412b3ba4245b15253ea192aa79f51f661b7eda.tar.xz book-f9412b3ba4245b15253ea192aa79f51f661b7eda.zip |
Added Greasemonkey 4 APIs
-rw-r--r-- | gpg/README.md | 17 | ||||
-rw-r--r-- | install-hyperbola/README.md | 4 | ||||
-rw-r--r-- | scripts-greasemonkey/gm4-polyfill.js | 131 |
3 files changed, 147 insertions, 5 deletions
diff --git a/gpg/README.md b/gpg/README.md index 7cc7986..bd4b5b2 100644 --- a/gpg/README.md +++ b/gpg/README.md @@ -60,15 +60,26 @@ Verify: gpg --keyserver pgp.mit.edu --send-keys <user-id> -## Encryt +## Cifrado +### Cifrado simétrico +#### Cifrar + + gpg --symmetric <miarchivo> + +#### Descifrado + + gpg --decrypt <archivo.gpg> + +### Cifrado Asimétrico +#### Encryt gpg --recipient <user-id> --encrypt archivo.odt -## Decrypt +#### Decrypt gpg --output archivo.odt --decrypt archivo.odt.gpg -### Refresh keys +## Refresh keys gpg --refresh-keys diff --git a/install-hyperbola/README.md b/install-hyperbola/README.md index 951f77f..ef625df 100644 --- a/install-hyperbola/README.md +++ b/install-hyperbola/README.md @@ -218,7 +218,7 @@ root@hyperiso# `pacstrap /mnt kernel-firmware` - root@gnulinux$ `su` ← Colocar su contraseña de usuario `root` - - root@gnulinux# `service NetworkManager start` + - root@gnulinux# `rc-service NetworkManager start` - root@gnulinux# `rc-update add NetworkManager default` @@ -396,7 +396,7 @@ reproductor. Para ello, procederemos a instalar los códecs ffmpeg y gstreamer, además de los reproductores. Aquí les sugiero algunos reproductores que les puede resultar útiles. -- Códecs: `pacman -S ffmpeg gstreamer gst-libav gst-plugins-bad gst-plugins-good gst-plugins-ugly gst-plugins-base gstreamer-vaapi gst-transcoder ffms2 x264` +- Códecs: `pacman -S ffmpeg gstreamer gst-libav gst-plugins-bad gst-plugins-good gst-plugins-ugly gst-plugins-base gstreamer-vaapi gst-transcoder ffms2 x264 libtheora opus libvorbis libvpx libogg` - Reproductor Audacious: `pacman -S audacious` - Reproductor SMPlayer: `pacman -S smplayer smplayer-themes smplayer-skins` - Reproductor VLC: `pacman -S vlc` diff --git a/scripts-greasemonkey/gm4-polyfill.js b/scripts-greasemonkey/gm4-polyfill.js new file mode 100644 index 0000000..ca91ef0 --- /dev/null +++ b/scripts-greasemonkey/gm4-polyfill.js @@ -0,0 +1,131 @@ +/* +This helper script bridges compatibility between the Greasemonkey 4 APIs and +existing/legacy APIs. Say for example your user script includes + + // @grant GM_getValue + +And you'd like to be compatible with both Greasemonkey 3 and Greasemonkey 4 +(and for that matter all versions of Violentmonkey, Tampermonkey, and any other +user script engine). Add: + + // @grant GM.getValue + // @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js + +And switch to the new (GM-dot) APIs, which return promises. If your script +is running in an engine that does not provide the new asynchronous APIs, this +helper will add them, based on the old APIs. + +If you use `await` at the top level, you'll need to wrap your script in an +`async` function to be compatible with any user script engine besides +Greasemonkey 4. + + (async () => { + let x = await GM.getValue('x'); + })(); +*/ + +if (typeof GM == 'undefined') { + this.GM = {}; +} + + +if (typeof GM_addStyle == 'undefined') { + this.GM_addStyle = (aCss) => { + 'use strict'; + let head = document.getElementsByTagName('head')[0]; + if (head) { + let style = document.createElement('style'); + style.setAttribute('type', 'text/css'); + style.textContent = aCss; + head.appendChild(style); + return style; + } + return null; + }; +} + + +if (typeof GM_registerMenuCommand == 'undefined') { + this.GM_registerMenuCommand = (caption, commandFunc, accessKey) => { + if (!document.body) { + if (document.readyState === 'loading' + && document.documentElement && document.documentElement.localName === 'html') { + new MutationObserver((mutations, observer) => { + if (document.body) { + observer.disconnect(); + GM_registerMenuCommand(caption, commandFunc, accessKey); + } + }).observe(document.documentElement, {childList: true}); + } else { + console.error('GM_registerMenuCommand got no body.'); + } + return; + } + let contextMenu = document.body.getAttribute('contextmenu'); + let menu = (contextMenu ? document.querySelector('menu#' + contextMenu) : null); + if (!menu) { + menu = document.createElement('menu'); + menu.setAttribute('id', 'gm-registered-menu'); + menu.setAttribute('type', 'context'); + document.body.appendChild(menu); + document.body.setAttribute('contextmenu', 'gm-registered-menu'); + } + let menuItem = document.createElement('menuitem'); + menuItem.textContent = caption; + menuItem.addEventListener('click', commandFunc, true); + menu.appendChild(menuItem); + }; +} + + +if (typeof GM_getResourceText == 'undefined') { + this.GM_getResourceText = (aRes) => { + 'use strict'; + return GM.getResourceUrl(aRes) + .then(url => fetch(url)) + .then(resp => resp.text()) + .catch(function(error) { + GM.log('Request failed', error); + return null; + }); + }; +} + + +Object.entries({ + 'log': console.log.bind(console), // Pale Moon compatibility. See #13. + 'info': GM_info, +}).forEach(([newKey, old]) => { + if (old && (typeof GM[newKey] == 'undefined')) { + GM[newKey] = old; + } +}); + + +Object.entries({ + 'GM_addStyle': 'addStyle', + 'GM_deleteValue': 'deleteValue', + 'GM_getResourceURL': 'getResourceUrl', + 'GM_getValue': 'getValue', + 'GM_listValues': 'listValues', + 'GM_notification': 'notification', + 'GM_openInTab': 'openInTab', + 'GM_registerMenuCommand': 'registerMenuCommand', + 'GM_setClipboard': 'setClipboard', + 'GM_setValue': 'setValue', + 'GM_xmlhttpRequest': 'xmlHttpRequest', + 'GM_getResourceText': 'getResourceText', +}).forEach(([oldKey, newKey]) => { + let old = this[oldKey]; + if (old && (typeof GM[newKey] == 'undefined')) { + GM[newKey] = function(...args) { + return new Promise((resolve, reject) => { + try { + resolve(old.apply(this, args)); + } catch (e) { + reject(e); + } + }); + }; + } +}); |