mirror of
https://git.alemi.dev/fedicharter.git
synced 2024-11-23 00:44:48 +01:00
Merge branch 'dev' of alemi.dev:fedicharter into dev
This commit is contained in:
commit
588cc4bfbc
2 changed files with 9 additions and 7 deletions
9
dist/index.html
vendored
9
dist/index.html
vendored
|
@ -31,7 +31,7 @@
|
|||
domain = domainParam;
|
||||
console.log("scanning domain " + domain);
|
||||
} else {
|
||||
domain = window.prompt("starting instance for charting", "social.alemi.dev");
|
||||
domain = window.prompt("starting instance for charting", "ihatebeinga.live");
|
||||
}
|
||||
|
||||
fetch(`https://api.alemi.dev/akkoma/bubble/crawl?domain=${domain}`)
|
||||
|
@ -47,8 +47,8 @@
|
|||
'#05979A',
|
||||
]
|
||||
for (const i in graph.nodes) {
|
||||
if (graph.nodes[i].label === domain) graph.nodes[i].color = '#BF616A';
|
||||
else graph.nodes[i].color = palette[Math.floor(Math.random() * palette.length)];;
|
||||
if (graph.nodes[i].label === domain) { graph.nodes[i].color = '#BF616A' }
|
||||
else { graph.nodes[i].color = palette[Math.floor(Math.random() * palette.length)] }
|
||||
}
|
||||
|
||||
const nodes = new vis.DataSet(graph.nodes);
|
||||
|
@ -60,9 +60,8 @@
|
|||
nodes: nodes,
|
||||
edges: edges,
|
||||
};
|
||||
const options = { edges: { dashes: true, arrows: 'to' }, nodes: { mass: 2, color: "#bf616a", shape: "box" }};
|
||||
const options = { edges: { dashes: true, arrows: 'to' }, nodes: { color: "#bf616a", shape: "box", scaling: { min: 1, max: 500, label: { enabled: true, min: 14, max: 56 }}}};
|
||||
const network = new vis.Network(container, data, options);
|
||||
document.getElementById("loader").remove();
|
||||
}))
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{collections::{HashSet, HashMap}, sync::Arc};
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use serde::Serialize;
|
||||
use tokio::sync::{mpsc, RwLock};
|
||||
|
@ -38,7 +38,7 @@ impl MapCollector {
|
|||
for (i, node) in nodes_domains.iter().enumerate() {
|
||||
nodes_map.insert(
|
||||
node.domain.clone(),
|
||||
Node { id: i, label: node.domain.clone(), title: node.name.clone(), value: 1 }
|
||||
Node { id: i, label: node.domain.clone(), title: node.name.clone(), value: 1, mass: 1. }
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,7 @@ impl MapCollector {
|
|||
let from = {
|
||||
if let Some(node) = nodes_map.get_mut(&vertex.from) {
|
||||
node.value += 1;
|
||||
node.mass += 0.1;
|
||||
node.id
|
||||
} else {
|
||||
tracing::warn!("vertex from nonexisting node {}", vertex.from);
|
||||
|
@ -56,6 +57,7 @@ impl MapCollector {
|
|||
let to = {
|
||||
if let Some(node) = nodes_map.get_mut(&vertex.to) {
|
||||
node.value += 10;
|
||||
node.mass += 1.;
|
||||
node.id
|
||||
} else {
|
||||
tracing::warn!("vertex to nonexisting node {}", vertex.to);
|
||||
|
@ -120,6 +122,7 @@ pub struct Node {
|
|||
pub id: usize,
|
||||
pub label: String,
|
||||
pub value: usize,
|
||||
pub mass: f32,
|
||||
pub title: String,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue