mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-10 10:04:01 +02:00
Add option to force proxying of files
Signed-off-by: Marco Dickert <marco@misterunknown.de>
This commit is contained in:
@@ -53,7 +53,8 @@ class IFM {
|
|||||||
"showpath" => 0,
|
"showpath" => 0,
|
||||||
"contextmenu" => 1,
|
"contextmenu" => 1,
|
||||||
"disable_mime_detection" => 0,
|
"disable_mime_detection" => 0,
|
||||||
"showrefresh" => 1
|
"showrefresh" => 1,
|
||||||
|
"forceproxy" => 0
|
||||||
);
|
);
|
||||||
|
|
||||||
private $config = array();
|
private $config = array();
|
||||||
@@ -101,6 +102,7 @@ class IFM {
|
|||||||
$this->config['contextmenu'] = getenv('IFM_GUI_CONTEXTMENU') !== false ? intval( getenv('IFM_GUI_CONTEXTMENU') ) : $this->config['contextmenu'] ;
|
$this->config['contextmenu'] = getenv('IFM_GUI_CONTEXTMENU') !== false ? intval( getenv('IFM_GUI_CONTEXTMENU') ) : $this->config['contextmenu'] ;
|
||||||
$this->config['search'] = getenv('IFM_API_SEARCH') !== false ? intval( getenv('IFM_API_SEARCH') ) : $this->config['search'] ;
|
$this->config['search'] = getenv('IFM_API_SEARCH') !== false ? intval( getenv('IFM_API_SEARCH') ) : $this->config['search'] ;
|
||||||
$this->config['showrefresh'] = getenv('IFM_GUI_REFRESH') !== false ? intval( getenv('IFM_GUI_REFRESH') ) : $this->config['showrefresh'] ;
|
$this->config['showrefresh'] = getenv('IFM_GUI_REFRESH') !== false ? intval( getenv('IFM_GUI_REFRESH') ) : $this->config['showrefresh'] ;
|
||||||
|
$this->config['forceproxy'] = getenv('IFM_GUI_FORCEPROXY') !== false ? intval( getenv('IFM_GUI_FORCEPROXY') ) : $this->config['forceproxy'] ;
|
||||||
|
|
||||||
// optional settings
|
// optional settings
|
||||||
if( getenv('IFM_SESSION_LIFETIME') !== false )
|
if( getenv('IFM_SESSION_LIFETIME') !== false )
|
||||||
@@ -1507,7 +1509,7 @@ function IFM(params) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
item.download.link = self.api+"?api="+item.download.action+"&dir="+self.hrefEncode(self.currentDir)+"&filename="+self.hrefEncode(item.download.name);
|
item.download.link = self.api+"?api="+item.download.action+"&dir="+self.hrefEncode(self.currentDir)+"&filename="+self.hrefEncode(item.download.name);
|
||||||
if( self.config.isDocroot )
|
if( self.config.isDocroot && !self.config.forceproxy )
|
||||||
item.link = self.hrefEncode( self.pathCombine( window.location.path, self.currentDir, item.name ) );
|
item.link = self.hrefEncode( self.pathCombine( window.location.path, self.currentDir, item.name ) );
|
||||||
else if (self.config.download && self.config.zipnload) {
|
else if (self.config.download && self.config.zipnload) {
|
||||||
if (self.config.root_public_url) {
|
if (self.config.root_public_url) {
|
||||||
@@ -3494,7 +3496,8 @@ f00bar;
|
|||||||
private function getConfig() {
|
private function getConfig() {
|
||||||
$ret = $this->config;
|
$ret = $this->config;
|
||||||
$ret['inline'] = ( $this->mode == "inline" ) ? true : false;
|
$ret['inline'] = ( $this->mode == "inline" ) ? true : false;
|
||||||
$ret['isDocroot'] = ( $this->getRootDir() == $this->getScriptRoot() ) ? true : false;
|
$ret['isDocroot'] = ($this->getRootDir() == $this->getScriptRoot);
|
||||||
|
|
||||||
foreach (array("auth_source", "root_dir") as $field) {
|
foreach (array("auth_source", "root_dir") as $field) {
|
||||||
unset($ret[$field]);
|
unset($ret[$field]);
|
||||||
}
|
}
|
||||||
|
9
ifm.php
9
ifm.php
@@ -53,7 +53,8 @@ class IFM {
|
|||||||
"showpath" => 0,
|
"showpath" => 0,
|
||||||
"contextmenu" => 1,
|
"contextmenu" => 1,
|
||||||
"disable_mime_detection" => 0,
|
"disable_mime_detection" => 0,
|
||||||
"showrefresh" => 1
|
"showrefresh" => 1,
|
||||||
|
"forceproxy" => 0
|
||||||
);
|
);
|
||||||
|
|
||||||
private $config = array();
|
private $config = array();
|
||||||
@@ -101,6 +102,7 @@ class IFM {
|
|||||||
$this->config['contextmenu'] = getenv('IFM_GUI_CONTEXTMENU') !== false ? intval( getenv('IFM_GUI_CONTEXTMENU') ) : $this->config['contextmenu'] ;
|
$this->config['contextmenu'] = getenv('IFM_GUI_CONTEXTMENU') !== false ? intval( getenv('IFM_GUI_CONTEXTMENU') ) : $this->config['contextmenu'] ;
|
||||||
$this->config['search'] = getenv('IFM_API_SEARCH') !== false ? intval( getenv('IFM_API_SEARCH') ) : $this->config['search'] ;
|
$this->config['search'] = getenv('IFM_API_SEARCH') !== false ? intval( getenv('IFM_API_SEARCH') ) : $this->config['search'] ;
|
||||||
$this->config['showrefresh'] = getenv('IFM_GUI_REFRESH') !== false ? intval( getenv('IFM_GUI_REFRESH') ) : $this->config['showrefresh'] ;
|
$this->config['showrefresh'] = getenv('IFM_GUI_REFRESH') !== false ? intval( getenv('IFM_GUI_REFRESH') ) : $this->config['showrefresh'] ;
|
||||||
|
$this->config['forceproxy'] = getenv('IFM_GUI_FORCEPROXY') !== false ? intval( getenv('IFM_GUI_FORCEPROXY') ) : $this->config['forceproxy'] ;
|
||||||
|
|
||||||
// optional settings
|
// optional settings
|
||||||
if( getenv('IFM_SESSION_LIFETIME') !== false )
|
if( getenv('IFM_SESSION_LIFETIME') !== false )
|
||||||
@@ -1507,7 +1509,7 @@ function IFM(params) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
item.download.link = self.api+"?api="+item.download.action+"&dir="+self.hrefEncode(self.currentDir)+"&filename="+self.hrefEncode(item.download.name);
|
item.download.link = self.api+"?api="+item.download.action+"&dir="+self.hrefEncode(self.currentDir)+"&filename="+self.hrefEncode(item.download.name);
|
||||||
if( self.config.isDocroot )
|
if( self.config.isDocroot && !self.config.forceproxy )
|
||||||
item.link = self.hrefEncode( self.pathCombine( window.location.path, self.currentDir, item.name ) );
|
item.link = self.hrefEncode( self.pathCombine( window.location.path, self.currentDir, item.name ) );
|
||||||
else if (self.config.download && self.config.zipnload) {
|
else if (self.config.download && self.config.zipnload) {
|
||||||
if (self.config.root_public_url) {
|
if (self.config.root_public_url) {
|
||||||
@@ -3494,7 +3496,8 @@ f00bar;
|
|||||||
private function getConfig() {
|
private function getConfig() {
|
||||||
$ret = $this->config;
|
$ret = $this->config;
|
||||||
$ret['inline'] = ( $this->mode == "inline" ) ? true : false;
|
$ret['inline'] = ( $this->mode == "inline" ) ? true : false;
|
||||||
$ret['isDocroot'] = ( $this->getRootDir() == $this->getScriptRoot() ) ? true : false;
|
$ret['isDocroot'] = ($this->getRootDir() == $this->getScriptRoot);
|
||||||
|
|
||||||
foreach (array("auth_source", "root_dir") as $field) {
|
foreach (array("auth_source", "root_dir") as $field) {
|
||||||
unset($ret[$field]);
|
unset($ret[$field]);
|
||||||
}
|
}
|
||||||
|
@@ -166,7 +166,7 @@ function IFM(params) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
item.download.link = self.api+"?api="+item.download.action+"&dir="+self.hrefEncode(self.currentDir)+"&filename="+self.hrefEncode(item.download.name);
|
item.download.link = self.api+"?api="+item.download.action+"&dir="+self.hrefEncode(self.currentDir)+"&filename="+self.hrefEncode(item.download.name);
|
||||||
if( self.config.isDocroot )
|
if( self.config.isDocroot && !self.config.forceproxy )
|
||||||
item.link = self.hrefEncode( self.pathCombine( window.location.path, self.currentDir, item.name ) );
|
item.link = self.hrefEncode( self.pathCombine( window.location.path, self.currentDir, item.name ) );
|
||||||
else if (self.config.download && self.config.zipnload) {
|
else if (self.config.download && self.config.zipnload) {
|
||||||
if (self.config.root_public_url) {
|
if (self.config.root_public_url) {
|
||||||
|
@@ -54,7 +54,8 @@ class IFM {
|
|||||||
"showpath" => 0,
|
"showpath" => 0,
|
||||||
"contextmenu" => 1,
|
"contextmenu" => 1,
|
||||||
"disable_mime_detection" => 0,
|
"disable_mime_detection" => 0,
|
||||||
"showrefresh" => 1
|
"showrefresh" => 1,
|
||||||
|
"forceproxy" => 0
|
||||||
);
|
);
|
||||||
|
|
||||||
private $config = array();
|
private $config = array();
|
||||||
@@ -102,6 +103,7 @@ class IFM {
|
|||||||
$this->config['contextmenu'] = getenv('IFM_GUI_CONTEXTMENU') !== false ? intval( getenv('IFM_GUI_CONTEXTMENU') ) : $this->config['contextmenu'] ;
|
$this->config['contextmenu'] = getenv('IFM_GUI_CONTEXTMENU') !== false ? intval( getenv('IFM_GUI_CONTEXTMENU') ) : $this->config['contextmenu'] ;
|
||||||
$this->config['search'] = getenv('IFM_API_SEARCH') !== false ? intval( getenv('IFM_API_SEARCH') ) : $this->config['search'] ;
|
$this->config['search'] = getenv('IFM_API_SEARCH') !== false ? intval( getenv('IFM_API_SEARCH') ) : $this->config['search'] ;
|
||||||
$this->config['showrefresh'] = getenv('IFM_GUI_REFRESH') !== false ? intval( getenv('IFM_GUI_REFRESH') ) : $this->config['showrefresh'] ;
|
$this->config['showrefresh'] = getenv('IFM_GUI_REFRESH') !== false ? intval( getenv('IFM_GUI_REFRESH') ) : $this->config['showrefresh'] ;
|
||||||
|
$this->config['forceproxy'] = getenv('IFM_GUI_FORCEPROXY') !== false ? intval( getenv('IFM_GUI_FORCEPROXY') ) : $this->config['forceproxy'] ;
|
||||||
|
|
||||||
// optional settings
|
// optional settings
|
||||||
if( getenv('IFM_SESSION_LIFETIME') !== false )
|
if( getenv('IFM_SESSION_LIFETIME') !== false )
|
||||||
@@ -418,7 +420,8 @@ f00bar;
|
|||||||
private function getConfig() {
|
private function getConfig() {
|
||||||
$ret = $this->config;
|
$ret = $this->config;
|
||||||
$ret['inline'] = ( $this->mode == "inline" ) ? true : false;
|
$ret['inline'] = ( $this->mode == "inline" ) ? true : false;
|
||||||
$ret['isDocroot'] = ( $this->getRootDir() == $this->getScriptRoot() ) ? true : false;
|
$ret['isDocroot'] = ($this->getRootDir() == $this->getScriptRoot);
|
||||||
|
|
||||||
foreach (array("auth_source", "root_dir") as $field) {
|
foreach (array("auth_source", "root_dir") as $field) {
|
||||||
unset($ret[$field]);
|
unset($ret[$field]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user