This commit is contained in:
Morgan 2023-10-05 12:59:33 +09:00
commit 7752a4a21a
13 changed files with 2134 additions and 0 deletions

BIN
pub/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

77
pub/form.html Normal file
View File

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PAWE.ME</title>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:wght@300;400;500;600;700;800;900&display=swap"
rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<style>
.url {
font-style: italic;
color: rgb(86, 105, 151);
}
</style>
</head>
<body class="font-sans text-gray-900 bg-gray-100 py-12 px-6 mx-auto max-w-5xl">
<header class="mb-10">
<h1 class="text-4xl font-bold mb-2"><a href="http://PAWE.ME" class="text-blue-500 hover:text-blue-700">PAWE.ME</a></h1>
<h2 class="text-lg text-gray-600"></h2>
</header>
<form id="contactForm" class="bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4">
<h2 class="text-2xl font-semibold mb-5">Request Form</h2>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="email">
Email
</label>
<input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="email" type="email" placeholder="Email">
</div>
<div class="mb-4 hidden">
<label class="block text-gray-700 text-sm font-bold mb-2" for="title">
Title
</label>
<input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="title" type="text" placeholder="Title" value="New Request">
</div>
<div class="mb-6">
<label class="block text-gray-700 text-sm font-bold mb-2" for="content">
Content
</label>
<textarea class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="content" placeholder="Content" rows="5"></textarea>
</div>
<div class="flex items-center justify-between">
<button id="sendButton" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline" type="button">
Send Message
</button>
</div>
</form>
<p class="text-gray-800 text-xs italic">&nbsp;&nbsp;Only Rsync &amp; HTTP File server is available. HTTP mirroring cycle is much slower than Rsync. Feel free to request!</p>
<script>
document.getElementById('sendButton').addEventListener('click', function() {
const email = document.getElementById('email').value;
const title = document.getElementById('title').value;
const content = document.getElementById('content').value;
let formData = new URLSearchParams();
formData.append('email', email);
formData.append('title', title);
formData.append('content', content);
fetch(PUSHNOTIFICAATIONURL, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: formData.toString(),
})
.then(response => response.json())
.then((data) => {
console.log(data);
alert("Sent to Administrator. Reply may take 2-3 days.");
})
});
</script>
</body>
</html>

179
pub/index.html Normal file
View File

@ -0,0 +1,179 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PAWE.ME</title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:wght@300;400;500;600;700;800;900&display=swap"
rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
darkMode: 'class'
}
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark')
} else {
document.documentElement.classList.remove('dark')
}
</script>
<style>
.url {
font-style: italic;
color: rgb(86, 105, 151);
}
</style>
</head>
<body class="font-sans text-gray-900 bg-gray-100 py-12 px-6 mx-auto max-w-5xl dark:bg-gray-900">
<header class="mb-10">
<h1 class="text-4xl font-bold mb-2"><a href="http://PAWE.ME"
class="text-blue-500 hover:text-blue-700">PAWE.ME</a></h1>
<h2 class="text-lg text-gray-600 dark:text-gray-300">Simple mirroring &amp; archiving server.</h2>
<h2 class="text-lg text-blue-400 dark:text-blue-200 italic"><a href="#">Hide my Email</a>, <a href="#">Invidious</a>, <a href="#">Proxy</a>.</h2>
</header>
<main>
<section class="mb-12">
<h2 class="dark:text-gray-200 text-2xl font-semibold mb-5">Mirroring List</h2>
<div id="mirrorList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-4">
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/archlinux"
class="text-blue-500 hover:text-blue-700">ArchLinux (x86_64)</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: 2023-10-05 08:00</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://mirror.rackspace.com/archlinux/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/ubuntu"
class="text-blue-500 hover:text-blue-700">Ubuntu</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: 2023-10-05 06:00</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://rsync.archive.ubuntu.com/ubuntu/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/ubuntu_cd"
class="text-blue-500 hover:text-blue-700">Ubuntu Releases</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: 2023-10-05 00:00</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://releases.ubuntu.com/releases/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/debian"
class="text-blue-500 hover:text-blue-700">Debian</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: 2023-10-05 06:00</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span class="url">rsync://ftp.halifax.rwth-aachen.de/debian/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/debian_cd"
class="text-blue-500 hover:text-blue-700">Debian Releases</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: 2023-10-05 00:00</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span class="url">rsync://ftp.lanet.kr/debian-cd/</span>
</p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/manjaro"
class="text-blue-500 hover:text-blue-700">Manjaro</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: 2023-10-05 08:00</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://ftp.riken.jp/manjaro/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/raspbian"
class="text-blue-500 hover:text-blue-700">Raspbian</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: 2023-10-05 08:00</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://archive.raspbian.org/archive/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/fedora"
class="text-blue-500 hover:text-blue-700">Fedora</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: Not Synced</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://dl.fedoraproject.org/fedora-enchilada/linux/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/epel"
class="text-blue-500 hover:text-blue-700">Epel</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: Not Synced</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://dl.fedoraproject.org/fedora-epel/</span></p>
</div>
</div>
</section>
<section class="mb-12">
<h2 class="dark:text-gray-200 text-2xl font-semibold mb-5">Additional Mirror</h2>
<!-- <button onclick="toggleView('httpView')" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded mb-4">View More</button> -->
<div id="httpView" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-4">
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/archlinuxarm"
class="text-blue-500 hover:text-blue-700">ArchLinux (ARM)</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: 2023-07-07 00:50</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">http://jp.mirror.archlinuxarm.org/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/asahilinux"
class="text-blue-500 hover:text-blue-700">AsahiLinux</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: 2023-10-05 00:00</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span class="url">https://cdn.asahilinux.org/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/ubuntu_cd_old"
class="text-blue-500 hover:text-blue-700">Ubuntu Releases (Old)</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: 2023-03-06 14:39</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://old-releases.ubuntu.com/releases/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/cd-image"
class="text-blue-500 hover:text-blue-700">Image Files</a></h3>
</div>
</div>
</section>
<section>
<h2 class="dark:text-gray-200 text-2xl font-semibold mb-5">Server Info</h2>
<ul class="space-y-2 mb-5">
<li class="text-gray-600 dark:text-gray-500">Xeon E5 CPU</li>
<li class="text-gray-600 dark:text-gray-500">12GiB Memory</li>
<li class="text-gray-600 dark:text-gray-500">750Mbps Network, Seoul, Korea</li>
<li class="text-gray-600 dark:text-gray-500">18TB Storage</li>
</ul>
<p class="text-gray-500 dark:text-gray-600 url">Fill out <a href="/form.html" class="text-blue-500 dark:text-blue-800">this</a> form to request additional mirroring.</p>
</section>
<button
class="fixed bottom-6 right-6 bg-blue-200 hover:bg-blue-300 text-blue-700 dark:bg-blue-800 dark:hover:bg-blue-600 dark:text-white w-10 h-10 rounded-full flex items-center justify-center"
onclick="toggleDarkMode()">
+
</button>
</main>
<footer class="mt-10 text-center text-gray-600">
<a href="mailto:mirror@devpg.net">&copy; PAWE.ME</a>
</footer>
<script>
function toggleView(elementId) {
const element = document.getElementById(elementId);
element.style.display = element.style.display === "none" ? "block" : "none";
}
function toggleDarkMode() {
if (document.documentElement.classList.contains('dark')) {
document.documentElement.classList.remove('dark');
localStorage.theme = 'light';
} else {
document.documentElement.classList.add('dark');
localStorage.theme = 'dark';
}
}
</script>
</body>
</html>

70
pub/log.html Normal file
View File

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Log Viewer</title>
</head>
<body>
<input type="text" id="logPath" placeholder="Enter log file path or URL">
<select id="intervalSelector">
<option value="1000">1 sec</option>
<option value="2000">2 sec</option>
<option value="3000">3 sec</option>
</select>
<button onclick="startFetchingLog()">Start Fetching</button>
<button onclick="toggleFetching()">Toggle Fetching</button>
<div id="logContent" style="white-space: pre-wrap;"></div>
<script>
let interval;
let isFetching = false;
function fetchLog(path) {
fetch(path)
.then(response => response.text())
.then(data => {
const reversedData = data.split("\n").reverse().join("\n");
document.getElementById('logContent').textContent = reversedData;
})
.catch(error => {
console.error('There was an error fetching the log:', error);
});
}
function startFetchingLog() {
stopFetching(); // Stop any existing fetching
const path = document.getElementById('logPath').value;
const fetchInterval = parseInt(document.getElementById('intervalSelector').value);
if (path) {
fetchLog(path); // Initial fetch
interval = setInterval(() => fetchLog(path), fetchInterval); // Fetch the log file at the selected interval
isFetching = true;
}
}
function stopFetching() {
if (interval) {
clearInterval(interval);
isFetching = false;
}
}
function toggleFetching() {
if (isFetching) {
stopFetching();
} else {
startFetchingLog();
}
}
</script>
</body>
</html>

2
pub/robots.txt Normal file
View File

@ -0,0 +1,2 @@
User-Agent: *
Disallow: /

179
scripts/base.html Normal file
View File

@ -0,0 +1,179 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PAWE.ME</title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:wght@300;400;500;600;700;800;900&display=swap"
rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
darkMode: 'class'
}
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark')
} else {
document.documentElement.classList.remove('dark')
}
</script>
<style>
.url {
font-style: italic;
color: rgb(86, 105, 151);
}
</style>
</head>
<body class="font-sans text-gray-900 bg-gray-100 py-12 px-6 mx-auto max-w-5xl dark:bg-gray-900">
<header class="mb-10">
<h1 class="text-4xl font-bold mb-2"><a href="http://PAWE.ME"
class="text-blue-500 hover:text-blue-700">PAWE.ME</a></h1>
<h2 class="text-lg text-gray-600 dark:text-gray-300">Simple mirroring &amp; archiving server.</h2>
<h2 class="text-lg text-blue-400 dark:text-blue-200 italic"><a href="#">Hide my Email</a>, <a href="#">Invidious</a>, <a href="#">Proxy</a>.</h2>
</header>
<main>
<section class="mb-12">
<h2 class="dark:text-gray-200 text-2xl font-semibold mb-5">Mirroring List</h2>
<div id="mirrorList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-4">
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/archlinux"
class="text-blue-500 hover:text-blue-700">ArchLinux (x86_64)</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@archlinux@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://mirror.rackspace.com/archlinux/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/ubuntu"
class="text-blue-500 hover:text-blue-700">Ubuntu</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@ubuntu@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://rsync.archive.ubuntu.com/ubuntu/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/ubuntu_cd"
class="text-blue-500 hover:text-blue-700">Ubuntu Releases</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@ubuntu_cd@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://releases.ubuntu.com/releases/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/debian"
class="text-blue-500 hover:text-blue-700">Debian</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@debian@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span class="url">rsync://ftp.halifax.rwth-aachen.de/debian/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/debian_cd"
class="text-blue-500 hover:text-blue-700">Debian Releases</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@debian_cd@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span class="url">rsync://ftp.lanet.kr/debian-cd/</span>
</p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/manjaro"
class="text-blue-500 hover:text-blue-700">Manjaro</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@manjaro@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://ftp.riken.jp/manjaro/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/raspbian"
class="text-blue-500 hover:text-blue-700">Raspbian</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@raspbian@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://archive.raspbian.org/archive/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/fedora"
class="text-blue-500 hover:text-blue-700">Fedora</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@fedora@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://dl.fedoraproject.org/fedora-enchilada/linux/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/epel"
class="text-blue-500 hover:text-blue-700">Epel</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@epel@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://dl.fedoraproject.org/fedora-epel/</span></p>
</div>
</div>
</section>
<section class="mb-12">
<h2 class="dark:text-gray-200 text-2xl font-semibold mb-5">Additional Mirror</h2>
<!-- <button onclick="toggleView('httpView')" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded mb-4">View More</button> -->
<div id="httpView" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-4">
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/archlinuxarm"
class="text-blue-500 hover:text-blue-700">ArchLinux (ARM)</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@archlinuxarm@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">http://jp.mirror.archlinuxarm.org/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/asahilinux"
class="text-blue-500 hover:text-blue-700">AsahiLinux</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@asahilinux@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span class="url">https://cdn.asahilinux.org/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/ubuntu_cd_old"
class="text-blue-500 hover:text-blue-700">Ubuntu Releases (Old)</a></h3>
<p class="text-gray-600 dark:text-gray-300">Last Updated: @@ubuntu_cd_old@@</p>
<p class="text-gray-600 dark:text-gray-300">Source: <span
class="url">rsync://old-releases.ubuntu.com/releases/</span></p>
</div>
<div class="bg-white dark:bg-gray-800 col-span-1 md:col-span-2 shadow-lg rounded-lg p-5">
<h3 class="dark:text-white text-lg font-semibold mb-1"><a href="/cd-image"
class="text-blue-500 hover:text-blue-700">Image Files</a></h3>
</div>
</div>
</section>
<section>
<h2 class="dark:text-gray-200 text-2xl font-semibold mb-5">Server Info</h2>
<ul class="space-y-2 mb-5">
<li class="text-gray-600 dark:text-gray-500">Xeon E5 CPU</li>
<li class="text-gray-600 dark:text-gray-500">12GiB Memory</li>
<li class="text-gray-600 dark:text-gray-500">750Mbps Network, Seoul, Korea</li>
<li class="text-gray-600 dark:text-gray-500">18TB Storage</li>
</ul>
<p class="text-gray-500 dark:text-gray-600 url">Fill out <a href="/form.html" class="text-blue-500 dark:text-blue-800">this</a> form to request additional mirroring.</p>
</section>
<button
class="fixed bottom-6 right-6 bg-blue-200 hover:bg-blue-300 text-blue-700 dark:bg-blue-800 dark:hover:bg-blue-600 dark:text-white w-10 h-10 rounded-full flex items-center justify-center"
onclick="toggleDarkMode()">
+
</button>
</main>
<footer class="mt-10 text-center text-gray-600">
<a href="mailto:mirror@devpg.net">&copy; PAWE.ME</a>
</footer>
<script>
function toggleView(elementId) {
const element = document.getElementById(elementId);
element.style.display = element.style.display === "none" ? "block" : "none";
}
function toggleDarkMode() {
if (document.documentElement.classList.contains('dark')) {
document.documentElement.classList.remove('dark');
localStorage.theme = 'light';
} else {
document.documentElement.classList.add('dark');
localStorage.theme = 'dark';
}
}
</script>
</body>
</html>

1259
scripts/ftpsync Executable file

File diff suppressed because it is too large Load Diff

12
scripts/ftpsync.conf Normal file
View File

@ -0,0 +1,12 @@
MIRRORNAME="pawe.me"
TO="${BASE_DIR}/debian"
HUB=false
RSYNC_HOST="mirrors.xtom.jp"
RSYNC_PATH="debian"
INFO_MAINTAINER="Morgan <admin@pawe.me>"
INFO_COUNTRY=KR
INFO_LOCATION="Seoul, Korea"
INFO_THROUGHPUT=500Mb
LOGDIR="${BASE_DIR}/logs"
UIPRETRIES=9
TRACEHOST="PAWE.ME"

80
scripts/http/getFetch.py Normal file
View File

@ -0,0 +1,80 @@
import requests, json, sys
from bs4 import BeautifulSoup as bs4
def tree(idx: int, flag = False) -> str:
idx += 1
if idx == 1:
if flag :
return "├────"
return "├──"
elif idx == 2:
if flag :
return "│ ├────"
return "│ ├──"
else:
if flag :
return "" * (idx - 2) + "├────"
return "" * (idx - 2) + "├──"
def parseIndex(url, base = "", idx = 0, dirs = [], ret = []):
print(f"D {(tree(idx)+url):<40} {''.join(dirs):>80}")
html = bs4(requests.get(base + url).text, features="html.parser")
hrefs = [a["href"] for a in html.find_all('a')]
hrefs = [i for i in hrefs if i[0] != '?']
fls = []
for href in hrefs:
if href[-1] == "/": # if dir
if href[0] != "/" and href[0] != ".":
parseIndex(href, base + url, idx + 1, dirs + [href], ret)
else:
if href[0:2] == "./" and "/" not in href[2:]:
href = href[2:]
assert "/" not in href
print(f"F {(tree(idx, 1)+href):<80}") # if file
fls.append(href)
while len(ret) <= idx:
ret.append({})
if ''.join(dirs) not in ret[idx].keys():
ret[idx][''.join(dirs)] = []
for fl in fls:
ret[idx][''.join(dirs)].append({fl: base + url + fl})
return ret
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: createFetch.py [URL] [Path]")
sys.exit()
# urls = {"archlinuxarm": "http://jp.mirror.archlinuxarm.org/", "asahilinux": "https://cdn.asahilinux.org/", "linux-surface": "https://pkg.surfacelinux.com/arch/"}
if "http" in sys.argv[1]:
if input(f"[*] Download from {sys.argv[1]}? ") in "Yy":
url = sys.argv[1]
else:
sys.exit()
else:
print("[*] Not supported")
sys.exit()
bpath = sys.argv[2]
assert(bpath[-1] == '/')
print()
print(f"[*] Downloading File list from {url} with base path {bpath}")
files = parseIndex('', base = url, dirs = [bpath])
filename = url.split('/')[2]+'.fetch'
with open(filename, 'w') as f:
f.write(json.dumps(files, indent=4))
print()
print(f"[*] Saved to {filename}.")

114
scripts/http/getFile.py Normal file
View File

@ -0,0 +1,114 @@
# import asyncio, aiohttp, aiofiles
import json, os, sys
import requests, time
# from tqdm import tqdm
def byteSize(size):
pr = ""
if size > 1024:
size = round(size / 1024, 1)
pr = "K"
if size > 1024:
size = round(size / 1024, 1)
pr = "M"
if size > 1024:
size = round(size / 1024, 1)
pr = "G"
return f"{size}{pr}"
if len(sys.argv) != 2:
print("Usage: getFiles.py [fetch file]")
sys.exit()
listf = sys.argv[1]
if not os.path.exists(listf):
print("There is no such file..")
sys.exit()
print(f"Downloading from fetchFile {listf}")
def spchr(string, num = 25, pad = 0):
if len(string) > num:
string = string[0:20] + ".." + string[-4:]
if pad > num:
string = string + ' '*(pad-len(string))
return string
with open(listf, 'r') as f:
jstr = json.loads(f.read())
for stage in jstr:
for redirs in stage.keys():
der = redirs.split('/')
for i in range(len(der)):
dpath = '/'.join(der[0:i])
if not os.path.exists(dpath) and dpath:
print(f"[*] Making new directory {dpath}")
os.mkdir(dpath)
for stage in jstr:
for dosta in stage:
print(f"[*] Downloading path {dosta}")
fpaths = []
furls = []
for fls in stage[dosta]:
fna = list(fls.keys())[0]
fpa = fls[fna]
fpaths.append(dosta + fna)
furls.append(fpa)
assert len(fpaths) == len(furls)
# pbar = tqdm(total=len(fpaths))
# print(furls)
dlist = []
for url, path in zip(furls, fpaths):
if os.path.exists(path):
flen = os.path.getsize(path)
wlen = requests.get(url, stream=True).headers['Content-length']
if int(flen) != int(wlen):
dlist.append((path, url))
else:
dlist.append((path, url))
for path, url in dlist:
print(f"[*] Fetch {url} ", end = "")
wfil = requests.get(url, stream=True)
wlen = wfil.headers['Content-length']
print(byteSize(int(wlen)))
with open(path, 'wb') as f:
if wlen is None: # no content length header
f.write(wfil.content)
else:
# pbar = tqdm(total=int(wlen), desc=spchr(' '+path, pad = 30))
for data in wfil.iter_content(chunk_size=4096):
f.write(data)
# print(".", end = "")
# pbar.update(len(data))
# print()
# async def getHTTP(session, url):
# async with session.get(url) as resp:
# try:
# reqa = await resp.read()
# # pbar.update(1)
# return reqa
# except:
# print(url)
# return
# async def agetReq():
# async with aiohttp.ClientSession() as session:
# tasks = []
# for url in furls:
# tasks.append(asyncio.ensure_future(getHTTP(session, url)))
# getReqs = await asyncio.gather(*tasks)
# for i, getReq in enumerate(getReqs):
# async with aiofiles.open(fpaths[i], mode='wb') as handle:
# await handle.write(getReq)
# asyncio.run(agetReq())

35
scripts/http/http.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
TIMENOW=$(date '+%Y%m%d_%H%M')
BASE_DIR="/srv/mirror"
DIST_ARR=('archlinuxarm' 'asahilinux')
in=0
for di in "${DIST_ARR[@]}"
do
if [ "$di" == "$1" ]; then in=1; fi
done
if [ "$in" -ne 1 ]; then
echo Not declared;exit;
fi
dist=$1
echo HTTP Mirroring ${dist} started at ${TIMENOW}.
echo "${TIMENOW} STARTED ${dist}" >> ${BASE_DIR}/logs/all.log
cd $BASE_DIR/scripts/http
echo ${dist} Fetch >> $BASE_DIR/logs/http.log
python3 -u $BASE_DIR/scripts/http/fetchFile.py ${dist} $BASE_DIR/${dist}/ >> $BASE_DIR/logs/${dist}.log 2>&1
echo ${dist} Download >> $BASE_DIR/logs/http.log
python3 -u $BASE_DIR/scripts/http/getFile.py $BASE_DIR/scripts/http/${dist}.fetch >> $BASE_DIR/logs/${dist}.log 2>&1
if [ $? -eq 0 ];
then
echo Sync ${dist} Success
echo "${TIMENOW} DONE ${dist}" >> ${BASE_DIR}/logs/all.log
cd $BASE_DIR
echo "Updating Index"
python3 -u ./scripts/index.py ${BASE_DIR}
fi

48
scripts/index.py Normal file
View File

@ -0,0 +1,48 @@
import os, sys, re
import datetime
from pprint import pprint
base_path = sys.argv[1]
assert os.path.exists(base_path)
log_path = os.path.join(base_path, "logs/all.log")
assert os.path.exists(log_path)
html_path = os.path.join(base_path, "scripts/base.html")
index = os.path.join(base_path, "index.html")
assert os.path.exists(html_path)
with open(log_path, 'r') as f:
log_file = f.read().splitlines()
log_file.reverse()
with open(html_path, 'r') as f:
html_file = f.read()
dists = re.findall("@@([^@@]+)@@", html_file)
pprint(dists)
logs = {}
for dist in dists:
logs[dist] = []
for logline in log_file:
print(logline)
time, stat, dist = logline.split(" ")
if stat == "DONE":
time = datetime.datetime.strptime(time, '%Y%m%d_%H%M')
if dist in logs.keys():
logs[dist].append(time)
last = {}
for dist in logs:
if logs[dist]:
last[dist] = sorted(logs[dist])[-1].strftime("%Y-%m-%d %H:%M")
else:
last[dist] = "Not Synced"
pprint(last)
for dist in last:
html_file = html_file.replace(f"@@{dist}@@", last[dist])
with open(index, 'w') as f:
f.write(html_file)

79
scripts/sync.sh Executable file
View File

@ -0,0 +1,79 @@
#!/bin/bash
TIMENOW=$(date '+%Y%m%d_%H%M')
BASE_DIR="/srv/mirror"
ALERT=""
option="-rtlHpv --chmod=D0755,F0644 --partial --hard-links --safe-links --stats --delete --delete-after --delay-updates --max-delete=70000"
exclude="--exclude=.*.?????? --exclude='.~tmp~/' --exclude='Packages*' --exclude='Sources*' --exclude='Release*' --exclude='*.links.tar.gz*' --exclude='/other' --exclude='/sources'"
ubuntu="rsync://rsync.archive.ubuntu.com/ubuntu/"
ubuntu_cd="rsync://releases.ubuntu.com/releases/"
ubuntu_cd_old="rsync://old-releases.ubuntu.com/releases/"
debian="rsync://mirrors.xtom.jp/debian/"
debian_cd="rsync://ftp.lanet.kr/debian-cd/"
fedora="rsync://dl.fedoraproject.org/fedora-enchilada/linux/"
epel="rsync://dl.fedoraproject.org/fedora-epel/"
fedora_cd=""
archlinux="rsync://mirror.rackspace.com/archlinux/"
raspbian="rsync://archive.raspbian.org/archive/"
manjaro="rsync://ftp.riken.jp/manjaro/"
DIST_ARR=('archlinux' 'debian' 'debian_cd' 'ubuntu' 'ubuntu_cd' 'ubuntu_cd_old' 'raspbian' 'epel' 'fedora' 'fedora_cd' 'manjaro')
in=0
for di in "${DIST_ARR[@]}"
do
if [ "$di" == "$1" ]; then in=1; fi
done
if [ "$in" -ne 1 ]; then
echo Not declared;exit;
fi
dist=$1
echo Syncing $1...
LASTLOG=`head -1 ${BASE_DIR}/logs/${dist}.log`
mv ${BASE_DIR}/logs/${dist}.log ${BASE_DIR}/logs/previous/${dist}-${LASTLOG}.log
mv ${BASE_DIR}/logs/${dist}-error.log ${BASE_DIR}/logs/previous/${dist}-error-${LASTLOG}.log
echo ${TIMENOW} >> ${BASE_DIR}/logs/${dist}.log
echo ${TIMENOW} >> ${BASE_DIR}/logs/${dist}-error.log
echo "${TIMENOW}: Mirroring ${dist} from ${!dist} to ${BASE_DIR}/${dist}"
echo "${TIMENOW} STARTED ${dist}" >> ${BASE_DIR}/logs/all.log
if [ "$dist" == "debian" ];
then
cd ${BASE_DIR}/scripts
export BASE_DIR=${BASE_DIR}
./ftpsync
else
echo "rsync ${option} ${exclude} ${!dist} ${BASE_DIR}/${dist}" >> ${BASE_DIR}/logs/${dist}.log
rsync ${option} ${exclude} ${!dist} ${BASE_DIR}/${dist} >> ${BASE_DIR}/logs/${dist}.log 2>> ${BASE_DIR}/logs/${dist}-error.log
fi
if [ $? -ne 0 ];
then
cd ${ALERT}
MSG="${dist} failed at ${TIMENOW}"
if [ -n "$ALERT" ];
then
${ALERT}/alert alert "${MSG}"
fi
echo Sync ${dist} Error
echo "${TIMENOW} ERROR ${dist}" >> ${BASE_DIR}/logs/all.log
echo curl -X POST -d 'email=DEVPG.NET' -d "title=${dist}" -d "content=${MSG}" https://one.devpg.net/send
else
echo Sync ${dist} Success
if [ `echo ${BASE_DIR}/logs/${dist}-error.log | wc -l` -eq 1 ];
then
rm ${BASE_DIR}/logs/${dist}-error.log
fi
echo "${TIMENOW} DONE ${dist}" >> ${BASE_DIR}/logs/all.log
cd $BASE_DIR
echo "Updating Index"
python3 -u ./scripts/index.py ${BASE_DIR}
fi