Jump to content

CEF: How to deal with it?


Jusonex

Recommended Posts

Posted

That would require a way to modify the useragent, either directly or via a function like setBrowserViewMode(browser, "mobile").

Also, since there is no way to inject Javascript code into browsers in remote mode, it might be worth considering adding something like callBrowserSpecialCommand that allows you for example to play or pause a YouTube video instead of many specialised functions.

Posted
That would require a way to modify the useragent, either directly or via a function like setBrowserViewMode(browser, "mobile").

Also, since there is no way to inject Javascript code into browsers in remote mode, it might be worth considering adding something like callBrowserSpecialCommand that allows you for example to play or pause a YouTube video instead of many specialised functions.

Wouldnt in the case of Youtube a key injection do the trick?

Posted

It's not that simple.

The main problem I see at the moment is the potential abuse capability: A server would be able to open every webpage it wants to - including porn and warez.

There should be in any case an option to turn the entire webbrowser stuff off.

Posted
It's not that simple.

The main problem I see at the moment is the potential abuse capability: A server would be able to open every webpage it wants to - including porn and warez.

There should be in any case an option to turn the entire webbrowser stuff off.

What about letting the client have a setting wich can be turned off only from the MTA Settings wich limits the pages to only load the whitelisted ones? - So clients can at their own risk disable this safety measure.

Posted
They already placed a whitelist system, the scripts can request pages and the client has to allow or not if he wants to see them.

Yeah, but isnt the whitelist dependant on the script itself downloaded from the server? the server can still whitelist whatever it wants and send it to clients

Posted

No, the white- and blacklist is MTA global and managed by the MTA team. URLs that are neither whitelisted nor blacklisted can/have to be requested via requestBrowserDomains/Browser.requestDomains (plus the player must accept the request)

Posted
No, the white- and blacklist is MTA global and managed by the MTA team. URLs that are neither whitelisted nor blacklisted can/have to be requested via requestBrowserDomains/Browser.requestDomains (plus the player must accept the request)

But isnt the script wich answers this request? (I.e, a scripted fake signal couldnt do it?)

Posted

No. The following window opens after executing Browser.requestDomains{"nyan.cat"}

requests.JPG

scripted fake signal couldnt do it?

A "fake signal" is not possible as the GUI window is created by MTA.

Posted
No. The following window opens after executing Browser.requestDomains{"nyan.cat"}

requests.JPG

scripted fake signal couldnt do it?

A "fake signal" is not possible as the GUI window is created by MTA.

Oh. Great then

Posted
No. The following window opens after executing Browser.requestDomains{"nyan.cat"}

requests.JPG

scripted fake signal couldnt do it?

A "fake signal" is not possible as the GUI window is created by MTA.

With my tests, i can't access nyan.cat: I allow, but the page don't load.

I tested with your scripts examples.

Posted

Try restarting the resource for now. The example resources on GitHub don't call loadURL again after allowing the request. I'll add the missing code soon.

Posted

You did not request any Twitch domain.

Replace line 12 by:

browser.pages = requestBrowserDomains({"google.com", "youtube.com", "twitch.tv", "pandora.com", "twitch.tv", "www.twitch.tv", "static-cdn.jtvnw.net", "www-cdn.jtvnw.net", "api.twitch.tv", "web-cdn.ttvnw.net", "media-cdn.twitch.tv"}) 

Unfortunately, Twitch loads data from many domains, so I might missed some. I think we will add Twitch to the whitelist before release.

You can display blocked URLs as follows:

1.) Start runcode 
2.) /debugscript 3 
3.) /crun setDevelopmentMode(true) 

Posted
You did not request any Twitch domain.

Replace line 12 by:

browser.pages = requestBrowserDomains({"google.com", "youtube.com", "twitch.tv", "pandora.com", "twitch.tv", "www.twitch.tv", "static-cdn.jtvnw.net", "www-cdn.jtvnw.net", "api.twitch.tv", "web-cdn.ttvnw.net", "media-cdn.twitch.tv"}) 

Unfortunately, Twitch loads data from many domains, so I might missed some. I think we will add Twitch to the whitelist before release.

You can display blocked URLs as follows:

1.) Start runcode 
2.) /debugscript 3 
3.) /crun setDevelopmentMode(true) 

Needs subdomain too. Okay! You can add something like *.domain.ext/* ?

TY for the fast reply and solution :) Now i understand the needs of the system.

What's missing for the release? Optimization?

Posted
You can add something like *.domain.ext/* ?

No. MTA's hardcoded whitelist supports wildcard domains, but allowing wildcards to be requested is a security risk. We might reduce the security restrictions later a bit, but it's usually better to start with too many than with insufficient security restrictions.

What's missing for the release? Optimization?

People doing intensive testing. My ToDo list is atm nearly empty.

  • 2 weeks later...
Posted
You can add something like *.domain.ext/* ?

No. MTA's hardcoded whitelist supports wildcard domains, but allowing wildcards to be requested is a security risk. We might reduce the security restrictions later a bit, but it's usually better to start with too many than with insufficient security restrictions.

What's missing for the release? Optimization?

People doing intensive testing. My ToDo list is atm nearly empty.

I'm back to the post.

You see the mouse position? When you click at a position with your mouse the action will be a little up

Posted

Two questions:

*- Is there anyway to set an alpha value to the browser with webui?

*-What does transparent value(createBrowser) do? Because I can't see the difference.

And finally good work with CEF, it is awesome that you integrated it to mta 1.5. I can't wait anymore. :)

Posted
*-What does transparent value(createBrowser) do? Because I can't see the difference

If transparent is set to false, the background will be an opaque white (if no other color was explicitly specified in the HTML file). If transparent is set to true on the other hand, the default background will be transparent by default.

*- Is there anyway to set an alpha value to the browser with webui?

If you want to set a certain alpha value, you have to edit the dxDrawImage call (link: https://github.com/Jusonex/mtasa_cef_to ... w.lua#L155) to:

dxDrawImage(self.m_BrowserPos, self.m_BrowserSize, self.m_Browser, 0, 0, 0, tocolor(255, 255, 255, alpha), self.m_PostGUI) 

By the way: I wrote a small CEF introduction: https://wiki.multitheftauto.com/wiki/CEF_Tutorial (it is still incomplete tho).

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...