First commit

This commit is contained in:
Miraty 2022-11-03 15:23:59 +01:00
commit f89133c4d8
4 changed files with 462 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/target
/Cargo.lock

11
Cargo.toml Normal file
View File

@ -0,0 +1,11 @@
[package]
name = "ashbat"
version = "0.0.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
gtk = { version = "0.5.1", package = "gtk4"}
html_parser = "0.6.3"
hyper-rustls = "0.23.0"

85
src/main.rs Normal file
View File

@ -0,0 +1,85 @@
use gtk::prelude::*;
use gtk::{ScrolledWindow, Label, Align, Button, Application, LinkButton, PasswordEntry, ApplicationWindow, Box, Orientation, PolicyType};
use html_parser::{Dom, Node, Result};
const APP_ID: &str = "org.antopie.AshBat";
fn parse() -> Result<Vec<String>> {
let html = include_str!("test.html");
let dom = Dom::parse(html)?;
let iter = dom.children.get(0).unwrap().into_iter();
let hrefs = iter.filter_map(|item| match item {
Node::Element(ref element) if element.name == "a" => element.attributes["href"].clone(),
_ => None,
});
println!("\nThe following links where found:");
let mut vec: Vec<String> = Vec::new();
for (index, href) in hrefs.enumerate() {
println!("{}: {}", index + 1, &href);
vec.push(href);
}
Ok(vec)
}
fn build_ui(app: &Application) {
let vec = parse().expect("Nope");
let link_button = LinkButton::new("matrix:r/antopie-synapse:matrix.antopie.org");
let password_entry = PasswordEntry::new();
password_entry.set_show_peek_icon(true);
let text = Label::new(Some("If characters in @str are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use __ (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. The <mnemonic> key can be used to activate another widget, chosen automatically, or explicitly using set_mnemonic_widget()."));
Label::set_wrap(&text, true);
let button = Button::from_icon_name("go-next");
let gtk_box = Box::builder()
.margin_top(12)
.margin_bottom(12)
.margin_start(12)
.margin_end(12)
.valign(Align::Center)
.halign(Align::Center)
.spacing(12)
.orientation(Orientation::Vertical)
.build();
gtk_box.append(&link_button);
gtk_box.append(&password_entry);
gtk_box.append(&text);
gtk_box.append(&button);
let mut vec_button = Vec::new();
for x in &vec {
vec_button.push(LinkButton::new(x));
}
for x in &vec_button {
gtk_box.append(x);
}
let scrolled_window = ScrolledWindow::builder()
.hscrollbar_policy(PolicyType::Never) // Disable horizontal scrolling
.min_content_width(700)
.min_content_height(950)
.child(&gtk_box)
.build();
let window = ApplicationWindow::builder()
.application(app)
.title("AshBat")
.child(&scrolled_window)
.build();
window.present();
gtk_box.append(&Button::from_icon_name("go-next"));
}
fn main() {
let app = Application::builder().application_id(APP_ID).build();
app.connect_activate(build_ui);
app.run();
}

364
src/test.html Normal file
View File

@ -0,0 +1,364 @@
<!DOCTYPE html>
<html lang='fr'>
<head>
<meta charset='UTF-8'>
<title>
Antopie
</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' media='screen' href='css/lessphp_e812172780813a4257491ff1c04f16a55de36dd8.css'>
<link rel='icon' type='image/webp' href='img/icons/16.webp' sizes='16x16'>
<link rel='icon' type='image/webp' href='img/icons/32.webp' sizes='32x32'>
<link rel='icon' type='image/webp' href='img/icons/64.webp' sizes='64x64'>
<link rel='icon' type='image/webp' href='img/icons/128.webp' sizes='128x128'>
<link rel='icon' type='image/webp' href='img/icons/256.webp' sizes='256x256'>
<link rel='icon' type='image/webp' href='img/icons/512.webp' sizes='512x512'>
</head>
<body>
<header>
<a id='lienHeader' href='./'><img src='img/logo.webp' width='500' height='94' alt='Antopie'></a>
</header>
<div class='centered'>
<p>
Antopie propose des services Internet, administrés par et hébergés chez <a href='https://miraty.antopie.org/fr/index.html'>Miraty</a> grâce à <a href='https://yunohost.org'>YunoHost</a>.
</p>
<p>
Le compte <a href='https://mamot.fr/@Antopie' rel='me'>@Antopie@mamot.fr</a> (<a href='https://mamot.fr/@Antopie.rss'><abbr title='Really Simple Syndication'>RSS</abbr></a>) informe des pannes, mises à jour et nouveaux services.
</p>
<div class='row padRow'>
<a href='manifeste-sur-le-contenu.html' class='button'>Manifeste sur le contenu</a><br>
<a href='details-techniques.html' class='button'>Détails techniques</a><br>
<a href='cgu.html' class='button'>Conditions d'utilisation</a>
</div>
<div class='grid'>
<div>
<div>
<img src='img/logos/peertube.webp' width='75' height='100' alt=''>
</div>
<h1 class='titreService'>
PeerTube
</h1><small class='row'><a class='metaService' title='Site officiel de PeerTube' href='https://joinpeertube.org'>Site</a><br>
<a class='metaService' title='Code source de PeerTube' href='https://github.com/Chocobozzz/PeerTube'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de PeerTube' href='https://github.com/YunoHost-Apps/peertube_ynh'>Paquet</a></small>
<div class='descService'>
Regarder et publier des vidéos sur le <a href='https://fr.wikipedia.org/wiki/Fediverse'>Fédiverse</a>.
</div>
<div class='domService'>
<code>video.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://video.antopie.org'>Accéder au service</a>
</div>
</div>
<div>
<div>
<img src='img/logos/gitea.webp' width='100' height='100' alt=''>
</div>
<h1 class='titreService'>
Gitea
</h1><small class='row'><a class='metaService' title='Site officiel de Gitea' href='https://gitea.io'>Site</a><br>
<a class='metaService' title='Code source de Gitea' href='https://github.com/go-gitea/gitea'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Gitea' href='https://github.com/YunoHost-Apps/gitea_ynh'>Paquet</a></small>
<div class='descService'>
<a href='https://fr.wikipedia.org/wiki/Forge_(informatique)'>Forge logicielle</a> simple basée sur <a href='https://fr.wikipedia.org/wiki/Git'>Git</a>.
</div>
<div class='domService'>
<code>code.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://code.antopie.org'>Coder</a>
</div>
</div>
<div>
<div>
<img src='img/logos/libreqr.webp' width='100' height='100' alt=''>
</div>
<h1 class='titreService'>
LibreQR
</h1><small class='row'><a class='metaService' title='Code source de LibreQR' href='https://code.antopie.org/miraty/libreqr'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de LibreQR' href='https://code.antopie.org/miraty/qr_ynh'>Paquet</a></small>
<div class='descService'>
Un générateur de <a href='https://fr.wikipedia.org/wiki/Code_QR'>codes QR</a> fait maison.
</div>
<div class='domService'>
<code>qr.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://qr.antopie.org'>Générer un code QR</a>
</div>
</div>
<div>
<div>
<img src='img/logos/vaultwarden.webp' width='100' height='100' alt=''>
</div>
<h1 class='titreService'>
Vaultwarden
</h1><small class='row'><a class='metaService' title='Code source de Vaultwarden' href='https://github.com/dani-garcia/vaultwarden'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Vaultwarden' href='https://github.com/YunoHost-Apps/vaultwarden_ynh'>Paquet</a></small>
<div class='descService'>
Enregistrer des clés de passe. Compatible avec les <a href='https://bitwarden.com/download/'>clients Bitwarden</a>.
</div>
<div class='domService'>
<code>mdp.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://mdp.antopie.org'>Accéder au service</a>
</div>
</div>
<div>
<div>
<img src='img/logos/nextcloud.webp' width='150' height='68' alt=''>
</div>
<h1 class='titreService'>
Nextcloud
</h1><small class='row'><a class='metaService' title='Site officiel de Nextcloud' href='https://nextcloud.com/fr_FR'>Site</a><br>
<a class='metaService' title='Code source de Nextcloud' href='https://github.com/nextcloud/server'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Nextcloud' href='https://github.com/YunoHost-Apps/nextcloud_ynh'>Paquet</a></small>
<div class='descService'>
Synchronisation de fichiers, de contacts (<a href='https://fr.wikipedia.org/wiki/CardDAV'>CardDAV</a>), dagenda (<a href='https://fr.wikipedia.org/wiki/CalDAV'>CalDAV</a>), <a href='https://getcarnet.app/'>Carnet</a> , et plein dautres fonctionnalités grâce à des extensions.
</div>
<div class='domService'>
<code>nuage.antopie.org</code>
</div>
<div>
<a class='smallButton' href='nextcloud.html'>Présentation</a>
</div>
<div>
<a class='smallButton action' href='https://nuage.antopie.org'>Accéder au service</a>
</div>
</div>
<div>
<div>
<img src='img/logos/matrix.webp' width='95' height='100' alt=''>
</div>
<h1 class='titreService'>
Synapse
</h1><small class='row'><a class='metaService' title='Code source de Synapse' href='https://github.com/matrix-org/synapse'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Synapse' href='https://github.com/YunoHost-Apps/synapse_ynh'>Paquet</a></small>
<div class='descService'>
Un serveur <a href='https://fr.wikipedia.org/wiki/Matrix_(protocole)'>Matrix</a>, qui est un protocole internet moderne pour la communication écrite, audio ou vidéo.
</div>
<div class='domService'>
<code>matrix.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://matrix.antopie.org/_matrix/static/'>Plus d'infos</a>
</div>
</div>
<div>
<div>
<img src='img/logos/element.webp' width='100' height='100' alt=''>
</div>
<h1 class='titreService'>
Element
</h1><small class='row'><a class='metaService' title='Site officiel de Element' href='https://element.io'>Site</a><br>
<a class='metaService' title='Code source de Element' href='https://github.com/vector-im/element-web'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Element' href='https://github.com/YunoHost-Apps/element_ynh'>Paquet</a></small>
<div class='descService'>
Client Web pour <a href='https://fr.wikipedia.org/wiki/Matrix_(protocole)'>Matrix</a>.
</div>
<div class='domService'>
<code>el.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://el.antopie.org'>Clavarder</a>
</div>
</div>
<div>
<div>
<img src='img/logos/privatebin.webp' width='94' height='100' alt=''>
</div>
<h1 class='titreService'>
PrivateBin
</h1><small class='row'><a class='metaService' title='Site officiel de PrivateBin' href='https://privatebin.info'>Site</a><br>
<a class='metaService' title='Code source de PrivateBin' href='https://github.com/PrivateBin/PrivateBin'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de PrivateBin' href='https://github.com/YunoHost-Apps/zerobin_ynh'>Paquet</a></small>
<div class='descService'>
Partager des textes, codes sources ou <a href='https://fr.wikipedia.org/wiki/Markdown'>Markdown</a> rapidement.
</div>
<div class='domService'>
<code>texte.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://texte.antopie.org'>Téléverser du texte</a>
</div>
</div>
<div>
<div>
<img src='img/logos/jirafeau.webp' width='100' height='100' alt=''>
</div>
<h1 class='titreService'>
Jirafeau
</h1><small class='row'><a class='metaService' title='Code source de Jirafeau' href='https://gitlab.com/mojo42/Jirafeau'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Jirafeau' href='https://github.com/YunoHost-Apps/jirafeau_ynh'>Paquet</a></small>
<div class='descService'>
Rendre un fichier accessible par une URL Web.
</div>
<div class='domService'>
<code>up.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://up.antopie.org'>Téléverser un fichier</a>
</div>
</div>
<div>
<div>
<img src='img/logos/etherpad.webp' width='59' height='100' alt=''>
</div>
<h1 class='titreService'>
Etherpad
</h1><small class='row'><a class='metaService' title='Site officiel de Etherpad' href='https://etherpad.org'>Site</a><br>
<a class='metaService' title='Code source de Etherpad' href='https://github.com/ether/etherpad-lite'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Etherpad' href='https://github.com/YunoHost-Apps/etherpad_mypads_ynh'>Paquet</a></small>
<div class='descService'>
Éditer un texte sur plusieurs appareils en même temps. Utilisable avec <a href='https://pad.antopie.org/mypads/'>MyPads</a>.
</div>
<div class='domService'>
<code>pad.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://pad.antopie.org'>Créer un bloc-notes</a>
</div>
</div>
<div>
<div>
<img src='img/logos/diagrams.webp' width='80' height='80' alt=''>
</div>
<h1 class='titreService'>
Diagrammes
</h1><small class='row'><a class='metaService' title='Site officiel de Diagrammes' href='https://www.diagrams.net'>Site</a><br>
<a class='metaService' title='Code source de Diagrammes' href='https://github.com/jgraph/drawio'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Diagrammes' href='https://github.com/YunoHost-Apps/diagramsnet_ynh'>Paquet</a></small>
<div class='descService'>
Créer des diagrammes.
</div>
<div class='domService'>
<code>draw.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://draw.antopie.org'>Accéder au service</a>
</div>
</div>
<div>
<div>
<img src='img/logos/opensondage.webp' width='64' height='64' alt=''>
</div>
<h1 class='titreService'>
OpenSondage
</h1><small class='row'><a class='metaService' title='Code source de OpenSondage' href='https://framagit.org/framasoft/framadate/framadate'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de OpenSondage' href='https://github.com/YunoHost-Apps/opensondage_ynh'>Paquet</a></small>
<div class='descService'>
Planifier un rendez-vous et prendre des décisions.
</div>
<div class='domService'>
<code>sondage.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://sondage.antopie.org'>Créer un sondage</a>
</div>
</div>
<div>
<h1 class='titreService'>
Méta
</h1><small class='row'><a class='metaService' title='Code source de Méta' href='https://code.antopie.org/miraty/meta'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Méta' href='https://github.com/YunoHost-Apps/my_webapp_ynh'>Paquet</a></small>
<div class='descService'>
Afficher diverses métadonnées techniques relatives à la transmission de la page.
</div>
<div class='domService'>
<code>meta.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://meta.antopie.org'>Accéder au service</a>
</div>
</div>
<div>
<div>
<img src='img/logos/rssbridge.webp' width='150' height='31' alt=''>
</div>
<h1 class='titreService'>
RSS Bridge
</h1><small class='row'><a class='metaService' title='Code source de RSS Bridge' href='https://github.com/rss-bridge/rss-bridge'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de RSS Bridge' href='https://github.com/YunoHost-Apps/rss-bridge_ynh'>Paquet</a></small>
<div class='descService'>
Exporter les données de centaines de sites aux formats <a href='https://fr.wikipedia.org/wiki/Atom_Syndication_Format'>Atom</a>, <a href='https://fr.wikipedia.org/wiki/JavaScript_Object_Notation'>JSON</a>, Mrss ou texte brut.
</div>
<div class='domService'>
<code>rss.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://rss.antopie.org'>Bridger</a>
</div>
</div>
<div>
<div>
<img src='img/logos/searx.webp' width='109' height='100' alt=''>
</div>
<h1 class='titreService'>
Searx
</h1><small class='row'><a class='metaService' title='Site officiel de Searx' href='https://asciimoo.github.io/searx'>Site</a><br>
<a class='metaService' title='Code source de Searx' href='https://github.com/searx/searx'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Searx' href='https://github.com/YunoHost-Apps/searx_ynh'>Paquet</a></small>
<div class='descService'>
<a href='https://fr.wikipedia.org/wiki/M%C3%A9tamoteur'>Métamoteur</a> anonymé : combine plusieurs moteurs de recherche sur une seule page.
</div>
<div class='domService'>
<code>searx.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://searx.antopie.org'>Rechercher</a>
</div>
</div>
<div>
<div>
<img src='img/logos/invidious.webp' width='100' height='96' alt=''>
</div>
<h1 class='titreService'>
Invidious
</h1><small class='row'><a class='metaService' title='Code source de Invidious' href='https://github.com/iv-org/invidious'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Invidious' href='https://github.com/YunoHost-Apps/invidious_ynh'>Paquet</a></small>
<div class='descService'>
Interface plus libre, légère et confidentielle pour accéder au contenu du service privateur YouTube.
</div>
<div class='domService'>
<code>inv.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://inv.antopie.org'>Accéder au service</a>
</div>
</div>
<div>
<div>
<img src='img/logos/nitter.webp' width='100' height='122' alt=''>
</div>
<h1 class='titreService'>
Nitter
</h1><small class='row'><a class='metaService' title='Code source de Nitter' href='https://github.com/zedeus/nitter'>Source</a><br>
<a class='metaService' title='Paquet YunoHost de Nitter' href='https://github.com/YunoHost-Apps/nitter_ynh'>Paquet</a></small>
<div class='descService'>
Interface plus libre, légère et confidentielle pour accéder au contenu du service privateur Twitter.
</div>
<div class='domService'>
<code>nitter.antopie.org</code>
</div>
<div>
<a class='smallButton action' href='https://nitter.antopie.org'>Accéder au service</a>
</div>
</div>
</div>
</div>
<footer>
<div class='interlude'>
<hr>
</div>
<div class='row padRow'>
<a href='https://miraty.antopie.org/fr/contact.html' class='button'>Me contacter</a><br>
<a href='http://sou4vla4k5peskbl3dlzhh3e6ve5eu3m3hhsmiidqevlsd6lqo3qq2ad.onion/index' class='button'>Accès Onion</a>
</div>
<div>
Services auto-hébergés avec datalove à Paris.<br>
Les <a href='https://code.antopie.org/Antopie/antopie'>sources de ce site</a> sont publiées sous <abbr title='GNU Affero General Public License version 3 ou toute version ultérieure'><a href='LICENSE.en.html'>AGPLv3</a>+</abbr>.
</div>
</footer>
</body>
</html>