Skip to content
This repository was archived by the owner on Aug 24, 2025. It is now read-only.

Commit a02b0db

Browse files
author
somanchiu
committed
Use another way to fix the issue #8
,v6.3 breaks some services
1 parent 142c620 commit a02b0db

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Usage
22
```html
3-
<script src="https://cdn.jsdelivr.net/gh/somanchiu/Keyless-Google-Maps-API@v6.3/mapsJavaScriptAPI.js"></script>
3+
<script src="https://cdn.jsdelivr.net/gh/somanchiu/Keyless-Google-Maps-API@v6.4/mapsJavaScriptAPI.js"></script>
44
```
55
# Example
66
Demo page: https://somanchiu.github.io/Keyless-Google-Maps-API/demo
@@ -36,7 +36,7 @@ Demo page: https://somanchiu.github.io/Keyless-Google-Maps-API/demo
3636
});
3737
}
3838
</script>
39-
<script src="https://cdn.jsdelivr.net/gh/somanchiu/Keyless-Google-Maps-API@v6.3/mapsJavaScriptAPI.js"
39+
<script src="https://cdn.jsdelivr.net/gh/somanchiu/Keyless-Google-Maps-API@v6.4/mapsJavaScriptAPI.js"
4040
async defer></script>
4141
</body>
4242
</html>

mapsJavaScriptAPI.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ var bypass = function (googleAPIcomponentJS, googleAPIcomponentURL) {
99
} else {
1010
var removeFailureAlert = function(googleAPIcomponentURL) {
1111
sendRequestThroughCROSproxy(googleAPIcomponentURL,(responseText)=>{
12+
var anotherAppendChildToHeadJSRegex = /.src=(.*?);\(void 0\)/;
13+
var anotherAppendChildToHeadJS = responseText.match(anotherAppendChildToHeadJSRegex);
14+
var googleAPItrustedScriptURL = anotherAppendChildToHeadJS[1];
15+
var bypassQuotaServicePayload = anotherAppendChildToHeadJS[0].replace(googleAPItrustedScriptURL, googleAPItrustedScriptURL+'.toString().indexOf("QuotaService.RecordEvent")!=-1?"":'+googleAPItrustedScriptURL);
16+
1217
var script = document.createElement('script');
13-
script.innerHTML = responseText.replace(new RegExp(/;if.*Failure.*?\}/), ";").replace(new RegExp(/(\|\|\(\(\)=>\{\}\);.*\?.*?\()/), "$1true||").replace(/\{.*\/maps\/api\/js\/QuotaService.RecordEvent.*?\}\)\}/, '{}');
18+
script.innerHTML = responseText.replace(new RegExp(/;if.*Failure.*?\}/), ";").replace(new RegExp(/(\|\|\(\(\)=>\{\}\);.*\?.*?\()/), "$1true||").replace(anotherAppendChildToHeadJSRegex, bypassQuotaServicePayload);
1419
document.head.appendChild(script);
1520
});
1621
}

0 commit comments

Comments
 (0)