This repository has been archived on 2023-10-27. You can view files and clone it, but cannot push or open issues or pull requests.
beatsaber-wip-uploader/index.php
2023-04-15 19:54:39 +01:00

91 lines
3.4 KiB
PHP

<!-- Before you ask, yes this code is awful, but it works -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WIP Uploader</title>
<script src="https://cdn.fascinated.cc/assets/tailwindcss/3.2.4.js"></script>
<script src="https://cdn.fascinated.cc/assets/sweetalert2.all.min.js"></script>
<script defer data-domain="wip.fascinated.cc" src="https://analytics.fascinated.cc/js/script.js"></script>
<meta property="og:type" content="website" />
<meta property="og:title" content="WIP Maps" />
<meta property="og:description" content="Simple website to host WIP BeatSaber maps" />
<meta property="og:url" content="https://wip.fascinated.cc" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="WIP Maps" />
<meta name="twitter:description" content="Simple website to host WIP BeatSaber maps" />
<meta property="theme-color" content="#4d3a9c" />
<script>
function copy() {
navigator.clipboard.writeText("!wip <?php echo $_GET["map"]; ?>");
Swal.fire({
icon: "success",
title: "Copied to clipboard",
showConfirmButton: false,
timer: 1000
});
}
</script>
</head>
<body>
<div class="flex items-center justify-center h-screen bg-gray-900">
<div class="w-1/2">
<div class="bg-gray-800 rounded-lg shadow-xl p-10">
<h2 class="text-3xl font-bold text-white mb-1.5">
WIP Map Uploader
</h2>
<p class="text-lg text-white mb-1.5">
Max File Size: 100MB (Cloudflare Limit)
</p>
<p class="text-lg text-gray-400 mb-6">
Note: Files will be automatically deleted after 30 minutes
</p>
<?php
// if the map parameter is set, display the map
if (isset($_GET["map"])) {
$command = "";
if (str_starts_with($_GET["map"], "https")) {
$command = "!wip " . $_GET["map"];
} else {
$command = $_GET["map"];
}
echo
'
<div class="mb-5">
<label for="map" class="block text-white text-sm font-bold mb-2">Successfully uploaded Map</label>
<span class="bg-gray-700 text-white rounded w-full py-2 px-3 focus:outline-none focus:shadow-outline">' . $command . '</span>
' . (!str_starts_with($_GET["map"], "https") ? "" : '<button onclick="copy()" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">Copy</button>') . '
</div>
';
return;
}
// if the map parameter is not set, display the upload form
echo
'
<form action="upload.php" method="post" enctype="multipart/form-data">
<div class="mb-5">
<label for="map" class="block text-white text-sm font-bold mb-2">Map</label>
<input type="file" name="map" id="map" class="bg-gray-700 text-white rounded w-full py-2 px-3 focus:outline-none focus:shadow-outline">
</div>
<div class="mb-5">
<button type="submit" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">Upload</button>
</div>
</form>
';
?>
</div>
</div>
</body>
</html>