Merge pull request #3613 from keymanapp/fix/developer/3394-debugger-hardcoded-urls

fix(developer): hardcoded urls in debugger
This commit is contained in:
Marc Durdin 2020-09-25 11:41:21 +10:00 committed by GitHub
commit 265aefbea0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 7 deletions

View file

@ -101,7 +101,8 @@ uses
JsonUtil,
KeymanDeveloperOptions,
RedistFiles;
RedistFiles,
Upload_Settings;
const
TestFontName: array[TKeyboardFont] of string = ( // I4409
@ -323,15 +324,17 @@ procedure TDebuggerHttpResponder.ProcessRequest(AContext: TIdContext;
jsonArray: TJSONArray;
jsonPackage: TJSONObject;
key: string;
jsonUrls: TJSONObject;
begin
// Get dynamic keyboard registration
FPackagesCS.Enter; // I4036
try
json := TJSONObject.Create;
jsonArray := TJSONArray.Create;
try
try
jsonArray := TJSONArray.Create;
for key in FPackages.Keys do
begin
jsonPackage := TJSONObject.Create;
@ -343,6 +346,11 @@ procedure TDebuggerHttpResponder.ProcessRequest(AContext: TIdContext;
json.AddPair('packages', jsonArray);
jsonUrls := TJSONObject.Create;
jsonUrls.AddPair('installLinkAndroid', MakeKeymanURL(URLPath_KeymanDeveloper_KeymanForAndroidDownload));
jsonUrls.AddPair('installLinkIos', MakeKeymanURL(URLPath_KeymanDeveloper_KeymanForIosDownload));
json.AddPair('urls', jsonUrls);
AResponseInfo.CharSet := 'UTF-8';
AResponseInfo.ContentType := 'application/json';
AResponseInfo.ContentText := JSONToString(json, True);

View file

@ -32,8 +32,10 @@
<div id='content'>
<div id='top-toolbar'>
<div class='control' id='controls'>
<a href='https://keyman.com/go/developer/10.0/ios-app' target='_blank' class='install-link'>Install Keyman for iOS</a>
<a href='https://keyman.com/go/developer/10.0/android-app' target='_blank' class='install-link'>Install Keyman for Android</a>
<!-- these links are assigned from data in /inc/packages.json after page load so that URLs can
be dynamically set according to version and tier. -->
<a id='install-link-ios' href='#' target='_blank' class='install-link'>Install Keyman for iOS</a>
<a id='install-link-android' href='#' target='_blank' class='install-link'>Install Keyman for Android</a>
</div>
</div>
@ -46,9 +48,9 @@
[Test Online].</p>
</div>
<!-- The following dynamic script will register each of the additional packages -->
<script>
var packages = null, packagesJSON = '';
// The following dynamic script will register each of the additional packages
var packagesJSON = '';
function ajaxRequest(){
var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
@ -70,7 +72,12 @@
var dataJSON = JSON.stringify(data);
if(packagesJSON !== dataJSON) {
packagesJSON = dataJSON;
packages = data;
if(data.urls) {
document.getElementById('install-link-ios').href = data.urls.installLinkIos;
document.getElementById('install-link-android').href = data.urls.installLinkAndroid;
}
if(!data.packages) {
return false;
}

View file

@ -49,6 +49,9 @@ const
URLPath_KeymanDeveloperDocumentation = '/go/developer/'+SKeymanVersion+'/docs';
URLPath_KeymanDeveloperHome = '/go/developer/'+SKeymanVersion+'/home';
URLPath_KeymanDeveloper_KeymanForAndroidDownload = '/go/developer/'+SKeymanVersion+'/android-app';
URLPath_KeymanDeveloper_KeymanForIosDownload = '/go/developer/'+SKeymanVersion+'/ios-app';
URLPath_Support = '/go/'+SKeymanVersion+'/support';
URLPath_Privacy = '/go/'+SKeymanVersion+'/privacy';
URLPath_Community = '/go/'+SKeymanVersion+'/community';