-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: Dekstop-app #21
base: master
Are you sure you want to change the base?
Add: Dekstop-app #21
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,11 @@ jobs: | |
# Note: Required by vergen (https://crates.io/crates/vergen) | ||
run: git config --global --add safe.directory $GITHUB_WORKSPACE | ||
|
||
- name: install dependencies (desktop-app) | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | ||
|
||
- name: Install build dependencies - Rustup | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y | ||
|
@@ -92,3 +97,77 @@ jobs: | |
tag: ${{ github.ref }} | ||
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
overwrite: true | ||
|
||
build-tauri: | ||
needs: quick-tests | ||
permissions: | ||
contents: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- platform: 'macos-latest' | ||
args: '--target aarch64-apple-darwin' | ||
label: 'Mac-M1' | ||
- platform: 'macos-latest' | ||
args: '--target x86_64-apple-darwin' | ||
label: 'Mac-x86' | ||
- platform: 'ubuntu-22.04' | ||
args: '' | ||
label: 'Linux' | ||
- platform: 'windows-latest' | ||
args: '' | ||
label: 'Windows' | ||
|
||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: install dependencies (ubuntu only) | ||
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above. | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | ||
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2. | ||
|
||
- name: setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
- name: install Rust stable | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. | ||
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | ||
|
||
- name: Rust cache | ||
uses: swatinem/rust-cache@v2 | ||
with: | ||
workspaces: './src-tauri -> target' | ||
|
||
- name: Install dependencies | ||
run: | | ||
cd ping-viewer-next-desktop | ||
bun install | ||
|
||
- name: Build the app | ||
id: tauri-build | ||
uses: tauri-apps/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
projectPath: './ping-viewer-next-desktop' | ||
args: ${{ matrix.args }} | ||
|
||
- name: Upload artifacts | ||
uses: actions/[email protected] | ||
with: | ||
name: 'ping-viewer_${{steps.tauri-build.outputs.appVersion}}_${{ matrix.label }}' | ||
path: "${{ join(fromJSON(steps.tauri-build.outputs.artifactPaths), '\n') }}" | ||
retention-days: 5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing EOL |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not necessary, can we clean it up ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the Logs default folder when we execute the desktop app with logger module with cargo run, would suggest to keep it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm just saying to remove the unnecessary stuff, .idea, .dist-ssr, .sln |
||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Ping Viewer Next DesktopApp | ||
|
||
Ping Viewer Next Desktop is a standalone version of the **Ping Viewer Next** core server. This application allows you to interface with **ping devices** attached directly to your computer or connected to a remotely one. | ||
|
||
## Key Features | ||
|
||
- **Local and Remote Connections**: Connect to ping devices on your local network or to remote Ping Viewer Next servers. | ||
- **Cross-Platform Support**: Available for macOS, Linux, and Windows. | ||
- **Standalone App**: Just install and use directly on your favorite OS. | ||
|
||
### Download | ||
|
||
You can download the latest version from the [releases page](https://github.com/bluerobotics/ping-viewer-next/releases). | ||
|
||
## How It Works | ||
|
||
Ping Viewer Next Desktop integrates the core Ping Viewer Next server with an embedded GUI, using Tauri to create a native experience across platforms. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Tauri + Vue + Typescript App</title> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "ping-viewer-next-desktop", | ||
"private": true, | ||
"version": "0.1.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vue-tsc --noEmit && vite build", | ||
"preview": "vite preview", | ||
"tauri": "tauri" | ||
}, | ||
"dependencies": { | ||
"vue": "^3.3.4", | ||
"@tauri-apps/api": "^1" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^5.0.5", | ||
"typescript": "^5.2.2", | ||
"vite": "^5.3.1", | ||
"vue-tsc": "^2.0.22", | ||
"@tauri-apps/cli": "^1" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
|
||
# Generated by Tauri | ||
# will have schema files for capabilities auto-completion | ||
/gen/schemas | ||
|
||
/Cargo.lock |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[package] | ||
name = "ping-viewer-next-desktop" | ||
version = "0.1.0" | ||
description = "A Tauri App" | ||
authors = ["you"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing authors |
||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[build-dependencies] | ||
tauri-build = { version = "1.5.4", features = [] } | ||
|
||
[dependencies] | ||
tauri = { version = "1.7.2", features = ["shell-open"] } | ||
serde = { version = "1", features = ["derive"] } | ||
serde_json = "1" | ||
ping-viewer-next = { path = "./../../", features = ["desktop-app"] } | ||
tokio = { version = "1.40.0", features = ["full"] } | ||
actix-web = "4.6.0" | ||
|
||
[features] | ||
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!! | ||
custom-protocol = ["tauri/custom-protocol"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
tauri_build::build() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Prevents additional console window on Windows in release, DO NOT REMOVE!! | ||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | ||
|
||
use ping_viewer_next::{cli, device, logger, server}; | ||
use tauri::Manager; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
cli::manager::init(); | ||
|
||
logger::manager::init(); | ||
|
||
let (manager, handler) = device::manager::DeviceManager::new(10); | ||
|
||
tokio::spawn(async move { manager.run().await }); | ||
|
||
run_tauri_app(handler).await; | ||
} | ||
|
||
async fn run_tauri_app(handler: device::manager::ManagerActorHandler) { | ||
tauri::Builder::default() | ||
.setup(|app: &mut tauri::App| { | ||
let window = app.get_window("main").unwrap(); | ||
|
||
std::thread::spawn(move || { | ||
run_from_tauri(&cli::manager::server_address(), handler).unwrap(); | ||
}); | ||
|
||
std::thread::spawn(move || { | ||
std::thread::sleep(std::time::Duration::from_secs(6)); | ||
window.eval("window.location.replace('http://0.0.0.0:8080')").unwrap(); | ||
}); | ||
|
||
Ok(()) | ||
}) | ||
.run(tauri::generate_context!()) | ||
.expect("error while running tauri application"); | ||
} | ||
|
||
#[actix_web::main] | ||
pub async fn run_from_tauri( | ||
server_address: &str, | ||
handler: device::manager::ManagerActorHandler, | ||
) -> std::io::Result<()> { | ||
server::manager::run(server_address, handler).await | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"build": { | ||
"beforeDevCommand": "bun run dev", | ||
"beforeBuildCommand": "bun run build", | ||
"devPath": "http://localhost:1420", | ||
"distDir": "../dist" | ||
}, | ||
"package": { | ||
"productName": "ping-viewer-next-desktop", | ||
"version": "0.1.0" | ||
}, | ||
"tauri": { | ||
"allowlist": { | ||
"all": false, | ||
"shell": { | ||
"all": false, | ||
"open": true | ||
} | ||
}, | ||
"windows": [ | ||
{ | ||
"title": "ping-viewer-next-desktop", | ||
"width": 800, | ||
"height": 600 | ||
} | ||
], | ||
"security": { | ||
"csp": null | ||
}, | ||
"bundle": { | ||
"active": true, | ||
"targets": "all", | ||
"identifier": "com.ping-viewer-next-desktop.app", | ||
"icon": [ | ||
"icons/32x32.png", | ||
"icons/128x128.png", | ||
"icons/[email protected]", | ||
"icons/icon.icns", | ||
"icons/icon.ico" | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script setup lang="ts"> | ||
import { ref, onMounted } from "vue"; | ||
|
||
const loading = ref(true); | ||
|
||
const checkServerReady = () => { | ||
setTimeout(() => { | ||
loading.value = false; | ||
}, 2000); | ||
}; | ||
|
||
onMounted(() => { | ||
checkServerReady(); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div v-if="loading" class="preloader"> | ||
<h1>Ping Viewer Next</h1> | ||
<p>Creating a local server...</p> | ||
</div> | ||
|
||
<div v-else class="container"> | ||
<h1>Ping Viewer Next</h1> | ||
<p>Server is ready!</p> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.preloader, .container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
width: 100vw; | ||
height: 100vh; | ||
margin: 0; | ||
padding: 0; | ||
background-color: #f0f0f0; | ||
} | ||
|
||
h1 { | ||
font-size: 3rem; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
p { | ||
font-size: 1.5rem; | ||
color: #666; | ||
} | ||
|
||
html, body { | ||
margin: 0; | ||
padding: 0; | ||
overflow: hidden; | ||
} | ||
</style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be Apple Silicon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The label?