Create Rental Applications offline on your own computer.


License
CNRI-Python-GPL-Compatible
Install
npm install rentap@1.1.8

Documentation

Rental Application

Create/save/print Rental Applications (Node.js version)

This is a port of my Mozilla Firefox Extension rentap to npm. You must install npm.

Rental Application can easily be run from your user's home folder by following these steps:

For Windows instructions, click here

Linux Terminal (ordinary user, no root privilages needed)

Install

  1. mkdir ~/nodejs
  2. cd ~/nodejs
  3. npm install rentap

(Optional) Import store.json From the Firefox (or Icecat) rentap extension

  1. Find store.json in a hidden subdirectory of your home directory: find ~/.mozilla -name store.json
  2. Copy or link it to ~/nodejs/node_modules/rentap/import_storejson Example: ln -s ~/.mozilla/icecat/vytcev6r.default-1510880606244/jetpack/jid1-E1afJi6vbTfsRg@jetpack/simple-storage/store.json ~/nodejs/node_modules/rentap/import_storejson/store.json
  3. cd ~/nodejs/node_modules/rentap/import_storejson
  4. node import_storejson and follow any prompts if it needs input from you
  5. mv store.db ..

Run

  1. cd ~/nodejs/node_modules/rentap
  2. npm start
  3. Open any browser to http://localhost:3000 or http://127.0.0.1:3000
  4. To stop the www server, run npm stop in ~/nodejs/node_modules/rentap.

(Optional) Google Appifying it and using a script to automatically run npm start

  1. Run as above and open in Google Chrome

  2. Click the 3-vertical-dot Google Chrome menu and choose More Tools -> Create Shortcut...

  3. Checkmark "Open As Window" if you want it to look like a separate ap instead of a tab

  4. Find the desktop file created by Google Chrome: grep "Rental Application" ~/.local/share/applications/*desktop

  5. Find the Exec command in the desktop file just found. For example, grep Exec ~/.local/share/applications/chrome-onobjhkphejolhnnbkgckmkjhpoelkgh-Default.desktop

  6. Create rentap with the following code in it where the last line is the Exec command found in the previous step.

    #!/bin/sh
    if test ! -f /tmp/rentap-server-running
    then
      rentap-server &
    fi
    /opt/google/chrome/google-chrome --profile-directory=Default --app-id=onobjhkphejolhnnbkgckmkjhpoelkgh
  7. chmod +x rentap

  8. sudo mv rentap /usr/local/bin

  9. Create rentap-server with the following code in it.

    #!/bin/sh
    cd ~/nodejs/node_modules/rentap
    npm start > /tmp/rentap-server-running
    rm /tmp/rentap-server-running
  10. chmod +x rentap-server

  11. sudo mv rentap-server /usr/local/bin

  12. Edit the desktop file found previously and set Exec=rentap

Now you can launch Rental Application like any other on your linux desktop. If the page displays an error, then press F5 to refresh, and maybe ad a sleep 4 or whatever length of time works after npm start ... in rentap-server.

To stop the www server, run npm stop in ~/nodejs/node_modules/rentap. Since the file /tmp/rentap-server-running is in /tmp (which is in memory only), it will be deleted on reboot even if rentap didn't get to delete it.

Windows Powershell (ordinary user, no Adminstrator privilages needed)

Install

  1. mkdir ~\nodejs
  2. cd ~\nodejs
  3. npm install rentap

(Optional) Import store.json From the Firefox (or Icecat) rentap extension

  1. Find store.json in a hidden subdirectory of your home directory:dir ~\AppData -recurse -ea 0 | % FullName | sls "store.json"
  2. Copy it to ~\nodejs\node_modules\rentap\import_storejson Example: cp ~\AppData\Roaming\Mozilla\Firefox\Profiles\4wvnz10q.default\jetpack\jid1-E1afJi6vbTfsRg@jetpack\simple-storage\store.json ~\nodejs\node_modules\rentap\import_storejson
  3. cd ~\nodejs\node_modules\rentap\import_storejson
  4. node import_storejson and follow any prompts if it needs input from you
  5. mv store.db ..

Run

  1. cd ~\nodejs\node_modules\rentap
  2. npm start
  3. Open any browser to http://localhost:3000 or http://127.0.0.1:3000
  4. To stop the www server, run npm stop in ~/nodejs/node_modules/rentap.

(Optional) Google Appifying it and using a script to automatically run npm start

  1. Run as above and open in Google Chrome

  2. Click the 3-vertical-dot Google Chrome menu and choose More Tools -> Create Shortcut...

  3. Checkmark "Open As Window" if you want it to look like a separate ap instead of a tab

  4. Get the command that launches the ap:

    1. Windows Menu -> All apps -> Recently added -> Rental Application, right click it and choose More...-> Open file location
    2. In the window that pops up, find the Rental Application shortcut and right click it, choosing Properties
    3. The "Target" will already be highlighted, so press Ctrl+c to copy it.
  5. Cancel the Properties window but keep the window showing the shortcut.

  6. Create ~\rentap.ps1 with the following code in it where the last line is a modified version of the "Target" that was copied in step 4. That last line splits the "Target" into a FilePath and an ArgumentList. Looking at the example in this script should make it clear how to do it.

    if (!(Test-Path "~\AppData\Local\Temp\rentap-server-running")) {
      Start-Job -FilePath "~\rentap-server.ps1"
      sleep 5
    }
    Start -FilePath "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -ArgumentList "--profile-directory=Default --app-id=onobjhkphejolhnnbkgckmkjhpoelkgh"
    cd ~\nodejs\node_modules\rentap

    My Windows computer is slow, so I added a sleep 5. This line may not be necessary, or 5 may be too long or too short - experiment.

  7. Create ~\rentap-server.ps1 with the following code in it:

    cd ~\nodejs\node_modules\rentap
    npm start > "~\AppData\Local\Temp\rentap-server-running"
    rm "~\AppData\Local\Temp\rentap-server-running"

    The rentap-server-running file won't be deleted until the server is stopped with npm stop in the window showing the server is running.

  8. Go back to the window showing the Rental Application shortcut, right click it, and choose Properties.

  9. Delete the highlighted "Target" and insert the following:

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoExit -File C:\Users\Colin\rentap.ps1

    Of course, replace "Colin" with your username.

  10. Turns out Windows doesn't delete the contents of ~\AppData\Local\Temp\ on reboot, so it's necessary to create a script to delete rentap-server-running and put it in the startup folder (in case the computer reboots before rentap-server.ps1 has the chance to delete the file).

    1. Create ~\rentap-not-running.ps1 with just one line:
    rm "~\AppData\Local\Temp\rentap-server-running"
    1. Open Windows startup folder: Right-click on the start menu, choose Run, and type Shell:common startup. This should bring up "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup".
    2. Open your home folder, Right-click on rentap-not-running.ps1 and create a shortcut.
    3. Drag the shortcut to the Startup folder (and allow administrative privilages to do it).
    4. Right-click the shortcut just moved to the Startup folder and change the Target, inserting the following at the beginning: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File (and allow administrative privilages to do it).
    5. For example, my Target looks like this: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\Users\Colin\rentap-not-running.ps1

Now you can launch Rental Application like any other. If on first launch, the page displays an error, press F5 to refresh the page because it tried to display the page before the server was up. You may need to play around with the line that says sleep 5 in the example script above. To stop the www server, run npm stop in the PowerShell window showing that it is running.