Skip to content

Commit

Permalink
new token script handling to avoid clashes with old plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas committed Feb 12, 2024
1 parent 72d0d22 commit c6a7dcf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions provider/include/requestHandler/ListRequestHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class ListRequestHandler : public RequestHandler {
obj["info"]=chartInfo;
obj["sequence"]=manager->GetChartSetSequence(info->name);
String host=StringHelper::trim(request->header["host"],' ');
obj["tokenUrl"]=FMT("http://%s/tokens/?request=script",host);
obj["tokenFunction"]="ochartsProvider";
obj["tokenUrl"]=FMT("http://%s/tokens/?request=script&scriptKey=ochartsProviderNG",host);
obj["tokenFunction"]="ochartsProviderNG";
obj["hasFeatureInfo"]=true;
items.append(obj);
}
Expand Down
10 changes: 5 additions & 5 deletions provider/tokenHandler/tktest.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<script id="ochartsProvider" type="text/javascript" src="?request=script"></script>
<script id="ochartsProvider" type="text/javascript" src="?request=script&scriptKey=ochartsProviderNG"></script>
</head>
<body>
<script type="text/javascript">
Expand Down Expand Up @@ -43,13 +43,13 @@
return "/charts/"+scl;
}
function test(){
window.avnav.ochartsProvider.heartBeat().then(function(status){
window.avnav.ochartsProviderNG.heartBeat().then(function(status){
console.log("status: "+status);
let url=document.getElementById("val").value;
let encryptedValue=window.avnav.ochartsProvider.encryptUrl(url);
let encryptedValue=window.avnav.ochartsProviderNG.encryptUrl(url);
document.getElementById("encrypted").textContent=encryptedValue;
var testImg=url;
var src=getBase()+"/"+window.avnav.ochartsProvider.encryptUrl(testImg);
var src=getBase()+"/"+window.avnav.ochartsProviderNG.encryptUrl(testImg);
document.getElementById("testimg").setAttribute("src",src);
console.log("enc="+encryptedValue);
}).catch(function(error){
Expand Down Expand Up @@ -98,7 +98,7 @@
function newImage(z,x,y){
var url=z+"/"+x+"/"+y+".png";
document.getElementById("val").value=url;
var src=getBase()+"/"+window.avnav.ochartsProvider.encryptUrl(url);
var src=getBase()+"/"+window.avnav.ochartsProviderNG.encryptUrl(url);
document.getElementById("testimg").setAttribute("src",src);
}
function startCont(){
Expand Down
2 changes: 1 addition & 1 deletion provider/tokenHandler/tokenHandler.js

Large diffs are not rendered by default.

0 comments on commit c6a7dcf

Please sign in to comment.