Proof of concept browser + embedded web server communicating via XMLHttpRequest.
Compile with "gcc -Wall `pkg-config --cflags --libs gtk+-2.0 webkit-1.0 libmicrohttpd` -o launcher main.c server.c" Requires GTK, libwebkit and libmicrohttpd.
This commit is contained in:
committed by
Chris Forbes
parent
c9bd3e8a1f
commit
a561dd376e
27
OpenRA.Launcher.Gtk/bridge.js
Normal file
27
OpenRA.Launcher.Gtk/bridge.js
Normal file
@@ -0,0 +1,27 @@
|
||||
window.external=new Object();
|
||||
window.external.do_ajax=function(uri)
|
||||
{
|
||||
request = new XMLHttpRequest();
|
||||
request.open("GET", uri, false);
|
||||
try
|
||||
{
|
||||
request.send(null);
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
}
|
||||
return request.responseText;
|
||||
};
|
||||
window.external.log=function(msg)
|
||||
{
|
||||
window.external.do_ajax("http://localhost:48764/log?msg=" + escape(msg));
|
||||
};
|
||||
window.external.launchMod=function(mod)
|
||||
{
|
||||
window.external.do_ajax("http://localhost:48764/launch?mod=" + mod);
|
||||
};
|
||||
window.external.existsInMod=function(file, mod)
|
||||
{
|
||||
|
||||
return window.external.do_ajax("http://localhost:48764/fileExists?mod=" + mod + "&file=" + escape(file));
|
||||
};
|
||||
Reference in New Issue
Block a user