1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-21 18:02:32 +01:00

update dependencies

This commit is contained in:
Puyodead1 2024-02-27 22:33:54 -05:00
parent 80b986ce36
commit a63e154431
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC
43 changed files with 9304 additions and 3958 deletions

2
.gitignore vendored
View File

@ -9,7 +9,7 @@
/coverage /coverage
# production # production
/build /dist
# misc # misc
.DS_Store .DS_Store

View File

@ -26,7 +26,7 @@
makeCacheWritable = true; makeCacheWritable = true;
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
cp -r build $out/ cp -r dist $out/
runHook postInstall runHook postInstall
''; '';
}; };

View File

@ -26,7 +26,7 @@
makeCacheWritable = true; makeCacheWritable = true;
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
cp -r build $out/ cp -r dist $out/
runHook postInstall runHook postInstall
''; '';
}; };

View File

@ -4,59 +4,59 @@
"url": "https://github.com/spacebarchat/client/issues" "url": "https://github.com/spacebarchat/client/issues"
}, },
"dependencies": { "dependencies": {
"@emotion/react": "^11.11.1", "@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0", "@emotion/styled": "^11.11.0",
"@floating-ui/react": "^0.26.4", "@floating-ui/react": "^0.26.9",
"@fontsource/roboto": "^4.5.8", "@fontsource/roboto": "^5.0.8",
"@fontsource/roboto-mono": "^5.0.16", "@fontsource/roboto-mono": "^5.0.16",
"@hcaptcha/react-hcaptcha": "^1.9.2", "@hcaptcha/react-hcaptcha": "^1.10.1",
"@hookform/resolvers": "^3.3.2", "@hookform/resolvers": "^3.3.4",
"@mattjennings/react-modal-stack": "^1.0.4", "@mattjennings/react-modal-stack": "^1.0.4",
"@mdi/js": "^7.3.67", "@mdi/js": "^7.4.47",
"@mdi/react": "^1.6.1", "@mdi/react": "^1.6.1",
"@mui/material": "^5.14.20", "@mui/material": "^5.15.11",
"@originjs/vite-plugin-commonjs": "^1.0.3", "@originjs/vite-plugin-commonjs": "^1.0.3",
"@rollup/plugin-replace": "^5.0.5", "@rollup/plugin-replace": "^5.0.5",
"@spacebarchat/spacebar-api-types": "0.37.51", "@spacebarchat/spacebar-api-types": "0.37.51",
"@tauri-apps/api": "^2.0.0-alpha.12", "@tauri-apps/api": "2.0.0-beta.3",
"@tauri-apps/plugin-authenticator": "2.0.0-alpha.3", "@tauri-apps/plugin-authenticator": "2.0.0-beta.1",
"@tauri-apps/plugin-autostart": "2.0.0-alpha.3", "@tauri-apps/plugin-autostart": "2.0.0-beta.1",
"@tauri-apps/plugin-clipboard-manager": "2.0.0-alpha.3", "@tauri-apps/plugin-clipboard-manager": "2.0.0-beta.1",
"@tauri-apps/plugin-dialog": "2.0.0-alpha.3", "@tauri-apps/plugin-dialog": "2.0.0-beta.1",
"@tauri-apps/plugin-log": "2.0.0-alpha.3", "@tauri-apps/plugin-log": "2.0.0-beta.1",
"@tauri-apps/plugin-notification": "2.0.0-alpha.3", "@tauri-apps/plugin-notification": "2.0.0-beta.1",
"@tauri-apps/plugin-os": "2.0.0-alpha.6", "@tauri-apps/plugin-os": "2.0.0-beta.1",
"@tauri-apps/plugin-process": "2.0.0-alpha.3", "@tauri-apps/plugin-process": "2.0.0-beta.1",
"@tauri-apps/plugin-stronghold": "2.0.0-alpha.4", "@tauri-apps/plugin-stronghold": "2.0.0-beta.1",
"@tauri-apps/plugin-updater": "2.0.0-alpha.3", "@tauri-apps/plugin-updater": "2.0.0-beta.1",
"@testing-library/jest-dom": "^5.17.0", "@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^13.4.0", "@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^13.5.0", "@testing-library/user-event": "^14.5.2",
"@types/react-measure": "^2.0.12", "@types/react-measure": "^2.0.12",
"@types/react-portal": "^4.0.6", "@types/react-portal": "^4.0.7",
"classnames": "^2.3.2", "classnames": "^2.5.1",
"csstype": "^3.1.3", "csstype": "^3.1.3",
"dayjs": "^1.11.9", "dayjs": "^1.11.10",
"framer-motion": "^10.16.16", "framer-motion": "^11.0.6",
"marked-react": "^2.0.0", "marked-react": "^2.0.0",
"missing-native-js-functions": "^1.4.3", "missing-native-js-functions": "^1.4.3",
"mobx": "^6.12.0", "mobx": "^6.12.0",
"mobx-react-lite": "^3.4.3", "mobx-react-lite": "^4.0.5",
"murmurhash-js": "^1.0.0", "murmurhash-js": "^1.0.0",
"prismjs": "^1.29.0", "prismjs": "^1.29.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-advanced-cropper": "^0.18.0", "react-advanced-cropper": "^0.19.5",
"react-colorful": "^5.6.1", "react-colorful": "^5.6.1",
"react-device-detect": "^2.2.3", "react-device-detect": "^2.2.3",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-fps-stats": "^0.3.1", "react-fps-stats": "^0.3.1",
"react-hook-form": "^7.49.0", "react-hook-form": "^7.50.1",
"react-infinite-scroll-component": "^6.1.0", "react-infinite-scroll-component": "^6.1.0",
"react-loading-skeleton": "^3.3.1", "react-loading-skeleton": "^3.4.0",
"react-markdown": "^8.0.7", "react-markdown": "^9.0.1",
"react-measure": "^2.5.2", "react-measure": "^2.5.2",
"react-portal": "^4.2.2", "react-portal": "^4.2.2",
"react-router-dom": "^6.20.1", "react-router-dom": "^6.22.1",
"react-secure-storage": "^1.3.2", "react-secure-storage": "^1.3.2",
"react-select-search": "^4.1.7", "react-select-search": "^4.1.7",
"react-spinners": "^0.13.8", "react-spinners": "^0.13.8",
@ -64,38 +64,39 @@
"react-syntax-highlighter": "^15.5.0", "react-syntax-highlighter": "^15.5.0",
"react-use-error-boundary": "^3.0.0", "react-use-error-boundary": "^3.0.0",
"react-virtualized": "^9.22.5", "react-virtualized": "^9.22.5",
"remark-gfm": "^3.0.1", "remark-gfm": "^4.0.0",
"reoverlay": "^1.0.3", "reoverlay": "^1.0.3",
"styled-components": "^5.3.11", "styled-components": "5.3.11",
"use-resize-observer": "^9.1.0", "use-resize-observer": "^9.1.0",
"yup": "^1.3.3" "yup": "^1.3.3"
}, },
"devDependencies": { "devDependencies": {
"@craco/craco": "^7.1.0", "@craco/craco": "^7.1.0",
"@tauri-apps/cli": "^2.0.0-alpha.16", "@tauri-apps/cli": "2.0.0-beta.5",
"@types/jest": "^27.5.2", "@types/jest": "^29.5.12",
"@types/loadable__component": "^5.13.5", "@types/loadable__component": "^5.13.8",
"@types/murmurhash-js": "^1.0.6", "@types/murmurhash-js": "^1.0.6",
"@types/node": "^16.18.50", "@types/node": "^20.11.20",
"@types/react": "^18.2.22", "@types/react": "^18.2.60",
"@types/react-dom": "^18.2.7", "@types/react-dom": "^18.2.19",
"@types/react-syntax-highlighter": "^15.5.7", "@types/react-syntax-highlighter": "^15.5.11",
"@types/react-virtualized": "^9.21.22", "@types/react-virtualized": "^9.21.29",
"@types/styled-components": "^5.1.27", "@types/styled-components": "^5.1.34",
"@typescript-eslint/eslint-plugin": "^6.7.0", "@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^6.7.0", "@typescript-eslint/parser": "^7.1.0",
"@vitejs/plugin-react": "^4.0.4", "@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.49.0", "cross-env": "^7.0.3",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3", "eslint-plugin-react-refresh": "^0.4.5",
"internal-ip": "^7.0.0", "internal-ip": "^8.0.0",
"typescript": "^5.2.2", "typescript": "^5.3.3",
"vite": "^4.4.12", "vite": "^5.1.4",
"vite-plugin-chunk-split": "^0.4.7", "vite-plugin-chunk-split": "^0.5.0",
"vite-plugin-clean": "^1.0.0", "vite-plugin-clean": "^1.0.0",
"vite-plugin-html": "^3.2.0", "vite-plugin-html": "^3.2.2",
"vite-plugin-progress": "^0.0.7", "vite-plugin-progress": "^0.0.7",
"vite-plugin-svgr": "^3.2.0" "vite-plugin-svgr": "^4.2.0"
}, },
"homepage": "https://spacebar.chat", "homepage": "https://spacebar.chat",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
@ -118,5 +119,5 @@
"tauri:android:build": "pnpm run ci:prebuild && tauri android build" "tauri:android:build": "pnpm run ci:prebuild && tauri android build"
}, },
"type": "module", "type": "module",
"version": "0.1.1" "version": "0.1.2"
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
# Generated by Cargo # Generated by Cargo
# will have compiled files and executables # will have compiled files and executables
/target/ /target/
version.json

1786
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,10 @@ chrono = "0.4"
log = "0.4.20" log = "0.4.20"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
tauri-plugin-notification = "2.0.0-beta.1"
tauri-plugin-single-instance = "2.0.0-beta.2"
tauri-plugin-autostart = "2.0.0-beta.1"
#openssl = { version = "0.10", features = ["vendored"] }
[features] [features]
# this feature is used for production builds or when `devPath` points to the filesystem # this feature is used for production builds or when `devPath` points to the filesystem

View File

@ -0,0 +1,24 @@
{
"identifier": "base",
"description": "base",
"windows": ["main", "splashscreen"],
"permissions": [
"path:default",
"event:default",
"window:default",
"app:default",
"resources:default",
"menu:default",
"tray:default",
"updater:default",
"notification:default",
"os:allow-platform",
"os:allow-arch",
"os:allow-family",
"os:allow-locale",
"os:allow-os-type",
"os:allow-version",
"webview:allow-internal-toggle-devtools"
],
"platforms": ["linux", "macOS", "windows", "android", "iOS"]
}

View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<value>
<entry key="app">
<State />
</entry>
</value>
</component>
</project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT">
<builds>
<build path="$PROJECT_DIR$/buildSrc" name="buildSrc">
<projects>
<project path="$PROJECT_DIR$/buildSrc" />
</projects>
</build>
</builds>
</compositeBuild>
</compositeConfiguration>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/buildSrc" />
<option value="D:/cache/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-alpha.20/mobile/android" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.8.10" />
</component>
</project>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

View File

@ -0,0 +1,9 @@
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
</component>
</project>

View File

@ -32,7 +32,7 @@ open class BuildTask : DefaultTask() {
val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null") val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null")
val target = target ?: throw GradleException("target cannot be null") val target = target ?: throw GradleException("target cannot be null")
val release = release ?: throw GradleException("release cannot be null") val release = release ?: throw GradleException("release cannot be null")
val args = listOf("C:\\Users\\23562\\Documents\\Code\\workspaces\\spacebar\\client-react\\node_modules\\.bin\\\\..\\@tauri-apps\\cli\\tauri.js", "android", "android-studio-script"); val args = listOf("..\\node_modules\\.bin\\\\..\\@tauri-apps\\cli\\tauri.js", "android", "android-studio-script");
project.exec { project.exec {
workingDir(File(project.projectDir, rootDirRel)) workingDir(File(project.projectDir, rootDirRel))

View File

@ -0,0 +1 @@
{"base":{"identifier":"base","description":"base","local":true,"windows":["main","splashscreen"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default","tray:default","updater:default","notification:default","os:allow-platform","os:allow-arch","os:allow-family","os:allow-locale","os:allow-os-type","os:allow-version","webview:allow-internal-toggle-devtools"],"platforms":["linux","macOS","windows","android","iOS"]}}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,28 @@
use tauri::RunEvent; use std::{sync::Arc, sync::Mutex};
#[cfg(desktop)] use tauri::{Manager, RunEvent, State, WebviewWindow};
use tauri::{AppHandle, Env, Manager}; use tauri_plugin_autostart::MacosLauncher;
use tauri_plugin_log::{Target, TargetKind, WEBVIEW_TARGET}; use tauri_plugin_log::{Target, TargetKind, WEBVIEW_TARGET};
use tauri_plugin_notification::NotificationExt;
#[macro_use] #[cfg(desktop)]
mod tray; mod tray;
mod updater; mod updater;
#[tauri::command] // wrappers around each Window
async fn close_splashscreen(window: tauri::Window) { // we use a dedicated type because Tauri can only manage a single instance of a given type
#[cfg(desktop)] struct SplashscreenWindow(Arc<Mutex<WebviewWindow>>);
{ struct MainWindow(Arc<Mutex<WebviewWindow>>);
// Close splashscreen
if let Some(splashscreen) = window.get_window("splashscreen") {
splashscreen.close().unwrap();
}
#[tauri::command]
fn close_splashscreen(
_: WebviewWindow,
splashscreen: State<SplashscreenWindow>,
main: State<MainWindow>,
) {
// Close splashscreen
splashscreen.0.lock().unwrap().close().unwrap();
// Show main window // Show main window
window.get_window("main").unwrap().show().unwrap(); main.0.lock().unwrap().show().unwrap();
}
} }
#[cfg_attr(mobile, tauri::mobile_entry_point)] #[cfg_attr(mobile, tauri::mobile_entry_point)]
@ -30,10 +34,9 @@ pub fn run() {
let config = context.config_mut(); let config = context.config_mut();
let mut app = tauri::Builder::default() let app = tauri::Builder::default()
.plugin(tauri_plugin_process::init()) .plugin(tauri_plugin_process::init())
.plugin(tauri_plugin_os::init()) .plugin(tauri_plugin_os::init())
// Add logging plugin
.plugin( .plugin(
tauri_plugin_log::Builder::default() tauri_plugin_log::Builder::default()
.clear_targets() .clear_targets()
@ -58,14 +61,34 @@ pub fn run() {
}) })
.level(log::LevelFilter::Info) .level(log::LevelFilter::Info)
.build(), .build(),
); )
.plugin(tauri_plugin_notification::init())
if config.tauri.bundle.updater.active { .plugin(tauri_plugin_single_instance::init(|app, argv, cwd| {
app = app.plugin(tauri_plugin_updater::Builder::new().build()); println!("{}, {argv:?}, {cwd}", app.package_info().name);
} app.notification()
.builder()
let app = app .title("This app is already running!")
.body("You can find it in the tray menu.")
.show()
.unwrap();
}))
.plugin(tauri_plugin_autostart::init(
MacosLauncher::LaunchAgent,
Some(vec![]),
))
.plugin(tauri_plugin_process::init())
.setup(move |app| { .setup(move |app| {
let app_handle = app.handle();
// set the splashscreen and main windows to be globally available with the tauri state API
app.manage(SplashscreenWindow(Arc::new(Mutex::new(
app.get_webview_window("splashscreen").unwrap(),
))));
app.manage(MainWindow(Arc::new(Mutex::new(
app.get_webview_window("main").unwrap(),
))));
app_handle.plugin(tauri_plugin_updater::Builder::new().build())?;
#[cfg(desktop)] #[cfg(desktop)]
{ {
// Tray // Tray
@ -75,19 +98,12 @@ pub fn run() {
// Open the dev tools automatically when debugging the application // Open the dev tools automatically when debugging the application
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
if let Some(main_window) = app.get_window("main") { if let Some(main_window) = app.get_webview_window("main") {
main_window.open_devtools(); main_window.open_devtools();
}; };
Ok(()) Ok(())
}) })
.on_window_event(|event| match event.event() {
tauri::WindowEvent::CloseRequested { api, .. } => {
event.window().hide().unwrap();
api.prevent_close();
}
_ => {}
})
.invoke_handler(tauri::generate_handler![ .invoke_handler(tauri::generate_handler![
close_splashscreen, close_splashscreen,
updater::check_for_updates, updater::check_for_updates,
@ -99,16 +115,40 @@ pub fn run() {
.expect("error while running tauri application"); .expect("error while running tauri application");
#[cfg(desktop)] #[cfg(desktop)]
app.run(|app_handle, e| match e { app.run(|app, e| match e {
RunEvent::Ready => { RunEvent::Ready => {
#[cfg(any(target_os = "macos", debug_assertions))] #[cfg(any(target_os = "macos", debug_assertions))]
let window = app_handle.get_window("main").unwrap(); let window = app.get_webview_window("main").unwrap();
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
window.open_devtools(); window.open_devtools();
println!("App is ready"); println!("App is ready");
} }
RunEvent::ExitRequested { api, code, .. } => {
// Keep the event loop running even if all windows are closed
// This allow us to catch tray icon events when there is no window
// if we manually requested an exit (code is Some(_)) we will let it go through
if code.is_none() {
api.prevent_exit();
}
}
tauri::RunEvent::WindowEvent {
label,
event: tauri::WindowEvent::CloseRequested { api, .. },
..
} => {
#[cfg(target_os = "macos")]
{
tauri::AppHandle::hide(&app.app_handle()).unwrap();
}
#[cfg(not(target_os = "macos"))]
{
let window = app.get_webview_window(label.as_str()).unwrap();
window.hide().unwrap();
}
api.prevent_close();
}
_ => {} _ => {}
}); });
} }

View File

@ -5,8 +5,8 @@ use tauri::{
}; };
pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> { pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
let branding = MenuItem::with_id(app, "name", "Spacebar", false, None); let branding = MenuItem::with_id(app, "name", "Spacebar", false, None::<String>)?;
let quit_i = MenuItem::with_id(app, "quit", "Quit", true, None); let quit_i = MenuItem::with_id(app, "quit", "Quit", true, None::<String>)?;
let menu1 = Menu::with_items(app, &[&branding, &quit_i])?; let menu1 = Menu::with_items(app, &[&branding, &quit_i])?;
let _ = TrayIconBuilder::with_id("main") let _ = TrayIconBuilder::with_id("main")
@ -24,7 +24,7 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
.on_tray_icon_event(|tray, event| { .on_tray_icon_event(|tray, event| {
if event.click_type == ClickType::Left { if event.click_type == ClickType::Left {
let app = tray.app_handle(); let app = tray.app_handle();
if let Some(window) = app.get_window("main") { if let Some(window) = app.get_webview_window("main") {
let _ = window.show(); let _ = window.show();
let _ = window.set_focus(); let _ = window.set_focus();
} }

View File

@ -1,3 +1,4 @@
use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::sync::Mutex; use std::sync::Mutex;
use tauri::{Manager, Runtime}; use tauri::{Manager, Runtime};
@ -29,10 +30,16 @@ struct UpdateAvailable {
pub fn check_for_updates<R: Runtime>(ignore_prereleases: bool, window: tauri::Window<R>) { pub fn check_for_updates<R: Runtime>(ignore_prereleases: bool, window: tauri::Window<R>) {
let handle = window.app_handle().clone(); let handle = window.app_handle().clone();
if !handle.config().tauri.bundle.updater.active { if std::env::var("DEVELOPMENT").is_ok() {
println!("[Updater] This is a development environment, not updating.");
return; return;
} }
// TODO: readd this
// if !handle.config().tauri.bundle.updater.active {
// return;
// }
match window.emit("CHECKING_FOR_UPDATE", Some(serde_json::json!({}))) { match window.emit("CHECKING_FOR_UPDATE", Some(serde_json::json!({}))) {
Ok(_) => {} Ok(_) => {}
Err(e) => { Err(e) => {
@ -163,6 +170,7 @@ pub fn check_for_updates<R: Runtime>(ignore_prereleases: bool, window: tauri::Wi
return; return;
} }
}; };
let updater_builder = match handle let updater_builder = match handle
.updater_builder() .updater_builder()
.version_comparator(|current_version, latest_version| { .version_comparator(|current_version, latest_version| {
@ -269,6 +277,11 @@ pub fn check_for_updates<R: Runtime>(ignore_prereleases: bool, window: tauri::Wi
#[tauri::command] #[tauri::command]
pub async fn download_update<R: Runtime>(window: tauri::Window<R>) { pub async fn download_update<R: Runtime>(window: tauri::Window<R>) {
if std::env::var("DEVELOPMENT").is_ok() {
println!("[Updater] This is a development environment, not updating.");
return;
}
println!("[Updater] Downloading update package"); println!("[Updater] Downloading update package");
let update = match UPDATE_INFO.lock().unwrap().clone() { let update = match UPDATE_INFO.lock().unwrap().clone() {
@ -343,6 +356,11 @@ pub async fn download_update<R: Runtime>(window: tauri::Window<R>) {
#[tauri::command] #[tauri::command]
pub async fn install_update<R: Runtime>(window: tauri::Window<R>) { pub async fn install_update<R: Runtime>(window: tauri::Window<R>) {
if std::env::var("DEVELOPMENT").is_ok() {
println!("[Updater] This is a development environment, not updating.");
return;
}
println!("[Updater] Installing update package"); println!("[Updater] Installing update package");
let update = match UPDATE_INFO.lock().unwrap().clone() { let update = match UPDATE_INFO.lock().unwrap().clone() {

View File

@ -1,56 +1,62 @@
{ {
"build": {
"beforeDevCommand": "pnpm run dev",
"beforeBuildCommand": "pnpm run build",
"devPath": "http://localhost:1420",
"distDir": "../build",
"withGlobalTauri": true
},
"package": {
"productName": "Spacebar", "productName": "Spacebar",
"version": "./version.json" "version": "./version.json",
"identifier": "chat.spacebar.app",
"build": {
"frontendDist": "../dist",
"devUrl": "http://localhost:1420",
"beforeDevCommand": "pnpm run dev",
"beforeBuildCommand": "pnpm run build"
},
"app": {
"withGlobalTauri": true,
"windows": [
{
"label": "main",
"title": "Tauri",
"width": 800,
"height": 600,
"visible": false
},
{
"label": "splashscreen",
"width": 400,
"height": 200,
"decorations": false,
"resizable": false,
"url": "splashscreen.html"
}
],
"security": {
"csp": "default-src 'self'; connect-src ipc: http://ipc.localhost"
}
}, },
"tauri": {
"bundle": { "bundle": {
"active": true, "active": true,
"targets": ["app", "appimage", "deb", "dmg", "nsis", "updater"], "targets": "all",
"identifier": "chat.spacebar.app", "icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"publisher": "Spacebar", "publisher": "Spacebar",
"category": "SocialNetworking", "category": "SocialNetworking",
"shortDescription": "A free, opensource self-hostable discord-compatible chat, voice and video platform.", "shortDescription": "A free, opensource self-hostable discord-compatible chat, voice and video platform.",
"licenseFile": "../LICENSE",
"windows": { "windows": {
"nsis": { "nsis": {
"license": "../LICENSE",
"sidebarImage": "./icons/sidebar.bmp", "sidebarImage": "./icons/sidebar.bmp",
"installerIcon": "./icons/icon.ico" "installerIcon": "./icons/icon.ico"
} }
},
"updater": {
"active": true,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDQxRkQwNTY1NzBEOTMyMTUKUldRVk10bHdaUVg5UWVoVm9JeDg4UEs1TkpMT3FKdzc3Y29CN2NZNk9vRE9sanJCUERqT09HVVYK",
"windows": {
"installMode": "passive"
} }
}
},
"security": {
"csp": null
},
"windows": []
}, },
"plugins": { "plugins": {
"shell": { "shell": {
"open": true "open": true
}, },
"updater": { "updater": {
"endpoints": ["https://github.com/spacebarchat/client/releases/download/latest/latest.json"] "active": true,
"endpoints": ["https://github.com/spacebarchat/client/releases/download/latest/latest.json"],
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDQxRkQwNTY1NzBEOTMyMTUKUldRVk10bHdaUVg5UWVoVm9JeDg4UEs1TkpMT3FKdzc3Y29CN2NZNk9vRE9sanJCUERqT09HVVYK",
"windows": {
"installMode": "passive"
}
} }
} }
} }

View File

@ -1,10 +1,10 @@
{ {
"tauri": {
"bundle": { "bundle": {
"iOS": { "iOS": {
"developmentTeam": "47RXBB8X9K" "developmentTeam": "47RXBB8X9K"
} }
}, },
"app": {
"windows": [ "windows": [
{ {
"fullscreen": false, "fullscreen": false,

View File

@ -1,5 +1,5 @@
{ {
"tauri": { "app": {
"windows": [ "windows": [
{ {
"width": 400, "width": 400,

View File

@ -1,5 +1,5 @@
{ {
"tauri": { "app": {
"windows": [ "windows": [
{ {
"width": 400, "width": 400,

View File

@ -1,5 +1,5 @@
{ {
"tauri": { "app": {
"windows": [ "windows": [
{ {
"width": 400, "width": 400,

3
src-tauri/version.json Normal file
View File

@ -0,0 +1,3 @@
{
"version": "0.1.1+00"
}

View File

@ -22,6 +22,7 @@ import { useAppStore } from "./stores/AppStore";
import { Globals } from "./utils/Globals"; import { Globals } from "./utils/Globals";
// @ts-expect-error no types // @ts-expect-error no types
import FPSStats from "react-fps-stats"; import FPSStats from "react-fps-stats";
import { isTauri } from "./utils/Utils";
function App() { function App() {
const app = useAppStore(); const app = useAppStore();
@ -68,7 +69,7 @@ function App() {
}; };
}; };
loadAsyncGlobals(); isTauri && loadAsyncGlobals();
Globals.load(); Globals.load();
app.loadSettings(); app.loadSettings();

View File

@ -1,4 +1,4 @@
import { invoke } from "@tauri-apps/api/primitives"; import { invoke } from "@tauri-apps/api/core";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import React from "react"; import React from "react";
import LoadingPage from "../pages/LoadingPage"; import LoadingPage from "../pages/LoadingPage";

View File

@ -8,7 +8,7 @@ import { HorizontalDivider } from "../Divider";
import { CDNRoutes, ImageFormat } from "@spacebarchat/spacebar-api-types/v9"; import { CDNRoutes, ImageFormat } from "@spacebarchat/spacebar-api-types/v9";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { ReactComponent as SpacebarLogoBlue } from "../../assets/images/logo/Spacebar_Icon.svg"; import SpacebarLogoBlue from "../../assets/images/logo/Spacebar_Icon.svg?react";
import { useAppStore } from "../../stores/AppStore"; import { useAppStore } from "../../stores/AppStore";
import REST from "../../utils/REST"; import REST from "../../utils/REST";
import Floating from "./Floating"; import Floating from "./Floating";

12
src/custom.d.ts vendored
View File

@ -1,9 +1,9 @@
declare module "*.svg" { // declare module "*.svg" {
import React = require("react"); // import React = require("react");
export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>; // export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;
const src: string; // const src: string;
export default src; // export default src;
} // }
interface GlobalVersionInfo { interface GlobalVersionInfo {
tauri: string; tauri: string;

View File

@ -2,7 +2,7 @@ import { observer } from "mobx-react-lite";
import { Suspense } from "react"; import { Suspense } from "react";
import PulseLoader from "react-spinners/PulseLoader"; import PulseLoader from "react-spinners/PulseLoader";
import styled from "styled-components"; import styled from "styled-components";
import { ReactComponent as SpacebarLogoBlue } from "../assets/images/logo/Logo-Blue.svg"; import SpacebarLogoBlue from "../assets/images/logo/Logo-Blue.svg?react";
import Button from "../components/Button"; import Button from "../components/Button";
import Container from "../components/Container"; import Container from "../components/Container";
import { useAppStore } from "../stores/AppStore"; import { useAppStore } from "../stores/AppStore";

View File

@ -3,7 +3,7 @@ import { Routes } from "@spacebarchat/spacebar-api-types/v9";
import React from "react"; import React from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { ReactComponent as SpacebarLogoBlue } from "../assets/images/logo/Logo-Blue.svg"; import SpacebarLogoBlue from "../assets/images/logo/Logo-Blue.svg?react";
import { import {
AuthContainer, AuthContainer,
AuthSwitchPageContainer, AuthSwitchPageContainer,

View File

@ -3,7 +3,7 @@ import { Routes } from "@spacebarchat/spacebar-api-types/v9";
import React from "react"; import React from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { ReactComponent as SpacebarLogoBlue } from "../assets/images/logo/Logo-Blue.svg"; import SpacebarLogoBlue from "../assets/images/logo/Logo-Blue.svg?react";
import { import {
AuthContainer, AuthContainer,
AuthSwitchPageContainer, AuthSwitchPageContainer,

View File

@ -2,7 +2,7 @@ import { Routes } from "@spacebarchat/spacebar-api-types/v9";
import React from "react"; import React from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { ReactComponent as SpacebarLogoBlue } from "../../assets/images/logo/Logo-Blue.svg"; import SpacebarLogoBlue from "../../assets/images/logo/Logo-Blue.svg?react";
import { import {
AuthContainer, AuthContainer,
FormContainer, FormContainer,

View File

@ -1,5 +1,5 @@
import { invoke } from "@tauri-apps/api/core";
import { listen } from "@tauri-apps/api/event"; import { listen } from "@tauri-apps/api/event";
import { invoke } from "@tauri-apps/api/primitives";
import { action, makeAutoObservable, observable } from "mobx"; import { action, makeAutoObservable, observable } from "mobx";
import useLogger from "../hooks/useLogger"; import useLogger from "../hooks/useLogger";
import Logger from "../utils/Logger"; import Logger from "../utils/Logger";

1
src/vite-env.d.ts vendored
View File

@ -1 +1,2 @@
/// <reference types="vite/client" /> /// <reference types="vite/client" />
/// <reference types="vite-plugin-svgr/client" />

View File

@ -44,7 +44,7 @@ function getVersion() {
return JSON.parse(readFileSync("package.json").toString()).version; return JSON.parse(readFileSync("package.json").toString()).version;
} }
const mobile = !!/android|ios/.exec(process.env.TAURI_PLATFORM); const mobile = !!/android|ios/.exec(process.env.TAURI_ENV_PLATFORM);
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig(async () => ({ export default defineConfig(async () => ({
@ -88,7 +88,7 @@ export default defineConfig(async () => ({
// https://tauri.studio/v1/api/config#buildconfig.beforedevcommand // https://tauri.studio/v1/api/config#buildconfig.beforedevcommand
envPrefix: ["VITE_", "TAURI_"], envPrefix: ["VITE_", "TAURI_"],
build: { build: {
outDir: "build", outDir: "dist",
sourcemap: true, sourcemap: true,
rollupOptions: { rollupOptions: {
input: { input: {