HOWTO: Local v8 Web Control

Moderators: Site Moderators, FAHC Science Team

Post Reply
calxalot
Site Moderator
Posts: 883
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco, CA
Contact:

HOWTO: Local v8 Web Control

Post by calxalot »

HOWTO: Local v8 Web Control

What?

Use a local Web Control served by the client.

Why?
Why not?
  • Must be manually updated
  • Insecure if allowing remote control direct connection

Prerequisites
  • Administrator account so you can use sudo
  • Comfortable using the command line in Terminal

NOTE

If using v8.2.4 or later, skip down to
viewtopic.php?p=363144#p363144


Create/Edit config.xml on local client computer

macOS

Code: Select all

sudo /usr/bin/nano "/Library/Application Support/FAHClient/config.xml"
Linux

Update: for v8.3.x, the path is /etc/fah-client/config.xml

Code: Select all

sudo /usr/bin/mkdir -p /etc/fahclient
sudo /usr/bin/nano /etc/fahclient/config.xml
If the file is empty, first add

Code: Select all

<config>
</config>

Allow localhost origin and set web-root in config.xml

Code: Select all

  <allowed-origins v='https://app.foldingathome.org http://localhost:7396'/>
  <web-root v='fah-web-control/dist'/>
Save config.xml. In nano, use Write Out, <enter>, Exit.


Download and install pre-built Web Control

macOS

Code: Select all

cd /tmp
curl -fLO https://download.foldingathome.org/releases/beta/fah-web-control/macos-12-universal/release/latest.tar.bz2
tar -xf latest.tar.bz2
mv fah-web-control_* fah-web-control
sudo /bin/mv fah-web-control "/Library/Application Support/FAHClient/."
rm latest.tar.bz2
Linux

Code: Select all

cd /tmp
wget https://download.foldingathome.org/releases/beta/fah-web-control/macos-12-universal/release/latest.tar.bz2
tar -xf latest.tar.bz2
mv fah-web-control_* fah-web-control
sudo /usr/bin/mv fah-web-control /var/lib/fah-client/.
rm latest.tar.bz2

Optional: Hack local Web Control for mobile browsers

You do not need this if you can pair a keyboard to your mobile device and type control-shift-L when Web Control is open, but you do need to allow remote control.

In the future, you will not need a hacked local Web Control to use a mobile browser.

Note that the Web Control layout is not mobile-optimized.
Landscape orientation generally works better.


Allow remote control of local client

WARNING: This is a security risk. See link for details.

If you haven't already, copy-paste these lines in config.xml after <config>

Code: Select all

  <http-addresses v='0.0.0.0:7396'/>
  <allow v='127.0.0.1 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12 169.254.0.0/16'/>
  <deny v='0/0'/>
For more secure allow options, see HOWTO: Allow v8 Client Remote Control


Add hostname as an allowed origin to config.xml

Replace my-computer wherever it appears in this document with output of command hostname. Use lowercase.

Code: Select all

  <allowed-origins v='https://app.foldingathome.org http://localhost:7396 http://my-computer.local:7396'/>

Edit Web Control JavaScript

This will not be needed for v8.1.19 and later.

macOS

Code: Select all

cd "/Library/Application Support/FAHClient"
cd fah-web-control/dist/assets
open -a TextEdit.app index.*.js
Linux

Code: Select all

cd /var/lib/fah-client
cd fah-web-control/dist/assets
nano index.*.js
Windows - Open fah-web-control\dist\assets\index.*.js in Notepad

In two places, replace

Code: Select all

getItem("client-host")||"127.0.0.1"
with

Code: Select all

getItem("client-host")||"my-computer.local"
Save file and quit.


Restart client

macOS

Code: Select all

sudo /bin/launchctl stop org.foldingathome.fahclient
sudo /bin/launchctl start org.foldingathome.fahclient
Linux

Code: Select all

sudo /usr/bin/systemctl restart fah-client

Enjoy

To access local Web Control, open

http://localhost:7396

For mobile browser option, open

http://my-computer.local:7396


Option: Build Web Control

Install build tools - macOS

Install homebrew from https://brew.sh
Follow any instructions given at end of homebrew install.

Install npm

Code: Select all

brew install npm vite

Install build tools - Linux

Code: Select all

sudo apt install -y npm vite

Clone Web Control from GitHub

Code: Select all

cd ~
git clone -b v8.1.18 https://github.com/FoldingAtHome/fah-web-client-bastet.git

Build Web Control and move to client directory

Code: Select all

cd ~/fah-web-client-bastet
npm install
npm run build
cd ..
mv fah-web-client-bastet fah-web-control
macOS

Code: Select all

sudo /bin/mv fah-web-control "/Library/Application Support/FAHClient/."
Linux

Code: Select all

sudo /usr/bin/mv fah-web-control /var/lib/fah-client/.
daiko
Posts: 9
Joined: Tue Jun 08, 2021 1:14 pm
Hardware configuration: Mac Studio M1 Max
Folding since 2005
Location: Atlantic County, NJ

Re: HOWTO: Local v8 Web Control

Post by daiko »

Thanks, calxalot. I appreciate the option to run local on MacOS (Ventura 13.2.1). I’m back to using Safari for folding control.
I downloaded and installed the latest beta from the given link, and it picked up where the previous version left off, no problems. 👍
Image
calxalot
Site Moderator
Posts: 883
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco, CA
Contact:

Re: HOWTO: Local v8 Web Control

Post by calxalot »

Edit: sorry, I apparently deleted this:

The latest built fah-web-control as of 2023-04-25 is available as a zip:

https://github.com/kbernhagen/fah-web-c ... t/releases

This does not need javascript hacking for a remote/mobile browser, but the hostname in your browser must end with ".local". The remote client would still need the config.xml changes to allow access.
calxalot
Site Moderator
Posts: 883
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco, CA
Contact:

Re: HOWTO: Local v8 Web Control

Post by calxalot »

If you are using beta v8.3.4 or later, things are much simpler.

Download latest beta Web Control 8.x from
https://download.foldingathome.org/rele ... l/release/

Unarchive and rename extracted directory to just "fah-web-control".

Move it into the fah data directory.

Restart the client.

Open http://localhost:7396
calxalot
Site Moderator
Posts: 883
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco, CA
Contact:

Re: HOWTO: Local v8 Web Control

Post by calxalot »

FYI
Currently, a local v8.3.4+ Web Control will likely always redirect to
https://beta.foldingathome.org/
Post Reply