5eTools Install Guide

From 5etools Community Wiki
Jump to: navigation, search

framless
v1.120.1

If you are here, you are interested in hosting the 5eTools website yourself, GREAT! if you are here for Roll20's project BetteR20 you should go HERE; or if you are looking for Foundry's projects Plutonium & Rivet you should go HERE


The website is designed to be able to require very little to no backend and is open source. The entire site is downloadable and can be deployed to work from your local machine, or be installed to a local or hosted web server for your own or your group's ease of access.

  • No need for SQL/database backend.
  • Powerful n' Portable


PC Install

Current version is v1.120.1, Image will not reflect current version.
This is for running the code from your local PC (This will require internet access to run various libraries, and pull images etc. - and you will need to run a local webserver)


๐Ÿ‘‰ Go to get.5e.tools (See image to the right) and choose an installation option (see below) for the option that best suits your needs.
๐Ÿ‘‰ Confirm you are going to be using a supported browser.



FOR MOBILE
See below


Installing for use without Internet Access

FOR PC
๐Ÿ‘‰ Make sure you've downloaded the 5eTools development files.
๐Ÿ‘‰ You'll also need the Images zip.
  • Unzip the img folder into the same folder as the 5eTools development files. The path should be a direct route to the img folder (...\5eTools\img).
You may want to edit the source to remove links back to 5eTools/Homebrew.
You can choose to AUTOMATICALLY load specific homebrew files (see below).
  • Copy the 5eTools.html and rename the copy to index.html


Local Web Server

If you want to run the site from a local workstation; the following steps are provided to help those unfamiliar with how to setup a local webservice. Any webservice SHOULD suffice, but those listed are often the easiest ones (in order of easiest to harder) to use if you are not familiar with the process.
Devd
  • Download DevD
  • Review Install section for devd Guide, making sure to follow completely, and install it to the same directory as you've extracted 5eTools
  • Open terminal (command prompt)
  • Navigate to the directory you unzipped 5eTools into in the terminal window
  • Type .\devd.exe -ol .
  • Open localhost (http://localhost) or http://localhost/index.html in the root of webserver using a supported browser.


If you didn't make a mistake, the browser will likely open and pull the index.html, which needs to have been made before hand in order for the service to work
IF the browser says File:// you're not opening the page from the webserver. It won't work like that, so the main content will not be there.

Python
  • Install the latest python (preinstalled on Mac)
  • Open terminal (command prompt)
  • Navigate to the directory you unzipped 5eTools in the terminal window.
  • Type py -m http.server
    • You may wish to specify SimpleHTTPServer ie py -m SimpleHTTPServer
    • You may wish to specify a port at the end of the command ie either py -m SimpleHTTPServer 8080 or py -m http.server 8080, if you specify a port other than 80, you will need to include that in your localhost URL eg. (in the example above you'd need to use http://localhost:8080)


If you didn't make a mistake, open the browser - going to localhost and the browser will likely open and pull the index.html, which needs to have been made before hand in order for the service to work
IF the browser says File:// you're not opening the page from the webserver. It won't work like that, so the main content will not be there.

Wampserver

Step 1: Download WampServer

Installing all the individual pieces of software you need and configuring them to work together can be daunting. WampServer is a software package that can do almost all of this for you: it installs Apache, PHP, and MySQL, and provides a simple interface to use them.

  1. Navigate to https://sourceforge.net/projects/wampserver/.
  2. Click the word "download" at the top of the page.


Step 2: Install WampServer

  1. Run the installer you just downloaded.
  2. You can leave all the options on their defaults and just click through it, but STOP when you get to the page titled "Select Destination Location." This page is important. After you install WampServer, you will have to put all the files you want the server to "see" in a special folder inside the one you're selecting in this step. Therefore, you will want to install WampServer somewhere you can easily access. This is a matter of personal preference, but you may prefer to change the install location to somewhere like a subfolder of your Documents folder.
  3. Once you're happy with where WampServer will install, click through the rest of the installer.
  4. Add the folder where you unzipped the 5eTools content as a virtual host, and you're good.



Video Instructions



Common hosted platforms to deploy the site code for your use:

Hosted Server Install


Local Server Autoupdate Script

The following is a community member donation, used for keeping your local installation up to date. The Github mirror is often a version or more behind the main site, and for those wanting to make sure your local copy remains up to current release; this script seeks the file; checks its version number; then if the local copy is out of date -- grabs and extracts that new code into the same directory. (This is not official content and is provided to assist you, but not supported if it breaks.)

#!/usr/bin/env bash
FN=`curl -s -I https://get.5e.tools/release/|grep filename|cut -d"=" -f2 | awk '{print $1}'`
FN=${FN//[$'\t\r\n"']}
VER=`basename ${FN} ".zip"|sed 's/5eTools\.//'`
CUR=$(<version)
if [ "$VER" != "$CUR" ]
then
    echo -n $VER > version
    rm index.html
    curl -s -O -J https://get.5e.tools/release/
    unzip -q -o -u $FN
    find . -name \*.html -exec sed -i 's/"width=device-width, initial-scale=1"/"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/' {} \;
    cp 5etools.html index.html
    sed -i 's/<head>/<head>\n<link rel="apple-touch-icon" href="icon\/icon-512.png">/' index.html
    sed -i 's/navigator.serviceWorker.register("\/sw.js/navigator.serviceWorker.register("sw.js/' index.html
    sed -i 's/navigator.serviceWorker.register("\/sw.js/navigator.serviceWorker.register("sw.js/' 5etools.html
fi


#!/usr/bin/env bash
# based on: https://wiki.5e.tools/index.php/5eTools_Install_Guide
FN=`curl -s -I https://get.5e.tools/release/|grep filename|cut -d"=" -f2 | awk '{print $1}'`
FN=${FN//[$'\t\r\n"']}
echo "FN: $FN"
FN_IMG=`curl -s -I https://get.5e.tools/img/|grep filename|cut -d"=" -f2 | awk '{print $1}'`
FN_IMG=${FN_IMG//[$'\t\r\n"']}
echo "FN_IMG: $FN_IMG"
VER=`basename ${FN} ".zip"|sed 's/5eTools\.//'`
echo "VER: $VER"
CUR=$(<version)

echo " === Remote version: $VER"
echo " === Local version: $CUR"

if [ "$VER" != "$CUR" ]
then
  echo " === Local version outdated, updating..."
  echo -n $VER > version

  rm ./site/index.html 2> /dev/null || true

  echo " === Downloading new remote version..."
  cd ./download/
  curl --progress-bar -O -J https://get.5e.tools/release/ -C -
  curl --progress-bar -O -J https://get.5e.tools/img/ -C -
  cd ..

  echo " === Extracting site..."
  7z x ./download/$FN -o./site/ -y
  echo " === Extracting images..."
  7z x ./download/$FN_IMG -o./site/img -y
  mv ./site/img/tmp/5et/img/* ./site/img
  rm -r ./site/img/tmp

  echo " === Configuring..."
  cd ./site/
  find . -name \*.html -exec sed -i 's/"width=device-width, initial-scale=1"/"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/' {} \;
  cp 5etools.html index.html
  sed -i 's/<head>/<head>\n<link rel="apple-touch-icon" href="icon\/icon-512.png">/' index.html
  sed -i 's/navigator.serviceWorker.register("\/sw.js/navigator.serviceWorker.register("sw.js/' index.html
  sed -i 's/navigator.serviceWorker.register("\/sw.js/navigator.serviceWorker.register("sw.js/' 5etools.html

  echo " === Done!"
else
  echo " === Local version matches remote, no action."
fi



Mobile Platform

FOR MOBILE (online)
Bring up the 5e.tools site.
  • Click/Accept the Add 5eTools to Home screen
This preloads all the data locally. Images still pull from external sources.
- or -
  • Under Settings Choose - Add as App



FOR MOBILE (offline) (not officially supported)
Android


1๏ธโƒฃ Install the web service app (https://play.google.com/store/apps/details?id=org.xeustechnologies.android.kws), take note of the "data directory path" (likely a folder name htdocs in the root of internal storage) and start the server once so that the app creates the necessary files on your device. Take note of the port where the webserver is running (likely 8000).

2๏ธโƒฃ Move the extracted files from the 5etools zip into the public folder inside of your "data directory path" (e.g. htdocs/public)

3๏ธโƒฃ With browser (Chrome/Firefox) point to the server with http://localhost/:<port>/5etools.html or whatever page you need.


iPhone/iOS


1๏ธโƒฃ On the iPhone, go to Settings โ†’ Safari โ†’ Advanced and activate the switch โ€œweb inspectorโ€:

IOSweb1.jpg

2๏ธโƒฃ Connect the phone to your MacBook using a lightning-to-USB cable.

3๏ธโƒฃ On the MacBook, open up Safari and go to Develop โ†’ {NAME_OF_YOUR_IPHONE} and select โ€œConnect via Networkโ€:

IOSweb2.png

4๏ธโƒฃ Open up a terminal and run the command โ€œifconfigโ€ to see the list of current network interfaces, and take note of the IP address of the last entry in the list:

IOSweb3.png

5๏ธโƒฃ On your phone, in Chrome/Firefox, use the IP address to access your locally running website. For example, if you use create-react-app, instead of going to http://localhost:3000, with the IP I got here, the address to use is http://169.254.145.56:3000 (donโ€™t forget the http:// prefix):




How to autoload Homebrew Files into your local or server Install

You will need - the DEVELOPER package of the hosted install. (Following the directions outlined above for a standard install). The "production" version of the site (i.e. NOT the dev zip) has this feature disabled. You can re-enable it by replacing IS_DEPLOYED = \"X.Y.Z\"; in the file js/utils.js, with IS_DEPLOYED = undefined;

In the root of the site locate the ๐Ÿ“‚ Homebrew folder, place the homebrew files you wish to include automatically to your site within the folder. Find the ๐Ÿ“ index.json file and open it in a simple text editor, and locate this part of the file (for more information on JSON, see Homebrew)
"toImport": [	
]
and add names of the homebrew files for each file inside quotes at set of quotes (including a , at the end of each file name that has another filename following it.

EXAMPLE:

"toImport": [
    "Homebrew File1.json",
    "Homebrew File2.json",  
    "Homebrew File3.json"
]
Save the file ๐Ÿ“.
You are good to go now.