Moved UI resources to Wwwroot in embedded golang webserver RIVM-23

This commit is contained in:
Mihail Slobodyanuk 2022-12-13 17:07:34 +02:00
parent b52e1bb787
commit dca4fdd689
6 changed files with 15 additions and 9 deletions

View file

@ -294,10 +294,10 @@ func run(args yggArgs, ctx context.Context) {
return return
} }
//override httpaddress and wwwroot parameters in cfg //override httpaddress and wwwroot parameters in cfg
if len(args.httpaddress) > 0 { if len(cfg.HttpAddress) == 0 {
cfg.HttpAddress = args.httpaddress cfg.HttpAddress = args.httpaddress
} }
if len(args.wwwroot) > 0 { if len(cfg.WwwRoot) == 0 {
cfg.WwwRoot = args.wwwroot cfg.WwwRoot = args.wwwroot
} }

View file

@ -57,7 +57,7 @@ cat > /tmp/$PKGNAME/usr/share/applications/riv.desktop << EOF
Name=RiV mesh Name=RiV mesh
GenericName=Mesh network GenericName=Mesh network
Comment=RiV-mesh is an early-stage implementation of a fully end-to-end encrypted IPv6 network Comment=RiV-mesh is an early-stage implementation of a fully end-to-end encrypted IPv6 network
Exec=sh -c "/usr/bin/mesh-ui /usr/share/riv/ui/index.html" Exec=sh -c "/usr/bin/mesh-ui http://localhost:19019"
Terminal=false Terminal=false
Type=Application Type=Application
Icon=riv Icon=riv

View file

@ -54,7 +54,7 @@ cp contrib/macos/mesh.plist pkgbuild/root/Library/LaunchDaemons
cat > pkgbuild/root/Applications/RiV-mesh.app/Contents/MacOS/open-mesh-ui << EOF cat > pkgbuild/root/Applications/RiV-mesh.app/Contents/MacOS/open-mesh-ui << EOF
#!/usr/bin/env bash #!/usr/bin/env bash
exec /Applications/RiV-mesh.app/Contents/MacOS/mesh-ui /Applications/RiV-mesh.app/Contents/Resources/ui/index.html 1>/tmp/mesh-ui.stdout.log 2>/tmp/mesh-ui.stderr.log exec /Applications/RiV-mesh.app/Contents/MacOS/mesh-ui http://localhost:19019 1>/tmp/mesh-ui.stdout.log 2>/tmp/mesh-ui.stderr.log
EOF EOF
# Create the postinstall script # Create the postinstall script

View file

@ -9,6 +9,12 @@
<string>/Applications/RiV-mesh.app/Contents/MacOS/mesh</string> <string>/Applications/RiV-mesh.app/Contents/MacOS/mesh</string>
<string>-useconffile</string> <string>-useconffile</string>
<string>/etc/mesh.conf</string> <string>/etc/mesh.conf</string>
<string>-logto</string>
<string>/var/log/mesh.log</string>
<string>-httpaddress</string>
<string>http://localhost:19019</string>
<string>-wwwroot</string>
<string>/Applications/RiV-mesh.app/Contents/Resources/ui</string>
</array> </array>
<key>KeepAlive</key> <key>KeepAlive</key>
<true/> <true/>

View file

@ -220,7 +220,7 @@ cat > wix.xml << EOF
Name="Mesh" Name="Mesh"
Start="auto" Start="auto"
Type="ownProcess" Type="ownProcess"
Arguments='-useconffile "%ALLUSERSPROFILE%\\RiV-mesh\\mesh.conf" -logto "%ALLUSERSPROFILE%\\RiV-mesh\\mesh.log"' Arguments='-useconffile "%ALLUSERSPROFILE%\\RiV-mesh\\mesh.conf" -logto "%ALLUSERSPROFILE%\\RiV-mesh\\mesh.log" -httpaddress "http://localhost:19019" -wwwroot "[MeshInstallFolder]\\RiV-mesh\\ui"'
Vital="yes" /> Vital="yes" />
<ServiceControl <ServiceControl
Id="MeshServiceControl" Id="MeshServiceControl"
@ -306,7 +306,7 @@ cat > wix.xml << EOF
<CustomAction Id="LaunchApplication" <CustomAction Id="LaunchApplication"
FileKey="MeshUI" FileKey="MeshUI"
Impersonate="yes" Impersonate="yes"
ExeCommand='"[MeshInstallFolder]ui\index.html"' ExeCommand='"http://localhost:19019"'
Return="asyncNoWait" /> Return="asyncNoWait" />
<!-- Step 3: Include the custom action --> <!-- Step 3: Include the custom action -->
@ -325,7 +325,7 @@ cat > wix.xml << EOF
Description="RiV-mesh is IoT E2E encrypted network" Description="RiV-mesh is IoT E2E encrypted network"
Directory="DesktopFolder" Directory="DesktopFolder"
Target="[MeshInstallFolder]mesh-ui.exe" Target="[MeshInstallFolder]mesh-ui.exe"
Arguments="ui\index.html" Arguments="http://localhost:19019"
WorkingDirectory="MeshInstallFolder"/> WorkingDirectory="MeshInstallFolder"/>
<RegistryValue Root="HKCU" <RegistryValue Root="HKCU"
Key="Software\RiV-chain\RiV-mesh" Key="Software\RiV-chain\RiV-mesh"
@ -337,7 +337,7 @@ cat > wix.xml << EOF
Key="Software\Microsoft\Windows\CurrentVersion\Run" Key="Software\Microsoft\Windows\CurrentVersion\Run"
Name="RiV-mesh client" Name="RiV-mesh client"
Type="string" Type="string"
Value='"[MeshInstallFolder]mesh-ui.exe" "[MeshInstallFolder]ui\index.html"' /> Value='"[MeshInstallFolder]mesh-ui.exe" "http://localhost:19019"' />
<Condition>ASSISTANCE_START_VIA_REGISTRY</Condition> <Condition>ASSISTANCE_START_VIA_REGISTRY</Condition>
</Component> </Component>

View file

@ -12,7 +12,7 @@ ProtectSystem=true
SyslogIdentifier=mesh SyslogIdentifier=mesh
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE
ExecStartPre=+-/sbin/modprobe tun ExecStartPre=+-/sbin/modprobe tun
ExecStart=/usr/bin/mesh -useconffile /etc/mesh.conf ExecStart=/usr/bin/mesh -useconffile /etc/mesh.conf -logto /var/log/mesh.log -httpaddress "http://localhost:19019" -wwwroot "/usr/share/riv"
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID
Restart=always Restart=always
TimeoutStopSec=5 TimeoutStopSec=5