Latest version and MOTD in osx launcher.

This commit is contained in:
Paul Chote
2010-12-23 12:47:26 +13:00
parent 14ad5099a0
commit fcdb3b536d
4 changed files with 33 additions and 26 deletions

View File

@@ -44,6 +44,7 @@ static JSBridge *SharedInstance;
@"log", NSStringFromSelector(@selector(log:)), @"log", NSStringFromSelector(@selector(log:)),
@"existsInMod", NSStringFromSelector(@selector(fileExists:inMod:)), @"existsInMod", NSStringFromSelector(@selector(fileExists:inMod:)),
@"metadata", NSStringFromSelector(@selector(metadata:forMod:)), @"metadata", NSStringFromSelector(@selector(metadata:forMod:)),
@"httpRequest", NSStringFromSelector(@selector(httpRequest:)),
// File downloading // File downloading
@"registerDownload", NSStringFromSelector(@selector(registerDownload:withURL:filename:)), @"registerDownload", NSStringFromSelector(@selector(registerDownload:withURL:filename:)),
@@ -232,4 +233,12 @@ static JSBridge *SharedInstance;
return @""; return @"";
} }
- (NSString *)httpRequest:(NSString *)url
{
NSLog(@"Requesting url %@",url);
NSString *response = [NSString stringWithContentsOfURL:[NSURL URLWithString:url] encoding:NSASCIIStringEncoding error:NULL];
NSLog(@"Response %@",response);
return response;
}
@end @end

View File

@@ -44,6 +44,7 @@
{ {
text-align: justify; text-align: justify;
padding-left:50px; padding-left:50px;
padding-right:50px;
overflow:hidden; overflow:hidden;
} }
@@ -125,7 +126,12 @@
function onLoad() function onLoad()
{ {
refreshSections(); refreshSections();
document.getElementById("versionstring").innerHTML = window.external.metadata("VERSION", "cnc"); var version = window.external.metadata("VERSION", "cnc");
document.getElementById("installedversion").innerHTML = version;
document.getElementById("latestversion").innerHTML = window.external.httpRequest("http://master.open-ra.org/VERSION");
motd = window.external.httpRequest("http://master.open-ra.org/motd.php?v="+version);
if (motd != undefined)
document.getElementById("motd").innerHTML = motd.substring(3);
} }
function refreshSections() function refreshSections()
@@ -212,21 +218,14 @@
<body onload="onLoad();"> <body onload="onLoad();">
<div id="header" class="bar"> <div id="header" class="bar">
<h1>Command&nbsp;&amp;&nbsp;Conquer</h1> <h1>Command&nbsp;&amp;&nbsp;Conquer</h1>
<p id="versionstring">XXX</p> <p id="installedversion">XXX</p>
</div> </div>
<div id="main"> <div id="main">
<!-- div id="content"> <div id="content">
<h2>Latest News</h2> <p>Latest version: <span id="latestversion">Unknown</span></p>
<div> <p id="motd"></p>
<h3>Version XXYYZZ Available</h3> </div>
<ul>
<li>Cool feature one</li>
<li>Cool feature two</li>
<li>Bugfixes!!!</li>
</ul>
</div>
</div -->
<div id="buttons-install" class="buttons" style="display:none"> <div id="buttons-install" class="buttons" style="display:none">
<div class="desc">The original game data is required before you can play this mod.<br /> <div class="desc">The original game data is required before you can play this mod.<br />
Installing from web will install the minimal files required to play. Installing from web will install the minimal files required to play.

View File

@@ -44,6 +44,7 @@
{ {
text-align: justify; text-align: justify;
padding-left:50px; padding-left:50px;
padding-right:50px;
overflow:hidden; overflow:hidden;
} }
@@ -125,7 +126,12 @@
function onLoad() function onLoad()
{ {
refreshSections(); refreshSections();
document.getElementById("versionstring").innerHTML = window.external.metadata("VERSION", "ra"); var version = window.external.metadata("VERSION", "ra");
document.getElementById("installedversion").innerHTML = version;
document.getElementById("latestversion").innerHTML = window.external.httpRequest("http://master.open-ra.org/VERSION");
motd = window.external.httpRequest("http://master.open-ra.org/motd.php?v="+version);
if (motd != undefined)
document.getElementById("motd").innerHTML = motd.substring(3);
} }
function refreshSections() function refreshSections()
@@ -212,21 +218,14 @@
<body onload="onLoad();"> <body onload="onLoad();">
<div id="header" class="bar"> <div id="header" class="bar">
<h1>Red Alert</h1> <h1>Red Alert</h1>
<p id="versionstring">XXX</p> <p id="installedversion">XXX</p>
</div> </div>
<div id="main"> <div id="main">
<!-- div id="content"> <div id="content">
<h2>Latest News</h2> <p>Latest version: <span id="latestversion">Unknown</span></p>
<div> <p id="motd"></p>
<h3>Version XXYYZZ Available</h3> </div>
<ul>
<li>Cool feature one</li>
<li>Cool feature two</li>
<li>Bugfixes!!!</li>
</ul>
</div>
</div -->
<div id="buttons-install" class="buttons" style="display:none"> <div id="buttons-install" class="buttons" style="display:none">
<div class="desc">The original game data is required before you can play this mod.<br /> <div class="desc">The original game data is required before you can play this mod.<br />
Installing from web will install the minimal files required to play. Installing from web will install the minimal files required to play.