diff options
| author | polo <ordipolo@gmx.fr> | 2026-11-18 22:09:05 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-11-18 22:09:05 +0100 |
| commit | 07e3ef46e92c862d052c872f70b5bcfb57363703 (patch) | |
| tree | 9e726bf28bec8723e06ec6ae65fa0d2ffc3680bc | |
| parent | a05773ec9a0e0335927f2731dfc76ad28f312697 (diff) | |
| download | rustdesk-scripts-07e3ef46e92c862d052c872f70b5bcfb57363703.tar.gz rustdesk-scripts-07e3ef46e92c862d052c872f70b5bcfb57363703.tar.bz2 rustdesk-scripts-07e3ef46e92c862d052c872f70b5bcfb57363703.zip | |
possibilité d'insérer des variables dans les scripts
| -rw-r--r-- | download.php | 32 | ||||
| -rwxr-xr-x | scripts/rustdesk-arch.sh.php (renamed from scripts/rustdesk-arch.sh) | 0 | ||||
| -rwxr-xr-x | scripts/rustdesk-deb.sh.php (renamed from scripts/rustdesk-deb.sh) | 0 | ||||
| -rwxr-xr-x | scripts/rustdesk-uninstall.bat.php (renamed from scripts/rustdesk-uninstall.bat) | 0 | ||||
| -rw-r--r-- | scripts/rustdesk.bat.php (renamed from scripts/rustdesk.bat) | 0 |
5 files changed, 27 insertions, 5 deletions
diff --git a/download.php b/download.php index dfafea6..7c50a5c 100644 --- a/download.php +++ b/download.php | |||
| @@ -2,11 +2,33 @@ | |||
| 2 | // téléchargements des scripts par les visiteurs | 2 | // téléchargements des scripts par les visiteurs |
| 3 | 3 | ||
| 4 | $file_names = ['win' => 'rustdesk.bat', 'win_uninstall' => 'rustdesk-uninstall.bat', 'deb' => 'rustdesk.sh', 'arch' => 'rustdesk.sh']; | 4 | $file_names = ['win' => 'rustdesk.bat', 'win_uninstall' => 'rustdesk-uninstall.bat', 'deb' => 'rustdesk.sh', 'arch' => 'rustdesk.sh']; |
| 5 | $scripts = ['win' => 'scripts/rustdesk.bat', 'win_uninstall' => 'scripts/rustdesk-uninstall.bat', 'deb' => 'scripts/rustdesk-deb.sh', 'arch' => 'scripts/rustdesk-arch.sh']; | 5 | $scripts = ['win' => 'scripts/rustdesk.bat.php', 'win_uninstall' => 'scripts/rustdesk-uninstall.bat.php', 'deb' => 'scripts/rustdesk-deb.sh.php', 'arch' => 'scripts/rustdesk-arch.sh.php']; |
| 6 | |||
| 7 | $os = $_GET['os'] ?? ''; | ||
| 8 | |||
| 9 | // GET incorrect | ||
| 10 | if(!isset($scripts[$os])){ | ||
| 11 | http_response_code(400); | ||
| 12 | die('OS invalide'); | ||
| 13 | } | ||
| 14 | |||
| 15 | // template introuvable | ||
| 16 | if(!is_file($scripts[$os])){ | ||
| 17 | http_response_code(404); | ||
| 18 | die('Script introuvable'); | ||
| 19 | } | ||
| 20 | |||
| 21 | // variables à insérer | ||
| 22 | // ... | ||
| 23 | |||
| 24 | // template | ||
| 25 | ob_start(); | ||
| 26 | include $scripts[$os]; | ||
| 27 | $content = ob_get_clean(); | ||
| 6 | 28 | ||
| 7 | header("Content-Type: application/octet-stream"); | 29 | header("Content-Type: application/octet-stream"); |
| 8 | header('Content-Disposition: attachment; filename="' . $file_names[$_GET['os']] . '"'); | 30 | header('Content-Disposition: attachment; filename="' . $file_names[$os] . '"'); |
| 9 | header('Content-Length: ' . filesize($scripts[$_GET['os']])); | 31 | header('Content-Length: ' . strlen($scripts[$os])); // strlen remplace filesize parce que le fichier laisse sa place à une chaîne php modifiée par l'insersion de variables |
| 10 | 32 | ||
| 11 | readfile($scripts[$_GET['os']]); | 33 | echo($content); // echo remplace readfile pour la même raison |
| 12 | exit; | 34 | die; |
diff --git a/scripts/rustdesk-arch.sh b/scripts/rustdesk-arch.sh.php index b7446b5..b7446b5 100755 --- a/scripts/rustdesk-arch.sh +++ b/scripts/rustdesk-arch.sh.php | |||
diff --git a/scripts/rustdesk-deb.sh b/scripts/rustdesk-deb.sh.php index 0c03baa..0c03baa 100755 --- a/scripts/rustdesk-deb.sh +++ b/scripts/rustdesk-deb.sh.php | |||
diff --git a/scripts/rustdesk-uninstall.bat b/scripts/rustdesk-uninstall.bat.php index 89e1584..89e1584 100755 --- a/scripts/rustdesk-uninstall.bat +++ b/scripts/rustdesk-uninstall.bat.php | |||
diff --git a/scripts/rustdesk.bat b/scripts/rustdesk.bat.php index 5e60787..5e60787 100644 --- a/scripts/rustdesk.bat +++ b/scripts/rustdesk.bat.php | |||
