From 8552e571ae22b90a7506940c754f72ed2de51c8a Mon Sep 17 00:00:00 2001 From: ketmar Date: Sat, 2 Jun 2018 09:14:29 +0000 Subject: [PATCH] fixed for PM v28a; gcli API is gone for good, along with package manager FossilOrigin-Name: a0f1a96dabb796d314b36d7e1ec8fa90be2e80ac77ec3770c409440c526c8c33 --- chrome/guerilla-overlay.xul | 2 + dox/README.txt | 138 ++++++++++++++---------------------------- install.rdf | 6 +- main/modules/concmd.js | 4 +- main/modules/pkg/downpkg.js | 5 +- main/modules/sbapi/sandbox.js | 5 +- main/prefs/prefs.js | 6 +- 7 files changed, 66 insertions(+), 100 deletions(-) diff --git a/chrome/guerilla-overlay.xul b/chrome/guerilla-overlay.xul index be3dbb6..39a53f2 100644 --- a/chrome/guerilla-overlay.xul +++ b/chrome/guerilla-overlay.xul @@ -10,9 +10,11 @@ http://www.wtfpl.net/txt/copying/ for more details. - ***** END LICENSE BLOCK ***** --> + \ No newline at end of file diff --git a/dox/README.txt b/dox/README.txt index 8e606c9..f237a3a 100644 --- a/dox/README.txt +++ b/dox/README.txt @@ -1,69 +1,66 @@ -what is Guerilla Scripting? +What is Guerilla Scripting? =========================== -GS is a userscript injecting engine, somewhat like GreaseMonkey, but -aimed at knowledgeable power users. GS was modelled after Opera 12 -userscript engine, but with support for some GreaseMonkey API. +GS is a userscript injecting engine, slightly similar to GreaseMonkey, +but its primary audience are knowledgeable power users. GS was modelled +after Opera 12 userscript engine, but with support for some GreaseMonkey +API. -GS has absolutely no GUI controls (not true anymore), as power users -using developer console anyway. ;-) it has it's own command in developer -console (shift+f2): "guerilla". this is the preferred (and the only one) -way to dynamically control GS (except some preferences in about:config -page). +GS has absolutely no GUI controls. -GS also don't have any l10n, and probably will not have any. as there is -almost no GUI and no user-visible dialogs, i don't see any real value in -adding l10n to GS. +GS also don't have any l10n, and probably will not have any. As there is +no GUI and no user-visible dialogs, I don't see any real value in adding +l10n to GS. -and last thing to say here: i know that it should be written "guerrilla". +And last thing to say here: I know that it should be written "guerrilla". but do you really expect that guerrillas know how to spell such bizarre -words? i found spelling error long after i released a preview to several -people, and the name stuck. let's say that one "r" is a trademark, like +words? I found spelling error long after I released a preview to several +people, and the name stuck. Let's say that one "r" is a trademark, like "ckr" for those you-know-them hipster sites. -how Guerilla Scripting works? +How Guerilla Scripting works? ============================= -contrary to GreaseMonkey, GS doesn't need any registration of -userscripts. simply copy your script in GS scripts directory with your -file manager, and GS should see it. to remove script, simply delete it or -change it's extension to someting that is not ".js". +Contrary to GreaseMonkey, GS doesn't need any registration of userscripts. +Simply copy your script in GS scripts directory with your file manager, +and GS should find it. To remove script, simply delete it or change its +extension to someting that is not ".js". -there is no itegration with any sites, nor automatic script updates from +There is no itegration with any sites, nor automatic script updates from teh internets. GS will *never* connect to any internet site on it's own, it doesn't do any automatic installation or updating of userscripts. -is Guerilla Scripting secure? +Is Guerilla Scripting secure? ============================= -the only way to add a userscript to GS (besides packages) is to MANUALLY +The only way to add a userscript to GS (besides packages) is to MANUALLY copy it in GS scripts directory (which is in your profile dir, named -"guerillajs/scripts"). so if you wrote all the scripts by yourself or got -them from the friend whom you can trust, there should be no security -breaches. +"guerillajs/scripts"). So if you wrote all the scripts by yourself, or +got them from a friend whom you can trust, there should be no security +risks. -GS will not do any connections to any sites on it's own. but note that +GS will not do any connections to any sites on it's own. But note that userscripts are free to connect to any site they want (exactly as in GreaseMonkey), and additionally, userscripts are free to read you local -files too. please, note that GreaseMonkey userscripts can't read your +files too. Please note that GreaseMonkey userscripts can't read your local files (they can try, but the request will fail), so you shouldn't simply copy GreaseMonkey userscripts to GS without understanging what they are doing under the hood. -the reason for giving GS userscripts access to local files is the -difference in addon target group. while GreaseMonkey is aimed at casual +The reason for giving GS userscripts access to local files is the +difference in addon target group. While GreaseMonkey is aimed at casual users, GS is aimed at knowledgeable power users, who may want to squeeze some more power from their userscripts. -WARNING! you should NEVER EVER install userscripts downloaded from -internet to GS, unless you know for sure what that scripts do and how. -if you'll install some malicious script downloaded from internet, that -script can breach your privacy, steal or alter your private data and so -on. +WARNING! You should NEVER EVER install userscripts downloaded from +internet to GS, unless you know *for* *sure* what those scripts do, why +and how. If you'll install some malicious script downloaded from internet, +that script can breach your privacy, steal or alter your private data and +so on. -please note that GreaseMonkey scripts can do privacy violation to some +Please note that GreaseMonkey scripts can do privacy violation to some extent too, that is nature of userscripts. @@ -71,10 +68,10 @@ API differences to GreaseMonkey =============================== some GreaseMonkey API aren't implemented, and some implemented in -slightly different way. script @metas altered too. +slightly different way. Script @metas altered too. API that should work the same in GS and GreaseMonkey: - unsafeWindow + unsafeWindow (not really, it is more a hack) GM_log GM_getValue GM_setValue @@ -135,14 +132,14 @@ different: @require -- this works COMPLETELY different, see below -changed @meta: @require +Changed @meta: @require ======================= -@require now can require only js files. all js files you want to @require -should reside in the directory named after your script. let me give a +@require now can require only js files. All js files you want to @require +should be placed in the directory named after your script. Let me give a sample. -let's assume you has script named "myscript.js" with such contents: +Let's assume you has script named "myscript.js" with such contents: // ==UserScript== // @require somecode.js @@ -151,63 +148,22 @@ let's assume you has script named "myscript.js" with such contents: GS will look for file "./myscript/somecode.js", relative to "myscript.js" directory. -if any @required file is absent, GS will refuse to run such userscript. +If any @required file is absent, GS will refuse to run such userscript. -multiple @require for same file are allowed, but file will be loaded only -once, first time GS sees @require with it. +Multiple @require for same file are allowed, but that file will be loaded +only once, first time GS sees @require with it. -package management -================== - -GS has simple package manager. it allows you to install, upgrade or -remove scripts from userscript sites like https://openuserjs.org/ - -to install new script, go to the corresponding site and find "install" -button on it. copy URL it points to. it usually looks like: - - https://example.com/install/YePpHa/YouTube_Center.user.js - -or something like that. note, that URL must point to script itself, not -on some html page. then type this command in gcli console: - - guerilla package install - -replace with package name of your choise (any alphanumeric -identifier, you will refer to installed package with it in other -commands). you can watch progress or errors in error console. - -to list installed packages, type this command in gcli console: - - guerilla package list - -you'll find the output in error console. - -to update installed package, type this command in gcli console: - - guerilla package update - -you can use "*" to update all installed packages. you can watch progress -or errors in error console. - -to remove installed package, type this command in gcli console: - - guerilla package remove pkgname - -this command will not accept wildcards. you can watch progress or errors -in error console. - - -known bugs +Known bugs ========== -some GM API is not supported. +Some GM API is not supported. pjaxed pages doesn't work right. -probably many other bugs i didn't found yet. +Probably many other bugs I didn't found yet. -good luck, and happy hacking! -Viva la revolucion! +Good luck, and happy hacking! +Remember, by downloading FOSS software you are downloading COMMUNISM! Ketmar Dark diff --git a/install.rdf b/install.rdf index 850529a..63ceb80 100644 --- a/install.rdf +++ b/install.rdf @@ -2,7 +2,7 @@ guerilla@ketmar.no-ip.org - 0.0.3.7.3 + 0.0.3.7.4 2 Guerilla Scripting Userscript injecting engine for power users. @@ -48,8 +48,8 @@ {8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} - 25.0 - 27.* + 27.0 + 28.* diff --git a/main/modules/concmd.js b/main/modules/concmd.js index 4380f41..3db719a 100644 --- a/main/modules/concmd.js +++ b/main/modules/concmd.js @@ -8,7 +8,8 @@ * http://www.wtfpl.net/txt/copying/ for more details. */ //////////////////////////////////////////////////////////////////////////////// -/*let gcli =*/ uses("resource://gre/modules/devtools/gcli.jsm"); +/* +/ *let gcli =* / uses("resource://gre/modules/devtools/gcli.jsm"); //uses("resource://gre/modules/devtools/gcli"); //let gcli = require("resource://gre/modules/devtools/gcli.jsm"); @@ -475,3 +476,4 @@ registerShutdownHook("gcli", function () { logError("ERROR: ", e.message); } }); +*/ diff --git a/main/modules/pkg/downpkg.js b/main/modules/pkg/downpkg.js index 549d601..26da87d 100644 --- a/main/modules/pkg/downpkg.js +++ b/main/modules/pkg/downpkg.js @@ -43,7 +43,10 @@ function calcFileSha512 (fname) { chan.updateFromStream(istream, 0xffffffff); // pass false here to get binary data back let hash = chan.finish(false); - return [("0"+hash.charCodeAt(i).toString(16)).slice(-2) for (i in hash)].join(""); + //return [("0"+hash.charCodeAt(i).toString(16)).slice(-2) for (i in hash)].join(""); + var res = ""; + for (var i = 0; i < hash.length; ++i) res += ("0"+hash.charCodeAt(i).toString(16)).slice(-2); + return res; } diff --git a/main/modules/sbapi/sandbox.js b/main/modules/sbapi/sandbox.js index 0990e51..6c3f3f1 100644 --- a/main/modules/sbapi/sandbox.js +++ b/main/modules/sbapi/sandbox.js @@ -95,7 +95,10 @@ function cryptoHashStr (aString, aAlg, aCharset) { if (str) chashObj.updateFromStream(uniconvObj.convertToInputStream(str), PR_UINT32_MAX); let hash = chashObj.finish(false); // hash as raw octets - return [("0"+hash.charCodeAt(i).toString(16)).slice(-2) for (i in hash)].join(""); + //return [("0"+hash.charCodeAt(i).toString(16)).slice(-2) for (i in hash)].join(""); + var res = ""; + for (var i = 0; i < hash.length; ++i) res += ("0"+hash.charCodeAt(i).toString(16)).slice(-2); + return res; } diff --git a/main/prefs/prefs.js b/main/prefs/prefs.js index b3c50e8..942c7e7 100644 --- a/main/prefs/prefs.js +++ b/main/prefs/prefs.js @@ -8,9 +8,9 @@ * http://www.wtfpl.net/txt/copying/ for more details. */ //////////////////////////////////////////////////////////////////////////////// -const PREFS_BRANCH = "extensions.guerilla."; +var PREFS_BRANCH = "extensions.guerilla."; -let PREFS = { +var PREFS = { fsoReadmeViewed: false, // readme viewed? debugMode: false, debugCache: false, @@ -25,7 +25,7 @@ let PREFS = { pkgtempdir: "guerillajs/packages/_0temp", }; -const PREFS_DIR_NAMES = { +var PREFS_DIR_NAMES = { jsdir: "JSDir", libdir: "LibDir", dbdir: "DBDir", -- 2.11.4.GIT