Skip to content

Commit

Permalink
Merge pull request #24 from polyphony-chat/experiments
Browse files Browse the repository at this point in the history
Experiments
  • Loading branch information
bitfl0wer authored Dec 12, 2023
2 parents 19b7c8b + 4cc7197 commit 6f4d9aa
Show file tree
Hide file tree
Showing 42 changed files with 379 additions and 578 deletions.
29 changes: 8 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
[package]
name = "polyphony-native"
version = "0.1.0"
edition = "2021"
license = "GPL-3.0"
[workspace]
members = ["crates/polyphony-wasm", "crates/polyphony-tauri"]
resolver = "2"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
iced = { version = "0.10", features = ["tokio"] }
chorus = { path = "../chorus", features = ["client"] }
tokio = { version = "1.32.0", features = ["rt-multi-thread"] }
serde = { version = "1.0.188", features = ["derive", "rc"] }
serde_json = "1.0.105"
log = "0.4.20"
async-trait = "0.1.73"
env_logger = "0.10.0"

[dev-dependencies]
rusty-hook = "0.11.2"
iced = { version = "0.10", features = ["debug"] }
tokio = { version = "1.32.0", features = ["full"] }
[profile.release]
opt-level = 'z'
lto = true
codegen-units = 1
panic = "abort"
80 changes: 33 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,65 @@
<a name="readme-top"></a>

<div align="center">

[![Discord]][Discord-invite]
[![Build][build-shield]][build-url]
[![Contributors][contributors-shield]][contributors-url]
[![Issues][issues-shield]][issues-url]
<img src="https://img.shields.io/badge/0.10-blue?logo=iced">
<img src="https://img.shields.io/static/v1?label=Status&message=Early%20Development&color=blue">

</div>

<!-- PROJECT LOGO -->
<br />
<div align="center">
</br>
<a href="https://github.com/polyphony-chat/polyphony">
<img src="https://github.com/polyphony-chat/branding/blob/main/logos/polyphony-2-5-round8bit.png?raw=true" alt="The Polyphony logo. a purple, square background with rounded edges. on this background, there are four vertically stacked, white lines. The lines each resemble a sine curve, although they are all shaped a little differently." width="128" height="128">
</a>

<h3 align="center">Polyphony</h3>
<h3 align="center">Polyphony Web</h3>

<p align="center">
A multi-instance, Discord/Spacebar API-compatible chat client, written in Rust, using Iced.
A multi-instance, cross-platform Discord/Spacebar API-compatible chat client, written in Rust using leptos and optionally Tauri.
<br />
<a href="https://github.com/polyphony-chat/polyphony"><strong>Explore the docs »</strong></a>
<a href="https://github.com/polyphony-chat/polyphony-web"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://github.com/polyphony-chat/polyphony/issues">Report Bug</a>
<a href="https://github.com/polyphony-chat/polyphony-web/issues">Report Bug</a>
·
<a href="https://github.com/polyphony-chat/polyphony/issues">Request Feature</a>
<a href="https://github.com/polyphony-chat/polyphony-web/issues">Request Feature</a>
·
<a href="https://discord.gg/8tKSC8wzDq">Join Discord</a>
</p>
</div>

<!-- ABOUT THE PROJECT -->

## About The Project

![Product Mockup](https://github.com/polyphony-chat/design/blob/main/ui/client-mockup-draft.png?raw=true)
<cite>_A mockup of the Polyphony client._</cite>

Polyphony will be a multi-instance, Discord/Spacebar API-compatible chat client, written in Rust, using Iced. The three goals of this project are ease of use, user experience and performance.

Ideally, you will be able to connect to multiple Spacebar instances at the same time and use the client just like you would expect a regular Discord client to work.
</div>

### Spacebar? What's that?
## Setting up a dev environment

[Go read about the Spacebar project here!](https://github.com/spacebarchat) Spacebar describes itself as "_a free _open source _self hostable_ discord compatible_ chat, voice and video platform_".
Add wasm as a compilation target

```bash
rustup target add wasm32-unknown-unknown
```

## Contact
Install `tauri-cli` and `trunk`
```bash
cargo install tauri-cli trunk --locked
```

florian@pro-weber.com
To start the web-based application, change into the `crates/polyphony-wasm` directory and run `trunk serve`.

To start the Tauri powered Desktop-App instead, change into the `crates/polyphony-tauri` directory and run `cargo tauri dev`.

<p align="right">(<a href="#readme-top">back to top</a>)</p>
> Note that the Tauri Dev Server will try to run and listen for the `trunk serve` Dev server. If it fails to do so (perhaps because Port `8080` is already occupied), it will not be able to start the Tauri App.

[build-shield]: https://img.shields.io/github/actions/workflow/status/polyphony-chat/polyphony/rust.yml?style=flat
[build-url]: https://github.com/polyphony-chat/polyphony/blob/main/.github/workflows/rust.yml
[contributors-shield]: https://img.shields.io/github/contributors/polyphony-chat/polyphony.svg?style=flat
[contributors-url]: https://github.com/polyphony-chat/polyphony/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/polyphony-chat/polyphony.svg?style=flat
[forks-url]: https://github.com/polyphony-chat/polyphony/network/members
[stars-shield]: https://img.shields.io/github/stars/polyphony-chat/polyphony.svg?style=flat
[stars-url]: https://github.com/polyphony-chat/polyphony/stargazers
[issues-shield]: https://img.shields.io/github/issues/polyphony-chat/polyphony.svg?style=flat
[issues-url]: https://github.com/polyphony-chat/polyphony/issues
[license-shield]: https://img.shields.io/github/license/polyphony-chat/polyphony.svg?style=flat
[license-url]: https://github.com/polyphony-chat/polyphony/blob/master/LICENSE
[svelte.dev]: https://img.shields.io/badge/Svelte-4A4A55?style=plastic&logo=svelte&logoColor=FF3E00
[svelte-url]: https://svelte.dev/
[rust]: https://img.shields.io/badge/Rust-orange?style=flat&logo=rust
[rust-url]: https://www.rust-lang.org/
[typescript]: https://img.shields.io/badge/TypeScript-blue?style=plastic&logo=typescript&logoColor=FFFFFF
[typescript-url]: https://www.typescriptlang.org/
[Rust]: https://img.shields.io/badge/Rust-orange?style=plastic&logo=rust
[Rust-url]: https://www.rust-lang.org/
[build-shield]: https://img.shields.io/github/actions/workflow/status/polyphony-chat/polyphony-web/rust.yml?style=flat
[build-url]: https://github.com/polyphony-chat/polyphony-web/blob/main/.github/workflows/rust.yml
[contributors-shield]: https://img.shields.io/github/contributors/polyphony-chat/polyphony-web.svg?style=flat
[contributors-url]: https://github.com/polyphony-chat/polyphony-web/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/polyphony-chat/polyphony-web.svg?style=flat
[forks-url]: https://github.com/polyphony-chat/polyphony-web/network/members
[stars-shield]: https://img.shields.io/github/stars/polyphony-chat/polyphony-web.svg?style=flat
[stars-url]: https://github.com/polyphony-chat/polyphony-web/stargazers
[issues-shield]: https://img.shields.io/github/issues/polyphony-chat/polyphony-web.svg?style=flat
[issues-url]: https://github.com/polyphony-chat/polyphony-web/issues
[license-shield]: https://img.shields.io/github/license/polyphony-chat/polyphony-web.svg?style=f;at
[license-url]: https://github.com/polyphony-chat/polyphony-web/blob/master/LICENSE
[Discord]: https://dcbadge.vercel.app/api/server/m3FpcapGDD?style=flat
[Discord-invite]: https://discord.com/invite/m3FpcapGDD
3 changes: 3 additions & 0 deletions crates/polyphony-tauri/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generated by Cargo
# will have compiled files and executables
/target/
26 changes: 26 additions & 0 deletions crates/polyphony-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
default-run = "app"
edition = "2021"
rust-version = "1.60"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
tauri-build = { version = "1.4.1", features = [] }

[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.5.0", features = [] }

[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
# If you use cargo directly instead of tauri's cli you can use this feature flag to switch between tauri's `dev` and `build` modes.
# DO NOT REMOVE!!
custom-protocol = [ "tauri/custom-protocol" ]
3 changes: 3 additions & 0 deletions crates/polyphony-tauri/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}
Binary file added crates/polyphony-tauri/icons/128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/polyphony-tauri/icons/128x128@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/polyphony-tauri/icons/32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/polyphony-tauri/icons/Square30x30Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/polyphony-tauri/icons/Square44x44Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/polyphony-tauri/icons/Square71x71Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/polyphony-tauri/icons/Square89x89Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/polyphony-tauri/icons/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/polyphony-tauri/icons/icon.icns
Binary file not shown.
Binary file added crates/polyphony-tauri/icons/icon.ico
Binary file not shown.
Binary file added crates/polyphony-tauri/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions crates/polyphony-tauri/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
65 changes: 65 additions & 0 deletions crates/polyphony-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"build": {
"beforeBuildCommand": "cd polyphony-wasm && trunk build",
"beforeDevCommand": "cd polyphony-wasm && trunk serve",
"devPath": "http://localhost:8080",
"distDir": "../polyphony-wasm/dist"
},
"package": {
"productName": "polyphony-tauri",
"version": "0.1.0"
},
"tauri": {
"allowlist": {
"all": false
},
"bundle": {
"active": true,
"category": "DeveloperTool",
"copyright": "",
"deb": {
"depends": []
},
"externalBin": [],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"identifier": "chat.polyphony.web",
"longDescription": "",
"macOS": {
"entitlements": null,
"exceptionDomain": "",
"frameworks": [],
"providerShortName": null,
"signingIdentity": null
},
"resources": [],
"shortDescription": "",
"targets": "all",
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"security": {
"csp": null
},
"updater": {
"active": false
},
"windows": [
{
"fullscreen": false,
"height": 600,
"resizable": true,
"title": "Polyphony",
"width": 800
}
]
}
}
22 changes: 22 additions & 0 deletions crates/polyphony-wasm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb


# Added by cargo

/target

# Do not include dist directory in git repo
dist/
19 changes: 19 additions & 0 deletions crates/polyphony-wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "polyphony-wasm"
version = "0.1.0"
edition = "2021"

[dependencies]
chorus = { version = "0.13.0", default-features = false, features = [
"rt",
"client",
], git = "https://github.com/polyphony-chat/chorus.git", branch = "dev" }
hashbrown = { version = "0.14.3", features = ["serde"] }
leptos = { version = "0.5.4", features = ["csr"] }
serde = { version = "1.0.193", features = ["derive"] }
tokio = { version = "1.34.0", features = ["rt", "macros"] }
wasm-bindgen-futures = "0.4.39"
web-sys = "0.3.65"
wasm-logger = "0.2.0"
log = "0.4.20"
leptos_router = { version = "0.5.4", features = ["csr"] }
38 changes: 38 additions & 0 deletions crates/polyphony-wasm/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<!--Copy ./public dir into dist to be able to link relatively from the dist-dir-->
<link data-trunk rel="copy-dir" href="./public/" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, height=device-height" />
<link rel="manifest" href="manifest.json" />
<title>Tauri + Yew App</title>

<link data-trunk rel="tailwind-css" href="/public/main.css" />
<script>
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/sw.js");
}

var viewport = document.querySelector("meta[name=viewport]");
viewport.setAttribute(
"content",
viewport.content + ", height=" + window.innerHeight
),
viewport.setAttribute(
"content",
viewport.content + ", width=" + window.innerWidth
);
</script>
</head>
<body>
<noscript>
<p>
This page runs with WebAssembly and needs JavaScript to execute the
WebAssembly. Please allow JavaScript for this page.<br />
If you are concerned about privacy, you can view the data we collect
here: [placeholder]
</p>
</noscript>
</body>
</html>
3 changes: 3 additions & 0 deletions crates/polyphony-wasm/public/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
3 changes: 3 additions & 0 deletions crates/polyphony-wasm/src/app/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod register;

pub use register::*;
Loading

0 comments on commit 6f4d9aa

Please sign in to comment.