mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Revert "Added autoLocation and autoTimezone option for weather modules and clock respectively."
This commit is contained in:
@@ -11,7 +11,6 @@ Module.register("currentweather",{
|
||||
|
||||
// Default module config.
|
||||
defaults: {
|
||||
autoLocation: false,
|
||||
location: false,
|
||||
locationID: false,
|
||||
appid: "",
|
||||
@@ -110,19 +109,8 @@ Module.register("currentweather",{
|
||||
this.weatherType = null;
|
||||
this.feelsLike = null;
|
||||
this.loaded = false;
|
||||
this.scheduleUpdate(this.config.initialLoadDelay);
|
||||
|
||||
if (this.config.autoLocation) {
|
||||
this.sendSocketNotification("AUTO_LOCATION");
|
||||
} else {
|
||||
this.scheduleUpdate(this.config.initialLoadDelay);
|
||||
}
|
||||
},
|
||||
|
||||
socketNotificationReceived: function (notification, payload) {
|
||||
if (notification === "UPDATE_LOCATION") {
|
||||
this.config.location = payload.location;
|
||||
this.scheduleUpdate(this.config.initialLoadDelay);
|
||||
}
|
||||
},
|
||||
|
||||
// add extra information of current weather
|
||||
|
@@ -1,29 +0,0 @@
|
||||
var http = require("http");
|
||||
var NodeHelper = require("node_helper");
|
||||
|
||||
module.exports = NodeHelper.create({
|
||||
start: function () {
|
||||
},
|
||||
|
||||
socketNotificationReceived: function (notification, payload) {
|
||||
var self = this;
|
||||
|
||||
if (notification === "AUTO_LOCATION") {
|
||||
console.log("Loading timezone...");
|
||||
http.get("http://ip-api.com/json", function (req) {
|
||||
var data = "";
|
||||
req.on("data", function (d) {
|
||||
data += d;
|
||||
});
|
||||
req.on("end", function () {
|
||||
var body = JSON.parse(data);
|
||||
payload.location = body.city + ", " + body.regionName;
|
||||
self.sendSocketNotification("UPDATE_LOCATION", payload);
|
||||
});
|
||||
}).on("error", function () {
|
||||
payload.error = "Could not figure out the timezone.";
|
||||
self.sendSocketNotification("UPDATE_LOCATION", payload);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user