nvpx se présente sous la forme d'une webview avec une url initiale et un ensemble de commandes javascript. L'url initiale peut provenir, dans l'ordre de priorité, d'un paramètre de la ligne de commande (-r url) ou bien des données locales système (origine fichier config puis écrite ds les données système lors de l'installation). *** Liste des commandes javascript *** Les commandes javascript utilisent la fonction javascript prompt qui accepte 2 paramètres de type string: param1 et param2 et une string de retour. Pour détecter une commande interne, param1 doit commencer par la chaine "nvpx::". Si ce n'est pas le cas on considère que c'est la commande prompt normale de javascript. ************************************************************************ Command: set_user_data ************************************************************************ Param1: nvpx::set_user_data::section;key Param2: data value return value: none ************************************************************************ Saves user data in section/key on local computer. Mainly used for setting internal dialog box text (ex login and proxy dialogs). ************************************************************************ ************************************************************************ Command: get_user_data ************************************************************************ Param1: nvpx::get_user_data::section;key Param2: default value return value: data value ************************************************************************ Gets data saved as section/key on local computer. ************************************************************************ ************************************************************************ Command: encrypt_string ************************************************************************ Param1: nvpx::encrypt_string::string Param2: optional key string return value: encrypted string ************************************************************************ Encrypt a string with a given optional key. 100 char max. ************************************************************************ ************************************************************************ Command: decrypt_string ************************************************************************ Param1: nvpx::decrypt_string::string Param2: key string used to encrypt return value: decrypted string ************************************************************************ Decrypt a string previously encrypted with encrypt_string given an optional key. ************************************************************************ ************************************************************************ Command: set_size ************************************************************************ Param1: nvpx::set_size::width;height Param2: not used return value: none ************************************************************************ Sets the webview size in pixels ************************************************************************ ************************************************************************ Command: save_size ************************************************************************ Param1: nvpx::save_size Param2: not used return value: none ************************************************************************ Saves the current webview size. This value will be used for the next call of nvpx. May be used after a set_size. Initial size is given in the config file. Not useful any more since the size is automatically saved when the position changes. ************************************************************************ ************************************************************************ Command: set_position ************************************************************************ Param1: nvpx::set_position::x;y Param2: not used return value: none ************************************************************************ Sets the webview position in pixels from the upper left corner of screen ************************************************************************ ************************************************************************ Command: save_position ************************************************************************ Param1: nvpx::save_position Param2: not used return value: none ************************************************************************ Saves the current webview position. This value will be used for the next call of nvpx. May be used after a set_position. Initial position is given in the config file. Not useful any more since the position is automatically saved when the position changes. ************************************************************************ ************************************************************************ Command: set_window_type ************************************************************************ Param1: nvpx::set_window_type::type Param2: not used return value: none ************************************************************************ Sets the webview type. Type can be "NOFRAME" or "STANDARD". If "NOFRAME" there is no system menu and no border. The window type is saved into the registry and retreived and set at startup. ************************************************************************ ************************************************************************ Command: compress_file ************************************************************************ Param1: not used Param2: not used return value: returns 1 if successful, 0 otherwise ************************************************************************ Compress the file to send in LZMA. ************************************************************************ ************************************************************************ Command: login ************************************************************************ Param1: nvpx::login::mode (INTERNAL or EXTERNAL) Param2: url/params return value: returns 1 if successful, 0 if authentication failed, -1 if canceled by user. Extra information specific to the connected server may follow in case of error. It's then separated from return code with a "::" string. ************************************************************************ Does the login following the login mode (internal or external). When successful, there will be a generated token that can be retrieved by the get_last_token command. When the login is internal, nvpx may display a Dialog asking for user ident and password. Internal login is being made by a direct internal http request to the url given in Param2. External login is being made by a call to the external prgm defined in the config file. Some extra parameters can be given in Param2. ************************************************************************ ************************************************************************ Command: check_login ************************************************************************ Param1: nvpx::check_login::mode (INTERNAL or EXTERNAL) Param2: url/params return value: returns 1 if user is currently logged and 0 otherwise ************************************************************************ Checks if the user is currently logged. If internal login, the check is made by a direct internal http/json request to the url given in Param1. External login is being made by a call to the external prgm defined in the config file. Some extra parameters can be given in Param2 (this is the place to send the current token to the external prgm). ************************************************************************ ************************************************************************ Command: logout ************************************************************************ Param1: nvpx::logout::mode (INTERNAL or EXTERNAL) Param2: url/params return value: returns 1 if successful and 0 otherwise ************************************************************************ Explicitly logout the user. If internal login, the logout is made by a direct internal http request to the url given in Param1. External logout is being made by a call to the external prgm defined in the config file. Some extra parameters can be given in Param2. ************************************************************************ ************************************************************************ Command: get_last_token ************************************************************************ Param1: nvpx::get_last_token Param2: not used return value: last token ************************************************************************ Retrieves the last successful login token (may be empty). ************************************************************************ ************************************************************************ Command: get_num_login_attempts ************************************************************************ Param1: nvpx::get_num_login_attempts Param2: not used return value: number of login attempts ************************************************************************ Retrieves the number of login attempts. This can be used to limit the number of attempts. ************************************************************************ ************************************************************************ Command: unsave_password ************************************************************************ Param1: nvpx::unsave_password Param2: not used return value: none ************************************************************************ Completly unsaves user credential (ident, password and token) from the prgm and from persistent local data. ************************************************************************ ************************************************************************ Command: unsave_proxy_password ************************************************************************ Param1: nvpx::unsave_proxy_password Param2: not used return value: none ************************************************************************ Completly unsaves proxy credential (ident, password) from the prgm and from persistent local data. ************************************************************************ ************************************************************************ Command: get_locale ************************************************************************ Param1: nvpx::get_locale Param2: not used return value: locale (ex fr_FR) see ISO 639 and ISO 3166 ************************************************************************ Gets the locale of the computer user ************************************************************************ ************************************************************************ Command: quit ************************************************************************ Param1: nvpx::quit::url Param2: not used return value: none ************************************************************************ leaves nvpx and displays the user's default browser with the given optional url if there is one. ************************************************************************ ************************************************************************ Command: load_page ************************************************************************ Param1: nvpx::load_page::url Param2: not used return value: none ************************************************************************ loads the given url to the webview. ************************************************************************ ************************************************************************ Command: log_write ************************************************************************ Param1: nvpx::log_write::logtext Param2: not used return value: none ************************************************************************ Sends the given text to log file if one has been defined. ************************************************************************ ************************************************************************ Command: log_writeln ************************************************************************ Param1: nvpx::log_writeln::logtext Param2: not used return value: none ************************************************************************ Sends the given text to log file if one has been defined. Adds a new line at the end. ************************************************************************ *** Ligne de commande nvpx *** Idem nvp aux exceptions suivantes: Mode send: option -m sendx ou -m send avec une url définie en ligne de commande ou dans le fichier config (registre) Url: option -r url Note le code de nvpx contient le code de nvp donc toutes les options de nvp fonctionnent. L'installation est similaire à nvp mais un certain nombre d'entrées du fichier de config ne sont pas utilisées par nvpx. Voici les entrées supplémentaires du fichier config pour nvpx: [WebView] Position="50,50" Type="Standard" Widht="300" Height="400" Url="http://win10:1081/NVS?command&NV_APPLICATION=NVPX&NV_CMD=OBJECT:GET&NAME=HTML&NV_PROC=perl:nvpx1&NV_CLOSE_SESSION=YES" Pour Type les valeurs sont "Standard" ou "Noframe" Pour lancer nvpx il faut utiliser "nvp -m sendx" ou bien "nvp -m send" après avoir défini une url dans le fichier config ou bien dans la ligne de commande. *** Directory *** Nvpx n'utilise pas le directory *** Protocole de login *** La fonction de login utilise un protocole en 2 étapes. Nvpx demande D'abord une paire clef publique / clef privée au server puis envoie un hash Du mot de passe codé par la clef privée. Les headers https sont utilisés pour gérer cette transaction. Phase 1 Nvpx envoie le header nvpx-auth-request qui contient le user name (user ident) Codé en utf-8 puis en base 64. Le serveur répond par le headear nvpx-auth-key qui contient une paire Clef publique - clef privée séparée par le caractère ":". private:public Si l'une des 2 clefs manque, ceci est considéré comme une erreur. Nvpx code alors le user utf-8 et le password utf-8 de la façon suivante: sha256_up(sha256_up(md5_up(user)) + sha256_up(md5_up(password)) + PrivateToken) Et l'envoie au serveur dans le header nvpx-auth-ident. Il renvoie également La clef publique dans nvpx-auth-key Le serveur répond alors par un header nvpx-auth-token qui contient le Token de connection. En cas d'erreur le serveur ne renvoie pas ce token Ou bien le renvoie vide et peut également envoyer un header Nvpx-auth-info qui donne une raison de l'erreur. *** Protocole de logout *** Nvpx envoie nvpx-auth-token au serveur avec le token (sauf s'il n'y A pas de token localement). Celui-ci doit répondre avec le header nvpx-auth-token avec la valeur "none". Toute autre valeur est considérée comme une erreur de logout. En cas d'erreur le serveur peut également envoyer un header Nvpx-auth-info qui donne une raison de l'erreur. *** Protocole de check du login *** Nvpx envoie nvpx-auth-token au serveur avec le token (sauf s'il n'y A pas de token localement). Celui-ci doit répondre avec le header nvpx-auth-token avec la valeur du token si l'utilisateur est Toujours considéré comme actif. Toute autre valeur indique que L'utilisateur n'est plus actif. En cas d'erreur le serveur peut également envoyer un header Nvpx-auth-info qui donne une raison de l'erreur.