From 4a708ab46a882b2e431e46f934015cad94e4a2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0t=C4=9Bch?= Date: Sat, 3 Aug 2024 20:56:43 +0200 Subject: [PATCH] Remove now useless core-dev-server --- .htaccess | 3 +- core-dev-server/.htaccess | 8 -- core-dev-server/_DIR-INFO-BOTTOM.html | 15 --- core-dev-server/_DIR-INFO-TOP.html | 2 - core-dev-server/generate-cache.php | 5 - core-dev-server/index.php | 135 -------------------------- core-dev-server/purge-cache.php | 29 ------ 7 files changed, 1 insertion(+), 196 deletions(-) delete mode 100644 core-dev-server/.htaccess delete mode 100644 core-dev-server/_DIR-INFO-BOTTOM.html delete mode 100644 core-dev-server/_DIR-INFO-TOP.html delete mode 100644 core-dev-server/generate-cache.php delete mode 100644 core-dev-server/index.php delete mode 100644 core-dev-server/purge-cache.php diff --git a/.htaccess b/.htaccess index 4cca970..d35e738 100644 --- a/.htaccess +++ b/.htaccess @@ -9,8 +9,7 @@ RewriteEngine On # RewriteCond %{REQUEST_FILENAME} !-f # RewriteCond %{REQUEST_FILENAME} !-d -RewriteCond %{REQUESt_URI} files/updater-data/.* [OR] -RewriteCond %{REQUEST_URI} files/core-dev-server/.* +RewriteCond %{REQUESt_URI} files/updater-data/.* RewriteRule ^.*$ - [NC,L] RewriteCond %{REQUEST_URI} browserconfig\.xml$ [OR] diff --git a/core-dev-server/.htaccess b/core-dev-server/.htaccess deleted file mode 100644 index e8df793..0000000 --- a/core-dev-server/.htaccess +++ /dev/null @@ -1,8 +0,0 @@ -Options -Indexes - -RewriteEngine On - -# Allow direct access to all files, redirect requests to subdirectories to index.php -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-di -RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L] diff --git a/core-dev-server/_DIR-INFO-BOTTOM.html b/core-dev-server/_DIR-INFO-BOTTOM.html deleted file mode 100644 index 39ae1fd..0000000 --- a/core-dev-server/_DIR-INFO-BOTTOM.html +++ /dev/null @@ -1,15 +0,0 @@ -
-This open directory serves as a testing server
-for Voices of Wynn Core. Files saved in this
-directory and its subdirectories are requested
-by the mod (working as a client) and dynamically
-downloaded for the mod user to use.
-
-You can browse through the files, but you won't
-really find anything secret here. But hey, if
-you're a techy type who likes to snoop around,
-why not let us know on our Discord and help us
-out with the project.
-
-Discord invite: https://discord.gg/kuEK3XH4Y5
-
\ No newline at end of file diff --git a/core-dev-server/_DIR-INFO-TOP.html b/core-dev-server/_DIR-INFO-TOP.html deleted file mode 100644 index 57a0bc1..0000000 --- a/core-dev-server/_DIR-INFO-TOP.html +++ /dev/null @@ -1,2 +0,0 @@ -

Open directory for Voices of Wynn Core

-

This directory hosts files requested by the mod client.

diff --git a/core-dev-server/generate-cache.php b/core-dev-server/generate-cache.php deleted file mode 100644 index d50a54a..0000000 --- a/core-dev-server/generate-cache.php +++ /dev/null @@ -1,5 +0,0 @@ - - - -

You can delete the file that will be downloaded after clicking the button.

- diff --git a/core-dev-server/index.php b/core-dev-server/index.php deleted file mode 100644 index 39ead47..0000000 --- a/core-dev-server/index.php +++ /dev/null @@ -1,135 +0,0 @@ -Open Directory'; - - if (file_exists($path.'/_DIR-INFO-TOP.html')) { - include $path.'/_DIR-INFO-TOP.html'; - } - - $entries = array_diff(scandir($path), array('.', '..')); - $filesHtml = ''; - - if ($path !== OPEN_DIRECTORY_ABSOLUTE_PATH) { - echo '📁 Parent directory
'; - } else { - echo "⚠ This is the root of this open directory, going to the parent directory will get you an error.
"; - } - - foreach ($entries as $entry) - { - if (is_dir($path.'/'.$entry)) { - echo '📁 '.$entry.'
'; - } - else { - if (in_array($entry, array('.htaccess', 'index.php', 'index.html', '_DIR-INFO-TOP.html', '_DIR-INFO-BOTTOM.html'))) { - $filesHtml .= '📜 '.$entry.'
'; - } else { - $filesHtml .= '📄 '.$entry.'
'; - } - } - } - - echo $filesHtml; - - if (file_exists($path.'/_DIR-INFO-BOTTOM.html')) { - include $path.'/_DIR-INFO-BOTTOM.html'; - } - - echo ''; -} - -/** - * Function generating index binary file (and index binary file of all subdirectories), containing information about files, directories and their CRC32b hashes in the binary format - * @param string $path Path to the directory, whose index binary we want - * @return int CRC32b hash of the generated file (used for recursion calls) - */ -function generateBinaryIndexFile($path) { - $path = rtrim($path, '/').'/'; //Makes sure the path ends with a slash and file/subdirectory name can be simply appended to it - $entries = array_diff(scandir($path), array('.', '..')); - $data = ''; - - foreach ($entries as $entry) { - $entryData = pack('N', strlen($entry)); //Length of the string - $entryData .= pack('A'.strlen($entry), $entry); //Filename (without path, with extension) - - if (is_dir($path.$entry)) { - //Directory - $entryData .= "\u{0001}"; - - if (file_exists($path.$entry.'/index.dat')) { - //Index binary of the subdirectory already exists - $entryData .= pack('J', base_convert(hash_file('crc32b', $path.$entry.'/index.dat'), 16, 10)); - } else { - //Index binary of the subdirectory doesn't exist yet - generate it recursively - $entryData .= pack('J', generateBinaryIndexFile($path.$entry)); - } - } else { - //File - $entryData .= "\u{0000}"; - - $entryData .= pack('J', base_convert(hash_file('crc32b', $path.$entry), 16, 10)); - } - - $data .= $entryData; - } - - //Save the file - $indexBinary = fopen($path.'index.dat', 'w'); - fwrite($indexBinary, $data); //Create and write the index binary file - fclose($indexBinary); - - //Return index binary's hash - return base_convert(hash_file('crc32b', $path.'index.dat'), 16, 10); -} - -/** - * Function downloading an existing index binary file for a specified directory. - * Script execution is killed at the end of this function. - * @param string $path Path to the directory whose index binary we want to download - * @return never - */ -function downloadIndexBinary($path) { - header('Content-Type: application/octet-stream'); - header("Content-Transfer-Encoding: Binary"); - header("Content-disposition: attachment; filename=\"index.dat\""); - readfile($path.'/index.dat'); - exit(); -} - diff --git a/core-dev-server/purge-cache.php b/core-dev-server/purge-cache.php deleted file mode 100644 index 712b915..0000000 --- a/core-dev-server/purge-cache.php +++ /dev/null @@ -1,29 +0,0 @@ -Enter access key:

'; - die(); -} - -$queue = array('./vow-src-upload/src'); - -$counter = 0; - -while (!empty($queue)) { - $dir = array_shift($queue); - foreach (glob($dir.'/*') as $entry) { - if (is_dir($entry)) { - # echo "$entry is a directory, adding to queue
"; - $queue[] = $entry; - } else if (pathinfo($entry, PATHINFO_EXTENSION) === 'dat') { - # echo "$entry is a binary index file, deleting
"; - unlink($entry); - $counter++; - }/* else { - echo "$entry is to be kept
"; - }*/ - } -} - -echo "$counter files deleted.
"; -echo 'Regenerate cache (recommended before releasing to production)';