mirror of
https://github.com/ThisIsBenny/iOS-Widgets.git
synced 2025-04-19 15:27:40 +00:00
Merge pull request #64 from FulytheFox/main
Fixed small changes in the Ecosia API
This commit is contained in:
commit
1b9d5b46ca
1 changed files with 3 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
// Variables used by Scriptable.
|
||||
// These must be at the very top of the file. Do not edit.
|
||||
// icon-color: brown; icon-glyph: magic;
|
||||
// Version 1.1.3
|
||||
// Version 1.1.4
|
||||
|
||||
// You can use this shortcut to get the needed Token via Safari Share Menu while you are on Ecosia.org: https://www.icloud.com/shortcuts/ab84483a898d42428b1a9be981c37854
|
||||
// It is important, that you are already logged in with the Safari Browser where you execute Shortcut
|
||||
|
@ -34,10 +34,10 @@ if (Device.isUsingDarkAppearance()) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
async function getTreeCounter(token) {
|
||||
try {
|
||||
const url = "https://api.ecosia.org/v1/accounts/personalcounter?token=" + token
|
||||
const url = "https://api.ecosia.org/v1/accounts/v2/personal_counter?token=" + token
|
||||
let req = new Request(url)
|
||||
let res = await req.loadJSON()
|
||||
return parseInt(res.counterValue)
|
||||
return parseInt(res.personal_counter)
|
||||
} catch (error) {
|
||||
throw new Error('An error occurred when loading data from the Ecosia API. Please check the entered token.')
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue