xiaozhian commited on
Commit
a5065b3
·
verified ·
1 Parent(s): dc45f00

Update upload.php

Browse files
Files changed (1) hide show
  1. upload.php +7 -1
upload.php CHANGED
@@ -12,7 +12,13 @@ if (!is_dir($videoDir)) {
12
  }
13
 
14
  // 获取协议
15
- $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
 
 
 
 
 
 
16
  // 获取客户端IP和端口
17
  $host = $_SERVER['HTTP_HOST'];
18
  $baseUrl = $protocol . $host . dirname($_SERVER['SCRIPT_NAME']) . '/';
 
12
  }
13
 
14
  // 获取协议
15
+ $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://';
16
+
17
+ // 如果是在 HuggingFace 空间上运行,强制使用 HTTPS
18
+ if (strpos($_SERVER['HTTP_HOST'], '.hf.space') !== false) {
19
+ $protocol = 'https://';
20
+ }
21
+
22
  // 获取客户端IP和端口
23
  $host = $_SERVER['HTTP_HOST'];
24
  $baseUrl = $protocol . $host . dirname($_SERVER['SCRIPT_NAME']) . '/';