cconard96 / glpi-screenshot-plugin

Take a screenshot or screen recording directly from GLPI and attach it to a ticket, change or problem
GNU General Public License v2.0
5 stars 0 forks source link

Problem installing on GLPI 10.0.0.3 #39

Closed GGodoy21 closed 7 months ago

GGodoy21 commented 1 year ago

Hello, I'm having trouble installing the Plugin in GLPI version 10.0.0.3 both through the marketplace and directly through the plugins folder.

Through the Marketplace I can download the plugin but I can't install it. The same occurs directly through the folder

I click install but nothing happens. I'm having this problem only with this plugin. I also tried to download a previous version of the plugin but it does not appear within the GLPI. image

cconard96 commented 1 year ago

Are you connecting to GLPI over HTTPS?

If not, the functionality of the plugin wouldn't be allowed by the browser. There is a HTTPS check made when you try to install the plugin but the message "This plugin requires GLPI be served over HTTPS" isn't ever shown. I am aware of that issue.

Antoine2tt commented 1 year ago

Hi,

I'm using GLPI through reverse proxy, so SSL is on (Let's Encrypt)

And i have the same issue.

lexcorp commented 1 year ago

Same here...

cconard96 commented 1 year ago

In the hook.php file, can you try making the following change?

diff --git a/hook.php b/hook.php
index 92d9649..e1a0e33 100644
--- a/hook.php
+++ b/hook.php
@@ -22,7 +22,8 @@

 function plugin_screenshot_install()
 {
-   if (empty($_SERVER['HTTPS']) && !in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
+   $is_https = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') || $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https';
+   if (!$is_https && !in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
       echo 'This plugin requires GLPI be served over HTTPS';
       return false;
    }
lexcorp commented 1 year ago

I get this:

[2022-10-11 15:28:29] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "HTTP_X_FORWARDED_PROTO" in /var/www/html/glpi/plugins/screenshot/hook.php at line 30 Backtrace : src/Plugin.php:787 plugin_screenshot_install() front/plugin.form.php:51 Plugin->install()

lexcorp commented 1 year ago

I get this:

[2022-10-11 15:28:29] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "HTTP_X_FORWARDED_PROTO" in /var/www/html/glpi/plugins/screenshot/hook.php at line 30 Backtrace : src/Plugin.php:787 plugin_screenshot_install() front/plugin.form.php:51 Plugin->install()

FE DE ERRATAS...

Confirmo que se instala el plugin sin problemas, cuando se usa una conexión segura "https" y el certificado es valido.

myrandor commented 1 year ago

The fix from @cconard96 worked for me. I'm using a web proxy on port 80 to my docker, but my proxy is SSL.

borkie commented 1 year ago

The fix from @cconard96 worked