This commit is contained in:
2026-04-20 15:32:19 +02:00
commit 0858b72e31
36 changed files with 6359 additions and 0 deletions

44
.gitignore vendored Normal file
View File

@@ -0,0 +1,44 @@
Cargo.lock
/target/
# Logs
logs
*.log
npm-debug.log*
# mails
*.eml
# Node
node_modules
package-lock.json
dist
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.settings
.project
# PID
*.pid
# var folder
var/
# env
.env
!.env.dev
config.json
# sqlite
dbdata
*.db
*.db-shm
*.db-wal

3
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"recommendations": ["rust-lang.rust-analyzer"]
}

71
Cargo.toml Normal file
View File

@@ -0,0 +1,71 @@
# file: Cargo.toml
[workspace]
resolver = "3"
members = [
"kb_lib",
"kb_app",
]
[workspace.package]
version = "0.0.1"
edition = "2024"
license = "MIT"
repository = "https://git.sasedev.com/Sasedev/khadhroony-bobobot"
authors = ["SinuS von SifriduS <sinus@sasedev.net>"]
publish = false
[workspace.dependencies]
argon2 = { version = "^0.5", features = ["std", "zeroize"] }
async-trait = { version = "^0.1", features = [] }
base64 = { version = "^0.22", features = [] }
chacha20poly1305 = { version = "^0.10", features = ["std", "stream"] }
chrono = { version = "^0.4", features = ["serde"] }
fs2 = { version = "^0.4", features = [] }
futures-util = { version = "^0.3", features = ["default", "std" ,"futures-sink"] }
jsonschema = { version = "^0.40", features = [] }
rand = { version = "^0.10", features = ["std", "serde", "sys_rng"] }
reqwest = { version = "^0.13", default-features = false, features = ["charset", "cookies", "deflate", "form", "gzip", "http2", "json", "multipart", "query", "rustls", "socks", "stream", "zstd"] }
rustls = { version = "^0.23", features = ["aws-lc-rs"] }
serde = { version = "^1.0", features = ["derive"] }
serde_json = { version = "^1.0", features = [] }
solana-account-decoder-client-types = { version = "4.0.0-beta.7", features = ["zstd"] }
solana-address-lookup-table-interface = { version = "^3.0", features = ["bincode", "serde"] }
solana-client = { version = "^3.1", features = [] }
solana-compute-budget-interface = { version = "^3.0", features = ["borsh", "serde"] }
solana-rpc-client-api = { version = "4.0.0-beta.7", features = [] }
solana-rpc-client-types = { version = "4.0.0-beta.7", features = [] }
solana-sdk = { version = "^4.0", features = ["full"] }
solana-sdk-ids = { version = "^3.1", features = [] }
solana-system-interface = { version = "^3.0", features = ["alloc", "bincode", "serde", "std"] }
solana-transaction-status-client-types = { version = "4.0.0-beta.7", features = [] }
spl-associated-token-account-interface = { version = "^2.0", features = ["borsh"] }
spl-memo-interface = { version = "^2.0", features = [] }
spl-token-interface = { version = "^2.0", features = [] }
spl-token-2022-interface = { version = "^2.1", features = [] }
sqlx = { version = "^0.8", features = ["chrono", "uuid", "bigdecimal", "json", "sqlite", "runtime-tokio-rustls"] }
tauri = { version = "^2.10", features = ["default"] }
tauri-build = { version = "2", features = [] }
tauri-plugin-tracing = { version = "^0.3", features = [] }
tempfile = { version = "^3", features = [] }
tokio = { version = "^1.52", features = ["full"] }
tokio-stream = { version = "^0.1", features = ["full"] }
tokio-tungstenite = { version = "^0.29", default-features = false, features = ["connect", "handshake", "rustls-tls-webpki-roots", "stream", "url"] }
tracing = { version = "^0.1", features = [] }
tracing-appender = { version = "^0.2", features = [] }
tracing-subscriber = { version = "^0.3", features = ["ansi", "env-filter", "chrono", "serde", "json"] }
ts-rs = { version = "^12.0", features = [] }
yellowstone-grpc-client = { version = "^13.0", features = [] }
yellowstone-grpc-proto = { version = "^12.2", features = [] }
uuid = { version = "^1.23", features = ["v4", "serde"] }
zeroize = { version = "^1.8", features = ["derive", "serde", "std"] }
[profile.dev]
incremental = true # Compile your binary in smaller steps.
[profile.release]
codegen-units = 1 # Allows LLVM to perform better optimization.
lto = true # Enables link-time-optimizations.
opt-level = 3 # s Prioritizes small binary size. Use `3` if you prefer speed.
panic = "abort" # Higher performance by disabling panic handlers.
strip = true # Ensures debug symbols are removed.

34
kb_app/Cargo.toml Normal file
View File

@@ -0,0 +1,34 @@
# file: kb_app/Cargo.toml
[package]
name = "kb_app"
edition.workspace = true
version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[lib]
# The `_lib` suffix may seem redundant, but it is necessary
# to make the lib name unique and wouldn't conflict with the bin name.
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
name = "kb_app_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build.workspace = true
[dependencies]
fs2.workspace = true
kb_lib = { path = "../kb_lib" }
rustls.workspace = true
serde.workspace = true
serde_json.workspace = true
tauri.workspace = true
tauri-plugin-tracing.workspace = true
tokio.workspace = true
tracing.workspace = true
tracing-appender.workspace = true
tracing-subscriber.workspace = true
ts-rs.workspace = true
uuid.workspace = true

5
kb_app/build.rs Normal file
View File

@@ -0,0 +1,5 @@
// file: kb_app/build.rs
fn main() {
tauri_build::build()
}

View File

@@ -0,0 +1,10 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main", "splash"],
"permissions": [
"core:default",
"tracing:default"
]
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 KiB

View File

@@ -0,0 +1,51 @@
<!-- file: kb_app/frontend/index.html -->
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Khadhroony-BoBoBot</title>
<link rel="stylesheet" href="sass/main.scss" />
</head>
<body class="bg-body-tertiary">
<header class="app-header">
<nav class="navbar navbar-expand-lg h-100 py-0 bg-light text-dark">
<div class="container my-0">
<a class="navbar-brand d-flex align-items-center" href="/"> <img alt="Logo" src="imgs/logo.png" class="app-logo" /> <span class="ps-2 fs-4 fw-bold text-primary font-logo">Khadhroony-BoBot</span>
</a>
</div>
</nav>
</header>
<main class="app-main">
<div class="osb-scrollable pt-1 pb-4" data-simplebar>
<div class="container vcentered sketchy-translucid">
<div class="row">
<div class="col-lg-12 text-center">
<h1>Khadhroony-BoBoBot</h1>
<div class="container py-4">
<div class="row g-4">
<div class="col-12 col-xl-4">
<div class="card shadow-sm border-0 h-100">
<div class="card-body text-start">
<h3 class="h5 card-title mb-3">Content</h3>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<footer class="app-footer bg-dark text-light">
<div class="container h-100 d-flex align-items-center">
<div class="row flex-grow-1 align-items-center">
<div class="col-12 col-md-4 text-center text-small my-1 my-md-0">&copy; 2026 SASEDEV</div>
</div>
</div>
</footer>
<script type="module" src="ts/main.ts" defer></script>
</body>
</html>

View File

@@ -0,0 +1,319 @@
// file: kb_app/frontend/sass/_app.scss
$app-header-height: 48px;
$app-footer-height: 48px;
$sidenav-base-width: 260px;
html,
body {
height: 100%;
overflow: hidden;
}
body {
min-height: 100vh;
}
#ibackground {
position: fixed;
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: 1;
object-fit: cover;
}
#vbackground {
position: fixed;
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: 2;
object-fit: cover;
}
video#vbackground:not([playsinline]) {
display: none;
}
.app-header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: $app-header-height;
z-index: 1030;
& nav {
border-top: none !important;
border-left: none !important;
border-right: none !important;
border-bottom: 3px $primary solid !important;
border-top-left-radius: 0 !important;
border-top-right-radius: 0 !important;
border-bottom-left-radius: 15px 150px;
border-bottom-right-radius: 75px 25px;
}
}
.app-footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: $app-footer-height;
z-index: 1020;
border-style: solid;
border-width: 2px 0 0;
border-top-left-radius: 255px 25px;
border-top-right-radius: 25px 225px;
}
.app-main {
position: relative;
height: calc(100vh - $app-header-height - $app-footer-height); // plein viewport
margin-top: $app-header-height;
margin-bottom: $app-footer-height;
box-sizing: border-box;
overflow: hidden; // pas de scroll ici
z-index: 500;
}
.app-main-error {
position: relative;
height: 100vh; // plein viewport
padding-top: $app-header-height;
padding-bottom: $app-footer-height;
box-sizing: border-box;
overflow: hidden; // pas de scroll ici
background: linear-gradient(135deg, #9945ff 0%, #764ba2 100%);
color: white;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
z-index: 501;
}
.app-main-error-content {
width: 100%;
& h1 {
font-size: 4rem;
margin: 0;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
& p {
font-size: 1.5rem;
margin: 1rem 0 2rem;
}
}
.app-logo {
height: 42px;
width: auto;
display: block;
}
#app-dashbord {
display: flex;
height: 100%; //height: calc(100vh - var(--app-header-height) - var(--app-footer-height));
}
#app-dashbord-sidenav {
flex-basis: $sidenav-base-width;
flex-shrink: 0;
transition: transform 0.15s ease-in-out;
&[dir="ltr"] {
transform: translateX(-$sidenav-base-width);
}
&[dir="rtl"] {
transform: translateX($sidenav-base-width);
}
}
#app-dashbord-main {
position: relative;
display: flex;
flex-direction: column;
min-width: 0;
flex-grow: 1;
min-height: 100%;
&[dir="ltr"] {
margin-left: -$sidenav-base-width;
}
&[dir="rtl"] {
margin-right: -$sidenav-base-width;
}
}
// quand body a la classe .sidenav-toggled
.sidenav-toggled {
#app-dashbord-sidenav {
transform: translateX(0);
}
#app-dashbord-main {
&:before {
content: "";
display: block;
position: absolute;
inset: 0;
background: #000;
opacity: 0.5;
transition: opacity 0.3s ease-in-out;
}
}
}
// breakpoint desktop : sidebar visible par défaut
@include media-breakpoint-up(lg) {
#app-dashbord-sidenav {
transform: translateX(0);
}
#app-dashbord-main {
margin-left: 0;
margin-right: 0;
transition: margin 0.15s ease-in-out;
}
.sidenav-toggled {
#app-dashbord-sidenav {
&[dir="ltr"] {
transform: translateX(-$sidenav-base-width);
}
&[dir="rtl"] {
transform: translateX($sidenav-base-width);
}
}
#app-dashbord-main {
&[dir="ltr"] {
margin-left: -$sidenav-base-width;
}
&[dir="rtl"] {
margin-right: -$sidenav-base-width;
}
&:before {
display: none;
}
}
}
}
// ------------------------------------------------------------------
// Sidebar (style SBAdmin-ish)
// ------------------------------------------------------------------
.app-sidebar.sidenav {
display: flex;
flex-direction: column;
height: 100%;
flex-wrap: nowrap;
background-color: rgb(97, 53, 131, 0.7);
color: #fff;
}
.sidenav-menu {
flex-grow: 1;
.nav {
flex-direction: column;
flex-wrap: nowrap;
}
.sidenav-menu-heading {
padding: 1.5rem 1rem 0.75rem;
font-size: 0.75rem;
font-weight: bold;
text-transform: uppercase;
color: rgba(255, 255, 255, 0.5);
}
.nav-link {
display: flex;
align-items: center;
padding: 0.75rem 1.25rem;
color: rgba(255, 255, 255, 0.8);
position: relative;
&:hover,
&.active {
color: #fff;
background: rgba(255, 255, 255, 0.08);
}
.nav-link-icon {
font-size: 0.9rem;
margin-right: 0.5rem;
}
.sidenav-collapse-arrow {
margin-left: auto;
transition: transform 0.15s ease;
}
&.collapsed {
.sidenav-collapse-arrow {
transform: rotate(-90deg);
}
}
}
.sidenav-menu-nested {
margin-left: 1.5rem;
flex-direction: column;
}
}
.osb-scrollable {
height: 100%; // occupe toute la hauteur de .app-main
max-height: 100%; // évite de dépasser
// Pour vérifier sans OverlayScrollbars :
//
}
.hero {
padding: 2rem;
background: white;
}
.modal {
z-index: 1080;
}
.modal-backdrop {
z-index: -1;
}
.voice-output-textarea {
min-height: 320px;
resize: vertical;
font-size: 1.05rem;
line-height: 1.5;
}
#logs-card {
transition: opacity 0.15s ease-in-out;
}

View File

@@ -0,0 +1,159 @@
// file: kb_app/frontend/sass/_bootswatch.scss
// Pulse 5.3.8
// Bootswatch
// Variables
// Buttons
.btn {
&:focus,
&:active,
&:active:focus,
&.active:focus {
outline: none;
}
&-secondary {
color: $gray-900;
background-color: $white;
border-color: #ccc;
&:hover {
color: $gray-900;
background-color: $gray-300;
border-color: $gray-500;
}
&.disabled {
color: tint-color($gray-900, 5%);
background-color: $white;
border-color: tint-color(#ccc, 5%);
}
}
&-warning {
color: $white;
}
&-primary:focus {
box-shadow: 0 0 5px tint-color($primary, 10%);
}
&-secondary:focus {
box-shadow: 0 0 5px $gray-400;
}
&-success:focus {
box-shadow: 0 0 5px tint-color($success, 10%);
}
&-info:focus {
box-shadow: 0 0 5px tint-color($info, 10%);
}
&-warning:focus {
box-shadow: 0 0 5px tint-color($warning, 10%);
}
&-danger:focus {
box-shadow: 0 0 5px tint-color($danger, 10%);
}
&.disabled:focus {
box-shadow: none;
}
}
// Tables
.table .thead-dark th {
background-color: $secondary;
border-color: $table-border-color;
}
.table-primary,
.table-secondary,
.table-success,
.table-warning,
.table-danger,
.table-info,
.table-light {
--#{$prefix}table-color: #{$body-color};
}
// Forms
.form-control:focus {
box-shadow: 0 0 5px rgba(100, 65, 164, .4);
}
// Navs
.nav-tabs {
.nav-link,
.nav-link.active {
border-width: 0 0 1px;
}
.nav-link:hover,
.nav-link.active,
.nav-link.active:hover,
.nav-link.active:focus {
border-bottom: 1px solid $primary;
}
.nav-item+.nav-item {
margin-left: 0;
}
}
.breadcrumb {
&-item.active {
color: $gray-700;
}
}
// Indicators
.badge {
&.bg-light {
color: $dark;
}
}
// Progress bars
.progress {
height: 8px;
}
// Containers
.list-group {
&-item {
color: rgba(255, 255, 255, .8);
&.active,
&:hover,
&:focus {
color: $white;
}
&.active {
font-weight: 700;
&:hover {
background-color: $list-group-hover-bg;
}
}
&.disabled:hover {
color: $list-group-disabled-color;
}
}
}

View File

@@ -0,0 +1,18 @@
// file: kb_app/frontend/sass/_fontawesome.scss
//@use '@fortawesome/fontawesome-free/scss/variables' with (
// // customizing $font-path - make sure it points to where your webfonts are stored in your project
// $font-path: '../webfonts',
//);
@use '@fortawesome/fontawesome-free/scss/variables' with (
// use fonts from @fortawesome/fontawesome-free
$font-path: '@fortawesome/fontawesome-free/webfonts',
);
// load Font Awesome core
@use '@fortawesome/fontawesome-free/scss/fontawesome';
// load and make available Font Awesome helpers (mixins, functions, and variables)
@use '@fortawesome/fontawesome-free/scss/fa' as fa;
@use '@fortawesome/fontawesome-free/scss/brands' as fa-brands;
@use '@fortawesome/fontawesome-free/scss/regular' as fa-regular;
@use '@fortawesome/fontawesome-free/scss/solid' as fa-solid;

View File

@@ -0,0 +1,247 @@
// file: kb_app/frontend/sass/_simplebar.scss
/* Rtl support */
[data-simplebar] {
position: relative;
flex-direction: column;
flex-wrap: wrap;
justify-content: flex-start;
align-content: flex-start;
align-items: flex-start;
}
.simplebar-wrapper {
overflow: hidden;
width: inherit;
height: inherit;
max-width: inherit;
max-height: inherit;
}
.simplebar-mask {
direction: inherit;
position: absolute;
overflow: hidden;
padding: 0;
margin: 0;
left: 0;
top: 0;
bottom: 0;
right: 0;
width: auto !important;
height: auto !important;
// z-index: 0;
inset: 0;
}
.simplebar-offset {
direction: inherit !important;
box-sizing: inherit !important;
resize: none !important;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
padding: 0;
margin: 0;
-webkit-overflow-scrolling: touch;
inset: 0;
}
.simplebar-content-wrapper {
direction: inherit;
box-sizing: border-box !important;
position: relative;
display: block;
height: 100%;
width: auto;
max-width: 100%;
max-height: 100%;
overflow: auto;
scrollbar-width: none;
-ms-overflow-style: none;
&::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
}
}
.simplebar-hide-scrollbar {
&::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
}
position: fixed;
left: 0;
visibility: hidden;
overflow-y: scroll;
scrollbar-width: none;
-ms-overflow-style: none;
}
.simplebar-content {
&:before {
content: ' ';
display: table;
}
&:after {
content: ' ';
display: table;
}
}
.simplebar-placeholder {
max-height: 100%;
max-width: 100%;
width: 100%;
pointer-events: none;
}
.simplebar-height-auto-observer-wrapper {
box-sizing: inherit !important;
height: 100%;
width: 100%;
max-width: 1px;
position: relative;
float: left;
max-height: 1px;
overflow: hidden;
// z-index: -1;
padding: 0;
margin: 0;
pointer-events: none;
flex-grow: inherit;
flex-shrink: 0;
flex-basis: 0;
}
.simplebar-height-auto-observer {
box-sizing: inherit;
display: block;
opacity: 0;
position: absolute;
top: 0;
left: 0;
height: 1000%;
width: 1000%;
min-height: 1px;
min-width: 1px;
overflow: hidden;
pointer-events: none;
// z-index: -1;
}
.simplebar-track {
// z-index: 1;
position: absolute;
right: 0;
bottom: 0;
pointer-events: none;
overflow: hidden;
}
[data-simplebar].simplebar-dragging {
pointer-events: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
.simplebar-content {
pointer-events: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.simplebar-track {
pointer-events: all;
}
}
.simplebar-scrollbar {
position: absolute;
left: 0;
right: 0;
min-height: 10px;
&:before {
position: absolute;
content: '';
background: black;
border-radius: 7px;
left: 2px;
right: 2px;
opacity: 0;
transition: opacity 0.2s 0.5s linear;
top: 2px;
bottom: 2px;
}
}
.simplebar-scrollbar.simplebar-visible {
&:before {
opacity: 0.5;
transition-delay: 0s;
transition-duration: 0s;
}
}
.simplebar-track.simplebar-vertical {
top: 0;
width: 11px;
}
.simplebar-track.simplebar-horizontal {
left: 0;
height: 11px;
.simplebar-scrollbar {
right: auto;
left: 0;
top: 0;
bottom: 0;
min-height: 0;
min-width: 10px;
width: auto;
}
}
[data-simplebar-direction='rtl'] {
.simplebar-track.simplebar-vertical {
right: auto;
left: 0;
}
}
.simplebar-dummy-scrollbar-size {
direction: rtl;
position: fixed;
opacity: 0;
visibility: hidden;
height: 500px;
width: 500px;
overflow-y: hidden;
overflow-x: scroll;
-ms-overflow-style: scrollbar !important;
>div {
width: 200%;
height: 200%;
margin: 10px 0;
}
}
.simplebar-hover {
cursor: pointer;
}

View File

@@ -0,0 +1,94 @@
// file: kb_app/frontend/sass/_variables.scss
// Pulse 5.3.8
// Bootswatch
$theme: "pulse" !default;
//
// Color system
//
$white: #fff !default;
$gray-100: #fafafa !default;
$gray-200: #f9f8fc !default;
$gray-300: #ededed !default;
$gray-400: #cbc8d0 !default;
$gray-500: #adb5bd !default;
$gray-600: #868e96 !default;
$gray-700: #444 !default;
$gray-800: #343a40 !default;
$gray-900: #17141f !default;
$black: #000 !default;
$blue: #007bff !default;
$indigo: #6610f2 !default;
$purple: #593196 !default;
$pink: #e83e8c !default;
$red: #fc3939 !default;
$orange: #fd7e14 !default;
$yellow: #efa31d !default;
$green: #13b955 !default;
$teal: #20c997 !default;
$cyan: #009cdc !default;
$primary: $purple !default;
$secondary: #a991d4 !default;
$success: $green !default;
$info: $cyan !default;
$warning: $yellow !default;
$danger: $red !default;
$light: $gray-200 !default;
$dark: $gray-900 !default;
$min-contrast-ratio: 2.1 !default;
// Options
$enable-rounded: false !default;
// Body
$body-color: $gray-700 !default;
// Links
$link-hover-color: $primary !default;
// Tables
$table-color: initial !default;
$table-border-color: rgba(0, 0, 0, .05) !default;
// Forms
$input-focus-border-color: $primary !default;
// Dropdowns
$dropdown-link-hover-color: $white !default;
$dropdown-link-hover-bg: $primary !default;
// Navs
$nav-tabs-border-color: $gray-300 !default;
$nav-tabs-link-hover-border-color: $primary !default;
// Navbar
$navbar-padding-y: 1.2rem !default;
// Progress bars
$progress-bg: $gray-300 !default;
$progress-bar-bg: $primary !default;
// List group
$list-group-bg: $gray-900 !default;
$list-group-border-color: transparent !default;
$list-group-hover-bg: lighten($list-group-bg, 10%) !default;
$list-group-active-color: $white !default;
$list-group-active-bg: $list-group-bg !default;
$list-group-disabled-color: lighten($list-group-bg, 30%) !default;

View File

@@ -0,0 +1,9 @@
// file: kb_app/frontend/sass/main.scss
@import "bootstrap/scss/functions";
@import "variables";
@import "fontawesome";
@import "simplebar";
@import "bootstrap/scss/bootstrap";
@import "bootswatch";
@import "app";

View File

@@ -0,0 +1,111 @@
// file: kb_app/frontend/sass/splash.scss
@font-face {
font-family: 'Dos Amazigh';
src: url('../fonts/DOS_Amazigh.ttf') format('truetype');
font-weight: normal;
font-style: normal;
font-display: swap; /* Assure un bon rendu pendant le chargement de la police */
}
body {
margin: 0;
padding: 0;
background-color: transparent;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
font-family: Arial, sans-serif;
}
#splash-container {
position: relative;
width: 960px; /* Largeur exacte de votre image */
height: 637px; /* Hauteur exacte de votre image */
opacity: 0; /* Sera animé par JavaScript */
}
#splash-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
#app-name {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-family: 'Dos Amazigh', sans-serif; /* Application de la police */
font-size: 96px;
font-weight: bold;
color: #fff; /* Blanc pour contraste */
text-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* Ombre pour meilleure lisibilité */
z-index: 2;
text-align: center;
}
#debug-info {
position: absolute;
top: 0;
left: 0;
width: 50%;
max-height: 30%;
overflow-y: auto;
color: white;
font-family: monospace;
font-size: 12px;
background-color: rgba(0, 0, 0, 0.1);
padding: 8px;
z-index: 3;
box-sizing: border-box;
}
#messages-container {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
max-height: 30%;
overflow-y: auto;
background-color: rgba(0, 0, 0, 0.1);
padding: 10px;
padding-bottom: 40px;
z-index: 2;
box-sizing: border-box;
}
.splash-message {
margin-bottom: 8px;
padding: 6px 10px;
border-radius: 4px;
animation: fadeIn 0.3s ease-in-out;
font-weight: bold;
color: #fff;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.splash-message.info {
background-color: rgba(33, 150, 243, 0.2);
}
.splash-message.warning {
background-color: rgba(255, 152, 0, 0.2);
}
.splash-message.error {
background-color: rgba(244, 67, 54, 0.2);
}
.splash-message.success {
background-color: rgba(76, 175, 80, 0.2);
}

View File

@@ -0,0 +1,19 @@
<!-- file: kb_app/frontend/splash.html -->
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Loading ... Khadhroony Solana BoBot</title>
<link rel="stylesheet" href="sass/splash.scss" />
</head>
<body>
<div id="splash-container">
<img id="splash-image" src="imgs/splash.png" alt="Application Loading" />
<div id="app-name">Khadhroony</div>
<div id="debug-info"></div>
<div id="messages-container"></div>
</div>
<script type="module" src="ts/splash.ts" defer></script>
</body>
</html>

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type SplashOrder = { order: string, msg: string | null, status: string | null, };

View File

@@ -0,0 +1,52 @@
// file: kb_app/frontend/ts/main.ts
import * as bootstrap from "bootstrap";
import "simplebar";
import ResizeObserver from "resize-observer-polyfill";
//import { invoke } from "@tauri-apps/api/core";
//import { listen, type UnlistenFn } from "@tauri-apps/api/event";
//import { error } from "@fltsci/tauri-plugin-tracing";
//import { info } from "@fltsci/tauri-plugin-tracing";
import { trace } from "@fltsci/tauri-plugin-tracing";
(window as Window & typeof globalThis & { bootstrap?: typeof bootstrap }).bootstrap = bootstrap;
(window as Window & typeof globalThis & { ResizeObserver?: typeof ResizeObserver }).ResizeObserver = ResizeObserver;
document.addEventListener("DOMContentLoaded", () => {
const sidebarToggle = document.querySelector<HTMLButtonElement>('#sidebarToggle');
if (sidebarToggle) {
// restaurer létat depuis localStorage
if (localStorage.getItem('sidebar-toggle') === 'true') {
document.body.classList.add('sidenav-toggled');
}
sidebarToggle.addEventListener('click', (event) => {
event.preventDefault();
document.body.classList.toggle('sidenav-toggled');
localStorage.setItem('sidebar-toggle', document.body.classList.contains('sidenav-toggled') ? 'true' : 'false');
});
}
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
Array.from(tooltipTriggerList).map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));
const toastElList = document.querySelectorAll('.toast');
Array.from(toastElList).map(toastEl => new bootstrap.Toast(toastEl));
const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]');
Array.from(popoverTriggerList).map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl));
const gobackto = location.pathname + location.search;
document.querySelectorAll<HTMLAnchorElement>('a[data-setlang]').forEach((a) => {
const href = a.getAttribute("href");
if (!href) return; // pas de href => on ignore
const url = new URL(href, location.origin);
url.searchParams.set("gobackto", gobackto);
// conserve une URL relative (path + query)
a.setAttribute("href", url.pathname + "?" + url.searchParams.toString());
});
trace("window loaded");
});

View File

@@ -0,0 +1,96 @@
// file: kb_app/frontend/ts/splash.ts
import { error } from "@fltsci/tauri-plugin-tracing";
import { info } from "@fltsci/tauri-plugin-tracing";
import { listen } from '@tauri-apps/api/event';
import { SplashOrder } from './bindings/SplashOrder.ts';
// Fonction d'animation d'opacité
async function animateOpacity(
element: HTMLElement,
fromOpacity: number,
toOpacity: number,
durationMs: number
): Promise<void> {
console.log(`Animating from ${fromOpacity} to ${toOpacity} over ${durationMs}ms`);
//debug(`Animating from ${fromOpacity} to ${toOpacity} over ${durationMs}ms`);
return new Promise((resolve) => {
const startTime = performance.now();
const startOpacity = fromOpacity;
const changeOpacity = toOpacity - fromOpacity;
function update(currentTime: number) {
const elapsed = currentTime - startTime;
if (elapsed >= durationMs) {
element.style.opacity = toOpacity.toString();
resolve();
return;
}
const progress = elapsed / durationMs;
element.style.opacity = (startOpacity + changeOpacity * progress).toString();
requestAnimationFrame(update);
}
requestAnimationFrame(update);
});
}
// Journalisation
function addLogMessage(message: string): void {
console.log(`Splash: ${message}`);
const debugInfo = document.getElementById('debug-info');
if (debugInfo) {
const time = new Date().toLocaleTimeString();
let msg = `${time}: ${message}<br>`;
debugInfo.innerHTML += msg;
}
}
// Pour ajouter des messages directement (sans événements)
function addMessage(message: string, status: string): void {
const messagesContainer = document.getElementById('messages-container');
if (!messagesContainer) return;
const messageElement = document.createElement('div');
messageElement.className = `splash-message ${status}`;
messageElement.textContent = message;
messagesContainer.appendChild(messageElement);
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}
listen("splash", (event) => {
const splashorder = event.payload as SplashOrder;
if (splashorder.order == "fadein") {
const container = document.getElementById('splash-container');
if (container) {
animateOpacity(container, 0, 1, 3000);
} else {
error("no container");
}
} else if (splashorder.order == "fadeout") {
const container = document.getElementById('splash-container');
if (container) {
animateOpacity(container, 1, 0, 3000);
} else {
error("no container");
}
} else if (splashorder.order == "add_msg" && splashorder.msg && splashorder.status) {
addMessage(splashorder.msg, splashorder.status);
} else if (splashorder.order == "add_log" && splashorder.msg) {
addLogMessage(splashorder.msg);
} else {
error("unknown order:"+splashorder.order);
}
});
// Démarrer l'initialisation au chargement du DOM
//window.addEventListener('DOMContentLoaded', initialize);
document.addEventListener("DOMContentLoaded", () => {
info("window loaded");
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"default":{"identifier":"default","description":"Capability for the main window","local":true,"windows":["main","splash"],"permissions":["core:default","tracing:default"]}}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

BIN
kb_app/icons/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 KiB

BIN
kb_app/icons/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

29
kb_app/package.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "kb-app",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"tauri": "tauri"
},
"dependencies": {
"@fltsci/tauri-plugin-tracing": "^0.3",
"@fortawesome/fontawesome-free": "^7.2",
"@tauri-apps/api": "^2.10",
"bootstrap": "^5.3",
"echarts": "^6.0",
"resize-observer-polyfill": "^1.5",
"simplebar": "^6.3"
},
"devDependencies": {
"@tauri-apps/cli": "^2.10",
"@types/bootstrap": "^5.2",
"@types/node": "^25.3",
"sass-embedded": "^1.97",
"typescript": "^5.9",
"vite": "^8.0"
}
}

136
kb_app/src/lib.rs Normal file
View File

@@ -0,0 +1,136 @@
// file: kb_app/src/lib.rs
//#![deny(unreachable_pub)]
//#![warn(missing_docs)]
mod splash;
pub use crate::splash::SplashOrder;
use tauri::Emitter;
use tauri::{Manager};
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
fn setup_logger() -> tauri_plugin_tracing::Builder {
let log_dir = std::env::temp_dir().join("kb_app");
match std::fs::create_dir_all(&log_dir) {
Ok(_) => {},
Err(err) => {
eprintln!("failed to create log directory: {:?}", err);
},
}
let file_appender = tracing_appender::rolling::daily(&log_dir, "app");
let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);
std::mem::forget(guard);
let targets = tracing_subscriber::filter::Targets::new()
.with_default(tracing::Level::DEBUG)
.with_target("hyper", tracing::Level::WARN)
.with_target("reqwest", tracing::Level::WARN)
.with_target("tao", tracing::Level::WARN)
.with_target("wry", tracing::Level::WARN);
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer().with_ansi(true))
.with(
tracing_subscriber::fmt::layer()
.with_writer(tauri_plugin_tracing::StripAnsiWriter::new(non_blocking))
.with_ansi(false),
)
.with(targets)
.init();
tauri_plugin_tracing::Builder::new()
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let tracing_builder = setup_logger();
let mut tauri_builder = tauri::Builder::default();
tauri_builder = tauri_builder.plugin(tracing_builder.build::<tauri::Wry>());
tauri_builder = tauri_builder.setup(|app| {
let app_handle = app.handle().clone();
tauri::async_runtime::spawn(async move {
let splash_window = app_handle.get_webview_window("splash").unwrap();
let main_window = app_handle.get_webview_window("main").unwrap();
//main_window.set_title(&app_name).unwrap();
let is_debug = cfg!(debug_assertions);
tokio::time::sleep(std::time::Duration::from_millis(500)).await;
if is_debug {
let _ = splash_window.emit(
"splash",
splash::SplashOrder {
order: "add_log".to_string(),
msg: Some("Start Fade-In".to_string()),
status: None,
},
);
}
let _ = splash_window.emit(
"splash",
splash::SplashOrder {
order: "fadein".to_string(),
msg: None,
status: None,
},
);
let _ = splash_window.emit(
"splash",
splash::SplashOrder {
order: "add_msg".to_string(),
msg: Some("Initialisation...".to_string()),
status: Some("info".to_string()),
},
);
tokio::time::sleep(std::time::Duration::from_millis(500)).await;
let _ = splash_window.emit(
"splash",
splash::SplashOrder {
order: "add_msg".to_string(),
msg: Some("Loading resources...".to_string()),
status: Some("info".to_string()),
},
);
tokio::time::sleep(std::time::Duration::from_millis(1000)).await;
let _ = splash_window.emit(
"splash",
splash::SplashOrder {
order: "add_msg".to_string(),
msg: Some("Loading complete...".to_string()),
status: Some("success".to_string()),
},
);
tokio::time::sleep(std::time::Duration::from_millis(500)).await;
tracing::debug!("Start fadeout");
if is_debug {
let _ = splash_window.emit(
"splash",
splash::SplashOrder {
order: "add_log".to_string(),
msg: Some("Start Fade-out".to_string()),
status: None,
},
);
}
let _ = splash_window.emit(
"splash",
splash::SplashOrder {
order: "fadeout".to_string(),
msg: None,
status: None,
},
);
tracing::debug!("End fadeout");
tokio::time::sleep(std::time::Duration::from_millis(3100)).await;
if let Err(err) = splash_window.close() {
tracing::error!("Error closing splash window: {:?}", err);
}
if let Err(err) = main_window.show() {
tracing::error!("Error showing main window: {:?}", err);
} else {
let _ = main_window.emit("setupTray", ());
}
});
Ok(())
});
if let Err(err) = tauri_builder.run(tauri::generate_context!()) {
tracing::error!("error while running tauri application: {:?}", err);
}
}

48
kb_app/src/main.rs Normal file
View File

@@ -0,0 +1,48 @@
// file: kb_app/src/main.rs
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
//! Binary entrypoint for the kb application.
//!
//! This binary remains intentionally thin and delegates its logic to `kb_lib`.
#![deny(unreachable_pub)]
#![warn(missing_docs)]
use fs2::FileExt;
/// Entrypoint of the kb app binary.
#[tokio::main]
async
fn main() -> std::process::ExitCode
{
let mut lock_path = std::env::temp_dir();
lock_path.push("com_khadhroony_solana_rust.lock");
let lock_file = match std::fs::File::create(lock_path) {
Ok(lock) => lock,
Err(_err) => {
eprintln!("Cannot create lock!");
std::process::exit(1);
},
};
// trying to aquire an exclusive lock
if lock_file.try_lock_exclusive().is_err() {
eprintln!("Another instance of the app is already running!");
std::process::exit(1);
}
if rustls::crypto::CryptoProvider::get_default().is_none() {
let provider_result = rustls::crypto::aws_lc_rs::default_provider().install_default();
match provider_result {
Ok(()) => {},
Err(error) => {
eprintln!("kb_app rustls provider init error: {:?}", error);
return std::process::ExitCode::FAILURE;
},
}
}
kb_app_lib::run();
std::process::ExitCode::SUCCESS
}

9
kb_app/src/splash.rs Normal file
View File

@@ -0,0 +1,9 @@
// file: kb_app/src/splash.rs
#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, ts_rs::TS)]
#[ts(export, export_to = "../frontend/ts/bindings/SplashOrder.ts")]
pub struct SplashOrder {
pub order: String,
pub msg: Option<String>,
pub status: Option<String>,
}

53
kb_app/tauri.conf.json Normal file
View File

@@ -0,0 +1,53 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "kb-bapp",
"version": "0.0.1",
"identifier": "com.sasedev.kb-app",
"build": {
"beforeDevCommand": "npm run dev",
"devUrl": "http://localhost:1420",
"beforeBuildCommand": "npm run build",
"frontendDist": "./dist"
},
"app": {
"withGlobalTauri": true,
"windows": [
{
"label": "splash",
"url": "splash.html",
"title": "Loading ... Khadhroony BoBoBot App",
"width": 960,
"height": 637,
"resizable": false,
"decorations": false,
"transparent": true,
"center": true,
"alwaysOnTop": true
},
{
"label": "main",
"url": "main.html",
"title": "Khadhroony-BoBoBot-App",
"width": 1024,
"height": 768,
"minWidth": 800,
"minHeight": 600,
"center": true,
"visible": false,
"transparent": false,
"decorations": true
}
],
"security": {
"csp": null
}
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/favicon.png",
"icons/favicon.ico"
]
}
}

26
kb_app/tsconfig.json Normal file
View File

@@ -0,0 +1,26 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": [
"ES2020",
"DOM",
"DOM.Iterable"
],
"skipLibCheck": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": "./frontend"
},
"include": [
"frontend"
]
}

80
kb_app/vite.config.ts Normal file
View File

@@ -0,0 +1,80 @@
// file: kb_app/vite.config.ts
import { defineConfig, normalizePath } from "vite";
import { NodePackageImporter } from "sass-embedded";
import { resolve } from 'path';
const host = process.env.TAURI_DEV_HOST;
// https://vite.dev/config/
export default defineConfig(async () => ({
envPrefix: ['VITE_', 'TAURI_ENV_*'],
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
//
// 1. prevent Vite from obscuring rust errors
clearScreen: false,
root: 'frontend', // Set this to your frontend directory
publicDir: 'public',
build: {
outDir: './dist', // Output directory for the build
emptyOutDir: true,
rollupOptions: {
input: {
"main": normalizePath(resolve(__dirname, 'frontend/index.html'))
},
output: {
entryFileNames: 'js/[name]-[hash].js',
chunkFileNames: 'js/chunks/[name]-[hash].js',
assetFileNames: (assetInfo) => {
const originalName = assetInfo.name ?? '';
const ext = originalName.substring(originalName.lastIndexOf('.') + 1).toLowerCase();
if (ext === 'js') {
return 'js/[name]-[hash][extname]';
}
// CSS
if (ext === 'css') {
return 'css/[name]-[hash][extname]';
}
if (['eot', 'otf', 'ttf', 'woff', 'woff2'].includes(ext)) {
return 'fonts/[name]-[hash][extname]';
}
if (['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp', 'ico'].includes(ext)) {
return 'imgs/[name][extname]';
}
if (['mp4', 'webm'].includes(ext)) {
return 'videos/[name][extname]';
}
return 'otherassets/[name][extname]';
},
},
},
minify: true,
sourcemap: false,
cssCodeSplit: true
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
importers: [new NodePackageImporter()],
}
}
},
// 2. tauri expects a fixed port, fail if that port is not available
server: {
port: 1420,
strictPort: false,
host: host || false,
hmr: host
? {
protocol: "ws",
host,
port: 1421,
}
: undefined,
watch: {
ignored: ["**/src/**"],
},
},
}));

45
kb_lib/Cargo.toml Normal file
View File

@@ -0,0 +1,45 @@
# file: kb_lib/Cargo.toml
[package]
name = "kb_lib"
edition.workspace = true
version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[dependencies]
async-trait.workspace = true
base64.workspace = true
chrono.workspace = true
futures-util.workspace = true
reqwest.workspace = true
rustls.workspace = true
serde.workspace = true
serde_json.workspace = true
solana-account-decoder-client-types.workspace = true
solana-address-lookup-table-interface.workspace = true
solana-client.workspace = true
solana-compute-budget-interface.workspace = true
solana-rpc-client-api.workspace = true
solana-sdk.workspace = true
solana-sdk-ids.workspace = true
solana-system-interface.workspace = true
solana-transaction-status-client-types.workspace = true
spl-associated-token-account-interface.workspace = true
spl-memo-interface.workspace = true
spl-token-2022-interface.workspace = true
spl-token-interface.workspace = true
sqlx.workspace = true
tokio.workspace = true
tokio-stream.workspace = true
tokio-tungstenite.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
yellowstone-grpc-client.workspace = true
yellowstone-grpc-proto.workspace = true
uuid.workspace = true
[dev-dependencies]
tempfile.workspace = true

14
kb_lib/src/lib.rs Normal file
View File

@@ -0,0 +1,14 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}