mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-06-16 05:14:48 +03:00
Compare commits
12 Commits
peer-versi
...
windows-ms
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4821cd11ac | ||
|
|
67c0ff0045 | ||
|
|
f4c9563a62 | ||
|
|
51601d68c7 | ||
|
|
5501ed0c50 | ||
|
|
f54a472e34 | ||
|
|
d68df35409 | ||
|
|
c2f6e172bb | ||
|
|
32b6683cda | ||
|
|
62b22e1764 | ||
|
|
72c86c0d83 | ||
|
|
82766cdc87 |
@@ -6,6 +6,7 @@
|
||||
<file compressed="true" preprocess="xml-stripblanks">fingerprint_window.ui</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">client_row.ui</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">key_row.ui</file>
|
||||
<file compressed="true">style.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/de/feschber/LanMouse/icons">
|
||||
<file compressed="true" preprocess="xml-stripblanks">de.feschber.LanMouse.svg</file>
|
||||
|
||||
12
lan-mouse-gtk/resources/style.css
Normal file
12
lan-mouse-gtk/resources/style.css
Normal file
@@ -0,0 +1,12 @@
|
||||
.peer-match > box > list .subtitle {
|
||||
color: @success_color;
|
||||
}
|
||||
|
||||
.peer-mismatch > box > list .subtitle {
|
||||
font-weight: bold;
|
||||
color: @warning_color;
|
||||
}
|
||||
|
||||
.peer-unknown > box > list .subtitle {
|
||||
color: @warning_color;
|
||||
}
|
||||
@@ -26,6 +26,7 @@ impl ClientObject {
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
.property("resolving", state.resolving)
|
||||
.property("peer-commit", peer_commit_to_string(state.peer_commit))
|
||||
.build()
|
||||
}
|
||||
|
||||
@@ -34,6 +35,14 @@ impl ClientObject {
|
||||
}
|
||||
}
|
||||
|
||||
/// Render the 8-byte ASCII commit hash carried in
|
||||
/// [`lan_mouse_ipc::ClientState::peer_commit`] as a `String`. `None`
|
||||
/// in → `None` out (peer hasn't sent a Hello yet, or speaks an older
|
||||
/// proto).
|
||||
pub fn peer_commit_to_string(commit: Option<[u8; 8]>) -> Option<String> {
|
||||
commit.and_then(|c| std::str::from_utf8(&c).ok().map(str::to_string))
|
||||
}
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
pub struct ClientData {
|
||||
pub handle: ClientHandle,
|
||||
@@ -43,4 +52,5 @@ pub struct ClientData {
|
||||
pub position: String,
|
||||
pub resolving: bool,
|
||||
pub ips: Vec<String>,
|
||||
pub peer_commit: Option<String>,
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ pub struct ClientObject {
|
||||
#[property(name = "position", get, set, type = String, member = position)]
|
||||
#[property(name = "resolving", get, set, type = bool, member = resolving)]
|
||||
#[property(name = "ips", get, set, type = Vec<String>, member = ips)]
|
||||
#[property(name = "peer-commit", get, set, type = Option<String>, member = peer_commit)]
|
||||
pub data: RefCell<ClientData>,
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,12 @@ impl ClientRow {
|
||||
bindings.push(position_binding);
|
||||
bindings.push(resolve_binding);
|
||||
bindings.push(ip_binding);
|
||||
|
||||
// Render the initial collapsed subtitle from whatever
|
||||
// peer_commit the ClientObject was created with. Subsequent
|
||||
// changes are pushed by `Window::update_client_state` calling
|
||||
// `refresh_version_status` after writing the new property.
|
||||
self.refresh_version_status();
|
||||
}
|
||||
|
||||
pub fn unbind(&self) {
|
||||
@@ -150,4 +156,40 @@ impl ClientRow {
|
||||
pub fn set_dns_state(&self, resolved: bool) {
|
||||
self.imp().set_dns_state(resolved);
|
||||
}
|
||||
|
||||
/// Recompute the collapsed subtitle (Pango markup) based on the
|
||||
/// current `peer-commit` property and the local build's commit.
|
||||
/// Soft-warn semantics: a missing or mismatched peer commit
|
||||
/// surfaces as orange text but never blocks traffic. Called by
|
||||
/// the window after `update_client_state` writes the new
|
||||
/// `peer-commit`. The dns-status icon is left to its existing
|
||||
/// `set_dns_state` handler so the two indicators don't fight
|
||||
/// for the same CSS class.
|
||||
pub fn refresh_version_status(&self) {
|
||||
let peer: Option<String> = self
|
||||
.imp()
|
||||
.client_object
|
||||
.borrow()
|
||||
.as_ref()
|
||||
.and_then(|co| co.property::<Option<String>>("peer-commit"));
|
||||
let local = crate::local_commit_str();
|
||||
let markup = match peer.as_deref() {
|
||||
None => format!("Peer version: unknown · Ours: {local}"),
|
||||
Some(p) if p == local.as_str() => {
|
||||
format!("Peer version: {p} · matched")
|
||||
}
|
||||
Some(p) => {
|
||||
format!("Peer version: {p} · Ours: {local}")
|
||||
}
|
||||
};
|
||||
self.remove_css_class("peer-mismatch");
|
||||
self.remove_css_class("peer-match");
|
||||
self.remove_css_class("peer-unknown");
|
||||
match peer.as_deref() {
|
||||
Some(p) if p == local.as_str() => self.add_css_class("peer-match"),
|
||||
Some(_) => self.add_css_class("peer-mismatch"),
|
||||
None => self.add_css_class("peer-unknown"),
|
||||
};
|
||||
self.set_subtitle(&markup);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,28 @@ mod macos_privacy;
|
||||
mod macos_status_item;
|
||||
mod window;
|
||||
|
||||
use std::{env, process, str};
|
||||
use std::{env, process, str, sync::OnceLock};
|
||||
|
||||
use gtk::CssProvider;
|
||||
use window::Window;
|
||||
|
||||
/// Local build's commit hash, set once by [`run`] before the GTK
|
||||
/// main loop starts. Read by per-row UI to compare against each
|
||||
/// peer's [`lan_mouse_ipc::ClientState::peer_commit`] for the
|
||||
/// soft-warn version-mismatch indicator.
|
||||
pub(crate) static LOCAL_COMMIT: OnceLock<[u8; 8]> = OnceLock::new();
|
||||
|
||||
/// Convenience: returns the local commit as an 8-char ASCII string,
|
||||
/// or a placeholder if unset (which would indicate a programmer
|
||||
/// error since [`run`] always sets it).
|
||||
pub(crate) fn local_commit_str() -> String {
|
||||
LOCAL_COMMIT
|
||||
.get()
|
||||
.and_then(|c| std::str::from_utf8(c).ok())
|
||||
.unwrap_or("????????")
|
||||
.to_string()
|
||||
}
|
||||
|
||||
use lan_mouse_ipc::FrontendEvent;
|
||||
|
||||
use adw::Application;
|
||||
@@ -31,8 +49,12 @@ pub enum GtkError {
|
||||
NonZeroExitCode(i32),
|
||||
}
|
||||
|
||||
pub fn run() -> Result<(), GtkError> {
|
||||
pub fn run(local_commit: [u8; 8]) -> Result<(), GtkError> {
|
||||
log::debug!("running gtk frontend");
|
||||
LOCAL_COMMIT
|
||||
.set(local_commit)
|
||||
.expect("local_commit set once");
|
||||
|
||||
#[cfg(windows)]
|
||||
let ret = std::thread::Builder::new()
|
||||
.stack_size(8 * 1024 * 1024) // https://gitlab.gnome.org/GNOME/gtk/-/commit/52dbb3f372b2c3ea339e879689c1de535ba2c2c3 -> caused crash on windows
|
||||
@@ -64,6 +86,7 @@ fn gtk_main() -> glib::ExitCode {
|
||||
.build();
|
||||
|
||||
app.connect_startup(|app| {
|
||||
load_css();
|
||||
load_icons();
|
||||
setup_actions(app);
|
||||
setup_menu(app);
|
||||
@@ -132,6 +155,16 @@ fn configure_macos_bundle_environment() {
|
||||
);
|
||||
}
|
||||
|
||||
fn load_css() {
|
||||
let provider = CssProvider::default();
|
||||
provider.load_from_resource("de/feschber/LanMouse/style.css");
|
||||
gtk::style_context_add_provider_for_display(
|
||||
&Display::default().expect("Could not connect to a display"),
|
||||
&provider,
|
||||
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
|
||||
);
|
||||
}
|
||||
|
||||
fn load_icons() {
|
||||
let display = &Display::default().expect("Could not connect to a display.");
|
||||
let icon_theme = IconTheme::for_display(display);
|
||||
|
||||
@@ -365,6 +365,13 @@ impl Window {
|
||||
.map(|ip| ip.to_string())
|
||||
.collect::<Vec<_>>();
|
||||
client_object.set_ips(ips);
|
||||
|
||||
/* peer build version (drives the version-match indicator) */
|
||||
client_object.set_property(
|
||||
"peer-commit",
|
||||
crate::client_object::peer_commit_to_string(state.peer_commit),
|
||||
);
|
||||
row.refresh_version_status();
|
||||
}
|
||||
|
||||
fn client_object_for_handle(&self, handle: ClientHandle) -> Option<ClientObject> {
|
||||
|
||||
@@ -176,6 +176,12 @@ pub struct ClientState {
|
||||
pub has_pressed_keys: bool,
|
||||
/// dns resolving in progress
|
||||
pub resolving: bool,
|
||||
/// Peer's build short commit hash from the [`Hello`] proto
|
||||
/// event. `None` means we haven't received a Hello yet — either
|
||||
/// the connection is fresh, or the peer is on an older build
|
||||
/// that predates the Hello event. The frontend uses this to
|
||||
/// soft-warn on version mismatch.
|
||||
pub peer_commit: Option<[u8; 8]>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
@@ -63,6 +63,15 @@ pub enum ProtoEvent {
|
||||
Ping,
|
||||
/// Response to [`ProtoEvent::Ping`], true if emulation is enabled / available
|
||||
Pong(bool),
|
||||
/// Build identification for the sending peer. Sent by the
|
||||
/// connect side once after the connection authenticates, and
|
||||
/// echoed back by the listen side in reply, so each end can
|
||||
/// display the peer's build hash and warn (soft) on mismatch.
|
||||
/// `commit` is the 8-byte ASCII short commit hash from
|
||||
/// `shadow_rs`'s `SHORT_COMMIT`. Old peers that don't
|
||||
/// recognize the event type silently skip it per the
|
||||
/// forward-compat handling in the receive loop.
|
||||
Hello { commit: [u8; 8] },
|
||||
}
|
||||
|
||||
impl Display for ProtoEvent {
|
||||
@@ -80,6 +89,10 @@ impl Display for ProtoEvent {
|
||||
if *alive { "alive" } else { "not available" }
|
||||
)
|
||||
}
|
||||
ProtoEvent::Hello { commit } => {
|
||||
let s = std::str::from_utf8(commit).unwrap_or("????????");
|
||||
write!(f, "Hello({s})")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,6 +111,7 @@ pub enum EventType {
|
||||
Enter,
|
||||
Leave,
|
||||
Ack,
|
||||
Hello,
|
||||
}
|
||||
|
||||
impl ProtoEvent {
|
||||
@@ -120,6 +134,7 @@ impl ProtoEvent {
|
||||
ProtoEvent::Enter(_) => EventType::Enter,
|
||||
ProtoEvent::Leave(_) => EventType::Leave,
|
||||
ProtoEvent::Ack(_) => EventType::Ack,
|
||||
ProtoEvent::Hello { .. } => EventType::Hello,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,6 +189,13 @@ impl TryFrom<[u8; MAX_EVENT_SIZE]> for ProtoEvent {
|
||||
EventType::Enter => Ok(Self::Enter(decode_u8(&mut buf)?.try_into()?)),
|
||||
EventType::Leave => Ok(Self::Leave(decode_u32(&mut buf)?)),
|
||||
EventType::Ack => Ok(Self::Ack(decode_u32(&mut buf)?)),
|
||||
EventType::Hello => {
|
||||
let mut commit = [0u8; 8];
|
||||
for b in commit.iter_mut() {
|
||||
*b = decode_u8(&mut buf)?;
|
||||
}
|
||||
Ok(Self::Hello { commit })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,6 +260,11 @@ impl From<ProtoEvent> for ([u8; MAX_EVENT_SIZE], usize) {
|
||||
ProtoEvent::Enter(pos) => encode_u8(buf, len, pos as u8),
|
||||
ProtoEvent::Leave(serial) => encode_u32(buf, len, serial),
|
||||
ProtoEvent::Ack(serial) => encode_u32(buf, len, serial),
|
||||
ProtoEvent::Hello { commit } => {
|
||||
for b in commit.iter() {
|
||||
encode_u8(buf, len, *b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(buf, len)
|
||||
|
||||
@@ -282,6 +282,12 @@ impl ClientManager {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn set_peer_commit(&self, handle: ClientHandle, commit: Option<[u8; 8]>) {
|
||||
if let Some((_, s)) = self.clients.borrow_mut().get_mut(handle as usize) {
|
||||
s.peer_commit = commit;
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn active_addr(&self, handle: ClientHandle) -> Option<SocketAddr> {
|
||||
self.clients
|
||||
.borrow()
|
||||
|
||||
@@ -28,6 +28,18 @@ use shadow_rs::shadow;
|
||||
|
||||
shadow!(build);
|
||||
|
||||
/// Local build's 8-byte ASCII short commit hash, suitable for use
|
||||
/// in [`lan_mouse_proto::ProtoEvent::Hello`]. Pads with `'?'` if
|
||||
/// shadow_rs returns an unexpected length so the field is always
|
||||
/// well-formed on the wire.
|
||||
pub fn local_commit() -> [u8; 8] {
|
||||
let bytes = build::SHORT_COMMIT.as_bytes();
|
||||
let mut out = [b'?'; 8];
|
||||
let n = bytes.len().min(8);
|
||||
out[..n].copy_from_slice(&bytes[..n]);
|
||||
out
|
||||
}
|
||||
|
||||
const CONFIG_FILE_NAME: &str = "config.toml";
|
||||
const CERT_FILE_NAME: &str = "lan-mouse.pem";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::client::ClientManager;
|
||||
use crate::config::local_commit;
|
||||
use lan_mouse_ipc::{ClientHandle, DEFAULT_PORT};
|
||||
use lan_mouse_proto::{MAX_EVENT_SIZE, ProtoEvent};
|
||||
use local_channel::mpsc::{Receiver, Sender, channel};
|
||||
@@ -197,6 +198,19 @@ async fn connect_to_handle(
|
||||
conns.lock().await.insert(addr, conn.clone());
|
||||
connecting.lock().await.remove(&handle);
|
||||
|
||||
// Best-effort version handshake. Send our commit hash once
|
||||
// immediately after the DTLS handshake; the listen side
|
||||
// mirrors a Hello back so the receive loop can populate
|
||||
// `peer_commit`. Old peers will silently skip this event
|
||||
// per the forward-compat handler in [`receive_loop`].
|
||||
let (buf, len) = ProtoEvent::Hello {
|
||||
commit: local_commit(),
|
||||
}
|
||||
.into();
|
||||
if let Err(e) = conn.send(&buf[..len]).await {
|
||||
log::debug!("hello send to {addr} failed: {e}");
|
||||
}
|
||||
|
||||
// poll connection for active
|
||||
spawn_local(ping_pong(addr, conn.clone(), ping_response.clone()));
|
||||
|
||||
@@ -255,16 +269,26 @@ async fn receive_loop(
|
||||
) {
|
||||
let mut buf = [0u8; MAX_EVENT_SIZE];
|
||||
while conn.recv(&mut buf).await.is_ok() {
|
||||
if let Ok(event) = buf.try_into() {
|
||||
log::trace!("{addr} <==<==<== {event}");
|
||||
match event {
|
||||
ProtoEvent::Pong(b) => {
|
||||
client_manager.set_active_addr(handle, Some(addr));
|
||||
client_manager.set_alive(handle, b);
|
||||
ping_response.borrow_mut().insert(addr);
|
||||
match buf.try_into() {
|
||||
Ok(event) => {
|
||||
log::trace!("{addr} <==<==<== {event}");
|
||||
match event {
|
||||
ProtoEvent::Pong(b) => {
|
||||
client_manager.set_active_addr(handle, Some(addr));
|
||||
client_manager.set_alive(handle, b);
|
||||
ping_response.borrow_mut().insert(addr);
|
||||
}
|
||||
ProtoEvent::Hello { commit } => {
|
||||
client_manager.set_peer_commit(handle, Some(commit));
|
||||
}
|
||||
event => tx.send((handle, event)).expect("channel closed"),
|
||||
}
|
||||
event => tx.send((handle, event)).expect("channel closed"),
|
||||
}
|
||||
// Skip undecodable datagrams without dropping the
|
||||
// connection. Each DTLS recv is one framed message, so
|
||||
// skipping is safe and keeps us forward-compatible with
|
||||
// peers that send event types we don't yet know about.
|
||||
Err(e) => log::debug!("ignoring undecodable event from {addr}: {e}"),
|
||||
}
|
||||
}
|
||||
log::warn!("recv error");
|
||||
@@ -280,6 +304,7 @@ async fn disconnect(
|
||||
log::warn!("client ({handle}) @ {addr} connection closed");
|
||||
conns.lock().await.remove(&addr);
|
||||
client_manager.set_active_addr(handle, None);
|
||||
client_manager.set_peer_commit(handle, None);
|
||||
let active: Vec<SocketAddr> = conns.lock().await.keys().copied().collect();
|
||||
log::info!("active connections: {active:?}");
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use crate::config::local_commit;
|
||||
use crate::listen::{LanMouseListener, ListenEvent, ListenerCreationError};
|
||||
use futures::StreamExt;
|
||||
use input_emulation::{EmulationHandle, InputEmulation, InputEmulationError};
|
||||
@@ -52,6 +53,17 @@ pub(crate) enum EmulationEvent {
|
||||
EmulationEnabled,
|
||||
/// capture should be released
|
||||
ReleaseNotify,
|
||||
/// peer sent us a Hello with its build commit hash. Used to
|
||||
/// populate `client_manager.peer_commit` from the listen side
|
||||
/// too — without this, peer-version visibility silently fails
|
||||
/// whenever the outgoing connection in the *other* direction is
|
||||
/// broken (one-way setups, asymmetric NAT, peer's TCP listener
|
||||
/// down). The connect-side path stays as the primary source;
|
||||
/// this is the defensive fallback.
|
||||
PeerHello {
|
||||
addr: SocketAddr,
|
||||
commit: [u8; 8],
|
||||
},
|
||||
}
|
||||
|
||||
enum EmulationRequest {
|
||||
@@ -150,6 +162,21 @@ impl ListenTask {
|
||||
}
|
||||
ProtoEvent::Input(event) => self.emulation_proxy.consume(event, addr),
|
||||
ProtoEvent::Ping => self.listener.reply(addr, ProtoEvent::Pong(self.emulation_proxy.emulation_active.get())).await,
|
||||
// Peer's version handshake. Echo our own
|
||||
// commit back so the peer's connect-side
|
||||
// receive_loop populates its `peer_commit`,
|
||||
// AND publish a PeerHello upward so our
|
||||
// service can populate ours from the listen
|
||||
// side too — the connect side is the primary
|
||||
// path, but if the outbound direction is
|
||||
// broken (one-way setup, NAT, peer's TCP
|
||||
// listener down) the version display would
|
||||
// otherwise silently say "unknown" while
|
||||
// the peer is in fact happily talking to us.
|
||||
ProtoEvent::Hello { commit } => {
|
||||
self.listener.reply(addr, ProtoEvent::Hello { commit: local_commit() }).await;
|
||||
self.event_tx.send(EmulationEvent::PeerHello { addr, commit }).expect("channel closed");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,8 +259,16 @@ async fn read_loop(
|
||||
.send(ListenEvent::Msg { event, addr })
|
||||
.expect("channel closed"),
|
||||
Err(e) => {
|
||||
log::warn!("error receiving event: {e}");
|
||||
break;
|
||||
// Skip the malformed/unknown datagram and keep
|
||||
// listening. Each DTLS recv returns one full
|
||||
// datagram, so a parse error here can't desync a
|
||||
// stream; the next call gets a fresh, framed
|
||||
// message. This makes the protocol forward-
|
||||
// compatible: a peer running a newer Lan Mouse
|
||||
// version can introduce additional event types
|
||||
// and old peers will simply ignore them rather
|
||||
// than dropping the connection.
|
||||
log::debug!("ignoring undecodable event from {addr}: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ fn run() -> Result<(), LanMouseError> {
|
||||
#[cfg(feature = "gtk")]
|
||||
{
|
||||
let mut service = start_service()?;
|
||||
let res = lan_mouse_gtk::run();
|
||||
let res = lan_mouse_gtk::run(config::local_commit());
|
||||
#[cfg(unix)]
|
||||
{
|
||||
// on unix we give the service a chance to terminate gracefully
|
||||
|
||||
@@ -319,6 +319,17 @@ impl Service {
|
||||
EmulationEvent::Connected { addr, fingerprint } => {
|
||||
self.notify_frontend(FrontendEvent::DeviceConnected { addr, fingerprint });
|
||||
}
|
||||
EmulationEvent::PeerHello { addr, commit } => {
|
||||
// Map the peer's source addr back to its client handle
|
||||
// and stamp the commit. Skip if we don't have an
|
||||
// outgoing client configured for this peer (incoming-
|
||||
// only setup) — there's nowhere to display the version
|
||||
// in that case anyway.
|
||||
if let Some(handle) = self.client_manager.get_client(addr) {
|
||||
self.client_manager.set_peer_commit(handle, Some(commit));
|
||||
self.broadcast_client(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
3
wix/bundle/.gitignore
vendored
Normal file
3
wix/bundle/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/bin
|
||||
/obj
|
||||
icon.ico
|
||||
16
wix/bundle/Bundle.wixproj
Normal file
16
wix/bundle/Bundle.wixproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="WixToolset.Sdk/5.0.0">
|
||||
<PropertyGroup>
|
||||
<OutputType>Bundle</OutputType>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
<Platforms>x64</Platforms>
|
||||
<InstallerPlatform>x64</InstallerPlatform>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="WixToolset.Heat">
|
||||
<Version>5.0.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="WixToolset.Bal.wixext">
|
||||
<Version>5.0.2</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
42
wix/bundle/Bundle.wxs
Normal file
42
wix/bundle/Bundle.wxs
Normal file
@@ -0,0 +1,42 @@
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
||||
xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
|
||||
|
||||
<Bundle
|
||||
Name="Lan Mouse"
|
||||
Version="0.10.0"
|
||||
UpgradeCode="{39A9744D-9D6E-4CD3-A84F-9E034786A7B1}"
|
||||
Compressed="no"
|
||||
SplashScreenSourceFile="icon.ico">
|
||||
|
||||
<BootstrapperApplication>
|
||||
<bal:WixStandardBootstrapperApplication
|
||||
LicenseUrl=""
|
||||
Theme="hyperlinkLicense" />
|
||||
</BootstrapperApplication>
|
||||
|
||||
<Chain>
|
||||
<!-- Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810 -->
|
||||
<ExePackage
|
||||
Id="VC_REDIST_X64"
|
||||
DisplayName="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
|
||||
PerMachine="yes"
|
||||
Permanent="yes"
|
||||
Protocol="burn"
|
||||
InstallCondition="VersionNT64 AND (ARCH_NAME = "AMD64")"
|
||||
DetectCondition="(VCRUNTIME_X64_VER >= VCRUNTIME_VER) AND VersionNT64 AND (ARCH_NAME = "AMD64")"
|
||||
InstallArguments="/install /quiet /norestart"
|
||||
RepairArguments="/repair /quiet /norestart"
|
||||
UninstallArguments="/uninstall /quiet /norestart">
|
||||
<ExePackagePayload
|
||||
Name="VC_redist.x64.exe"
|
||||
ProductName="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
|
||||
Description="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
|
||||
Hash="5935B69F5138AC3FBC33813C74DA853269BA079F910936AEFA95E230C6092B92F6225BFFB594E5DD35FF29BF260E4B35F91ADEDE90FDF5F062030D8666FD0104"
|
||||
Size="25397512"
|
||||
Version="14.40.33810.0"
|
||||
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/1754ea58-11a6-44ab-a262-696e194ce543/3642E3F95D50CC193E4B5A0B0FFBF7FE2C08801517758B4C8AEB7105A091208A/VC_redist.x64.exe" />
|
||||
</ExePackage>
|
||||
<MsiPackage SourceFile="..\lan-mouse\bin\Debug\en-US\LanMouse.msi" Compressed="yes"/>
|
||||
</Chain>
|
||||
</Bundle>
|
||||
</Wix>
|
||||
3
wix/lan-mouse/.gitignore
vendored
Normal file
3
wix/lan-mouse/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/bin
|
||||
/obj
|
||||
icon.ico
|
||||
13
wix/lan-mouse/Folders.wxs
Normal file
13
wix/lan-mouse/Folders.wxs
Normal file
@@ -0,0 +1,13 @@
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Fragment>
|
||||
<StandardDirectory Id="ProgramFiles64Folder">
|
||||
<Directory Id="INSTALLFOLDER" Name="!(bind.Property.Manufacturer) !(bind.Property.ProductName)">
|
||||
<Directory Id="SHARE" Name="share"/>
|
||||
<Directory Id="LIB" Name="lib"/>
|
||||
</Directory>
|
||||
</StandardDirectory>
|
||||
<StandardDirectory Id="ProgramMenuFolder">
|
||||
<Directory Id="ApplicationProgramsFolder" Name="!(bind.Property.ProductName)"/>
|
||||
</StandardDirectory>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
34
wix/lan-mouse/LanMouse.wixproj
Normal file
34
wix/lan-mouse/LanMouse.wixproj
Normal file
@@ -0,0 +1,34 @@
|
||||
<Project Sdk="WixToolset.Sdk/5.0.2">
|
||||
<PropertyGroup>
|
||||
<InstallerPlatform>x64</InstallerPlatform>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="WixToolset.Heat">
|
||||
<Version>5.0.2</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<HarvestDirectory Include="C:\gtk-build\gtk\x64\release\bin">
|
||||
<ComponentGroupName>GTKBIN</ComponentGroupName>
|
||||
<DirectoryRefId>INSTALLFOLDER</DirectoryRefId>
|
||||
<SuppressRegistry>true</SuppressRegistry>
|
||||
</HarvestDirectory>
|
||||
<BindPath Include="C:\gtk-build\gtk\x64\release\bin" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<HarvestDirectory Include="C:\gtk-build\gtk\x64\release\share\icons">
|
||||
<ComponentGroupName>GTKICONS</ComponentGroupName>
|
||||
<DirectoryRefId>SHARE</DirectoryRefId>
|
||||
<SuppressRegistry>true</SuppressRegistry>
|
||||
</HarvestDirectory>
|
||||
<BindPath Include="C:\gtk-build\gtk\x64\release\share\icons" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<HarvestDirectory Include="C:\gtk-build\gtk\x64\release\lib\gdk-pixbuf-2.0">
|
||||
<ComponentGroupName>GTKLIBS</ComponentGroupName>
|
||||
<DirectoryRefId>LIB</DirectoryRefId>
|
||||
<SuppressRegistry>true</SuppressRegistry>
|
||||
</HarvestDirectory>
|
||||
<BindPath Include="C:\gtk-build\gtk\x64\release\lib\gdk-pixbuf-2.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
32
wix/lan-mouse/LanMouseComponents.wxs
Normal file
32
wix/lan-mouse/LanMouseComponents.wxs
Normal file
@@ -0,0 +1,32 @@
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Fragment>
|
||||
<ComponentGroup Id="LanMouseComponents" Directory="INSTALLFOLDER" Subdirectory="bin">
|
||||
<Component Guid="{ECB52D3E-28AD-4BEC-B9DF-E01CCAB356BE}">
|
||||
<!-- the main binary -->
|
||||
<File Source="..\..\target\release\lan-mouse.exe"/>
|
||||
|
||||
<!-- visual c runtime dll -->
|
||||
<!--<File Source="C:\windows\system32\VCRUNTIME140.dll"/>-->
|
||||
<!--<File Source="C:\windows\system32\VCRUNTIME140_1.dll"/>-->
|
||||
</Component>
|
||||
<!-- start menu entry-->
|
||||
<Component Id="ApplicationShortcut" Directory="ApplicationProgramsFolder">
|
||||
<Shortcut Id="ApplicationStartMenuShortcut"
|
||||
Name="!(bind.Property.ProductName)"
|
||||
Description ="Mouse and Keyboard sharing Software"
|
||||
Target="[INSTALLFOLDER]bin\lan-mouse.exe"
|
||||
WorkingDirectory="INSTALLFOLDER">
|
||||
<Icon Id="LanMouse" SourceFile=".\icon.ico"/>
|
||||
</Shortcut>
|
||||
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
|
||||
<RegistryValue
|
||||
Root="HKCU"
|
||||
Key="Software\Feschber\LanMouse"
|
||||
Name="installed"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes"/>
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
8
wix/lan-mouse/Package.en-us.wxl
Normal file
8
wix/lan-mouse/Package.en-us.wxl
Normal file
@@ -0,0 +1,8 @@
|
||||
<!--
|
||||
This file contains the declaration of all the localizable strings.
|
||||
-->
|
||||
<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
|
||||
|
||||
<String Id="DowngradeError" Value="A newer version of [ProductName] is already installed." />
|
||||
|
||||
</WixLocalization>
|
||||
16
wix/lan-mouse/Package.wxs
Normal file
16
wix/lan-mouse/Package.wxs
Normal file
@@ -0,0 +1,16 @@
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Package Name="Lan Mouse"
|
||||
Manufacturer="Ferdinand Schober"
|
||||
Version="0.10.0.0"
|
||||
UpgradeCode="{a330cd60-4c35-4a54-8bb6-75b3049b46c6}">
|
||||
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
|
||||
|
||||
<MediaTemplate EmbedCab="yes"/>
|
||||
<Feature Id="Main">
|
||||
<ComponentGroupRef Id="GTKBIN"/>
|
||||
<ComponentGroupRef Id="GTKICONS"/>
|
||||
<ComponentGroupRef Id="GTKLIBS"/>
|
||||
<ComponentGroupRef Id="LanMouseComponents"/>
|
||||
</Feature>
|
||||
</Package>
|
||||
</Wix>
|
||||
2
wix/lan-mouse/build.ps1
Normal file
2
wix/lan-mouse/build.ps1
Normal file
@@ -0,0 +1,2 @@
|
||||
magick -background none -density 384 ..\lan-mouse-gtk\resources\de.feschber.LanMouse.svg -trim -define icon:auto-resize icon.ico
|
||||
dotnet build
|
||||
Reference in New Issue
Block a user