diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..76efe82 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "editor.defaultFormatter": "dprint", + "[ignore]": { + "editor.defaultFormatter": "foxundermoon.shell-format" + } +} diff --git a/README.md b/README.md index 3839c0f..c3af4f0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ --- -Formatting we use [dprint](https://dprint.dev/install/) for formatting files `npm i dprint -g` +## Formatting + +for formatting we use [dprint](https://dprint.dev/install/) for formatting files `npm i dprint -g` ### Copyright diff --git a/apps/backend/src/core/Cargo.toml b/apps/backend/src/core/Cargo.toml index db68708..c212d32 100644 --- a/apps/backend/src/core/Cargo.toml +++ b/apps/backend/src/core/Cargo.toml @@ -20,7 +20,7 @@ futures = "0.3.18" openssl = { version = "0.10.38", optional = true } tokio = { version = "1.14.0", features = ["rt-multi-thread"] } tracing-subscriber = "0.3.3" -# actix-cors = "0.6.0-beta.4" + [features] openssl-vendored = ["openssl/vendored"] diff --git a/apps/backend/src/http/src/routes/v2/upload.rs b/apps/backend/src/http/src/routes/v2/upload.rs index 9d15318..6d81d57 100644 --- a/apps/backend/src/http/src/routes/v2/upload.rs +++ b/apps/backend/src/http/src/routes/v2/upload.rs @@ -92,8 +92,9 @@ pub async fn post(req: HttpRequest, mut payload: Multipart) -> Result) **[OWNER]** {name} ({id})", image = &img.vanity, name = &data.name, id = &data.id diff --git a/apps/desktop/Cargo.lock b/apps/desktop/Cargo.lock index 80681f5..290ca22 100644 --- a/apps/desktop/Cargo.lock +++ b/apps/desktop/Cargo.lock @@ -44,6 +44,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "android_glue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" + [[package]] name = "approx" version = "0.5.0" @@ -53,12 +59,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.2" @@ -72,7 +72,6 @@ dependencies = [ "chrono", "clap", "clipboard", - "embed-resource", "home", "iced", "itertools", @@ -260,6 +259,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + [[package]] name = "chrono" version = "0.4.19" @@ -275,9 +283,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.0.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d17bf219fcd37199b9a29e00ba65dfb8cd5b2688b7297ec14ff829c40ac50ca9" +checksum = "b1121e32687f7f90b905d4775273305baa4f32cd418923e9b0fa726533221857" dependencies = [ "atty", "bitflags", @@ -774,17 +782,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "embed-resource" -version = "1.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85505eb239fc952b300f29f0556d2d884082a83566768d980278d8faf38c780d" -dependencies = [ - "cc", - "vswhom", - "winreg 0.10.1", -] - [[package]] name = "encoding_rs" version = "0.8.30" @@ -863,15 +860,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bad48618fdb549078c333a7a8528acb57af271d0433bdecd523eb620628364e" -[[package]] -name = "float_next_after" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc612c5837986b7104a87a0df74a5460931f1c5274be12f8d0f40aa2f30d632" -dependencies = [ - "num-traits", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1113,6 +1101,17 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + [[package]] name = "glam" version = "0.10.2" @@ -1122,6 +1121,18 @@ dependencies = [ "version_check", ] +[[package]] +name = "glow" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1625b792e2f9267116dd41eb7d325e0ea2572ceba5069451906745e04f852f33" +dependencies = [ + "js-sys", + "slotmap 0.4.3", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "glow" version = "0.11.2" @@ -1129,11 +1140,89 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919" dependencies = [ "js-sys", - "slotmap", + "slotmap 1.0.6", "wasm-bindgen", "web-sys", ] +[[package]] +name = "glow_glyph" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0510450eb46dd2b8e3284b50b08bfd870f1ef93a55045f54d7376fbcb63b1cb" +dependencies = [ + "bytemuck", + "glow 0.6.1", + "glyph_brush", + "log", +] + +[[package]] +name = "glutin" +version = "0.27.0" +source = "git+https://github.com/iced-rs/glutin?rev=492c20605907accf2b5dc2da52284305fd128346#492c20605907accf2b5dc2da52284305fd128346" +dependencies = [ + "android_glue", + "cgl", + "cocoa", + "core-foundation 0.9.2", + "glutin_egl_sys", + "glutin_emscripten_sys", + "glutin_gles2_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "lazy_static", + "libloading", + "log", + "objc", + "osmesa-sys", + "parking_lot 0.11.2", + "wayland-client 0.28.6", + "wayland-egl", + "winapi 0.3.9", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.1.5" +source = "git+https://github.com/iced-rs/glutin?rev=492c20605907accf2b5dc2da52284305fd128346#492c20605907accf2b5dc2da52284305fd128346" +dependencies = [ + "gl_generator", + "winapi 0.3.9", +] + +[[package]] +name = "glutin_emscripten_sys" +version = "0.1.1" +source = "git+https://github.com/iced-rs/glutin?rev=492c20605907accf2b5dc2da52284305fd128346#492c20605907accf2b5dc2da52284305fd128346" + +[[package]] +name = "glutin_gles2_sys" +version = "0.1.5" +source = "git+https://github.com/iced-rs/glutin?rev=492c20605907accf2b5dc2da52284305fd128346#492c20605907accf2b5dc2da52284305fd128346" +dependencies = [ + "gl_generator", + "objc", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.1.7" +source = "git+https://github.com/iced-rs/glutin?rev=492c20605907accf2b5dc2da52284305fd128346#492c20605907accf2b5dc2da52284305fd128346" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.1.5" +source = "git+https://github.com/iced-rs/glutin?rev=492c20605907accf2b5dc2da52284305fd128346#492c20605907accf2b5dc2da52284305fd128346" +dependencies = [ + "gl_generator", +] + [[package]] name = "glyph_brush" version = "0.7.3" @@ -1352,6 +1441,8 @@ source = "git+https://github.com/iced-rs/iced?rev=4db0f4a570a1fb3398062c78770c54 dependencies = [ "iced_core", "iced_futures", + "iced_glow", + "iced_glutin", "iced_web", "iced_wgpu", "iced_winit", @@ -1377,6 +1468,32 @@ dependencies = [ "wasm-bindgen-futures", ] +[[package]] +name = "iced_glow" +version = "0.2.0" +source = "git+https://github.com/iced-rs/iced?rev=4db0f4a570a1fb3398062c78770c542d9efb8a64#4db0f4a570a1fb3398062c78770c542d9efb8a64" +dependencies = [ + "bytemuck", + "euclid", + "glow 0.6.1", + "glow_glyph", + "glyph_brush", + "iced_graphics", + "iced_native", + "log", +] + +[[package]] +name = "iced_glutin" +version = "0.2.0" +source = "git+https://github.com/iced-rs/iced?rev=4db0f4a570a1fb3398062c78770c542d9efb8a64#4db0f4a570a1fb3398062c78770c542d9efb8a64" +dependencies = [ + "glutin", + "iced_graphics", + "iced_native", + "iced_winit", +] + [[package]] name = "iced_graphics" version = "0.2.0" @@ -1387,7 +1504,6 @@ dependencies = [ "glam", "iced_native", "iced_style", - "lyon", "raw-window-handle 0.3.4", "thiserror", ] @@ -1531,9 +1647,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.9.0" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" dependencies = [ "either", ] @@ -1594,6 +1710,12 @@ dependencies = [ "libloading", ] +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + [[package]] name = "lazy_static" version = "1.4.0" @@ -1655,56 +1777,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3bd0dd2cd90571056fdb71f6275fada10131182f84899f4b2a916e565d81d86" -[[package]] -name = "lyon" -version = "0.17.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf0510ed5e3e2fb80f3db2061ef5ca92d87bfda1a624bb1eacf3bd50226e4cbb" -dependencies = [ - "lyon_algorithms", - "lyon_tessellation", -] - -[[package]] -name = "lyon_algorithms" -version = "0.17.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8037f716541ba0d84d3de05c0069f8068baf73990d55980558b84d944c8a244a" -dependencies = [ - "lyon_path", - "sid", -] - -[[package]] -name = "lyon_geom" -version = "0.17.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce99ce77c22bfd8f39a95b9c749dffbfc3e2491ea30c874764c801a8b1485489" -dependencies = [ - "arrayvec 0.5.2", - "euclid", - "num-traits", -] - -[[package]] -name = "lyon_path" -version = "0.17.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0a59fdf767ca0d887aa61d1b48d4bbf6a124c1a45503593f7d38ab945bfbc0" -dependencies = [ - "lyon_geom", -] - -[[package]] -name = "lyon_tessellation" -version = "0.17.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7230e08dd0638048e46f387f255dbe7a7344a3e6705beab53242b5af25635760" -dependencies = [ - "float_next_after", - "lyon_path", -] - [[package]] name = "malloc_buf" version = "0.0.6" @@ -2187,6 +2259,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "osmesa-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" +dependencies = [ + "shared_library", +] + [[package]] name = "owned_ttf_parser" version = "0.14.0" @@ -2640,7 +2721,7 @@ dependencies = [ "tokio-timer", "url 1.7.2", "uuid", - "winreg 0.6.2", + "winreg", ] [[package]] @@ -2831,12 +2912,13 @@ dependencies = [ ] [[package]] -name = "sid" -version = "0.6.1" +name = "shared_library" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd5ac56c121948b4879bba9e519852c211bcdd8f014efff766441deff0b91bdb" +checksum = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" dependencies = [ - "num-traits", + "lazy_static", + "libc", ] [[package]] @@ -2845,6 +2927,12 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" +[[package]] +name = "slotmap" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bf34684c5767b87de9119790e92e9a1d60056be2ceeaf16a8e6ef13082aeab1" + [[package]] name = "slotmap" version = "1.0.6" @@ -2883,7 +2971,7 @@ dependencies = [ "memmap2", "nix 0.22.2", "pkg-config", - "wayland-client", + "wayland-client 0.29.2", "wayland-cursor", "wayland-protocols", ] @@ -2895,7 +2983,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "610b551bd25378bfd2b8e7a0fcbd83d427e8f2f6a40c47ae0f70688e9949dd55" dependencies = [ "smithay-client-toolkit", - "wayland-client", + "wayland-client 0.29.2", ] [[package]] @@ -3320,26 +3408,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "vswhom" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" -dependencies = [ - "libc", - "vswhom-sys", -] - -[[package]] -name = "vswhom-sys" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f5402d3d0e79a069714f7b48e3ecc60be7775a2c049cb839457457a239532" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "walkdir" version = "2.3.2" @@ -3434,6 +3502,22 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +[[package]] +name = "wayland-client" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ab332350e502f159382201394a78e3cc12d0f04db863429260164ea40e0355" +dependencies = [ + "bitflags", + "downcast-rs", + "libc", + "nix 0.20.2", + "scoped-tls", + "wayland-commons 0.28.6", + "wayland-scanner 0.28.6", + "wayland-sys 0.28.6", +] + [[package]] name = "wayland-client" version = "0.29.2" @@ -3445,9 +3529,21 @@ dependencies = [ "libc", "nix 0.22.2", "scoped-tls", - "wayland-commons", - "wayland-scanner", - "wayland-sys", + "wayland-commons 0.29.2", + "wayland-scanner 0.29.2", + "wayland-sys 0.29.2", +] + +[[package]] +name = "wayland-commons" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21817947c7011bbd0a27e11b17b337bfd022e8544b071a2641232047966fbda" +dependencies = [ + "nix 0.20.2", + "once_cell", + "smallvec 1.7.0", + "wayland-sys 0.28.6", ] [[package]] @@ -3459,7 +3555,7 @@ dependencies = [ "nix 0.22.2", "once_cell", "smallvec 1.7.0", - "wayland-sys", + "wayland-sys 0.29.2", ] [[package]] @@ -3469,10 +3565,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13bf37fd845bf29a5a9e57ad9c14baedb64f926f071e27afb8654d3ca348efd3" dependencies = [ "nix 0.22.2", - "wayland-client", + "wayland-client 0.29.2", "xcursor", ] +[[package]] +name = "wayland-egl" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99ba1ab1e18756b23982d36f08856d521d7df45015f404a2d7c4f0b2d2f66956" +dependencies = [ + "wayland-client 0.28.6", + "wayland-sys 0.28.6", +] + [[package]] name = "wayland-protocols" version = "0.29.2" @@ -3480,9 +3586,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95eec5f6e43e4ad07088aa7003feb5df261684ffa69224ef57501110ead88af4" dependencies = [ "bitflags", - "wayland-client", - "wayland-commons", - "wayland-scanner", + "wayland-client 0.29.2", + "wayland-commons 0.29.2", + "wayland-scanner 0.29.2", +] + +[[package]] +name = "wayland-scanner" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce923eb2deb61de332d1f356ec7b6bf37094dc5573952e1c8936db03b54c03f1" +dependencies = [ + "proc-macro2", + "quote", + "xml-rs", ] [[package]] @@ -3496,6 +3613,17 @@ dependencies = [ "xml-rs", ] +[[package]] +name = "wayland-sys" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d841fca9aed7febf9bed2e9796c49bf58d4152ceda8ac949ebe00868d8f0feb8" +dependencies = [ + "dlib", + "lazy_static", + "pkg-config", +] + [[package]] name = "wayland-sys" version = "0.29.2" @@ -3533,7 +3661,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7181fe6ba5f4b632a9079cc9e922a64555156c87def72c063f94b180c7d68" dependencies = [ - "arrayvec 0.7.2", + "arrayvec", "js-sys", "log", "parking_lot 0.11.2", @@ -3553,7 +3681,7 @@ version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35600627b6c718ad0e23ed75fb6140bfe32cdf21c8f539ce3c9ab8180e2cb38e" dependencies = [ - "arrayvec 0.7.2", + "arrayvec", "bitflags", "cfg_aliases", "copyless", @@ -3575,7 +3703,7 @@ version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af28b29ef0b44cd22dd9895d4349b9d5a687df42f58da234871198637eabe328" dependencies = [ - "arrayvec 0.7.2", + "arrayvec", "ash", "bit-set", "bitflags", @@ -3584,7 +3712,7 @@ dependencies = [ "d3d12", "foreign-types", "fxhash", - "glow", + "glow 0.11.2", "gpu-alloc", "gpu-descriptor", "inplace_it", @@ -3730,7 +3858,7 @@ dependencies = [ "raw-window-handle 0.3.4", "smithay-client-toolkit", "wasm-bindgen", - "wayland-client", + "wayland-client 0.29.2", "wayland-protocols", "web-sys", "winapi 0.3.9", @@ -3746,15 +3874,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "wio" version = "0.2.2" diff --git a/apps/desktop/Cargo.toml b/apps/desktop/Cargo.toml index e51a8d7..01bebc6 100644 --- a/apps/desktop/Cargo.toml +++ b/apps/desktop/Cargo.toml @@ -1,62 +1,34 @@ [package] name = "ascella" version = "0.1.0" -edition = "2021" -description = "Ascella desktop app uploader" authors = ["Tricked-dev"] +edition = "2021" +homepage = "https://tricked.pro/ascella" license = "AGPL-3" readme = "README.md" repository = "https://github.com/Tricked-dev/ascella" -homepage = "https://tricked.pro/ascella" +description = "Ascella desktop app uploader" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -iced = {git="https://github.com/iced-rs/iced" , rev="4db0f4a570a1fb3398062c78770c542d9efb8a64", features = ["canvas", "tokio", "debug"]} -tokio = { version = "1.0", features = ["sync"] } -itertools = "0.9" -rustc-hash = "1.1" -chrono = "0.4" -serde ={version= "1.0.133", features=["derive"]} -serde_json = "1.0.74" -toml = "0.5.8" -#use sync version of reqwest cause i cba to deal witht his shit tbfh -reqwest = {version = "0.9.10", features=[]} +chrono = "0.4.19" +clap = { version = "3.0.1", features = ["cargo", "color"] } clipboard = "0.5.0" -clap = {version = "3.0.0", features = ["cargo", "color"]} home = "0.5.3" - -[dependencies.native-dialog] -version= "0.6.1" - -[build-dependencies] -embed-resource = "1.3" +iced = { git = "https://github.com/iced-rs/iced", rev = "4db0f4a570a1fb3398062c78770c542d9efb8a64", features = [ "tokio", "debug", "glow"] } +itertools = "0.10.3" +native-dialog = "0.6.1" +# use sync version of reqwest cause i cba to deal witht his shit tbfh +reqwest = { version = "0.9.10", features = [] } +rustc-hash = "1.1.0" +serde = { version = "1.0.133", features = ["derive"] } +serde_json = "1.0.74" +tokio = { version = "1.15.0", features = ["sync"] } +toml = "0.5.8" [target.'cfg(unix)'.dependencies] openssl = { version = "0.10.38", features = ["vendored"] } -libc = "0.2.107" +libc = "0.2.112" [target.'cfg(windows)'.build-dependencies] winapi = "0.3.9" - - - -[package.metadata.deb] -maintainer = "Tricked-dev" -copyright = "2022, Tricked-dev" -license-file = ["LICENSE", "4"] -extended-description = """https://github.com/Tricked-dev/diplo""" -depends = "$auto" -section = "utility" -priority = "optional" -assets = [ - [ - "target/release/ascella", - "usr/bin/", - "755", - ], - [ - "README.md", - "usr/share/doc/ascella/README", - "644", - ], -] \ No newline at end of file diff --git a/apps/desktop/README.md b/apps/desktop/README.md index 89f3877..9ee4229 100644 --- a/apps/desktop/README.md +++ b/apps/desktop/README.md @@ -1 +1,9 @@ +# Ascella desktop + +## Docs + [https://ascella.host/docs/ascella-desktop](https://ascella.host/docs/ascella-desktop) + +## Contributing + +Contribution are welcome improving the ux/ui diff --git a/apps/desktop/src/app.rs b/apps/desktop/src/app.rs new file mode 100644 index 0000000..baf3940 --- /dev/null +++ b/apps/desktop/src/app.rs @@ -0,0 +1,24 @@ +//Macro to create the app so it can be used for the ascella-backend +#[macro_export] +macro_rules! create_main ( + () => { + pub fn main() -> iced::Result { + let app = App::new(crate_name!()) + .version(crate_version!()) + .author(crate_authors!()) + .about(crate_description!()) + .subcommand(App::new("area").about("Screenshot a area")) + .subcommand(App::new("window").about("screenshot the current window")) + .subcommand(App::new("full").about("screenshot all screens")); + + let matches = app.get_matches(); + + match matches.subcommand() { + Some(("area", _)) => screenshot(ScreenshotKind::Area), + Some(("window", _)) => screenshot(ScreenshotKind::Window), + Some(("full", _)) => screenshot(ScreenshotKind::Full), + _ => AscellaDesktop::run(Settings::default()), + } + } + }; +); diff --git a/apps/desktop/src/lib.rs b/apps/desktop/src/lib.rs index 61f999f..b102d7f 100644 --- a/apps/desktop/src/lib.rs +++ b/apps/desktop/src/lib.rs @@ -3,6 +3,7 @@ use std::fs; use std::process::Command; use std::process::Stdio; +pub mod app; pub mod ui; pub mod util; diff --git a/apps/desktop/src/main.rs b/apps/desktop/src/main.rs index aae20d0..5eecae6 100644 --- a/apps/desktop/src/main.rs +++ b/apps/desktop/src/main.rs @@ -1,26 +1,9 @@ use clap::{crate_authors, crate_description, crate_name, crate_version, App}; use iced::{Application, Settings}; +use ascella::create_main; use ascella::ui::app::AscellaDesktop; use ascella::util::screenshot; use ascella::ScreenshotKind; - -pub fn main() -> iced::Result { - let app = App::new(crate_name!()) - .version(crate_version!()) - .author(crate_authors!()) - .about(crate_description!()) - .subcommand(App::new("area").about("Screenshot a area")) - .subcommand(App::new("window").about("screenshot the current window")) - .subcommand(App::new("full").about("screenshot all screens")); - - let matches = app.get_matches(); - - match matches.subcommand() { - Some(("area", _)) => screenshot(ScreenshotKind::Area), - Some(("window", _)) => screenshot(ScreenshotKind::Window), - Some(("full", _)) => screenshot(ScreenshotKind::Full), - _ => AscellaDesktop::run(Settings::default()), - } -} +create_main!(); diff --git a/apps/desktop/src/ui/app.rs b/apps/desktop/src/ui/app.rs index fb135a0..f733d83 100644 --- a/apps/desktop/src/ui/app.rs +++ b/apps/desktop/src/ui/app.rs @@ -1,7 +1,8 @@ use home::home_dir; +use iced::svg::Handle; use iced::{ - button, executor, scrollable, slider, text_input, Application, Button, Column, Command, - Container, Element, Length, Radio, Text, + button, executor, scrollable, slider, svg, text_input, Application, Button, Column, Command, + Container, Element, Length, Radio, Row, Rule, Svg, Text, Toggler, }; use native_dialog::{FileDialog, MessageDialog, MessageType}; use serde_json::Value; @@ -29,6 +30,7 @@ pub enum Message { ThemeChanged(style::Theme), NewConfig, ButtonPressed, + TogglerToggled(bool), } impl Application for AscellaDesktop { @@ -46,6 +48,21 @@ impl Application for AscellaDesktop { fn update(&mut self, message: Message) -> Command { match message { + Message::TogglerToggled(dark) => { + self.toggler_value = dark; + + if dark { + self.theme = *style::Theme::ALL + .iter() + .find(|x| format!("{:?}", x) == "Dark".to_owned()) + .unwrap(); + } else { + self.theme = *style::Theme::ALL + .iter() + .find(|x| format!("{:?}", x) != "Dark".to_owned()) + .unwrap(); + } + } Message::ThemeChanged(theme) => self.theme = theme, Message::NewConfig => { let path = FileDialog::new() @@ -70,11 +87,7 @@ impl Application for AscellaDesktop { write_path.extend(&[".ascella", "config.toml"]); std::fs::write(&write_path, toml::to_string_pretty(&config).unwrap()).unwrap(); - // toml::toml! { - // user_id = r["Headers"]["x-user-id"].as_str() - // user_token = r["Headers"]["x-user-token"].as_str() - // effects = r["Headers"]["x-image-effects"].as_str() - // } + let path_string = path.into_os_string().into_string().unwrap(); MessageDialog::new() .set_type(MessageType::Info) @@ -92,20 +105,14 @@ impl Application for AscellaDesktop { } fn view(&mut self) -> Element<'_, Self::Message> { - let choose_theme = style::Theme::ALL.iter().fold( - Column::new().spacing(10).push(Text::new("Choose a theme:")), - |column, theme| { - column.push( - Radio::new( - *theme, - format!("{:?}", theme), - Some(self.theme), - Message::ThemeChanged, - ) - .style(self.theme), - ) - }, - ); + let darkmode = Toggler::new( + self.toggler_value, + String::from("Darkmode"), + Message::TogglerToggled, + ) + .width(Length::Shrink) + .spacing(10) + .style(self.theme); let button = Button::new(&mut self.button, Text::new("Take screenshot")) .padding(10) @@ -117,13 +124,17 @@ impl Application for AscellaDesktop { .on_press(Message::NewConfig) .style(self.theme); + let row = Row::new().push(button).push(config).spacing(20); + let text = Text::new("© Ascella - image uploader"); + let content = Column::new() .spacing(20) .padding(20) .max_width(600) - .push(choose_theme) - .push(button) - .push(config); + .push(darkmode) + .push(row) + .push(Rule::horizontal(38).style(self.theme)) + .push(text); Container::new(content) .width(Length::Fill) diff --git a/apps/web/src/routes/docs/privacy.md b/apps/web/src/routes/docs/privacy.md index 72ec063..4e33827 100644 --- a/apps/web/src/routes/docs/privacy.md +++ b/apps/web/src/routes/docs/privacy.md @@ -9,6 +9,10 @@ description: Privacy policy of Ascella Images - When you create a account using `/redeem` in the discord the following information is stored: name, discord id, account creation date and selected domain. - No other information is collected. +### When you upload a image + +When you upload a image following information is saved: Upload date, ContentType, Vanity and id of who uploaded it. a log is also send containing the username and vanity to prevent abuse. We will never look at your images without a reason! + ### How can I contact you for privacy concerns? / How can I request data deletion? - DM tricked#3777 on Discord.