Major performance increase
This commit is contained in:
parent
ca4b7635a4
commit
b294032487
3 changed files with 26 additions and 25 deletions
|
@ -3,8 +3,6 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-left:5vw;
|
|
||||||
margin-right:5vw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#interverse-details{
|
#interverse-details{
|
||||||
|
@ -223,26 +221,9 @@ a{
|
||||||
Alpine.store("data", {});
|
Alpine.store("data", {});
|
||||||
interverse_data(url.replace("https://",'').replace('http://','').replace('/',''), function (data) {
|
interverse_data(url.replace("https://",'').replace('http://','').replace('/',''), function (data) {
|
||||||
console.log("Initializing interverse...")
|
console.log("Initializing interverse...")
|
||||||
Alpine.store('data',data);
|
Alpine.store('data',data['main'])
|
||||||
for (group in data['connection_groups']) {
|
for (c in data['connections']){
|
||||||
for (link in data['connection_groups'][group]) {
|
Alpine.store(c,data['connections'][c])
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,15 +7,13 @@ import simple_cache
|
||||||
app = Flask('interverse-proxy')
|
app = Flask('interverse-proxy')
|
||||||
cache = simple_cache.Cache()
|
cache = simple_cache.Cache()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/", methods=['GET'])
|
@app.route("/", methods=['GET'])
|
||||||
def interverse_proxy():
|
def interverse_proxy():
|
||||||
url = request.args.get('url')
|
url = request.args.get('url')
|
||||||
if url == None:
|
if url == None:
|
||||||
return redirect("https://codeberg.org/gabe/Interverse",307)
|
return redirect("https://codeberg.org/gabe/Interverse",307)
|
||||||
return "See <a href='https://codeberg.org/gabe/Interverse'>Interverse</a>"
|
return "See <a href='https://codeberg.org/gabe/Interverse'>Interverse</a>"
|
||||||
data = cache.load_data(url)
|
data = cache.get_interverse_data(url)
|
||||||
return json.dumps(data)
|
return json.dumps(data)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -60,3 +60,25 @@ class Cache:
|
||||||
'time':t+ideal_delta
|
'time':t+ideal_delta
|
||||||
}
|
}
|
||||||
return data
|
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()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue