diff --git a/cors.py b/cors.py deleted file mode 100644 index f269921..0000000 --- a/cors.py +++ /dev/null @@ -1,19 +0,0 @@ -import requests -from flask import Flask, jsonify - -cors = Flask(__name__) - - -@cors.get("/") -def deal_with_cors(query): - return {"data": requests.get(f"https://ac.duckduckgo.com/ac/?q={query}&type=list").json()[1]} - - -@cors.after_request -def actually_deal_with_cors(res): - res.headers["Access-Control-Allow-Origin"] = "*" - return res - - -if __name__ == "__main__": - cors.run("localhost", 8080) diff --git a/main.js b/main.js index bad4fe5..f19e9c8 100644 --- a/main.js +++ b/main.js @@ -44,7 +44,7 @@ $(() => { $("#greeting").text(`Good ${new Date().getHours() < 12 ? "morning" : new Date().getHours() < 18 ? "afternoon" : "evening"}, ${conf.username}.`); // Weather Detection - /* if (navigator.geolocation) { + if (navigator.geolocation) { navigator.geolocation.getCurrentPosition((pos) => { $.get(`https://api.openweathermap.org/data/2.5/onecall?lat=${pos.coords.latitude}&lon=${pos.coords.longitude}&units=${conf.weather.unit}&appid=${conf.weather.apikey}`, (res) => { let ress = res.current; @@ -75,7 +75,7 @@ $(() => { } }); }); - } */ + } // Search $("#search").on("keyup", (event) => { @@ -89,7 +89,7 @@ $(() => { } } else if (event.key === " " && event.ctrlKey) { if ($("#search").val().length === 0 || !$("#search").val().trim()) { } else { - $.get(`http://localhost:8080/${$("#search").val()}`, (res) => { + $.get(`/ac/${$("#search").val()}`, (res) => { $(".search-predictions > ul").remove(); res = res.data.slice(0, 10); var predictions = "