Browse Source

Use new experimental image host

spaghetti 8 years ago
parent
commit
6ad54e28f6
2 changed files with 4 additions and 2 deletions
  1. 2
    0
      classes/config.template
  2. 2
    2
      classes/imagetools.class.php

+ 2
- 0
classes/config.template View File

@@ -7,6 +7,7 @@ if (version_compare(PHP_VERSION, '7.0.0', '<')) {
7 7
 // Main settings
8 8
 define('SITE_NAME',     'Oppaitime'); //The name of your site
9 9
 define('SITE_DOMAIN',   'oppaiti.me'); //The FQDN of your site
10
+define('IMAGE_DOMAIN',  'img.oppaiti.me'); //The FQDN of your image host
10 11
 define('SERVER_ROOT',   '/var/www/oppaiti.me'); //The root of the server, used for includes
11 12
 define('TORRENT_STORE', '/var/torrents/'); //Where torrent files are stored
12 13
 
@@ -32,6 +33,7 @@ define('INTEGRITY_ALGO', 'sha256');
32 33
 
33 34
 // Keys
34 35
 define('ENCKEY',       'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); //Random key. The key for encryption
36
+define('IMAGE_PSK',    'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); //Pre-shared key for generating hmacs for the image proxy
35 37
 define('SCHEDULE_KEY', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); // Random key. This key must be the argument to schedule.php for the schedule to work.
36 38
 define('RSS_HASH',     'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); //Random key. Used for generating unique RSS auth key.
37 39
 

+ 2
- 2
classes/imagetools.class.php View File

@@ -183,10 +183,10 @@ class ImageTools {
183 183
       }
184 184
     }
185 185
 
186
-    if (preg_match('/^https:\/\/'.SITE_DOMAIN.'\//', $Url)) {
186
+    if (preg_match('/^https:\/\/('.SITE_DOMAIN.'|'.IMAGE_DOMAIN.')\//', $Url)) {
187 187
       return $Url;
188 188
     } else {
189
-      return 'https://' . SITE_DOMAIN . "/image.php?c=1&amp;i=" . urlencode($Url);
189
+      return 'https://'.IMAGE_DOMAIN.'?h='.rawurlencode(base64_encode(hash_hmac('sha256', $Url, IMAGE_PSK, true))).'&i='.urlencode($Url);
190 190
     }
191 191
   }
192 192
 

Loading…
Cancel
Save