Skip to content

Commit

Permalink
add 429 warning
Browse files Browse the repository at this point in the history
  • Loading branch information
fgl27 committed Aug 6, 2023
1 parent 313fff0 commit fffaeb2
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 2 deletions.
1 change: 0 additions & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,6 @@
text-align: center;
display: inline-block;
filter: drop-shadow(0 0.05em 0.15em #000000) drop-shadow(0 0.05em 0.15em #000000);
word-break: break-all;
white-space: normal;
}

Expand Down
2 changes: 2 additions & 0 deletions app/languages/0_Strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,3 +756,5 @@ var STR_BLOCK_OVERWRITE;
var STR_BLOCK_SORT_DATE;
var STR_BLOCK_SORT_NAME;
var STR_BLOCK_EMPTY_CONTENT;
var STR_NO_TOKEN_WARNING;
var STR_NO_TOKEN_WARNING_429;
4 changes: 4 additions & 0 deletions app/languages/en_US.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,4 +863,8 @@ function en_USLang() {
STR_BLOCK_SORT_DATE = 'Sorted by blocked date';
STR_BLOCK_SORT_NAME = 'Sorted by name A to Z';
STR_BLOCK_EMPTY_CONTENT = 'There is no blocked content of this type';

STR_NO_TOKEN_WARNING = 'Without adding a user and authorization token the app, may fail to load the content, this is a Twitch API limitation';
STR_NO_TOKEN_WARNING_429 =
'The app is failing to load the content due to a Twitch API limitation, to fix this add a user and authorization token.';
}
5 changes: 5 additions & 0 deletions app/languages/pt_BR.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,4 +863,9 @@ function pt_BRLang() {
STR_BLOCK_SORT_DATE = 'Ordenado por data de bloqueio';
STR_BLOCK_SORT_NAME = 'Ordenado por nome de A a Z';
STR_BLOCK_EMPTY_CONTENT = 'Não há conteúdo bloqueado deste tipo';

STR_NO_TOKEN_WARNING =
'Sem adicionar um usuário e token de autorização, o aplicativo pode falhar ao carregar o conteúdo, esta é uma limitação da API do Twitch';
STR_NO_TOKEN_WARNING_429 =
'O aplicativo está falhando ao carregar o conteúdo devido a uma limitação da API do Twitch, para corrigir isso, adicione um usuário e um token de autorização.';
}
8 changes: 7 additions & 1 deletion app/specific/AddUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ function AddUser_RestoreUsers() {
for (i; i < len; i++) {
AddUser_UsernameArray[i].timeout_id = null;

if (AddUser_UsernameArray[i].access_token) AddCode_CheckTokenStart(i);
if (AddUser_UsernameArray[i].access_token) {
AddCode_CheckTokenStart(i);
} else if (!i) {
Main_showWarningDialog(STR_NO_TOKEN_WARNING, 5000);
}

//Set user history obj
Main_values_History_data[AddUser_UsernameArray[i].id] = {
Expand Down Expand Up @@ -420,6 +424,8 @@ function AddUser_UserMakeOne(position) {

if (AddUser_UsernameArray[0].access_token) {
HttpGetSetUserHeader();
} else {
Main_showWarningDialog(STR_NO_TOKEN_WARNING, 5000);
}
}

Expand Down
3 changes: 3 additions & 0 deletions app/specific/Screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ function Screens_HttpResultStatus(resultObj, key) {
if (ScreenObj[key].itemsCount && Main_ThumbOpenIsNull(ScreenObj[key].posY + 1 + '_0', ScreenObj[key].ids[0])) {
Screens_addFocus(true, key);
}
} else if (resultObj.status === 429 && !AddUser_UserHasToken()) {
Main_showWarningDialog(STR_NO_TOKEN_WARNING_429, 5000);
Screens_loadDataFail(key);
} else if (resultObj.status === 401 || resultObj.status === 403) {
//token expired

Expand Down

0 comments on commit fffaeb2

Please sign in to comment.