delete weather api keys

This commit is contained in:
Justin 2023-05-23 16:36:24 +08:00 committed by GitHub
parent 418336d7bf
commit 508456ff19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1252,14 +1252,12 @@ function getWeatherSettings(page) {
let speed = getSelected(page.querySelectorAll(".wind-speed-select")[0]); let speed = getSelected(page.querySelectorAll(".wind-speed-select")[0]);
let title = page.querySelectorAll(".title-select")[0].checked; let title = page.querySelectorAll(".title-select")[0].checked;
let api_key = page.querySelectorAll(".api-key")[0];
let let
settings = { settings = {
temp: temp, temp: temp,
wind_speed: speed, wind_speed: speed,
title: title, title: title,
api_key:api_key
}; };
//only for daily weather //only for daily weather
@ -1276,45 +1274,45 @@ function getWeatherSettings(page) {
return settings; return settings;
} }
function saveWeatherAPIKey(){ // function saveWeatherAPIKey(){
let featureSelector = document.getElementById("drop"); // let featureSelector = document.getElementById("drop");
feature = getSelected(featureSelector); // feature = getSelected(featureSelector);
let features = [ // let features = [
"Stocks", // "Stocks",
"Crypto", // "Crypto",
"Forex", // "Forex",
"Current Weather", // "Current Weather",
"Daily Forecast", // "Daily Forecast",
"News", // "News",
"Sports (Upcoming Games)", // "Sports (Upcoming Games)",
"Sports (Past Games)", // "Sports (Past Games)",
"Sports (Live Games)", // "Sports (Live Games)",
"Sports (Team Stats)", // "Sports (Team Stats)",
"Custom Images", // "Custom Images",
"Custom GIFs", // "Custom GIFs",
"Custom Messages", // "Custom Messages",
"Commodities", // "Commodities",
"Indices", // "Indices",
"Movies", // "Movies",
"IPO Calendar", // "IPO Calendar",
]; // ];
let pageNum = features.indexOf(feature) + 1; // let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString(); // let pageSelector = "Page" + pageNum.toString();
let page = document.getElementById(pageSelector); // let page = document.getElementById(pageSelector);
let api_key = page.querySelectorAll(".api-key")[0].value; // let api_key = page.querySelectorAll(".api-key")[0].value;
let settings = { // let settings = {
api_key:api_key // api_key:api_key
}; // };
console.log(settings); // console.log(settings);
fetch("/saveWeatherAPIKey", { // fetch("/saveWeatherAPIKey", {
method: "POST", // method: "POST",
body: JSON.stringify(settings), // body: JSON.stringify(settings),
}); // });
} // }
function saveMovieAPIKey(){ function saveMovieAPIKey(){
@ -1404,8 +1402,8 @@ ipoAPIbtn.addEventListener("click", saveIpoAPIKey);
var movieAPIbtn = document.getElementById("movie-api-btn"); var movieAPIbtn = document.getElementById("movie-api-btn");
movieAPIbtn.addEventListener("click", saveMovieAPIKey); movieAPIbtn.addEventListener("click", saveMovieAPIKey);
var weatherAPIbtn = document.getElementById("weather-api-btn"); // var weatherAPIbtn = document.getElementById("weather-api-btn");
weatherAPIbtn.addEventListener("click", saveWeatherAPIKey); // weatherAPIbtn.addEventListener("click", saveWeatherAPIKey);
function getNewsSettings(page) { function getNewsSettings(page) {
@ -1879,22 +1877,22 @@ function showDivTwo() {
// Display message asking for restart of ticker when new API key added for weather // Display message asking for restart of ticker when new API key added for weather
function showWeatherP() { // function showWeatherP() {
if(document.getElementById("api-key1").value==="") { // if(document.getElementById("api-key1").value==="") {
document.getElementById('weather-api-p').style.display = "none"; // document.getElementById('weather-api-p').style.display = "none";
} // }
else if (document.getElementById("api-key1").value==="Weather API Key") { // else if (document.getElementById("api-key1").value==="Weather API Key") {
document.getElementById('weather-api-p').style.display = "none"; // document.getElementById('weather-api-p').style.display = "none";
} // }
else { // else {
document.getElementById('weather-api-p').style.display = "block" // document.getElementById('weather-api-p').style.display = "block"
} // }
} // }
// Display message asking for restart of ticker when new API key added for movie // Display message asking for restart of ticker when new API key added for movie
@ -1939,32 +1937,32 @@ function showIpoP() {
// Disable adding cities when no API key detected // Disable adding cities when no API key detected
if(document.getElementById("api-key1").value==="") { // if(document.getElementById("api-key1").value==="") {
document.getElementById('inputTextBtn6').disabled = true; // document.getElementById('inputTextBtn6').disabled = true;
} // }
else if (document.getElementById("api-key1").value==="Weather API Key") { // else if (document.getElementById("api-key1").value==="Weather API Key") {
document.getElementById('inputTextBtn6').disabled = true; // document.getElementById('inputTextBtn6').disabled = true;
} // }
else { // else {
document.getElementById('inputTextBtn6').disabled = false; // document.getElementById('inputTextBtn6').disabled = false;
} // }
if(document.getElementById("api-key").value==="") { // if(document.getElementById("api-key").value==="") {
document.getElementById('inputTextBtn7').disabled = true; // document.getElementById('inputTextBtn7').disabled = true;
} // }
else if (document.getElementById("api-key").value==="Weather API Key") { // else if (document.getElementById("api-key").value==="Weather API Key") {
document.getElementById('inputTextBtn7').disabled = true; // document.getElementById('inputTextBtn7').disabled = true;
} // }
else { // else {
document.getElementById('inputTextBtn7').disabled = false; // document.getElementById('inputTextBtn7').disabled = false;
} // }
// Stocks validation // Stocks validation