minor changes

This commit is contained in:
Gabriel 2022-03-03 14:22:04 -05:00
parent 208eb9eea3
commit 5a8705b256
2 changed files with 70 additions and 73 deletions

View file

@ -1,22 +1,20 @@
{
"version": 0.1,
"name": "My website",
"image":"",
"image": "",
"location": "https://my.website",
"resources": [
{
"resources": [{
"label": "RSS Feed",
"icon": "",
"location": "https://my.website.com/rss.xml",
"description": "Stay up to date!"
}
],
"connection_groups":{
"Group1":[
"description": "<img src='example.com'>"
}],
"connection_groups": {
"Group1": [
"https://libresolutions.network"
],
"Group2":["https://retroedge.tech"],
"Group3":["https://small-web.org"]
"Group2": ["https://retroedge.tech"],
"Group3": ["https://small-web.org"]
},
"connections": [
"https://gabe.rocks",
@ -27,4 +25,4 @@
"matrix": "@me:https://my.website",
"fediverse": "@me@mastodon.social"
}
}
}

View file

@ -1,12 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/theme.css">
<title>Interverse</title>
<script src="//unpkg.com/alpinejs" defer></script>
<! consider hosting on your site>
<script src="https://unpkg.com/alpinejs" defer></script>
<script src="/helper.js"></script>
</head>
<body>
<div class="interverse" x-data x-if="Alpine.store('data')">
<div id="interverse-details">
@ -89,40 +91,38 @@
</div>
<script>
var main_url="/.well-known/interverse";
if (getUrlParameter('s') && getUrlParameter("url")){
var main_url = "/.well-known/interverse";
if (getUrlParameter('s') && getUrlParameter("url")) {
var uri = "";
main_url=getUrlParameter('s')+"://"+getUrlParameter("url")+'/.well-known/interverse';
}
else{
if (getUrlParameter('url')){
main_url = "https://" + getUrlParameter('url')+'/.well-known/interverse';
main_url = getUrlParameter('s') + "://" + getUrlParameter("url") + '/.well-known/interverse';
} else {
if (getUrlParameter('url')) {
main_url = "https://" + getUrlParameter('url') + '/.well-known/interverse';
}
}
document.addEventListener('alpine:init',function(){
document.addEventListener('alpine:init', function() {
initialize(main_url);
});
function initialize(url){
Alpine.store("data",{});
fetchdata(url,function(e){
function initialize(url) {
Alpine.store("data", {});
fetchdata(url, function(e) {
data = JSON.parse(e.target.response);
raw_data = JSON.parse(e.target.response);
Alpine.store("data",data);
Alpine.store("data", data);
var connections = raw_data['connections'];
for (group in data['connection_groups']){
for (link in data['connection_groups'][group]){
for (group in data['connection_groups']) {
for (link in data['connection_groups'][group]) {
connections.push(data['connection_groups'][group][link]);
}
}
for (var i =0; i<connections.length; i++){
fetchdata(connections[i]+'/.well-known/interverse',function(e){
try{
for (var i = 0; i < connections.length; i++) {
fetchdata(connections[i] + '/.well-known/interverse', function(e) {
try {
dat = JSON.parse(e.target.response);
console.log(dat);
Alpine.store(dat['location'],dat);
}
catch{
Alpine.store(dat['location'], dat);
} catch {
console.log("Failed to parse connection JSON");
}
});
@ -130,7 +130,6 @@
});
}
</script>
</body>