Skip to content

Commit af019d5

Browse files
authored
Merge pull request #97 from AI-Tournaments/patch
Patch
2 parents 8eb6fb9 + f5aec8f commit af019d5

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

GitHubApi.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class GitHubApi{
3636
if(typeof init.body === 'object'){
3737
init.body = JSON.stringify(init.body);
3838
}
39-
return await fetch(new Request('https://api.github.com/'+path, init)).then(response => {
39+
return await fetch(new Request('https://api.github.com/'+path, init)).then(async response => {
4040
if(localStorage.getItem('GitHub API debug') !== null){
4141
let a = path.split('/')[0];
4242
let reset = localStorage.getItem('_GitHub '+a+' x-ratelimit-reset');
@@ -63,11 +63,12 @@ class GitHubApi{
6363
if(response.status === 200){
6464
return response;
6565
}else if(response.status === 401){
66-
GitHubApi.logout();
6766
if(accessToken){
67+
GitHubApi.logout();
6868
throw new Error('Unauthorized GitHub OAuth-Token. Logged out.');
6969
}
70-
return;
70+
console.error('API call requires authorization. Call dropped.', path);
71+
return await new Promise(()=>{});
7172
}else if([403, 429/*Unconfirmed*/].includes(response.status)){
7273
let timestamp = 1000*(parseInt(response.headers.get('x-ratelimit-reset'))+1);
7374
if(this.isLoggedIn()){

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
</style>
262262
<script>
263263
if(location.href.endsWith('?soon=aitournaments.io') || location.href.endsWith('?soon=ai-tournaments.io')){
264-
//window.location.replace('https://aitournaments.io'); Pending...
264+
//window.location.replace('https://ai-tournaments.io'); Pending...
265265
window.location.replace('/');
266266
}
267267
sessionStorage.setItem('PageLoaded', Date.now());
@@ -280,7 +280,7 @@
280280
<div id="header-title-fake">GitHub.com</div>
281281
</div>
282282
<div class="dropdown">
283-
<a href="https://github.com/AI-Tournaments/AI-Tournaments.github.io/releases/" target="_blank">Announcements</a>
283+
<a href="https://github.com/orgs/AI-Tournaments/discussions/categories/1-announcements" target="_blank">Announcements</a>
284284
<div class="dropdown-content" id="announcements-dropdown"></div>
285285
</div>
286286
<div class="dropdown">

0 commit comments

Comments
 (0)