Compare commits

...
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

3 Commits

444
Cargo.lock generated

@ -68,6 +68,15 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "android_system_properties"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
dependencies = [
"libc",
]
[[package]]
name = "arboard"
version = "2.1.1"
@ -79,7 +88,7 @@ dependencies = [
"objc",
"objc-foundation",
"objc_id",
"parking_lot",
"parking_lot 0.12.1",
"thiserror",
"winapi",
"x11rb",
@ -245,6 +254,21 @@ dependencies = [
"libc",
]
[[package]]
name = "chrono"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
dependencies = [
"iana-time-zone",
"js-sys",
"num-integer",
"num-traits",
"time",
"wasm-bindgen",
"winapi",
]
[[package]]
name = "clang-sys"
version = "1.4.0"
@ -313,6 +337,16 @@ dependencies = [
"objc",
]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
dependencies = [
"termcolor",
"unicode-width",
]
[[package]]
name = "combine"
version = "4.6.6"
@ -413,7 +447,7 @@ dependencies = [
"nix 0.23.1",
"oboe",
"once_cell",
"parking_lot",
"parking_lot 0.12.1",
"stdweb",
"thiserror",
"web-sys",
@ -458,6 +492,50 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
[[package]]
name = "cxx"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8"
dependencies = [
"cc",
"cxxbridge-flags",
"cxxbridge-macro",
"link-cplusplus",
]
[[package]]
name = "cxx-build"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86"
dependencies = [
"cc",
"codespan-reporting",
"once_cell",
"proc-macro2",
"quote",
"scratch",
"syn",
]
[[package]]
name = "cxxbridge-flags"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78"
[[package]]
name = "cxxbridge-macro"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "darling"
version = "0.13.4"
@ -635,6 +713,70 @@ dependencies = [
"serde",
]
[[package]]
name = "encoding"
version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
dependencies = [
"encoding-index-japanese",
"encoding-index-korean",
"encoding-index-simpchinese",
"encoding-index-singlebyte",
"encoding-index-tradchinese",
]
[[package]]
name = "encoding-index-japanese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-korean"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-simpchinese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-singlebyte"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-tradchinese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding_index_tests"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
[[package]]
name = "encoding_rs"
version = "0.8.31"
@ -656,7 +798,7 @@ dependencies = [
"bytemuck",
"emath",
"nohash-hasher",
"parking_lot",
"parking_lot 0.12.1",
"serde",
]
@ -784,47 +926,88 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
[[package]]
name = "futures"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0"
dependencies = [
"futures-channel",
"futures-core",
"futures-executor",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050"
checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
name = "futures-core"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf"
checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
[[package]]
name = "futures-executor"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-io"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68"
checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"
[[package]]
name = "futures-macro"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "futures-sink"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56"
checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"
[[package]]
name = "futures-task"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1"
checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea"
[[package]]
name = "futures-util"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90"
checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"
dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
"pin-project-lite",
@ -851,7 +1034,7 @@ dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi",
"wasi 0.11.0+wasi-snapshot-preview1",
"wasm-bindgen",
]
@ -902,7 +1085,7 @@ dependencies = [
"objc",
"once_cell",
"osmesa-sys",
"parking_lot",
"parking_lot 0.12.1",
"raw-window-handle 0.5.0",
"wayland-client",
"wayland-egl",
@ -964,7 +1147,7 @@ dependencies = [
"indexmap",
"slab",
"tokio",
"tokio-util",
"tokio-util 0.7.4",
"tracing",
]
@ -1060,6 +1243,30 @@ dependencies = [
"tokio-native-tls",
]
[[package]]
name = "iana-time-zone"
version = "0.1.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"winapi",
]
[[package]]
name = "iana-time-zone-haiku"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
dependencies = [
"cxx",
"cxx-build",
]
[[package]]
name = "ident_case"
version = "1.0.1"
@ -1104,6 +1311,44 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b"
[[package]]
name = "irc"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5510c4c4631e53c57d6b05c44ab8447d1db6beef28fb9d12c4d6a46fad9dfcc"
dependencies = [
"chrono",
"encoding",
"futures-util",
"irc-proto",
"log",
"native-tls",
"parking_lot 0.11.2",
"pin-project",
"serde",
"serde_derive",
"thiserror",
"tokio",
"tokio-native-tls",
"tokio-socks",
"tokio-stream",
"tokio-util 0.6.10",
"toml",
]
[[package]]
name = "irc-proto"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55fa0a52d825e59ba8aea5b7503890245aea000f77e68d9b1903f3491fa33643"
dependencies = [
"bytes",
"encoding",
"thiserror",
"tokio",
"tokio-util 0.6.10",
]
[[package]]
name = "itoa"
version = "1.0.4"
@ -1250,6 +1495,15 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "link-cplusplus"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369"
dependencies = [
"cc",
]
[[package]]
name = "lock_api"
version = "0.4.9"
@ -1360,7 +1614,7 @@ checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
dependencies = [
"libc",
"log",
"wasi",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys",
]
@ -1443,7 +1697,7 @@ dependencies = [
"ndk-macro",
"ndk-sys 0.4.0",
"once_cell",
"parking_lot",
"parking_lot 0.12.1",
]
[[package]]
@ -1542,6 +1796,16 @@ dependencies = [
"syn",
]
[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
"autocfg",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.15"
@ -1712,6 +1976,17 @@ dependencies = [
"ttf-parser",
]
[[package]]
name = "parking_lot"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core 0.8.5",
]
[[package]]
name = "parking_lot"
version = "0.12.1"
@ -1719,7 +1994,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
"parking_lot_core 0.9.3",
]
[[package]]
name = "parking_lot_core"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
dependencies = [
"cfg-if",
"instant",
"libc",
"redox_syscall",
"smallvec",
"winapi",
]
[[package]]
@ -1747,6 +2036,26 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "pin-project"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pin-project-lite"
version = "0.2.9"
@ -1936,7 +2245,7 @@ dependencies = [
"tokio",
"tokio-native-tls",
"tokio-socks",
"tokio-util",
"tokio-util 0.7.4",
"tower-service",
"url",
"wasm-bindgen",
@ -2021,6 +2330,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "scratch"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898"
[[package]]
name = "sctk-adwaita"
version = "0.4.2"
@ -2151,6 +2466,15 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]]
name = "signal-hook-registry"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
dependencies = [
"libc",
]
[[package]]
name = "slab"
version = "0.4.7"
@ -2268,6 +2592,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.37"
@ -2288,6 +2621,17 @@ dependencies = [
"syn",
]
[[package]]
name = "time"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi",
]
[[package]]
name = "tiny-skia"
version = "0.7.0"
@ -2340,11 +2684,25 @@ dependencies = [
"memchr",
"mio",
"num_cpus",
"parking_lot 0.12.1",
"pin-project-lite",
"signal-hook-registry",
"socket2",
"tokio-macros",
"winapi",
]
[[package]]
name = "tokio-macros"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tokio-native-tls"
version = "0.3.0"
@ -2367,6 +2725,31 @@ dependencies = [
"tokio",
]
[[package]]
name = "tokio-stream"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce"
dependencies = [
"futures-core",
"pin-project-lite",
"tokio",
]
[[package]]
name = "tokio-util"
version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"log",
"pin-project-lite",
"tokio",
]
[[package]]
name = "tokio-util"
version = "0.7.4"
@ -2449,6 +2832,12 @@ dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-width"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
name = "url"
version = "2.3.1"
@ -2499,6 +2888,12 @@ dependencies = [
"try-lock",
]
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@ -2829,7 +3224,7 @@ dependencies = [
"ndk-glue 0.7.0",
"objc",
"once_cell",
"parking_lot",
"parking_lot 0.12.1",
"percent-encoding",
"raw-window-handle 0.4.3",
"raw-window-handle 0.5.0",
@ -2867,10 +3262,13 @@ version = "0.1.0"
dependencies = [
"eframe",
"egui",
"futures",
"irc",
"libtor",
"regex",
"reqwest",
"rodio",
"tokio",
]
[[package]]

@ -8,8 +8,10 @@ edition = "2021"
[dependencies]
libtor = { git = "https://github.com/MagicalBitcoin/libtor" }
eframe = { version = "0.19.0", features = ["persistence"] }
# serde = { version = "1", features = ["derive"] }
reqwest = { version = "0.11.12", features = ["blocking", "json", "stream", "socks"] }
tokio = { version = "1", features = ["full"] }
irc = { version = "0.15.0", features = ["proxy"] }
egui = "0.19.0"
rodio = "0.16.0"
regex = "1.6.0"
regex = "1.6.0"
futures = "0.3.24"

@ -0,0 +1,21 @@
server = "irc.oftc.net"
port = 6697
nickname = "wowboombox"
username = "wowboombox"
realname = "wowboombox"
channels = ["#wownero-music", "#wownero"]
proxy_type = "SOCKS5"
proxy_server = "127.0.0.1"
proxy_port = 19050
proxy_username = ""
proxy_password = ""
use_tls = true
encoding = "UTF-8"
umodes = "+RB-x"
user_info = "I'm a Wownero gui radio scrub"
version = "0.0.1"
source = "https://git.wownero.com/lza_menace/gui"
ping_time = 180
ping_timeout = 20
burst_window_length = 8
max_messages_in_burst = 15

@ -3,15 +3,15 @@ use egui::FontFamily::Proportional;
use egui::FontId;
use egui::TextStyle::*;
use crate::player::Player;
use libtor::Error as libtorError;
// use crate::irc::IRC;
pub struct App {
pub player: Player,
pub tor_started: bool,
pub tor_connected: bool,
pub tor_thread: std::thread::JoinHandle<()>,
pub to_data: String,
pub show_irc: bool,
pub irc_message: String
pub show_irc: bool
}
impl Default for App {
@ -19,10 +19,10 @@ impl Default for App {
Self {
tor_started: false,
tor_connected: false,
tor_thread: std::thread::spawn(move|| {}),
show_irc: false,
to_data: "".to_owned(),
player: Player::default(),
irc_message: "".to_owned()
player: Player::default()
}
}
}
@ -59,6 +59,7 @@ impl eframe::App for App {
if ! self.show_irc {
ui.heading("Tor");
if self.tor_started {
ui.label(format!("Tor connected: {}", self.tor_connected));
ui.label("Tor started.");
if ui.button("Clear Tor logs").clicked() {
let _r: std::io::Result<()> = crate::clear_tor_log();
@ -68,26 +69,45 @@ impl eframe::App for App {
self.tor_connected = true;
}
}
ui.collapsing("View Tor logs:", |ui| {
egui::ScrollArea::vertical().stick_to_bottom(true).show(ui, |ui| {
let contents = std::fs::read_to_string(crate::TOR_LOG.to_string()).unwrap();
ui.label(contents);
});
egui::ScrollArea::vertical().stick_to_bottom(true).show(ui, |ui| {
let contents = std::fs::read_to_string(crate::TOR_LOG.to_string()).unwrap();
ui.label(contents);
});
} else {
if ui.button("Start Tor").clicked() {
let _t: std::thread::JoinHandle<Result<u8, libtorError>> = crate::start_tor();
if self.tor_thread.is_finished() {
let t: Result<std::thread::JoinHandle<()>, std::io::Error> = std::thread::Builder::new().name("tor_thread".to_string()).spawn(move || {
let _ = crate::start_tor();
});
self.tor_thread = t.unwrap();
self.tor_started = true;
}
}
} else {
if ui.button("connect IRC").clicked() {
let _ = std::thread::Builder::new().name("irc_thread".to_string()).spawn(move || async {
//
});
}
ui.heading("IRC");
if self.tor_started {
ui.label("Chat wit da braddahs and sistas");
ui.text_edit_singleline(&mut self.irc_message);
if ui.button("[> Send <]").clicked() {
let _r: std::io::Result<()> = crate::clear_tor_log();
}
egui::ScrollArea::vertical().stick_to_bottom(true).show(ui, |ui| {
// let mut bod = "connecting";
let contents = std::fs::read_to_string(crate::IRC_LOG.to_string());
if contents.is_ok() {
let bod = contents.unwrap();
ui.label(bod);
} else {
ui.label("connecting".to_owned());
}
});
// ui.horizontal(|ui| {
// ui.text_edit_singleline(&mut self.irc.message);
// if ui.button("|> Send <|").clicked() {
// let _ = self.irc.send_message(self.irc.message.clone());
// let _ = self.irc.clear_message();
// }
// });
} else {
ui.label("You should connect to Tor network first brah");
}
@ -102,12 +122,10 @@ impl eframe::App for App {
if self.player.playing {
if ui.button("⏸").clicked() {
let _ = &self.player.sink.pause();
// let _ = &self.player.sink.stop();
self.player.playing = false;
}
ui.add(egui::Slider::new(&mut self.player.volume, 0.0..=100.0));
self.player.sink.set_volume(self.player.volume / 100.0);
// self.player.sink.stop();
} else {
if ui.button("▶").clicked() {
// If stream thread is done, start again

@ -0,0 +1,192 @@
extern crate irc;
extern crate futures;
use std::io::Write;
use irc::client::prelude::*;
use futures::prelude::*;
use std::thread;
pub struct IRC {
pub connecting: bool,
pub connected: bool,
pub thread: thread::JoinHandle<()>,
pub thread_state: Result<Option<bool>, irc::error::Error>,
pub exit_reason: String,
pub message: String,
pub client: Client
}
impl IRC {
pub async fn new() -> Self {
Self {
connecting: false,
connected: false,
thread: thread::spawn(move || {}),
thread_state: Ok(Some(false)),
exit_reason: "havent started yet".to_owned(),
message: "".to_owned(),
client: Client::from_config(Config {
nickname: Some("wowboombox".to_owned()),
server: Some("irc.oftc.net".to_owned()),
channels: vec!["#wownero-music".to_owned(), "#wownero".to_owned()],
proxy_type: Some(ProxyType::Socks5),
proxy_server: Some("127.0.0.1".to_owned()),
proxy_port: Some(19050),
..Default::default()
}).await.unwrap()
}
}
pub async fn default() -> Self {
Self::new().await
}
pub fn write_log(&self, b: &[u8]) -> () {
let mut file: std::fs::File = std::fs::File::create(&crate::IRC_LOG).expect("failed to create file");
let _ = file.write(b);
let _ = file.flush();
()
}
pub async fn identify_server(&self, client: Client) -> Result<(), irc::error::Error> {
return client.identify();
}
pub async fn listen_for_messages(&self, mut client: Client) {
let mut stream = client.stream().unwrap();
let sender = client.sender();
while let Some(message) = stream.next().await.transpose().unwrap() {
match message.command {
Command::PRIVMSG(ref target, ref msg) => {
if msg.contains(client.current_nickname()) {
sender.send_privmsg(target, "yo").unwrap();
}
}
_ => (),
}
}
}
// pub async fn connect(&mut self) -> String {
// if ! self.connected && ! self.connecting {
// let config = Config {
// nickname: Some("wowboombox".to_owned()),
// server: Some("irc.oftc.net".to_owned()),
// channels: vec!["#wownero-music".to_owned(), "#wownero".to_owned()],
// proxy_type: Some(ProxyType::Socks5),
// proxy_server: Some("127.0.0.1".to_owned()),
// proxy_port: Some(19050),
// ..Default::default()
// };
// self.write_log("connecting".as_bytes());
// let client = Client::from_config(config).await.unwrap();
// let r = client.identify();
// if r.is_err() {
// self.thread_state = Err(r.err().unwrap());
// self.exit_reason = "failed to connect".to_owned();
// self.write_log(b"shitballs, error");
// return "ok there".to_owned()
// }
// self.thread_state = Ok(Some(true));
// self.write_log(b"fine, no error");
// return "nope".to_owned()
// } else {
// self.write_log(b"couldnt start, already connecting or connected");
// return "nope".to_owned()
// }
// }
pub async fn send_message(&self, _msg: String) -> bool {
return true
}
pub fn clear_message(&mut self) {
self.message = "".to_owned();
}
}
// pub async fn start_irc() -> Result<(), ()> {
// let config = Config {
// nickname: Some("wowboombox".to_owned()),
// server: Some("irc.oftc.net".to_owned()),
// channels: vec!["#wownero-music".to_owned(), "#wownero".to_owned()],
// proxy_type: Some(ProxyType::Socks5),
// proxy_server: Some("127.0.0.1".to_owned()),
// proxy_port: Some(19050),
// ..Default::default()
// };
// let mut client = Client::from_config(config).await.unwrap();
// match client.identify() {
// Ok(k) => {
// let mut stream = client.stream().unwrap();
// let sender = client.sender();
// while let Some(message) = stream.next().await.transpose().unwrap() {
// match message.command {
// Command::PRIVMSG(ref target, ref msg) => {
// if msg.contains(client.current_nickname()) {
// sender.send_privmsg(target, "Hi!").unwrap();
// }
// }
// _ => (),
// }
// let mut file: std::fs::File = std::fs::File::create(&crate::IRC_LOG).expect("failed to create file");
// file.write(b"somebyte");
// // client.send(Command::NICK("example".to_owned())).unwrap();
// // client.send(Command::USER("user".to_owned(), "0".to_owned(), "name".to_owned())).unwrap();
// // let mut buf_reader = std::io::BufReader::new(file);
// // let mut buf_writer = std::io::BufWriter::new(message);
// // let mut contents = message.to_string();
// // buf_reader.read_to_string(&mut contents).unwrap();
// // file.write_all(buf_reader);
// }
// Ok(())
// },
// Err(_e) => Err(())
// }
// // let log_file = std::path::Path::new(crate::IRC_LOG);
// // if ! log_file.is_file() {
// // let f = std::fs::File::create(log_file);
// // let _ = f.unwrap().write(b"connecting");
// // }
// // let mut file = std::fs::OpenOptions::new()
// // .write(true)
// // .append(true)
// // .open(log_file)
// // .unwrap();
// // let mut stream = client.stream().unwrap();
// // let sender = client.sender();
// // while let Some(message) = stream.next().await.transpose().unwrap() {
// // match message.command {
// // Command::PRIVMSG(ref target, ref msg) => {
// // if msg.contains(client.current_nickname()) {
// // sender.send_privmsg(target, "Hi!").unwrap();
// // }
// // }
// // _ => (),
// // }
// // let mut file: std::fs::File = std::fs::File::create(&crate::IRC_LOG).expect("failed to create file");
// // file.write(b"somebyte");
// // // client.send(Command::NICK("example".to_owned())).unwrap();
// // // client.send(Command::USER("user".to_owned(), "0".to_owned(), "name".to_owned())).unwrap();
// // // let mut buf_reader = std::io::BufReader::new(file);
// // // let mut buf_writer = std::io::BufWriter::new(message);
// // // let mut contents = message.to_string();
// // // buf_reader.read_to_string(&mut contents).unwrap();
// // // file.write_all(buf_reader);
// // }
// // Ok(())
// }

@ -5,13 +5,13 @@
pub use crate::player::Player;
pub use crate::app::App;
// use std::{thread, io, fs, time};
use libtor::{Tor, TorFlag, Error as libtorError, log as libtorLog};
#[allow(unused_imports)]
use rodio::{Decoder, OutputStream, source::Source, Sink};
mod app;
mod player;
mod irc;
// "http://wowradiod6mhb4ignjqy5ghf5l42yh2yeumgeq3yi7gn7yqy3efhe5ad.onion"
// "http://wowradiof5wx62w4avdk5fwbvcoea2z4ul2q3awffn5vmfaa3vhlgiid.onion"
@ -23,20 +23,21 @@ mod player;
pub const TOR_DATA: &str = &"/tmp/tor-rust";
pub const TOR_LOG: &str = &"/tmp/tor-rust/tor.log";
pub const RADIO_STREAM: &str = &"radio.ogg";
pub const IRC_LOG: &str = &"irc.log";
pub const IRC_CONFIG: &str = &"config.toml";
fn cleanup() {
let r: std::io::Result<()> = std::fs::remove_file(&RADIO_STREAM);
match r {
_ => ()
}
let _ = std::fs::remove_file(&RADIO_STREAM);
let _ = std::fs::remove_file(&IRC_LOG);
()
}
fn start_tor() -> std::thread::JoinHandle<Result<u8, libtorError>> {
let t: std::thread::JoinHandle<_> = Tor::new()
fn start_tor() -> Result<u8, libtorError> {
let t = Tor::new()
.flag(TorFlag::DataDirectory(TOR_DATA.to_owned()))
.flag(TorFlag::SocksPort(19050))
.flag(TorFlag::LogTo(libtorLog::LogLevel::Info, libtorLog::LogDestination::File(TOR_LOG.to_string())))
.start_background();
.start();
return t
}
@ -59,7 +60,8 @@ fn clear_tor_log() -> std::io::Result<()> {
// return res
// }
fn main() {
#[tokio::main(flavor = "current_thread")]
async fn main() {
let (_stream, stream_handle) = rodio::OutputStream::try_default().unwrap();
let sink: rodio::Sink = rodio::Sink::try_new(&stream_handle).unwrap();
let player: player::Player = player::Player::new(sink, stream_handle);