feat: simple index html file

This commit is contained in:
əlemi 2023-10-02 07:25:41 +02:00
parent 68cbe3c062
commit 5a4f26f3dd

56
dist/index.html vendored Normal file
View file

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>akkoma bubble network</title>
<script
type="text/javascript"
src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"
></script>
<style type="text/css">
body {
background: #111111;
}
#mynetwork {
width: 100%;
height: 98vh;
}
</style>
</head>
<body>
<div id="mynetwork"></div>
<script type="text/javascript">
let nodes_array = []
let edges_array = []
let domain;
const urlParams = new URLSearchParams(window.location.search);
const domainParam = urlParams.get('domain');
if (domainParam) {
domain = domainParam;
console.log("scanning domain " + domain);
} else {
domain = "social.alemi.dev";
console.log("defaulting to social.alemi.dev");
}
fetch(`https://api.alemi.dev/akkoma/bubble/crawl?domain=${domain}`)
.then((res) => res.json().then((graph) => {
// create an array with nodes
var nodes = new vis.DataSet(graph.nodes);
// create an array with edges
var edges = new vis.DataSet(graph.vertices);
// create a network
var container = document.getElementById("mynetwork");
var data = {
nodes: nodes,
edges: edges,
};
var options = { edges: { dashes: true }, nodes: { color: "#bf616a", shape: "box" }};
var network = new vis.Network(container, data, options);
}))
</script>
</body>
</html>