Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ All notable changes to this project will be documented in this file.

### 🔧 Other Changes
- chore(Optimized build & removed .next warning): chore optimization of the packages (7962202)
- chore(bump version): bump version (1b15050)
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trixty/desktop",
"version": "1.1.5",
"version": "1.1.6",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
59 changes: 54 additions & 5 deletions apps/desktop/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tauri-build = { version = "2.5.6", features = [] }
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
log = "0.4"
tauri = { version = "2.10.3", features = [] }
tauri = { version = "2.10.3", features = [ "image-ico", "image-png", "tray-icon"] }
tauri-plugin-log = "2"
tauri-plugin-shell = "2.0.0"
tauri-plugin-store = "2.0.0"
Expand Down
10 changes: 10 additions & 0 deletions apps/desktop/src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
"core:window:allow-start-resize-dragging",
"core:window:allow-show",
"core:window:allow-hide",
"core:window:allow-create",
"core:window:allow-set-size",
"core:window:allow-set-position",
"core:webview:default",
"core:webview:allow-create-webview",
"core:webview:allow-webview-close",
"core:webview:allow-set-webview-position",
"core:webview:allow-set-webview-size",
"core:webview:allow-webview-show",
"core:webview:allow-webview-hide",

"positioner:default",
"window-state:default",
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop/src-tauri/src/discord_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ use serde::{Deserialize, Serialize};
use serde_json::{json, Value};

use log::{error, info, warn};
#[cfg(unix)]
use std::env;
#[cfg(unix)]
use std::path::PathBuf;
use tauri::{AppHandle, Emitter};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
#[cfg(unix)]
Expand Down
39 changes: 38 additions & 1 deletion apps/desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ use scraper::{Html, Selector};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::fs;
use std::net::TcpStream;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use sysinfo::System;
use tauri::Manager;
use tauri_plugin_store::StoreExt;
Expand All @@ -41,7 +43,11 @@ use tracing_subscriber::prelude::*;
/// supervisor lazily the first time you spawn.
#[inline]
fn silent_command(program: &str) -> Command {
#[cfg(target_os = "windows")]
let mut cmd = Command::new(program);
#[cfg(not(target_os = "windows"))]
let cmd = Command::new(program);

#[cfg(target_os = "windows")]
{
// `creation_flags` and `raw_arg` are inherent methods on
Expand Down Expand Up @@ -627,6 +633,15 @@ async fn get_system_health(
})
}

#[tauri::command]
async fn check_port(port: u16) -> bool {
TcpStream::connect_timeout(
&format!("127.0.0.1:{}", port).parse().unwrap(),
Duration::from_millis(150),
)
.is_ok()
}

#[tauri::command]
async fn git_init(path: String) -> Result<String, String> {
let output = silent_command("git")
Expand Down Expand Up @@ -2685,6 +2700,23 @@ fn delete_path(path: String, workspace: tauri::State<'_, WorkspaceState>) -> Res
}
}

#[tauri::command]
async fn open_browser_window(app: tauri::AppHandle, url: String) -> Result<(), String> {
// Generate a unique label so we can open multiple browser windows
let label = format!("browser-{}", uuid::Uuid::new_v4());
let _ = tauri::WebviewWindowBuilder::new(
&app,
&label,
tauri::WebviewUrl::External(url.parse::<url::Url>().map_err(|e| e.to_string())?),
)
.title("Trixty Browser")
.inner_size(1200.0, 800.0)
.resizable(true)
.build()
.map_err(|e| e.to_string())?;
Ok(())
}

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
// Initialize Sentry
Expand Down Expand Up @@ -2775,6 +2807,7 @@ pub fn run() {
.manage::<InitialJoinSecret>(new_initial_join_secret(initial_join_secret))
.manage(DiscordState(Arc::new(tokio::sync::Mutex::new(discord_rpc::DiscordRpc::new()))))
.invoke_handler(tauri::generate_handler![
check_port,
read_directory,
read_file,
write_file,
Expand Down Expand Up @@ -2848,7 +2881,8 @@ pub fn run() {
set_discord_activity,
accept_discord_join_request,
reject_discord_join_request,
get_initial_join_secret
get_initial_join_secret,
open_browser_window
])
.setup(|app| {
// Main window is required — failing fast with a structured error beats
Expand Down Expand Up @@ -2992,6 +3026,9 @@ pub fn run() {
let _ = main_window.set_focus();
});




// Start Discord RPC background task
let discord_state = app.handle().state::<DiscordState>();
let mut discord_rpc = discord_state.0.blocking_lock();
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
],
"withGlobalTauri": false,
"security": {
"csp": "default-src 'self'; img-src 'self' data: asset: https://asset.localhost https://raw.githubusercontent.com; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' ipc: http://ipc.localhost https://ipc.localhost; font-src 'self' data:;"
"csp": "default-src 'self'; img-src 'self' data: asset: https://asset.localhost https://raw.githubusercontent.com; script-src 'self' blob:; style-src 'self' 'unsafe-inline'; connect-src 'self' ipc: http://ipc.localhost https://ipc.localhost; font-src 'self' data:; frame-src *; worker-src 'self' blob:;"
}
},
"plugins": {
Expand Down
20 changes: 20 additions & 0 deletions apps/desktop/src/api/builtin.l10n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ export function registerBuiltinTranslations() {
'marketplace.view_install': 'View & Install',
'marketplace.installed_badge': 'Installed',

'browser.title': 'Browser',
'browser.back': 'Back',
'browser.forward': 'Forward',
'browser.reload': 'Reload',
'browser.address_placeholder': 'Enter URL...',
'browser.open_external': 'Open in External Browser',
'browser.open_native': 'Open in Native Window',
'browser.native_mode_active': 'Native Engine Active (No Restrictions)',
'browser.security_note': 'Some sites may block embedding for security.',

'git.no_repo': 'No Repository',
'git.no_repo_desc': 'Initialize a Git repository to begin',
'git.init_button': 'git init',
Expand Down Expand Up @@ -613,6 +623,16 @@ export function registerBuiltinTranslations() {
'marketplace.view_install': 'Ver e Instalar',
'marketplace.installed_badge': 'Instalada',

'browser.title': 'Navegador',
'browser.back': 'Atrás',
'browser.forward': 'Adelante',
'browser.reload': 'Recargar',
'browser.address_placeholder': 'Ingrese URL...',
'browser.open_external': 'Abrir en navegador externo',
'browser.open_native': 'Abrir en ventana nativa',
'browser.native_mode_active': 'Motor nativo activo (sin restricciones)',
'browser.security_note': 'Algunos sitios pueden bloquear su inserción por seguridad.',

'git.no_repo': 'Sin Repositorio',
'git.no_repo_desc': 'Inicializa un repositorio Git para empezar',
'git.init_button': 'git init',
Expand Down
19 changes: 18 additions & 1 deletion apps/desktop/src/components/ActivityBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react";
import { Settings, Package } from "lucide-react";
import { Settings, Package, Globe } from "lucide-react";
import { useUI } from "@/context/UIContext";
import { useFiles } from "@/context/FilesContext";
import { trixty, WebviewView } from "@/api/trixty";
Expand Down Expand Up @@ -39,6 +39,11 @@ const ActivityBar: React.FC = () => {
return;
}

if (id === "browser") {
openFile("virtual://browser", t('browser.title'), "", "virtual");
return;
}

if (id === "settings") {
setSettingsOpen(true);
return;
Expand Down Expand Up @@ -87,6 +92,18 @@ const ActivityBar: React.FC = () => {
);
})}
<div className="mt-auto flex flex-col gap-1 items-center">
<button
role="tab"
aria-selected={false}
aria-label={t('browser.title')}
onClick={() => handleTabClick("browser")}
className="w-[40px] h-[40px] flex items-center justify-center rounded-lg text-subtle-fg hover:text-white/80 hover:bg-white/5 transition-all group relative focus:outline-none focus-visible:ring-2 focus-visible:ring-white/40"
title={t('browser.title')}
>
<Globe size={18} strokeWidth={1.5} />
<Tooltip label={t('browser.title')} />
</button>

<button
role="tab"
aria-selected={false}
Expand Down
Loading
Loading