File webwormhole.spec of Package webwormhole
#
# spec file for package webwormhole
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global services webwormhole.service
Name: webwormhole
Version: 20250531.g386ff1b
Release: 0
Summary: Ephemeral WebRTC data transfer pipes between computers
License: BSD-3-Clause
URL: https://github.com/saljam/webwormhole
Source0: %{name}-%{version}.tar.zst
Source1: vendor.tar.zst
Source2: webwormhole-sysusers.conf
Source3: webwormhole.service
Source4: webwormhole.sysconfig
Patch: 0001-Disable-browser-extension-quirk-in-UI.patch
BuildRequires: golang(API) >= 1.13
BuildRequires: golang-packaging
BuildRequires: sysuser-shadow
BuildRequires: sysuser-tools
BuildRequires: zstd
Requires(post): %fillup_prereq
%{?systemd_ordering}
%{?sysusers_requires}
%description
WebWormhole creates ephemeral pipes between computers to send files
or other data.
WebWormhole is inspired by and uses a model very similar to that of
Magic Wormhole. It differs in that it uses WebRTC to make its
connections. This allows us to make use of WebRTC's NAT traversal
tricks, as well as the fact that it can be used in browsers.
The exchange of session descriptions (offers and answers) is
protected by PAKE (we use CPace) and a generated random password,
similar to Magic Wormhole. The session descriptions include the
fingerprints of the DTLS certificates that WebRTC uses to secure
its communications. The protocol does not need to trust the
signalling server to maintain the confidentiality of the files
transferred.
%prep
%autosetup -p1
tar -xf %{SOURCE1}
%build
go build -mod=vendor -buildmode=pie -trimpath -o ./ww ./cmd/ww
GOOS=js GOARCH=wasm go build -mod=vendor -o ./web/webwormhole.wasm ./web
%sysusers_generate_pre %{SOURCE2} %{name} %{name}.conf
%install
install -D -m0755 -t %{buildroot}%{_bindir} ww
install -D -m0644 -t %{buildroot}%{_unitdir} %{SOURCE3}
install -D -m0644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf
install -D -m0644 %{SOURCE4} %{buildroot}%{_fillupdir}/sysconfig.%{name}
install -D -m0644 -t %{buildroot}%{_datadir}/%{name}/web web/* "$(go env GOROOT)/lib/wasm/wasm_exec.js"
rm %{buildroot}%{_datadir}/%{name}/web/*.{go,ts}
%pre -f %{name}.pre
%service_add_pre %{services}
%preun
%service_del_preun %{services}
%post
%fillup_only %{name}
%service_add_post %{services}
%postun
%service_del_postun %{services}
%files
%license LICENSE
%doc README
%{_bindir}/ww
%{_datadir}/%{name}
%{_unitdir}/%{name}.service
%{_sysusersdir}/%{name}.conf
%{_fillupdir}/sysconfig.%{name}
%changelog