Open Rawrior opened 5 years ago
I have the same issue. Is there a way to manually give it my API?
I was just able to fix mine by going into the script, line 130: $.get('/settings/account'). Your API key is no longer under your account but here: https://www.wanikani.com/settings/personal_access_tokens. So I changed "account" to "personal_access_tokens."
Line 130 is now: $.get('/settings/personal_access_tokens')
Line 130 is now: $.get('/settings/personal_access_tokens')
This works perfectly, thank you!
Did this break again after WaniKani's latest dashboard update? Thanks!
Yes, this did break. I assume this is because the scripts relied on the API of version which was marked as deprecated. The network requests respond with HTTP status code 410 Gone
Looks like with API v2 there needs to be a major rewrite, the data structure seems to have changed as well.
I updated the function fetchAndCacheBurnedItemsThen
so at least data fetching works but everything else needs to be rewritten I believe.
function fetchAndCacheBurnedItemsThen(callback, requestedResource, type, storageKey, mapFunction) {
var request = $.ajax({url:"https://api.wanikani.com/v2/assignments?burned=true&subject_types=" + requestedResource, dataType:"json", headers: {Authorization: "Bearer " + apiKey, 'Wanikani-Revision': '20170710'}, method:"GET"});
request.done(function(response) {
// vocabulary for some reason has everything in a child called general, kanji and radicals do not
var burnedItems = response.data;
BRData[type] = burnedItems.map(mapFunction);
localStorage.setItem(storageKey, JSON.stringify(BRData[type]));
callback();
})
.fail(function(e) {
BRLog("Request to WaniKani API failed. Catastrophic failure ermagerd D:", ERROR);
});
}
You need to update the expected API key as well
var api_key = localStorage.getItem('apiv2_key');
if (typeof api_key === 'string' && api_key.length === 36) {
return callback(api_key);
}
The widget never loads, seemingly due to an api key issue? I've included pictures of the widget and the console.
LocalStorage also has apiv2_key as a field. I tried tinkering around with making the script fetch that instead, but it seemingly didn't do anything.