Skip to content

Commit 1dd2d05

Browse files
authored
Merge pull request #98 from AI-Tournaments/patch
Patch
2 parents af019d5 + 3f64297 commit 1dd2d05

2 files changed

Lines changed: 2 additions & 23 deletions

File tree

Dev/index.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ function a(){
6161
message: 'Property "url" is not a URL.'
6262
});
6363
}
64-
if(!isUrl(setup.arena.replay)){
65-
errors.push({
66-
path: [index_0, 'arena', 'replay'],
67-
message: 'Property "replay" is not a URL.'
68-
});
69-
}
7064
}else if(setup.settings){
7165
errors.push({
7266
path: [index_0, 'settings'],

Replay/index.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -188,22 +188,7 @@ function a(){
188188
_element_previousReplaysController.classList.remove('hidden');
189189
});
190190
function onValidate(json){
191-
function isUrl(string){
192-
let url;
193-
try{
194-
url = new URL(string);
195-
}catch(e){
196-
return false;
197-
}
198-
return url.protocol === 'http:' || url.protocol === 'https:';
199-
}
200191
let errors = [];
201-
if(json.header !== undefined && json.header.defaultReplay !== undefined && !isUrl(json.header.defaultReplay)){
202-
errors.push({
203-
path: ['header'],
204-
message: 'Property "defaultReplay" is not a URL.'
205-
});
206-
}
207192
if(json.body !== undefined && typeof json.body.matchLogs !== 'object'){
208193
errors.push({
209194
path: ['body'],
@@ -429,7 +414,7 @@ function a(){
429414
if(b.id === 'default-option'){return 1;}
430415

431416
let aOfficial = a.value.startsWith('https://ai-tournaments.github.io/');
432-
let bOfficial = a.value.startsWith('https://ai-tournaments.github.io/');
417+
let bOfficial = b.value.startsWith('https://ai-tournaments.github.io/');
433418
if(aOfficial ? !bOfficial : bOfficial){return 1;}
434419

435420
if(parseFloat(a.dataset.stars) < parseFloat(b.dataset.stars)){return -1;}
@@ -452,7 +437,7 @@ function a(){
452437
let url = option.value;
453438
const session = GitHubApi.getSessionStorage();
454439
if(!url.startsWith('https://ai-tournaments.github.io/') && !session?.externalReplaysAccepted){
455-
session.externalReplaysAccepted = 'i accept external replay viewers' === (prompt('External replays are by default blocked for security reasons. do so at your own risk. Only do this to URLs for code that you trust.\n\nWrite "I accept external replays" to allow external replay viewers.')??'').toLowerCase();
440+
session.externalReplaysAccepted = 'I accept external replay viewers' === (prompt('External replays are by default blocked for security reasons. do so at your own risk. Only do this to URLs for code that you trust.\n\nWrite "I accept external replays" to allow external replay viewers.')??'').toLowerCase();
456441
GitHubApi.setSessionStorage(session);
457442
}
458443
if(url.startsWith('https://ai-tournaments.github.io/') || session?.externalReplaysAccepted){

0 commit comments

Comments
 (0)