Porovnat revize

...

2 Commity

Autor SHA1 Zpráva Datum
tree 79384e36d0 remove cli, future is go cli 2023-07-13 22:07:46 +00:00
tree d8b47f1a63 pds list tweaks, map is optional 2023-07-13 22:03:24 +00:00
8 změnil soubory, kde provedl 49 přidání a 90 odebrání

Zobrazit soubor

@ -6,6 +6,10 @@ This is a monorepo containing the backend and frontend of ATScan.
The current version is hosted at [atscan.net](https://atscan.net). You can follow us on Bluesky as [@atscan.net](https://bsky.app/profile/did:plc:ft3tl5dxjn4psdk6asenqn3r).
## Our libraries
- [broadsky](https://github.com/atscan/broadsky) - Bridge Streaming Wire Protocol (v0) to NATS and other protocols
## Technology stack
### Infrastructure
@ -30,10 +34,6 @@ The current version is hosted at [atscan.net](https://atscan.net). You can follo
- [Numbro](https://numbrojs.com/) number library
- [Minidenticons](https://github.com/laurentpayot/minidenticons) identicon generator
### CLI
- [Deno](https://deno.land/) JavaScript runtime
- [Cliffy](https://cliffy.io/) commandline framework
## Authors
- Tree (GitHub: [@burningtree](https://github.com/burningtree), Bluesky: [@tree.fail](https://bsky.app/profile/did:plc:524tuhdhh3m7li5gycdn6boe))

Zobrazit soubor

@ -1,55 +0,0 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
import jsonata from "npm:jsonata"
import { inspect, read } from "../backend/lib/car.js";
await new Command()
.name("ats-repo")
.action(() => { console.log("Please specify command or use `-h`") })
.command("car-inspect,ci", "Inspect CAR file")
.option("--did <val:string>", "DID", { required: true })
.option("--signing-key <val:string>", "Signing key", { required: true })
.arguments("<file:string>", 'Input CAR file')
.example("Inspect CAR file", "ats r ci --did did:plc:ixko5wwzamist35uptkjae7p --signing-key did:key:zQ3shXv3xDNbJfYiMtyNT3E6buJtgKwQTYpoJu6NJDU2EHyVj backend/db/repos/test.car")
.action(async ({ did, signingKey }, file) => {
const out = await inspect(await Deno.readFile(file), did, signingKey)
console.log(JSON.stringify(out, null, 2))
})
.command("remote-car-inspect,rci", "Inspect remote CAR file")
.option('--checkout,-c', "Read checkout data")
.option('--query,-q <query>', "Query result with JSONata")
.option('--debug', "Debug")
.arguments("<did:string>", 'DID')
.action(async ({ debug, checkout, query }, did) => {
// get did info
const didRes = await fetch('https://api.atscan.net/'+did)
if (!didRes.ok) {
console.error(`Error: ${didRes.status} ${didRes.statusText}`)
return;
}
const didInfo = await didRes.json()
const signingKey = didInfo.revs[didInfo.revs.length-1].operation.verificationMethods.atproto
// fetch remote repo
const repo = await fetch(`${didInfo.pds[0]}/xrpc/com.atproto.sync.getRepo?did=${did}`)
const data = new Uint8Array(await repo.arrayBuffer())
// load and validate repo
let out;
if (debug) {
out = await read(data, did, signingKey)
} else if (checkout) {
const resp = await read(data, did, signingKey)
delete resp.checkout.newCids
out = resp.checkout
} else {
out = await inspect(data, did, signingKey)
}
if (query) {
out = await jsonata(query).evaluate(out)
}
console.log(JSON.stringify(out, null, 2))
})
.example("Inspect remote CAR", "ats r rci did:plc:naichbdds7i7cwbzwzvjraxm")
.example("Get all current data", "ats r rci did:plc:naichbdds7i7cwbzwzvjraxm -c")
.example("Get feed generators", "ats r rci did:plc:524tuhdhh3m7li5gycdn6boe -c -q 'contents.`app.bsky.feed.generator`'")
.parse(Deno.args)

Zobrazit soubor

@ -1,14 +0,0 @@
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
//import { inspect } from "./lib/car.js";
await new Command()
.name("ats")
.description("CLI for ATScan")
.meta("deno", Deno.version.deno)
.meta("v8", Deno.version.v8)
.version("0.1.0")
.usage("<command>")
.action(() => { console.log("Please specify command or use `-h`") })
.command("repo,r", "Repository tools").executable()
.parse(Deno.args)

Zobrazit soubor

@ -1,6 +1,6 @@
{
"name": "atscan-fe",
"version": "0.8.0-alpha",
"version": "0.8.1-alpha",
"private": true,
"scripts": {
"dev": "vite dev",

Zobrazit soubor

@ -48,7 +48,18 @@
val = arr.reverse().join(' ');
}
if (key === 'host') {
val = `<a href="/pds/${val}" class=""><span class="font-semibold text-lg">${val}</span></a>`;
val = `<div class="inline-block align-top"><a href="/pds/${val}" class=""><span class="font-semibold text-lg">${val}</span></a>`;
if (
row.inspect?.current.data?.availableUserDomains &&
row.inspect.current.data.availableUserDomains.length > 0
) {
val +=
'<div class="text-xs opacity-75">' +
row.inspect?.current.data?.availableUserDomains.join(', ') +
'</div>';
}
val += `</div>`;
}
if (key === 'responseTime') {
val = row.responseTime ? '~' + Math.round(row.responseTime) + 'ms' : '-';
@ -61,16 +72,18 @@
}" class="inline-block mr-2" />`
: '-';
if (row.ip && row.ip.city) {
val += `${row.ip.city} - `;
val += `${row.ip.city}, ${row.ip.country}`;
}
if (row.ip) {
const dnsIp = row.dns ? row.dns.Answer?.filter((a) => a.type === 1)[0].data : null;
val +=
/*val +=
`<a href="http://ipinfo.io/${dnsIp}" target="_blank" class="anchor">${dnsIp}</a>` || '-';
if (row.ip && row.ip.regionName) {
val += ' (' + row.ip.regionName + ')';
}
val += `<br /><span class="text-xs">${row.ip?.org || 'n/a'}</span>`;
}*/
val += `<br /><span class="text-xs opacity-75">${
row.ip?.org?.replace(/^AS\d+ /, '') || 'n/a'
}</span>`;
}
}
if (key === 'didsCount') {
@ -90,6 +103,9 @@
: '-'
}</span>`;
}
if (key === 'time') {
val = `<span class="text-xs">${dateDistance(row.time)} ago</span>`;
}
if (key === 'host_raw') {
val = row.host;
}
@ -112,9 +128,10 @@
['Host', 'host'],
['DIDs', 'didsCount'],
['Size', 'size'],
['Location', 'country'],
['PLCs (User Domains)', 'plcs'],
['Location / Provider', 'country'],
//['PLCs (User Domains)', 'plcs'],
['Latency', 'responseTime'],
['First seen', 'time'],
['Last Online', 'lastOnline']
],
body: customTableMapper(
@ -126,8 +143,9 @@
'didsCount',
'size',
'location',
'plcs',
//'plcs',
'responseTime',
'time',
'lastOnline'
],
tableMap

Zobrazit soubor

@ -86,7 +86,7 @@
$: classesTable = `${element} ${text} ${color}`;
</script>
<div class="table-container {classesBase}">
<div class="table-container {classesBase}" id="table">
<!-- Table -->
<!-- prettier-ignore -->
<table
@ -134,10 +134,12 @@
aria-colindex={cellIndex + 1}
tabindex={cellIndex === 0 ? 0 : -1}
>
{@html cell ? cell : '-'}
{#if favoriteColumn !== null && favoriteColumn === cellIndex}
<i class="favorite fa-regular fa-star ml-1 {source.meta[rowIndex][3] !== undefined && source.meta[rowIndex][3] ? 'inline-block active text-yellow-500 opacity-100 hover:text-red-500' : 'opacity-50 hidden hover:text-green-500'} hover:opacity-100" on:click={(ev) => onFavoriteClick(ev, source.meta[rowIndex][0])}></i>
<div class="inline-block"><i class="favorite fa-regular fa-star ml-1 {source.meta[rowIndex][3] !== undefined && source.meta[rowIndex][3] ? 'inline-block active text-yellow-500 opacity-100 hover:text-red-500' : 'opacity-50 hidden hover:text-green-500'} hover:opacity-100" on:click={(ev) => onFavoriteClick(ev, source.meta[rowIndex][0])}></i></div>
{/if}
</td>
{/each}
</tr>

Zobrazit soubor

@ -1,5 +1,6 @@
import { persisted } from 'svelte-local-storage-store';
export const preferences = persisted('preferences', {
favoritePDS: []
favoritePDS: [],
pdsShowMap: true
});

Zobrazit soubor

@ -10,6 +10,7 @@
import { nats, connected, codec } from '$lib/sockets.js';
import { preferences } from '$lib/stores.js';
import { onMount, onDestroy } from 'svelte';
import { SlideToggle } from '@skeletonlabs/skeleton';
export let data;
@ -205,8 +206,18 @@
{#if $preferences.favoritePDS.length > 0}
<h2 class="h2">Your favourites</h2>
<PDSTable sourceData={favoritesData} {data} on:favoriteClick={(e) => onFavoriteClick(e)} />
{/if}
<h2 class="h2">All instances</h2>
<div class="flex">
<div class="grow"><h2 class="h2">PDS Worldwide</h2></div>
<div class="">
<SlideToggle name="slider-label" bind:checked={$preferences.pdsShowMap} size="sm"
>Show map</SlideToggle
>
</div>
</div>
{#if $preferences.pdsShowMap}
<PDSMap data={baseData} />
{/if}
{/if}
@ -217,10 +228,6 @@
{:else}
All PDS Instances ({formatNumber(sourceData.length)}):
{/if}
{#if !$search}
<PDSMap data={baseData} />
{/if}
</div>
<div class="min-h-screen">
<PDSTable