ecosia widget

Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
Benny Samir Hierl 2020-10-30 20:08:45 +01:00
parent 6f5bff8165
commit e3d321f2c9
No known key found for this signature in database
GPG key ID: 69DE3C3C097DB7F7
3 changed files with 14 additions and 4 deletions

View file

@ -6,7 +6,10 @@
let widgetInputRAW = args.widgetParameter;
let token;
if (widgetInputRAW !== null) {
token = widgetInputRAW.toString();
token = widgetInputRAW.toString().trim();
if (/^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/.text(token) === false) {
throw new Errpr('Invalid Token Format')
}
} else {
throw new Error('No token set via widget parameter! You can request a token here: https://www.ecosia.org/account/login')
}

View file

@ -2,15 +2,15 @@
![Ecosia Widget Preview light](https://raw.githubusercontent.com/ThisIsBenny/iOS-Widgets/main/Ecosia/previewLight.jpeg)
![Ecosia Widget Preview dark](https://raw.githubusercontent.com/ThisIsBenny/iOS-Widgets/main/Ecosia/previewDark.jpeg)
This widget allows you to save the location of your car, which will then displayed in the widget as a map. So you know exactly where you parked.
If you don't know the way to the car anymore, you can start the navigation to the car's location with one click and let Apple Maps or Google Maps navigate you.
This widget shows how many trees you have already planted based on your searches on Ecosia.org.
Clicking on the widget will open Ecosia.org in your browser.
[[Download]](https://raw.githubusercontent.com/ThisIsBenny/iOS-Widgets/main/Ecosia/Ecosia.js)
## Setup
For this widget is a ecosia account required. Go to https://www.ecosia.org/account/login and enter your E-Mail address. You will recieve a E-Mail with a link.
Use this Link on all your devices where you use Ecosia to connect all Devices to one counter (you can request the Mail multiple time, import is that the E-Mail address is always the same).
After this, you have to copy the token from the Link in the E-Mail and paste the token to the widget parameter
After this, you have to copy the token from the Link in the E-Mail and paste the token to the widget parameter. The Token is the part behind `https://www.ecosia.org/account/verify?token=[TOKEN]` in the url:
![Get Token](https://raw.githubusercontent.com/ThisIsBenny/iOS-Widgets/main/Ecosia/token.jpeg)
![Setup](https://raw.githubusercontent.com/ThisIsBenny/iOS-Widgets/main/Ecosia/setup.jpeg)

View file

@ -14,6 +14,13 @@
"previewURL": "https://raw.githubusercontent.com/ThisIsBenny/iOS-Widgets/main/Covid-19/previewLight.jpeg",
"descriptionURL": "https://github.com/ThisIsBenny/iOS-Widgets/blob/main/Covid-19/README.md"
},
{
"name": "Ecosia Tree Counter",
"version": "1.0.0",
"scriptURL": "https://raw.githubusercontent.com/ThisIsBenny/iOS-Widgets/main/Ecosia/Ecosia.js",
"previewURL": "https://raw.githubusercontent.com/ThisIsBenny/iOS-Widgets/main/Ecosia/previewLight.jpeg",
"descriptionURL": "https://github.com/ThisIsBenny/iOS-Widgets/blob/main/Ecosia/README.md"
},
{
"name": "Meeting dial in",
"version": "0.1.1",