Fix Nextcloud .htaccess workaround

This commit is contained in:
the-djmaze 2023-01-03 13:26:00 +01:00
parent 8fdd0407db
commit 1f9b3ec699
2 changed files with 15 additions and 9 deletions

View file

@ -21,7 +21,6 @@ foreach ($files as $file) {
if (is_file($file)) { if (is_file($file)) {
$name = str_replace('\\', '/', $file); $name = str_replace('\\', '/', $file);
$name = str_replace('integrations/nextcloud/snappymail/', '', $name); $name = str_replace('integrations/nextcloud/snappymail/', '', $name);
$name = str_replace('.htaccess', '_htaccess', $name);
$hashes[$name] = hash_file('sha512', $file); $hashes[$name] = hash_file('sha512', $file);
} }
} }
@ -35,6 +34,11 @@ foreach ($files as $file) {
$hashes["app/{$newFile}"] = hash_file('sha512', $file); $hashes["app/{$newFile}"] = hash_file('sha512', $file);
} }
} }
$nc_tar->delete("snappymail/app/snappymail/v/{$package->version}/app/.htaccess");
$nc_tar->addFile("snappymail/v/{$package->version}/app/.htaccess", "snappymail/app/snappymail/v/{$package->version}/app/_htaccess");
$nc_tar->delete("snappymail/app/snappymail/v/{$package->version}/static/.htaccess");
$nc_tar->addFile("snappymail/v/{$package->version}/static/.htaccess", "snappymail/app/snappymail/v/{$package->version}/static/_htaccess");
/* /*
$nc_tar->addFile('data/.htaccess'); $nc_tar->addFile('data/.htaccess');
$nc_tar->addFromString('data/VERSION', $package->version); $nc_tar->addFromString('data/VERSION', $package->version);
@ -62,7 +66,6 @@ $hashes['app/serviceworker.js'] = hash('sha512', $data);
spl_autoload_register(function($name){ spl_autoload_register(function($name){
$file = __DIR__ . '/' . str_replace('\\', '/', $name) . '.php'; $file = __DIR__ . '/' . str_replace('\\', '/', $name) . '.php';
echo "{$file}\n";
require $file; require $file;
}); });

View file

@ -21,7 +21,6 @@ foreach ($files as $file) {
if (is_file($file)) { if (is_file($file)) {
$name = str_replace('\\', '/', $file); $name = str_replace('\\', '/', $file);
$name = str_replace('integrations/owncloud/snappymail/', '', $name); $name = str_replace('integrations/owncloud/snappymail/', '', $name);
$name = str_replace('.htaccess', '_htaccess', $name);
$hashes[$name] = hash_file('sha512', $file); $hashes[$name] = hash_file('sha512', $file);
} }
} }
@ -35,6 +34,11 @@ foreach ($files as $file) {
$hashes["app/{$newFile}"] = hash_file('sha512', $file); $hashes["app/{$newFile}"] = hash_file('sha512', $file);
} }
} }
$nc_tar->delete("snappymail/app/snappymail/v/{$package->version}/app/.htaccess");
$nc_tar->addFile("snappymail/v/{$package->version}/app/.htaccess", "snappymail/app/snappymail/v/{$package->version}/app/_htaccess");
$nc_tar->delete("snappymail/app/snappymail/v/{$package->version}/static/.htaccess");
$nc_tar->addFile("snappymail/v/{$package->version}/static/.htaccess", "snappymail/app/snappymail/v/{$package->version}/static/_htaccess");
/* /*
$nc_tar->addFile('data/.htaccess'); $nc_tar->addFile('data/.htaccess');
$nc_tar->addFromString('data/VERSION', $package->version); $nc_tar->addFromString('data/VERSION', $package->version);
@ -60,13 +64,12 @@ $data = file_get_contents('dev/serviceworker.js');
$nc_tar->addFromString('snappymail/app/serviceworker.js', $data); $nc_tar->addFromString('snappymail/app/serviceworker.js', $data);
$hashes['app/serviceworker.js'] = hash('sha512', $data); $hashes['app/serviceworker.js'] = hash('sha512', $data);
spl_autoload_register(function($name){
$file = __DIR__ . '/' . str_replace('\\', '/', $name) . '.php';
echo "{$file}\n";
require $file;
});
if ($cert_dir) { if ($cert_dir) {
spl_autoload_register(function($name){
$file = __DIR__ . '/' . str_replace('\\', '/', $name) . '.php';
require $file;
});
ksort($hashes); ksort($hashes);
$cert = file_get_contents($cert_dir.'/snappymail.crt'); $cert = file_get_contents($cert_dir.'/snappymail.crt');
$rsa = new \phpseclib\Crypt\RSA(); $rsa = new \phpseclib\Crypt\RSA();