Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Add research snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptofyre committed Sep 23, 2024
0 parents commit c711ab7
Show file tree
Hide file tree
Showing 25 changed files with 2,625 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

src-tauri/Microsoft.WebView2.FixedVersionRuntime**

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
.history/
*.ntvs*
*.njsproj
*.sln
*.sw?
pnpm-lock.yaml
yarn.lock
*.gz
Microsoft.WebView2.FixedVersionRuntime**
45 changes: 45 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

# Cider Collective Research License (CCRL)

## Version 1.0

### 1. **Grant of License**

Cider Collective ("Licensor") hereby grants you ("Licensee") a non-exclusive, non-transferable, revocable license to use the provided source code ("Code") strictly for non-commercial, research, and educational purposes. The Code may **not** be used to reproduce, modify, or develop any application that mirrors or replicates the original source application ("Application").

### 2. **Restrictions on Use**

The following restrictions apply:

- **No Reproduction**: Licensee is strictly prohibited from using the Code to produce a functional or derivative copy of the Application in any form.

- **No Piracy or Malicious Use**: The Code must not be used for any activity related to piracy, circumvention of software protections, or any malicious or illegal purposes.

- **No Commercial Use**: The Code may not be used in any commercial product or for profit-driven endeavors.

- **Non-functional Representation**: The Code provided herein is intended solely for research and educational purposes and does **not** represent a live or operational version of the Application. It is not suitable for any production-level deployment.

### 3. **Permissible Use**

Licensee may use the Code only for:

- Research and study of the Code structure and architecture.
- Exploration of theoretical improvements or modifications for academic purposes.

No rights are granted to Licensee to distribute, sublicense, or otherwise make the Code or any derivative works available to third parties without prior written consent from the Licensor.

### 4. **Ownership and Copyright**

The Code is the intellectual property of Cider Collective. All rights not expressly granted under this License are reserved. Licensee acknowledges that all ownership rights, including copyright and trademark rights, remain with the Licensor.

### 5. **Disclaimer of Warranty**

The Code is provided "AS IS" without any warranty of any kind. Cider Collective disclaims any and all warranties, whether express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, or non-infringement.

### 6. **Limitation of Liability**

In no event shall Cider Collective be liable for any direct, indirect, incidental, consequential, or special damages arising out of or in connection with the use of the Code, even if advised of the possibility of such damages.

### 7. **Termination**

This License will automatically terminate if Licensee violates any of the terms and conditions stated herein. Upon termination, Licensee must immediately cease all use of the Code and destroy all copies in their possession.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

# Sabiiro Snapshot

This snapshot of **Sabiiro** represents a developmental backend for Cider based on Tauri & Rust, various chunks have been removed due to correspondance in active software. It is provided solely for **research purposes** and is not intended for compilation or deployment. Key functions and data have been omitted for security reasons, and it is no longer actively maintained or used.

## Purpose

Sabiiro was the backend platform used during Cider's development. It was a full scale attempt at a backend for Cider and was briefly used (not in this form) as a suitable backend for a while before being retired to due developmental difficulties. This release allows researchers to study the architectural decisions made during its development, but it is **not suitable** for operational use.

## Security Notice

This snapshot has been stripped of sensitive functions, and the code is safe to publish under the **Cider Collective Research License (CCRL)**. Any attempts to use this code beyond research purposes are strictly prohibited, and the snapshot is provided **as-is**.

## License

This project is published under the **Cider Collective Research License (CCRL)**, restricting its use to non-commercial, research-intensive purposes only.

## Special Credit

Huge thanks to @d3rpp who participated largely in the making of this backend, you are **AWESOME**! Good luck on your future endeavors!
4 changes: 4 additions & 0 deletions src-tauri/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Generated by Cargo
# will have compiled files and executables
/target/

94 changes: 94 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
[package]
name = "cider"
version = "x.x.x"
description = "Cider"
authors = ["Cider Collective"]
license = ""
repository = ""
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.release]
lto = true
opt-level = 2
debug = 0
strip = "symbols"

[build-dependencies]
tauri-build = { version = "1.3.0", features = [] }
cfg-if = "~1.0"

[dependencies]
tauri = { version = "~1.2", features = [ "fs-all", "window-create", "window-set-focus", "window-center", "window-set-icon", "window-request-user-attention", "window-set-title", "window-show", "process-all", "http-all", "dialog-all", "clipboard-write-text", "devtools", "notification-all", "os-all", "process-command-api", "shell-open", "shell-sidecar", "system-tray", "window-close", "window-hide", "window-maximize", "window-minimize", "window-set-always-on-top", "window-set-fullscreen", "window-set-position", "window-set-size", "window-start-dragging", "window-unmaximize"] }
serde = { version = "1.0", features = ["derive"] }
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
tauri-plugin-deep-link = { git = "https://github.com/FabianLars/tauri-plugin-deep-link", branch = "main" }

tokio = { version = "~1.29", default-features = false, features = ["fs", "macros"] }
reqwest = { version = "~0.11", features = ["json", "blocking", "rustls-tls"], default-features = false }
warp = { version = "~0.3", features = [] }
rouille = "~3.6"
bytes = "~1.4"

steamworks = { version = "~0.10", optional = true }

thiserror = "~1.0"
lazy_static = "~1.4"
obfstr = "~0.4"
cfg-if = "~1.0"
futures = "~0.3"
dialog = "0.3.0"
native-dialog = "0.7.0"

rustfm-scrobble = "~1.1"

discord-rich-presence = "0.2.3"

zip = "0.6"
sha2 = "0.10.8"
mime_guess = "2.0.3"

tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
portpicker = "0.1" # used in the example to pick a random free port


fon = "0.6.0"

base64 = "0.21.0"
serde_json = "~1.0"
md5 = "~0.7"

chrono = "~0.4"
chashmap = "2.2.2"
open = "~5.0"

[target.'cfg(macos)'.dependencies]
objc = "~0.2"

[target.'cfg(windows)'.dependencies]
# Windows Only
webview2-com = "~0.19" # DO NOT BUMP
windows = { version = "~0.39", features = [
"Win32_Graphics_Dwm",
"Win32_Foundation",
"Win32_UI_Controls",
] } # DO NOT BUMP
widestring = "~1.0"

[target."cfg(target_os = \"windows\")".dependencies.windows-sys]
version = "0.45.0"
features = [
"Win32_Foundation",
"Win32_System_LibraryLoader",
"Win32_System_SystemInformation",
"Win32_Graphics_Gdi",
"Win32_Graphics_Dwm",
"Win32_UI_WindowsAndMessaging"
]

[features]
default = ["custom-protocol"]
steamworks = ["dep:steamworks"]
# this feature is used for production builds or when `devPath` points to the filesystem
# DO NOT REMOVE!!
custom-protocol = ["tauri/custom-protocol"]
55 changes: 55 additions & 0 deletions src-tauri/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
use cfg_if::cfg_if;
use std::{env, fs, path::PathBuf};
cfg_if! {
if #[cfg(any(windows))] {
fn main() {

#[cfg(debug_assertions)]
let profile = "debug";
#[cfg(not(debug_assertions))]
let profile = "release";


let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());

cfg_if! {
if #[cfg(all(any(debug_assertions, feature = "steamworks"), windows))] {
let from_path = manifest_dir.join("resource/steam_api64.dll");
let to_path = manifest_dir.join(format!("target/{}/steam_api64.dll", profile));

println!("cargo:rerun-if-changed=resource/steam_api64.dll");
println!("cargo:rerun-if-changed=target/{}/steam_api_64.dll", profile);

fs::copy(from_path, to_path).expect("FAILED TO COPY STEAM_API DLL");
}
}

cfg_if! {
if #[cfg(all(not(debug_assertions), windows))] {
// create a symlink for ../../Microsoft.WebView2.FixedVersionRuntime.123.0.2420.81.x64/ to ./target/debug/Microsoft.WebView2.FixedVersionRuntime.123.0.2420.81.x64/ folder to debug and release
let from_path = manifest_dir.join("Microsoft.WebView2.FixedVersionRuntime.123.0.2420.81.x64");
let to_path_debug = manifest_dir.join(format!("target/debug/Microsoft.WebView2.FixedVersionRuntime.123.0.2420.81.x64"));
let to_path_release = manifest_dir.join(format!("target/release/Microsoft.WebView2.FixedVersionRuntime.123.0.2420.81.x64"));

println!("cargo:rerun-if-changed=resource/Microsoft.WebView2.FixedVersionRuntime.123.0.2420.81.x64");
println!("cargo:rerun-if-changed=target/{}/Microsoft.WebView2.FixedVersionRuntime.123.0.2420.81.x64", profile);

if !to_path_debug.exists() {
std::os::windows::fs::symlink_dir(&from_path, to_path_debug).expect("FAILED TO CREATE SYMLINK FOR WEBVIEW2 RUNTIME");
}

if !to_path_release.exists() {
std::os::windows::fs::symlink_dir(&from_path, to_path_release).expect("FAILED TO CREATE SYMLINK FOR WEBVIEW2 RUNTIME");
}
}
}

tauri_build::build()
}
}
else {
fn main() {
compile_error!("UNSUPPORTED PLATFORM AT THIS TIME");
}
}
}
70 changes: 70 additions & 0 deletions src-tauri/src/additional.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
use tauri::{async_runtime::Mutex, LogicalPosition, LogicalSize, Runtime};

/*
```js
let wm = new WindowManager("cider_main")
const factor = await wm.scaleFactor();
const size = await wm.outerSize();
const logical = size.toLogical(factor);
window.tempSize = logical;
await wm.setSize(new LogicalSize(296, 296));
```
*/

lazy_static::lazy_static! {
static ref OLD_SIZE: Mutex<(f32, f32)> = Mutex::new((600.0, 500.0));
static ref OLD_POS: Mutex<(f32, f32)> = Mutex::new((0.0, 0.0));
}

#[tauri::command]
pub async fn set_miniplayer_mode<R: Runtime>(
window: tauri::Window<R>,
toggled: bool,
) -> Result<(), String> {
let mut s_lock = OLD_SIZE.lock().await;
let mut p_lock = OLD_POS.lock().await;

if toggled {
let factor = window.scale_factor().map_err(|e| e.to_string())?;
let size = window.outer_size().map_err(|e| e.to_string())?;
let logical = size.to_logical::<f32>(factor);

*s_lock = (logical.width, logical.height);
drop(s_lock);

let position = window.outer_position().map_err(|e| e.to_string())?;
let logical_pos = position.to_logical::<f32>(factor);

*p_lock = (logical_pos.x, logical_pos.y);
drop(p_lock);

window
.set_title("Miniplayer - Cider")
.map_err(|e| e.to_string())?;
window.set_resizable(false).map_err(|e| e.to_string())?; // there is no benefit to changing the size, so i will disable it
window
.set_size(LogicalSize::new(296.0, 296.0))
.map_err(|e| e.to_string())?;
window.set_always_on_top(true).map_err(|e| e.to_string())?;

Ok(())
} else {
let (w, h) = *s_lock;
drop(s_lock);

let (x, y) = *p_lock;
drop(p_lock);

window.set_title("Cider").map_err(|e| e.to_string())?;
window
.set_position(LogicalPosition::new(x, y))
.map_err(|e| e.to_string())?;
window
.set_size(LogicalSize::new(w, h))
.map_err(|e| e.to_string())?;
window.set_resizable(true).map_err(|e| e.to_string())?;
window.set_always_on_top(false).map_err(|e| e.to_string())?;

Ok(())
}
}
8 changes: 8 additions & 0 deletions src-tauri/src/airplay/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use serde::Serialize;
use thiserror::Error;

#[derive(Debug, Serialize, Error)]
pub enum AirPlayError {
#[error("Initialisation Error: {0}")]
Init(String),
}
Loading

0 comments on commit c711ab7

Please sign in to comment.