diff --git a/Client/index.html b/Client/index.html index 685813f..39c6711 100644 --- a/Client/index.html +++ b/Client/index.html @@ -3,8 +3,6 @@ display: flex; flex-direction: column; align-items: center; - margin-left:5vw; - margin-right:5vw; } #interverse-details{ @@ -223,26 +221,9 @@ a{ Alpine.store("data", {}); interverse_data(url.replace("https://",'').replace('http://','').replace('/',''), function (data) { console.log("Initializing interverse...") - Alpine.store('data',data); - for (group in data['connection_groups']) { - for (link in data['connection_groups'][group]) { - url = data['connection_groups'][group][link]; - console.log("Connection: "+url) - interverse_data(url.replace("https://",'').replace('http://','').replace('/',''),function(data){ - Alpine.store(data['location'],data) - }); - //connections.push(data['connection_groups'][group][link]); - } - } - var connections = data['connections']; - for (var i = 0; i < connections.length; i++) { - url = connections[i].replace("https://",'').replace('http://','').replace('/','') - interverse_data(url,function(data){ - if (data['location']){ - Alpine.store(data['location'],data); - - } - }); + Alpine.store('data',data['main']) + for (c in data['connections']){ + Alpine.store(c,data['connections'][c]) } }); diff --git a/server/interverse-proxy.py b/server/interverse-proxy.py index 69944a1..046e7f0 100644 --- a/server/interverse-proxy.py +++ b/server/interverse-proxy.py @@ -7,15 +7,13 @@ import simple_cache app = Flask('interverse-proxy') cache = simple_cache.Cache() - - @app.route("/", methods=['GET']) def interverse_proxy(): url = request.args.get('url') if url == None: return redirect("https://codeberg.org/gabe/Interverse",307) return "See Interverse" - data = cache.load_data(url) + data = cache.get_interverse_data(url) return json.dumps(data) if __name__ == '__main__': diff --git a/server/simple_cache.py b/server/simple_cache.py index f09ecb9..b50f06d 100644 --- a/server/simple_cache.py +++ b/server/simple_cache.py @@ -60,3 +60,25 @@ class Cache: 'time':t+ideal_delta } return data + def get_interverse_data(self,url): + origin = self.load_data(url) + connections = {} + for con in origin['connections']: + dat = self.load_data(con.replace('https://','').replace('http://','').replace("/",'')) + if dat != None: + connections[con] = dat + for g in origin['connection_groups']: + for con in origin['connection_groups'][g]: + dat = self.load_data(con.replace('https://','').replace('http://','').replace("/",'')) + if dat != None: + connections[con] = dat + return { + 'main':origin, + 'connections':connections + } + + +if __name__ == '__main__': + c = Cache() + +