minor changes
This commit is contained in:
parent
208eb9eea3
commit
5a8705b256
2 changed files with 70 additions and 73 deletions
|
@ -1,30 +1,28 @@
|
||||||
{
|
{
|
||||||
"version": 0.1,
|
"version": 0.1,
|
||||||
"name": "My website",
|
"name": "My website",
|
||||||
"image":"",
|
"image": "",
|
||||||
"location": "https://my.website",
|
"location": "https://my.website",
|
||||||
"resources": [
|
"resources": [{
|
||||||
{
|
"label": "RSS Feed",
|
||||||
"label": "RSS Feed",
|
"icon": "",
|
||||||
"icon": "",
|
"location": "https://my.website.com/rss.xml",
|
||||||
"location": "https://my.website.com/rss.xml",
|
"description": "<img src='example.com'>"
|
||||||
"description": "Stay up to date!"
|
}],
|
||||||
}
|
"connection_groups": {
|
||||||
],
|
"Group1": [
|
||||||
"connection_groups":{
|
"https://libresolutions.network"
|
||||||
"Group1":[
|
],
|
||||||
"https://libresolutions.network"
|
"Group2": ["https://retroedge.tech"],
|
||||||
],
|
"Group3": ["https://small-web.org"]
|
||||||
"Group2":["https://retroedge.tech"],
|
|
||||||
"Group3":["https://small-web.org"]
|
|
||||||
},
|
},
|
||||||
"connections": [
|
"connections": [
|
||||||
"https://gabe.rocks",
|
"https://gabe.rocks",
|
||||||
"https://codeberg.org"
|
"https://codeberg.org"
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"e-mail": "contact@https://my.website",
|
"e-mail": "contact@https://my.website",
|
||||||
"matrix": "@me:https://my.website",
|
"matrix": "@me:https://my.website",
|
||||||
"fediverse": "@me@mastodon.social"
|
"fediverse": "@me@mastodon.social"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,12 +1,14 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="/theme.css">
|
<link rel="stylesheet" href="/theme.css">
|
||||||
<title>Interverse</title>
|
<title>Interverse</title>
|
||||||
<script src="//unpkg.com/alpinejs" defer></script>
|
<script src="https://unpkg.com/alpinejs" defer></script>
|
||||||
<! consider hosting on your site>
|
|
||||||
<script src="/helper.js"></script>
|
<script src="/helper.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="interverse" x-data x-if="Alpine.store('data')">
|
<div class="interverse" x-data x-if="Alpine.store('data')">
|
||||||
<div id="interverse-details">
|
<div id="interverse-details">
|
||||||
|
@ -21,14 +23,14 @@
|
||||||
<template x-if="resource['icon'] !=''">
|
<template x-if="resource['icon'] !=''">
|
||||||
<img class="interverse-resource-icon" x-bind:src="resource['icon']">
|
<img class="interverse-resource-icon" x-bind:src="resource['icon']">
|
||||||
</template>
|
</template>
|
||||||
<h2 x-text="resource['label']"></h2>
|
<h2 x-text="resource['label']"></h2>
|
||||||
<p x-text="resource['description']"></p>
|
<p x-text="resource['description']"></p>
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="interverse-groups">
|
</a>
|
||||||
<template x-for="(group,name) in Alpine.store('data')['connection_groups']">
|
</template>
|
||||||
|
</div>
|
||||||
|
<div id="interverse-groups">
|
||||||
|
<template x-for="(group,name) in Alpine.store('data')['connection_groups']">
|
||||||
<div>
|
<div>
|
||||||
<h3 x-text="name"></h3>
|
<h3 x-text="name"></h3>
|
||||||
<div class="interverse-group">
|
<div class="interverse-group">
|
||||||
|
@ -41,7 +43,7 @@
|
||||||
<a x-bind:href="link" x-text="link"></a>
|
<a x-bind:href="link" x-text="link"></a>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template x-if="Alpine.store(link) == undefined">
|
<template x-if="Alpine.store(link) == undefined">
|
||||||
<div>
|
<div>
|
||||||
<a x-bind:href="link" x-text="link">
|
<a x-bind:href="link" x-text="link">
|
||||||
|
|
||||||
|
@ -50,16 +52,16 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<h2>Links</h2>
|
<h2>Links</h2>
|
||||||
<div id="interverse-connections">
|
<div id="interverse-connections">
|
||||||
<template x-for="connection in Alpine.store('data')['connections']">
|
<template x-for="connection in Alpine.store('data')['connections']">
|
||||||
<div class="interverse-connection" >
|
<div class="interverse-connection" >
|
||||||
<template x-if="Alpine.store(connection)['version'] >=0">
|
<template x-if="Alpine.store(connection)['version'] >=0">
|
||||||
<div x-on:click="initialize(connection+'/.well-known/interverse')">
|
<div x-on:click="initialize(connection+'/.well-known/interverse')">
|
||||||
|
@ -67,62 +69,60 @@
|
||||||
<template x-if="Alpine.store(connection)['image']!=''">
|
<template x-if="Alpine.store(connection)['image']!=''">
|
||||||
<img x-bind:src="Alpine.store(connection)['image']">
|
<img x-bind:src="Alpine.store(connection)['image']">
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<template x-if="name == ''">
|
<template x-if="name == ''">
|
||||||
<a x-bind:href="connection" x-text="connection"></a>
|
<a x-bind:href="connection" x-text="connection"></a>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</div>>
|
</div>>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div id="interverse-contact">
|
<div id="interverse-contact">
|
||||||
<template x-for="contact in Alpine.store('data')['contact']">
|
<template x-for="contact in Alpine.store('data')['contact']">
|
||||||
<div class="interverse-contact">
|
<div class="interverse-contact">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var main_url="/.well-known/interverse";
|
var main_url = "/.well-known/interverse";
|
||||||
if (getUrlParameter('s') && getUrlParameter("url")){
|
if (getUrlParameter('s') && getUrlParameter("url")) {
|
||||||
var uri = "";
|
var uri = "";
|
||||||
main_url=getUrlParameter('s')+"://"+getUrlParameter("url")+'/.well-known/interverse';
|
main_url = getUrlParameter('s') + "://" + getUrlParameter("url") + '/.well-known/interverse';
|
||||||
}
|
} else {
|
||||||
else{
|
if (getUrlParameter('url')) {
|
||||||
if (getUrlParameter('url')){
|
main_url = "https://" + getUrlParameter('url') + '/.well-known/interverse';
|
||||||
main_url = "https://" + getUrlParameter('url')+'/.well-known/interverse';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.addEventListener('alpine:init',function(){
|
document.addEventListener('alpine:init', function() {
|
||||||
initialize(main_url);
|
initialize(main_url);
|
||||||
});
|
});
|
||||||
|
|
||||||
function initialize(url){
|
function initialize(url) {
|
||||||
Alpine.store("data",{});
|
Alpine.store("data", {});
|
||||||
fetchdata(url,function(e){
|
fetchdata(url, function(e) {
|
||||||
data = JSON.parse(e.target.response);
|
data = JSON.parse(e.target.response);
|
||||||
raw_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'];
|
var connections = raw_data['connections'];
|
||||||
for (group in data['connection_groups']){
|
for (group in data['connection_groups']) {
|
||||||
for (link in data['connection_groups'][group]){
|
for (link in data['connection_groups'][group]) {
|
||||||
connections.push(data['connection_groups'][group][link]);
|
connections.push(data['connection_groups'][group][link]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var i =0; i<connections.length; i++){
|
for (var i = 0; i < connections.length; i++) {
|
||||||
fetchdata(connections[i]+'/.well-known/interverse',function(e){
|
fetchdata(connections[i] + '/.well-known/interverse', function(e) {
|
||||||
try{
|
try {
|
||||||
dat = JSON.parse(e.target.response);
|
dat = JSON.parse(e.target.response);
|
||||||
console.log(dat);
|
console.log(dat);
|
||||||
Alpine.store(dat['location'],dat);
|
Alpine.store(dat['location'], dat);
|
||||||
}
|
} catch {
|
||||||
catch{
|
|
||||||
console.log("Failed to parse connection JSON");
|
console.log("Failed to parse connection JSON");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -130,7 +130,6 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue