Skip to content

How to use it step by step

0red edited this page Nov 10, 2020 · 14 revisions

Prepare server

  1. On the server where the Apache Werb Server is avaiable create directory i.e. exeoutput_updater in the www files location (/var/www/html)
  2. copy server/pmo.php to the exeoutput_updater/
  3. copy server/htaccess to the exeoutput_updater/.htaccess
  4. check the ownership for the files and dir. (i.e.chown www-data:www-data . .. .htaccess pmo.php)
  5. check if it's working - type in Web Browser something like: http://<server>/<dir>/exeoutput_updater/php.php
  6. You can ban/allow users by updating pmo.php: check_user() function
function check_user() {
	//if ($_POST && in_array($_POST['d'],array("HOME","WORK"))) return false;   // You can limit the access to You application here
	return false; // update allowed
	return true; //no update allowed
}

You can use some $_POST variabes i.e.

  • $_POST['o'] - operation u-pdate, v-erify
  • $_POST['u'] - PC user login name
  • $_POST['d'] - domain/workgroup
  • $_POST['v'] - exe app version
  • $_POST['c'] - cpu id
  • $_POST['t'] - actual update file (ts)

which also be saved in the pmo. log file (accesible via i.e. pmo.php?s=1)

In case it return true on the system all update files will be deleted and application will be close, so You can do some access control here !!!

please be aware of CORS https://enable-cors.org/server.html


Prepare update file

  1. Create directory for the project
  2. copy files from exeoutput/ to this project directory
  3. edit enc_data.php:266 for changing the encryption password $pass_buduj_plik="my_new_pass"; <-- enter new password here. Server has no knowledge of unencrypted version of Your software.
  4. edit enc_data.php:449 for server url location $url = 'https://<server>/exeoutput_updater/pmo.php?upp';
  5. edit enc_data.php:2 You can change the time zone `$defaultTimeZone='Europe/Warsaw'
  6. edit enc_data.php:267/268 Setting the local PC directory $up_dir='C:\Users\<username>\AppData\Local\ExeOutput\UserApplication\{APP GUID}'."\\";

image

{APP GUID} - ExeOutput --> Application Output --> Output Settings --> Application GUID

i.e.

$up_dir='C:\Users\<username>\AppData\Local\ExeOutput\UserApplication\{3AE5192C-F8CC-477F-B0E0-73D6D84D5BF2}'."\\"; // for windows cmd

$up_dir="/mnt/c/Users/<username>/AppData/Local/ExeOutput/UserApplication/{3AE5192C-F8CC-477F-B0E0-73D6D84D5BF2}/"; // for windoes subsystem for Linux (WSL)

update file will be stored as dane5.txt in that directory

  1. edit enc_data.php:282 function buduj_plik() (sorry for my Polish --> in English build_a_file)

add here all Your files which You would like to update. For the demo below are requested files

$ar=array(
 # mandatory files for demo with toast
  "jquery.toast.css",
  "jquery.toast.js",
  "update.php",
  "main.php",
  "exe_update.js"
 );

Please remember that script now canNOT create directories.

So if You need to use subdirs minumum of file in each directories You want to use should be added into ExeOutput test.exop to create the virtual files system with such directory. If such subdir exists You can overwrite or add new files in such subdir, if not - files will not be created, so update will not work.

  1. edit enc_data.php:313 $w=array('files'=>$w,'ts'=>$t,'main'=>"main.php"); // put HERE the YOUR INITIAL PAGE 'main' => my main page is in 'main.php
  2. open console (i.e. WIN-key then cmd+ENTER)
  3. go to the proper project directory (cd <dirs>/project)
  4. execute php.exe enc_data.php build_file1 (in case php.exe is not in path use proper i.e. "c:\Program Files\PHP\php.exe" instead of php.exe
  5. in Your directory should dane.2.txt appears.
  6. now You have Your initial version. Files from this file will override the ones inside ExeOutput test.exe !!

prepare exe

  1. Open ExeOutput and create NEW Project i.e test.exop in the project directory

    image

  2. set exe_start.php as the index page

    image

  3. add the following files (as the requested minimum) to the test.exop :

    • dane.2.txt
    • enc_data.php
    • exe_start.php

    image

  4. Add menu

  • To add Menu in ExeOutput

image

  • Delete updates: exe_start.php?noupdate=2

image

  • Check for Updates: jr_check_update('https://www.jr.pl/projects/exeoutput_updater/pmo.php')

image

  • Start without updates (sometimes fails): exe_start.php?noupdate=1

image

  • To Reload (F5) use normal ExeOutput menu Navigate then Home or main.php (in my example)

image

  1. Build the Project
  2. Check if it's working
    • the application should initially starting with the minimum version
    • look and find the update
    • download update and restart
    • now should be the final version
  3. Enjoy the application

Changes to be done to the production version

  1. Disable Chrome console in the production version Application Settings --> Components --> Rendering Enginde --> Developer Tools OFF

    otherwise the updated javascript code could be hacked and visible in the console and people have the easy access to some console hacking --> i.e. executing php scripts making AJAX query and so on.

    image

  2. You can also think about OFF PHP debugging using the following settings:

    • Php Settings->Debugging-->Store requests and errors to log files --> I put it OFF in my production
    • Php Settings->Debugging-->Enable PHP error logging --> I personally kept it ON to have ability to track claims/bugs
    • Php Settings->Debugging-->Display PHP error messaging at runtime--> I personally kept it ON to have ability to track claims/bugs

create the update

  1. open console (i.e. WIN-key then cmd+ENTER)
  2. go to the proper project directory (cd <dirs>/project)
  3. execute php.exe enc_data.php build_file (in case php.exe is not in path use proper i.e. "c:\Program Files\PHP\php.exe" instead of php.exe)
  4. see it data.5.txt exists and "is newly" created
  5. execute php.exe enc_data.php update_server
  6. in case You are in the network 10.x.x.x use build_file1 instead build_file or comment line 467 (see below for proxy)

quicker

  1. open console (i.e. WIN-key then cmd+ENTER)
  2. go to the proper project directory (cd <dirs>/project)
  3. execute php.exe enc_data.php do_all (in case php.exe is not in path use proper i.e. "c:\Program Files\PHP\php.exe" instead of php.exe)

some enc_data.php tips

  1. use php.exe enc_data.php help for showing help

  2. in case of using proxy please update enc_data.php proxy settings change line 467 according to Your proxy settings

    if ($possible_proxy && preg_match('/^10\\./',$ip)) $options['http']['proxy']='proxy.default.in.case.pc.is.in.net10.x.x.x:8080';

    WARNING !!!. The app checking by default if PC is in the network 10.x.x.x --> if Yes add the proxy settings - put Yours

  3. You can force not to use proxy using php.exe enc_data.php build_file1 instead php.exe enc_data.php build_file (not working with php.exe enc_data.php do_all by default)

  4. Some tips are added in Issue 2

  5. See also main Wiki

  6. And the best - server has no knowledge of unencrypted version of Your software. You crypt it on Your PC, upload encryted to the server. User download it and it's unencrypt in the virtual ExeOutput space for the execution time only.

I hope it will help to use.


"Customer support"

In case of any problems please ask the Your Customer to:

  1. delete update file (menu see in demo)
  2. and restart the app....
  3. [sometimes also do update and restart again :-)] --> In my app is the worst scenario to recover i.e. in case of buggy update