Skip to content

Commit 726f8a4

Browse files
committed
added js_remove config option
1 parent dcbdf91 commit 726f8a4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Plugin/ProxifyPlugin.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Proxy\Plugin\AbstractPlugin;
66
use Proxy\Event\ProxyEvent;
77
use Proxy\Config;
8+
use Proxy\Html;
89

910
class ProxifyPlugin extends AbstractPlugin {
1011

@@ -138,6 +139,19 @@ public function onCompleted(ProxyEvent $event){
138139
return;
139140
}
140141

142+
// remove JS from urls
143+
$js_remove = Config::get('js_remove');
144+
if(is_array($js_remove)){
145+
$domain = parse_url($this->base_url, PHP_URL_HOST);
146+
147+
foreach($js_remove as $pattern){
148+
if(strpos($domain, $pattern) !== false){
149+
$str = Html::remove_scripts($str);
150+
break;
151+
}
152+
}
153+
}
154+
141155
// let's remove all frames?? does not protect against the frames created dynamically via javascript
142156
$str = preg_replace('@<iframe[^>]*>[^<]*<\\/iframe>@is', '', $str);
143157

0 commit comments

Comments
 (0)