Universal-Bypass/.build.php

64 lines
1.3 KiB
PHP
Raw Normal View History

2018-11-09 15:00:05 +01:00
<?php
2018-12-05 09:04:17 +01:00
if(file_exists("Universal Bypass.zip"))
2018-11-09 15:00:05 +01:00
{
2018-12-05 09:04:17 +01:00
unlink("Universal Bypass.zip");
2018-11-09 15:00:05 +01:00
}
if(file_exists("Universal Bypass for Firefox.zip"))
{
unlink("Universal Bypass for Firefox.zip");
}
echo "Indexing...\n";
$index = [];
2018-11-09 15:00:05 +01:00
function recursivelyIndex($dir)
{
global $index;
2018-11-09 15:00:05 +01:00
foreach(scandir($dir) as $f)
{
2018-11-26 20:21:16 +01:00
if(substr($f, 0, 1) != ".")
2018-11-09 15:00:05 +01:00
{
2018-11-26 20:21:16 +01:00
$fn = $dir."/".$f;
if(is_dir($fn))
{
recursivelyIndex($fn);
}
else
2018-11-26 20:21:16 +01:00
{
array_push($index, substr($fn, 2));
2018-11-26 20:21:16 +01:00
}
2018-11-09 15:00:05 +01:00
}
}
}
recursivelyIndex(".");
echo "Building...\n";
function createZip($file)
{
$zip = new ZipArchive();
$zip->open($file, ZipArchive::CREATE + ZipArchive::EXCL + ZipArchive::CHECKCONS) or die("Failed to create {$file}.\n");
return $zip;
}
2020-01-31 06:36:31 +01:00
$raw_build = createZip("Universal Bypass for Firefox.zip");
$chromium_build = createZip("Universal Bypass for Chromium-based browsers.zip");
foreach($index as $fn)
{
if($fn == "README.md" || $fn == "injection_script.js")
{
continue;
}
if($fn == "manifest.json")
{
$json = json_decode(file_get_contents($fn), true);
2020-01-26 14:35:57 +01:00
unset($json["browser_specific_settings"]);
$json["incognito"] = "split";
2020-01-31 06:36:31 +01:00
$chromium_build->addFromString($fn, json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
}
else
{
2020-01-31 06:36:31 +01:00
$chromium_build->addFile($fn, $fn);
}
2020-01-31 06:36:31 +01:00
$raw_build->addFile($fn, $fn);
}
2020-01-31 06:36:31 +01:00
$raw_build->close();
$chromium_build->close();