rename app

This commit is contained in:
2026-08-31 15:36:36 +08:00
parent 78eb5c773c
commit 4e80a081e9
30 changed files with 1593 additions and 449 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ use sqlx::{Pool, Sqlite};
use std::error::Error;
use tauri::{AppHandle, Manager};
const DATABASE_FILE: &str = "wyd.sqlite";
const DATABASE_FILE: &str = "friendolls.sqlite";
pub struct AppDatabase {
pool: Pool<Sqlite>,
+7 -7
View File
@@ -41,7 +41,7 @@ async fn emit_changed(handle: &AppHandle, database: &AppDatabase) -> Result<(),
async fn update_profiles(
database: &AppDatabase,
profiles: &[wyd_common::Profile],
profiles: &[friendolls_common::Profile],
) -> Result<bool, sqlx::Error> {
let mut transaction = database.pool().begin().await?;
let mut changed = false;
@@ -49,7 +49,7 @@ async fn update_profiles(
if profile
.skin_hash
.as_deref()
.is_some_and(|hash| !wyd_common::is_skin_hash(hash))
.is_some_and(|hash| !friendolls_common::is_skin_hash(hash))
{
continue;
}
@@ -71,7 +71,7 @@ async fn update_profiles(
pub(crate) async fn apply_profile_update(
handle: &AppHandle,
database: &AppDatabase,
profile: wyd_common::Profile,
profile: friendolls_common::Profile,
) -> Result<bool, String> {
apply_profile_sync(handle, database, vec![profile]).await
}
@@ -79,7 +79,7 @@ pub(crate) async fn apply_profile_update(
pub(crate) async fn apply_profile_sync(
handle: &AppHandle,
database: &AppDatabase,
profiles: Vec<wyd_common::Profile>,
profiles: Vec<friendolls_common::Profile>,
) -> Result<bool, String> {
let changed = update_profiles(database, &profiles)
.await
@@ -205,12 +205,12 @@ mod tests {
update_profiles(
&database,
&[
wyd_common::Profile {
friendolls_common::Profile {
id: "friend-id".to_owned(),
display_name: "New".to_owned(),
skin_hash: Some("a".repeat(64)),
},
wyd_common::Profile {
friendolls_common::Profile {
id: "missing".to_owned(),
display_name: "Name".to_owned(),
skin_hash: None,
@@ -223,7 +223,7 @@ mod tests {
assert!(
!update_profiles(
&database,
&[wyd_common::Profile {
&[friendolls_common::Profile {
id: "friend-id".to_owned(),
display_name: "New".to_owned(),
skin_hash: Some("a".repeat(64)),
+1 -1
View File
@@ -2,12 +2,12 @@ use std::io::Cursor;
use base64::Engine;
use base64::engine::general_purpose::STANDARD;
use friendolls_common::{InteractionContent, MAX_IMAGE_B64_SIZE, MAX_IMAGE_DIMENSION};
use image::codecs::jpeg::JpegEncoder;
use image::imageops::FilterType;
use image::{DynamicImage, ImageReader, Limits, Rgb, RgbImage};
use tauri::{AppHandle, State};
use tauri_plugin_dialog::DialogExt;
use wyd_common::{InteractionContent, MAX_IMAGE_B64_SIZE, MAX_IMAGE_DIMENSION};
use crate::network::Network;
+2 -2
View File
@@ -3,11 +3,11 @@ use std::sync::Mutex;
use base64::Engine;
use base64::engine::general_purpose::STANDARD;
use friendolls_common::InteractionContent;
use serde::Serialize;
use specta::Type;
use tauri::{AppHandle, Manager, State};
use tauri_specta::Event;
use wyd_common::InteractionContent;
use crate::network::Network;
@@ -106,7 +106,7 @@ pub async fn send_interaction(
#[cfg(test)]
mod tests {
use super::*;
use wyd_common::MAX_TEXT_CHARS;
use friendolls_common::MAX_TEXT_CHARS;
#[test]
fn validates_interaction_content_limits() {
+1 -1
View File
@@ -2,5 +2,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
wyd_lib::run()
friendolls_lib::run()
}
+7 -5
View File
@@ -1,14 +1,14 @@
use std::collections::HashMap;
use std::time::Duration;
use friendolls_common::{
ClientMessage, InteractionDeliveryStatus, Profile, ServerMessage, friends_bytes,
interaction_bytes, message_bytes, profile_bytes, register_bytes,
};
use futures_util::{SinkExt, StreamExt};
use tauri::{AppHandle, Manager};
use tokio::sync::{mpsc, oneshot, watch};
use tokio_tungstenite::tungstenite::Message;
use wyd_common::{
ClientMessage, InteractionDeliveryStatus, Profile, ServerMessage, friends_bytes,
interaction_bytes, message_bytes, profile_bytes, register_bytes,
};
use super::presence::FriendPresence;
use super::{
@@ -113,7 +113,9 @@ async fn connect(
let (mut writer, mut reader) = socket.split();
let challenge = match recv(&mut reader).await? {
ServerMessage::Challenge { version, challenge } if version == wyd_common::VERSION => {
ServerMessage::Challenge { version, challenge }
if version == friendolls_common::VERSION =>
{
challenge
}
_ => return Err("server did not send a compatible challenge".into()),
+1 -1
View File
@@ -3,12 +3,12 @@ use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::{Arc, Mutex};
use std::time::Duration;
use friendolls_common::{InteractionContent, InteractionDeliveryStatus};
use serde::{Deserialize, Serialize};
use specta::Type;
use tauri::{AppHandle, Manager, State};
use tauri_specta::Event;
use tokio::sync::{mpsc, oneshot, watch};
use wyd_common::{InteractionContent, InteractionDeliveryStatus};
use crate::db::AppDatabase;
use crate::friends::{self, FriendsChanged};
+2 -2
View File
@@ -13,7 +13,7 @@ const SKIN_WIDTH: u32 = 64;
const SKIN_HEIGHT: u32 = 64;
fn validate_hash(hash: &str) -> Result<(), String> {
if wyd_common::is_skin_hash(hash) {
if friendolls_common::is_skin_hash(hash) {
Ok(())
} else {
Err("Skin hash must be a 64-character SHA-256 value".to_owned())
@@ -72,7 +72,7 @@ fn read_verified(path: PathBuf, expected_hash: &str) -> Result<Option<Vec<u8>>,
}
pub(crate) fn decode_response(data: &str, expected_hash: &str) -> Option<Vec<u8>> {
if data.len() > wyd_common::MAX_SKIN_B64_SIZE {
if data.len() > friendolls_common::MAX_SKIN_B64_SIZE {
return None;
}
let bytes = STANDARD.decode(data).ok()?;
+1 -1
View File
@@ -14,7 +14,7 @@ pub fn init(handle: &AppHandle) {
WINDOW_LABEL,
WebviewUrl::App("/control-panel".into()),
)
.title("Wyd Control Panel")
.title("Friendolls")
.inner_size(400.0, 600.0)
.min_inner_size(400.0, 600.0)
.resizable(false)
+1 -1
View File
@@ -14,7 +14,7 @@ pub fn init(handle: &AppHandle) {
let builder =
tauri::WebviewWindowBuilder::new(handle, WINDOW_LABEL, WebviewUrl::App("/".into()))
.title("Wyd Debug")
.title("Friendolls Debug")
.inner_size(800.0, 600.0)
.min_inner_size(500.0, 400.0)
.visible(true);
+1 -1
View File
@@ -24,7 +24,7 @@ pub fn init(handle: &AppHandle) {
.expect("Tray menu should be created");
let mut builder = TrayIconBuilder::new()
.tooltip("Wyd")
.tooltip("Friendolls")
.menu(&menu)
.show_menu_on_left_click(true)
.on_menu_event(|app, event| match event.id().as_ref() {