Open Iey4iej3 opened 1 year ago
There is an error.
TypeError: can't access property "slice", GM_info.script.namespace is null
line 546
The script uses GM_info.script.namespace
which is not supported in FireMonkey and is set to null
.
However, the use of above is simply for obfuscation.
GM_info.script.namespace.slice(33, 34) // result: a
GM_info.script.namespace.slice(28, 29) // result: e
var u = `/api/${GM_info.script.namespace.slice(33, 34)}uth/s${GM_info.script.namespace.slice(28, 29)}ssion`;
// result:
// /api/+ a + uth/s + e + ssion
// /api/auth/session
You can add var u = '/api/auth/session';
in line 549 and check again:
var u = `/api/${GM_info.script.namespace.slice(33, 34)}uth/s${GM_info.script.namespace.slice(28, 29)}ssion`;
var symbol1_class = 'nav>a.flex';
var symbol2_class = 'button.justify-center';
var u = '/api/auth/session';
})();
Violentmonkey by default injects into page
context. Check by setting the default to content
and see if the script still works?
This userscript uses a lot of methods unavailable in page
context under FireMonkey such as GM_setValue
. What are currently supported about GM_info.script
?
You are right about page
. I updated the reply accordingly.
What are currently supported about
GM_info.script
?
FireMonkey Help: GM info lists the available data.
The scripts uses GM_info.script.namespace
in other places too. You can also set it globally on top of the script (line 57) by:
(function() {
'use strict';
GM_info.script.namespace = 'https://github.com/xcanwin/KeepChatGPT/';
var $ = (Selector, el) => (el || document).querySelector(Selector);
...
The userscript works under ViolentMonkey even if it is injected into content
context. Other usages of GM_info.script.namespace
are not essential to key functions of this script.
Look at the method https://github.com/xcanwin/KeepChatGPT/blob/cb039a1dcfe664c128780c0611427ea259e77fe0/KeepChatGPT.user.js#L525
It is intercepting the method fetch
. If I want to make it work under FireMonkey, I should replace fetch
by unsafeWindow.fetch
in https://github.com/xcanwin/KeepChatGPT/blob/cb039a1dcfe664c128780c0611427ea259e77fe0/KeepChatGPT.user.js#L527 , and add a layer of exportFunction
to https://github.com/xcanwin/KeepChatGPT/blob/cb039a1dcfe664c128780c0611427ea259e77fe0/KeepChatGPT.user.js#L530
However, this is not necessary under ViolentMonkey even injected into content
. What leads to this difference between VM and FM?
However, this is not necessary under ViolentMonkey even injected into content. What leads to this difference between VM and FM?
There are differences between FM & GM|TM|VM in manifest V2. There are also differences between GM & TM & VM. Please note https://github.com/erosman/support/issues/429#issuecomment-1512992456
However, this is not necessary under ViolentMonkey even injected into content. What leads to this difference between VM and FM?
There are differences between FM & GM|TM|VM in manifest V2. There are also differences between GM & TM & VM. Please note #429 (comment)
This does not seem to explain why it is not needed to use exportFunction
under VM even if injected into content
context.
This does not seem to explain why it is not needed to use
exportFunction
under VM even if injected into content context.
FireMonkey injects into the dedicated & isolated userScripts
context while GM|TM|VM inject into semi-privileged content
context.
Firefox created the isolated userScripts
context as a security measure for injecting userscripts. Due to the isolation, functions has to be exported.
Have you had any feedback from the script developers? I can work on it if I know what the issue is.
The only thing that could be worked on from the side of FireMonkey is the one that you mentioned earlier https://github.com/erosman/support/issues/551#issuecomment-1518506453
Other things are about Xvision (their code has been modified a lot, and I am no longer using that userscript), and they seem to show no interest in the FireMonkey compatibility.
The userscript KeepChatGPT does not work under FireMonkey. It works under ViolentMonkey. The console log does not seem to contain any useful info.