Jump to content

CEF: How to deal with it?


Jusonex

Recommended Posts

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.

Link to comment
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?

Link to comment

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.

Link to comment
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.

Link to comment
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?)

Link to comment
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.

Link to comment

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) 

Link to comment
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?

Link to comment
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.

Link to comment
  • 2 weeks later...
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

Link to comment

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. :)

Link to comment
*-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).

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

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