Skip to content

Commit 3a2f395

Browse files
authored
Merge pull request #100 from AI-Tournaments/patch
Patch
2 parents 924c7c4 + 838a2fe commit 3a2f395

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Replay/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,17 @@ function a(){
436436
}
437437
let url = option.value;
438438
const session = GitHubApi.getSessionStorage();
439-
if(!url.startsWith('https://ai-tournaments.github.io/') && url.startsWith('http') && !session?.externalReplaysAccepted){
439+
let secureUrl = url.startsWith('https://ai-tournaments.github.io/');
440+
if(!secureUrl){
441+
const u = url.replace('//', '');
442+
secureUrl = u.indexOf('/') < u.indexOf('.');
443+
}
444+
if(!secureUrl && !session?.externalReplaysAccepted){
440445
const passphrase = 'I accept external replay viewers';
441446
session.externalReplaysAccepted = (prompt('External replays are by default blocked for security reasons, since they are outside of AI-Tournaments control. So use them at your own risk. Only do this to URLs for code that you trust.\n\nWrite "'+passphrase+'" to allow external replay viewers.')??'').toLowerCase() === passphrase.toLowerCase();
442447
GitHubApi.setSessionStorage(session);
443448
}
444-
if(url.startsWith('https://ai-tournaments.github.io/') || session.externalReplaysAccepted){
449+
if(secureUrl || session.externalReplaysAccepted){
445450
_element_iframe.dataset.arenaResult = JSON.stringify(_replayData.body);
446451
_element_iframe.src = url;
447452
document.getElementById('open-replay-in-new-tab').addEventListener('click', ()=>{

0 commit comments

Comments
 (0)