This commit is contained in:
tree 2023-01-23 03:37:00 +01:00
rodič b25a0acff4
revize 90e22c56c0
6 změnil soubory, kde provedl 164 přidání a 5 odebrání

Zobrazit soubor

@ -14,4 +14,7 @@ format:
fmt: format
build:
deno run --unstable --allow-read --allow-write utils/exec.js build
deno run --unstable --allow-read --allow-write utils/exec.js build
event-sync:
deno run --unstable --allow-read --allow-write --allow-net utils/eventSync.js

Zobrazit soubor

@ -0,0 +1,7 @@
export async function data($) {
const bundle = await $.loadJSONUrl("https://spec.utxo.cz/23/bundle.json");
return {
speakers: bundle.spec.speakers,
tracks: bundle.spec.tracks,
};
}

Zobrazit soubor

@ -0,0 +1,110 @@
{
"speakers": [
{
"id": "petr-lukac",
"name": "Petr Lukáč",
"twitter": "RuzovejSlon",
"bio": "Novinář, podcaster",
"orgs": "Podcast [Krypto Space](https://www.kryptospace.cz/)\n",
"tracks": [
"spolecnost"
],
"country": "cz",
"photos": [
"web:png",
"twitter:jpg"
]
},
{
"id": "tereza-starostova",
"name": "Tereza Starostová",
"twitter": "terkastarostova",
"orgs": "Spoluzakladatelka [Holky v Kryptu](https://holkyvkryptu.cz/), předsedkyně [UTXO Foundation](httsp://utxo.foundation)\n",
"tracks": [
"zaklady",
"spolecnost"
],
"country": "cz",
"photos": [
"twitter:jpg"
]
},
{
"id": "tree",
"name": "tree",
"twitter": "treecz",
"bio": "Libertarián, propagátor Web3 a DAOs",
"orgs": "Zakladatel [Gwei.cz](https://gwei.cz). Organizátor [ETHBrno](https://ethbrno.cz/), [UTXO.23](https://utxo.cz) a dalších akcí\n",
"country": "cz",
"tracks": [
"eth",
"defi",
"dao"
],
"desc": "Founder of @gweicz | 🦄 #Ethereum #DeFi #DAO enthusiast 🦇🔊 | ✈️ #travel maniac | ⚡ riding #electricunicycle | 🇨🇿🇬🇧 lang | 🟡⚫ | 🇺🇦 Слава Україні!\n",
"photos": [
"twitter:jpg"
]
}
],
"tracks": [
{
"id": "zaklady",
"name": "Základy kryptoměn",
"shortname": "Základy",
"examples": "* principy otevřených projektů (blockchainů)\n* základy bezpečnosti a soukromí\n* peněženky - SW, HW\n* základy obchodování - DCA\n"
},
{
"id": "btc",
"name": "Bitcoin",
"examples": "* Bitcoin jako peníze\n* Lightning Network - adopce, implementace\n* Taproot\n* Bitcoin mining\n* smart-kontrakty na bitcoinu (RGB)\n"
},
{
"id": "eth",
"name": "Ethereum a smart-kontrakty obecně",
"shortname": "Ethereum",
"examples": "* Ethereum 2.0\n* Layer2 - rollupy\n* (EVM) Sidechainy\n* vývoj smart-kontraktů (solidity)\n* MEV - Miner Extractable Value\n"
},
{
"id": "defi",
"name": "Decentralizované finance (DeFi)",
"shortname": "DeFi",
"examples": "* stablecoiny\n* lending protokoly\n* DEX - decentralizované burzy\n* predikční trhy\n* futures/options kontrakty\n* tokenizace\n"
},
{
"id": "dao",
"name": "Decentralizované organizace (DAO)",
"shortname": "DAOs",
"examples": "* budoucnost organizací\n* showcase jednotlivých DAOs\n"
},
{
"id": "nft",
"name": "NFTs a Metaverse",
"shortname": "NFTs/Metaverse",
"examples": "* NFT umění\n* NFT collectibles\n* gaming\n* Metaverse\n"
},
{
"id": "alty",
"name": "Experimentální L1 blockchainy a další altcoiny",
"shortname": "Alternativní L1",
"examples": "* Polkadot\n* Cardano\n* Cosmos (Secret Network..)\n* Solana\n* NEAR\n* Monero\n* ...\n"
},
{
"id": "regulace",
"name": "Regulace a fiat rampy",
"shortname": "Regulace",
"examples": "* legislativa\n* směnárny a burzy\n* darování kryptoměn\n* insitucionální peníze v kryptoměnách\n"
},
{
"id": "spolecnost",
"name": "Krypto-společnost",
"shortname": "Společnost",
"examples": "* odluka peněz od státu\n* kryptoanarchismus, anarchokapitalismus, meritokracie\n* představení lokálních krypto-komunit\n* fenomén maximalismu\n"
},
{
"id": "other",
"name": "Ostatní",
"hidden": true
}
]
}

Zobrazit soubor

@ -1,6 +1,7 @@
import { emptyDir, exists } from "https://deno.land/std@0.119.0/fs/mod.ts";
import { parse as tomlParse } from "https://deno.land/std@0.173.0/encoding/toml.ts";
import { load as yamlLoad } from "https://deno.land/x/js_yaml_port@3.14.0/js-yaml.js";
import * as syncTools from "./syncTools.js";
let _silentMode = false;
@ -13,7 +14,7 @@ export class DeConfEngine {
this.githubUrl = this.options.githubUrl ||
"https://github.com/utxo-foundation/prague-blockchain-week/tree/main/data";
if (options.silentMode) {
if (options.silent) {
_silentMode = true;
}
}
@ -108,18 +109,36 @@ class DeConf_Event {
constructor(id) {
this.id = id;
this.data = null;
this.dir = null;
}
async load(dir) {
this.dir = dir.join("/");
const efIndex = await _tomlLoad([...dir, "index.toml"].join("/"));
const event = {
const data = {
index: { id: this.id, ...efIndex },
};
this.data = event;
const syncDataFn = [...dir, "data.json"].join("/");
if (await exists(syncDataFn)) {
data.sync = await _jsonLoad(syncDataFn);
}
this.data = data;
}
async sync() {
const syncFile = [this.dir, "_sync.js"].join("/");
if (!await exists(syncFile)) return null;
if (!_silentMode) console.log(`syncing ${this.id} ..`);
const module = await import("../" + syncFile);
// data
if (module.data) {
const data = await module.data(syncTools);
await _jsonWrite([this.dir, "data.json"].join("/"), data);
}
}
toJSON() {
return Object.assign({ id: this.id }, this.data.index);
return Object.assign({ id: this.id }, this.data.index, this.data.sync);
}
}
@ -139,3 +158,6 @@ async function _jsonWrite(fn, data) {
}
return true;
}
async function _jsonLoad(fn) {
return JSON.parse(await Deno.readTextFile(fn));
}

12
utils/eventSync.js Normal file
Zobrazit soubor

@ -0,0 +1,12 @@
import { DeConfEngine } from "./engine.js";
const dc = new DeConfEngine();
await dc.init();
// pick last entry (eq. "23")
const entry = dc.entries[dc.entries.length - 1];
console.log(`entry=${entry.id}`);
for (const event of entry.data.events) {
await event.sync();
}

5
utils/syncTools.js Normal file
Zobrazit soubor

@ -0,0 +1,5 @@
export async function loadJSONUrl(url) {
const resp = await fetch(url);
const data = await resp.json();
return data;
}