Update Firefox build process

This commit is contained in:
Sainan 2020-05-13 17:04:37 +02:00
parent ca2635ba09
commit 7e232bfe68
3 changed files with 0 additions and 50 deletions

View File

@ -1,41 +1,8 @@
<?php <?php
function recursivelyDelete($path)
{
if(substr($path, -1) == "/")
{
$path = substr($path, 0, -1);
}
if(!file_exists($path))
{
return;
}
if(is_dir($path))
{
foreach(scandir($path) as $file)
{
if(!in_array($file, [
".",
".."
]))
{
recursivelyDelete($path."/".$file);
}
}
rmdir($path);
}
else
{
unlink($path);
}
}
if(file_exists("Universal Bypass for Netscape Navigator.zip")) if(file_exists("Universal Bypass for Netscape Navigator.zip"))
{ {
unlink("Universal Bypass for Netscape Navigator.zip"); unlink("Universal Bypass for Netscape Navigator.zip");
} }
if(is_dir(".firefox"))
{
recursivelyDelete(".firefox");
}
echo "Indexing...\n"; echo "Indexing...\n";
$index = []; $index = [];
@ -49,7 +16,6 @@ function recursivelyIndex($dir)
$fn = $dir."/".$f; $fn = $dir."/".$f;
if(is_dir($fn)) if(is_dir($fn))
{ {
mkdir(".firefox/".$fn);
recursivelyIndex($fn); recursivelyIndex($fn);
} }
else else
@ -59,7 +25,6 @@ function recursivelyIndex($dir)
} }
} }
} }
mkdir(".firefox");
recursivelyIndex("."); recursivelyIndex(".");
echo "Building...\n"; echo "Building...\n";
@ -83,11 +48,9 @@ foreach($index as $fn)
if($fn == "manifest.json") if($fn == "manifest.json")
{ {
$json = json_decode(file_get_contents($fn), true); $json = json_decode(file_get_contents($fn), true);
unset($json["browser_specific_settings"]);
$json["version"] .= ".".$build_id; $json["version"] .= ".".$build_id;
$content = str_replace(" ", "\t", json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); $content = str_replace(" ", "\t", json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
$build->addFromString($fn, $content); $build->addFromString($fn, $content);
file_put_contents(".firefox/".$fn, $content);
} }
else if($fn == "background.js") else if($fn == "background.js")
{ {
@ -102,18 +65,11 @@ foreach($index as $fn)
"if(false)" "if(false)"
], file_get_contents($fn)); ], file_get_contents($fn));
$build->addFromString($fn, $content); $build->addFromString($fn, $content);
file_put_contents(".firefox/".$fn, $content);
} }
else else
{ {
$build->addFile($fn, $fn); $build->addFile($fn, $fn);
copy($fn, ".firefox/".$fn);
} }
} }
$build->close(); $build->close();
file_put_contents(".next_build_id.txt", $build_id + 1); file_put_contents(".next_build_id.txt", $build_id + 1);
if(is_file(".sign_firefox_build.bat"))
{
passthru(".sign_firefox_build.bat");
}
recursivelyDelete(".firefox");

1
.gitignore vendored
View File

@ -1,2 +1 @@
.next_build_id.txt .next_build_id.txt
.sign_firefox_build.bat

View File

@ -50,11 +50,6 @@
"run_at": "document_start" "run_at": "document_start"
} }
], ],
"browser_specific_settings": {
"gecko": {
"update_url": "https://universal-bypass.org/firefox/updates.json"
}
},
"web_accessible_resources": [ "web_accessible_resources": [
"html/before-navigate.html", "html/before-navigate.html",
"html/blocked.html", "html/blocked.html",