mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-03 01:23:22 +02:00
Fixed #151 and update script
This commit is contained in:
parent
076d1a4e3a
commit
b471758f04
5 changed files with 379 additions and 34 deletions
|
@ -58,7 +58,7 @@ php /var/www/cp/bin/clear_cache.php
|
|||
|
||||
# Clone the new version of the repository
|
||||
echo "Cloning v1.0.1 from the repository..."
|
||||
git clone https://github.com/getnamingo/registry /opt/registry101
|
||||
git clone --branch v1.0.1 --single-branch https://github.com/getnamingo/registry /opt/registry
|
||||
|
||||
# Copy files from the new version to the appropriate directories
|
||||
echo "Copying files..."
|
||||
|
|
135
docs/update102.sh
Normal file
135
docs/update102.sh
Normal file
|
@ -0,0 +1,135 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prompt the user for confirmation
|
||||
echo "This will update Namingo Registry from v1.0.1 to v1.0.2."
|
||||
echo "Make sure you have a backup of the database, /var/www/cp, and /opt/registry."
|
||||
read -p "Are you sure you want to proceed? (y/n): " confirm
|
||||
|
||||
# Check user input
|
||||
if [[ "$confirm" != "y" ]]; then
|
||||
echo "Upgrade aborted."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Create backup directory
|
||||
backup_dir="/opt/backup"
|
||||
mkdir -p "$backup_dir"
|
||||
|
||||
# Backup directories
|
||||
echo "Creating backups..."
|
||||
tar -czf "$backup_dir/cp_backup_$(date +%F).tar.gz" -C / var/www/cp
|
||||
tar -czf "$backup_dir/whois_backup_$(date +%F).tar.gz" -C / var/www/whois
|
||||
tar -czf "$backup_dir/registry_backup_$(date +%F).tar.gz" -C / opt/registry
|
||||
|
||||
# Database credentials
|
||||
config_file="/opt/registry/whois/port43/config.php"
|
||||
db_user=$(grep "'db_username'" "$config_file" | awk -F "=> '" '{print $2}' | sed "s/',//")
|
||||
db_pass=$(grep "'db_password'" "$config_file" | awk -F "=> '" '{print $2}' | sed "s/',//")
|
||||
db_host=$(grep "'db_host'" "$config_file" | awk -F "=> '" '{print $2}' | sed "s/',//")
|
||||
|
||||
# List of databases to back up
|
||||
databases=("registry" "registryAudit" "registryTransaction")
|
||||
|
||||
# Backup specific databases
|
||||
for db_name in "${databases[@]}"; do
|
||||
echo "Backing up database $db_name..."
|
||||
sql_backup_file="$backup_dir/db_${db_name}_backup_$(date +%F).sql"
|
||||
mysqldump -u"$db_user" -p"$db_pass" -h"$db_host" "$db_name" > "$sql_backup_file"
|
||||
|
||||
# Compress the SQL backup file
|
||||
echo "Compressing database backup $db_name..."
|
||||
tar -czf "${sql_backup_file}.tar.gz" -C "$backup_dir" "$(basename "$sql_backup_file")"
|
||||
|
||||
# Remove the uncompressed SQL file
|
||||
rm "$sql_backup_file"
|
||||
done
|
||||
|
||||
# Stop services
|
||||
echo "Stopping services..."
|
||||
systemctl stop caddy
|
||||
systemctl stop epp
|
||||
systemctl stop whois
|
||||
systemctl stop rdap
|
||||
systemctl stop das
|
||||
|
||||
# Clear cache
|
||||
echo "Clearing cache..."
|
||||
php /var/www/cp/bin/clear_cache.php
|
||||
|
||||
# Clone the new version of the repository
|
||||
echo "Cloning v1.0.2 from the repository..."
|
||||
git clone --branch v1.0.2 --single-branch https://github.com/getnamingo/registry /opt/registry102
|
||||
|
||||
# Copy files from the new version to the appropriate directories
|
||||
echo "Copying files..."
|
||||
|
||||
# Function to copy files and maintain directory structure
|
||||
copy_files() {
|
||||
src_dir=$1
|
||||
dest_dir=$2
|
||||
|
||||
if [[ -d "$src_dir" ]]; then
|
||||
echo "Copying from $src_dir to $dest_dir..."
|
||||
cp -R "$src_dir/." "$dest_dir/"
|
||||
else
|
||||
echo "Source directory $src_dir does not exist. Skipping..."
|
||||
fi
|
||||
}
|
||||
|
||||
# Copy specific directories
|
||||
copy_files "/opt/registry102/automation" "/opt/registry/automation"
|
||||
copy_files "/opt/registry102/cp" "/var/www/cp"
|
||||
copy_files "/opt/registry102/whois/web" "/var/www/whois"
|
||||
#copy_files "/opt/registry102/das" "/opt/registry/das"
|
||||
#copy_files "/opt/registry102/whois/port43" "/opt/registry/whois/port43"
|
||||
#copy_files "/opt/registry102/rdap" "/opt/registry/rdap"
|
||||
#copy_files "/opt/registry102/epp" "/opt/registry/epp"
|
||||
copy_files "/opt/registry102/docs" "/opt/registry/docs"
|
||||
|
||||
# Path to the config.php file
|
||||
config_file="/var/www/whois/config.php"
|
||||
|
||||
# Use sed to find the line with 'ignore_captcha' and add a comma after 'true' or 'false'
|
||||
sed -i "/'ignore_captcha'/ s/\(true\|false\)\([^,]\)/\1,\2/" "$config_file"
|
||||
|
||||
# Append the new lines after 'ignore_captcha' line
|
||||
sed -i "/'ignore_captcha'/a\ 'registry_name' => 'Domain Registry LLC',\n 'registry_url' => 'https://example.com',\n 'branding' => false," "$config_file"
|
||||
|
||||
# Run composer update in copied directories (excluding docs)
|
||||
echo "Running composer update..."
|
||||
|
||||
composer_update() {
|
||||
dir=$1
|
||||
if [[ -d "$dir" ]]; then
|
||||
echo "Updating composer in $dir..."
|
||||
cd "$dir" && composer update
|
||||
else
|
||||
echo "Directory $dir does not exist. Skipping composer update..."
|
||||
fi
|
||||
}
|
||||
|
||||
# Update composer in relevant directories
|
||||
composer_update "/opt/registry/automation"
|
||||
composer_update "/var/www/cp"
|
||||
#composer_update "/opt/registry/das"
|
||||
#composer_update "/opt/registry/whois/port43"
|
||||
#composer_update "/opt/registry/rdap"
|
||||
#composer_update "/opt/registry/epp"
|
||||
|
||||
# Start services
|
||||
echo "Starting services..."
|
||||
systemctl start epp
|
||||
systemctl start whois
|
||||
systemctl start rdap
|
||||
systemctl start das
|
||||
systemctl start caddy
|
||||
|
||||
# Check if services started successfully
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo "Services started successfully. Deleting /opt/registry102..."
|
||||
rm -rf /opt/registry102
|
||||
else
|
||||
echo "There was an issue starting the services. /opt/registry102 will not be deleted."
|
||||
fi
|
||||
|
||||
echo "Upgrade to v1.0.2 completed successfully."
|
3
whois/web/chota.min.css
vendored
3
whois/web/chota.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -3,5 +3,8 @@
|
|||
return [
|
||||
'whois_url' => 'whois.example.com',
|
||||
'rdap_url' => 'rdap.example.com',
|
||||
'ignore_captcha' => true
|
||||
'ignore_captcha' => true,
|
||||
'registry_name' => 'Domain Registry LLC',
|
||||
'registry_url' => 'https://example.com',
|
||||
'branding' => false,
|
||||
];
|
|
@ -1,6 +1,10 @@
|
|||
<?php
|
||||
session_start();
|
||||
$c = require_once 'config.php';
|
||||
|
||||
$c['registry_name'] = isset($c['registry_name']) ? $c['registry_name'] : 'Domain Registry LLC';
|
||||
$c['registry_url'] = isset($c['registry_url']) ? $c['registry_url'] : 'https://example.com';
|
||||
$c['branding'] = isset($c['branding']) ? $c['branding'] : false;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -8,38 +12,217 @@ $c = require_once 'config.php';
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Domain Lookup</title>
|
||||
<link rel="stylesheet" href="chota.min.css">
|
||||
<style>
|
||||
/* Resetting and base styles */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Improved font settings using system fonts */
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
background-color: #f4f4f4;
|
||||
color: #333;
|
||||
line-height: 1.6;
|
||||
padding: 20px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 2.2rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 20px;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.input-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Input field styling with improved typography */
|
||||
input[type="text"] {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
font-size: 1rem;
|
||||
font-family: inherit;
|
||||
border: 2px solid #ccc;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 10px;
|
||||
transition: border 0.3s ease;
|
||||
}
|
||||
|
||||
input[type="text"]:focus {
|
||||
border-color: #007BFF;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* General link styles */
|
||||
a {
|
||||
color: #007BFF;
|
||||
text-decoration: none;
|
||||
transition: color 0.3s ease, text-decoration 0.3s ease;
|
||||
}
|
||||
|
||||
/* Hover and focus states for links */
|
||||
a:hover,
|
||||
a:focus {
|
||||
color: #0056b3;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* CAPTCHA container styling */
|
||||
.captcha-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#captchaImg {
|
||||
width: 150px;
|
||||
height: 50px;
|
||||
margin-right: 10px;
|
||||
border: 2px solid #ccc;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#captchaInput {
|
||||
padding: 10px;
|
||||
font-size: 1rem;
|
||||
font-family: inherit;
|
||||
border: 2px solid #ccc;
|
||||
border-radius: 5px;
|
||||
flex-grow: 1;
|
||||
transition: border 0.3s ease;
|
||||
}
|
||||
|
||||
#captchaInput:focus {
|
||||
border-color: #007BFF;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Button styling */
|
||||
.buttons {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.buttons button {
|
||||
padding: 12px 24px;
|
||||
font-size: 1.1rem;
|
||||
font-family: inherit;
|
||||
color: #fff;
|
||||
background-color: #007BFF;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease, transform 0.2s ease;
|
||||
}
|
||||
|
||||
.buttons button:hover {
|
||||
background-color: #0056b3;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
/* Result display area */
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
white-space: -moz-pre-wrap;
|
||||
white-space: -pre-wrap;
|
||||
white-space: -o-pre-wrap;
|
||||
word-wrap: break-word;
|
||||
overflow-y: visible;
|
||||
height: auto;
|
||||
max-height: none;
|
||||
text-align: left;
|
||||
background-color: #f0f0f0;
|
||||
border: 2px solid #ccc;
|
||||
color: #333!important;
|
||||
padding: 20px;
|
||||
border-radius: 5px;
|
||||
width: 100%;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
/* Footer styling */
|
||||
footer {
|
||||
margin-top: 40px;
|
||||
font-size: 0.9rem;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
#bottom {
|
||||
display: none;
|
||||
}
|
||||
pre {
|
||||
background-color: #f3f3f6;
|
||||
border: 1px solid #3f4144;
|
||||
}
|
||||
code {
|
||||
color: #333!important;
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.captcha-container {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#captchaImg {
|
||||
margin-right: 0;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#captchaInput {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.buttons button {
|
||||
width: 48%;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Domain Lookup</h1>
|
||||
<div class="row">
|
||||
<div class="col col-4-md col-8-lg"><input type="text" id="domainInput" placeholder="Enter Domain Name" autocapitalize="none"></div>
|
||||
<?php if ($c['ignore_captcha'] === false) { ?>
|
||||
<div class="col col-2-md col-4-lg"><img id="captchaImg" src="captcha.php" onclick="this.src='captcha.php?'+Math.random();"></div>
|
||||
<div class="col col-3-md col-6-lg"><input type="text" id="captchaInput" placeholder="Enter Captcha" autocapitalize="none"></div>
|
||||
<?php } ?>
|
||||
<div class="col col-3-md col-6-lg"><button class="button primary" id="whoisButton">WHOIS</button> <button class="button secondary" id="rdapButton">RDAP</button></div>
|
||||
</div>
|
||||
|
||||
<div class="row" id="bottom">
|
||||
<div class="col col-12-lg"><pre><code><div id="result"></div></code></pre></div>
|
||||
</div>
|
||||
|
||||
<header>
|
||||
<h1>Domain Lookup</h1>
|
||||
</header>
|
||||
<main>
|
||||
<div class="input-container">
|
||||
<input type="text" id="domainInput" placeholder="Enter domain name" autocapitalize="none">
|
||||
<?php if ($c['ignore_captcha'] === false) { ?>
|
||||
<div class="captcha-container">
|
||||
<img alt="Captcha" id="captchaImg" src="captcha.php" onclick="this.src='captcha.php?'+Math.random();">
|
||||
<input type="text" id="captchaInput" placeholder="Enter CAPTCHA" autocapitalize="none">
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="buttons">
|
||||
<button id="whoisButton">WHOIS</button>
|
||||
<button id="rdapButton">RDAP</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bottom">
|
||||
<pre id="result"></pre>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
<p>© <?php echo date('Y'); ?> <strong><a href="<?php echo $c['registry_url']; ?>" target="_blank"><?php echo $c['registry_name']; ?></a></strong> <?php if ($c['branding'] === true) { ?> · Powered by <a href="https://namingo.org" target="_blank">Namingo</a><?php } ?></p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.getElementById('domainInput').addEventListener('keypress', function(event) {
|
||||
|
@ -55,7 +238,16 @@ $c = require_once 'config.php';
|
|||
|
||||
document.getElementById('whoisButton').addEventListener('click', function() {
|
||||
var domain = document.getElementById('domainInput').value;
|
||||
// Get the CAPTCHA input element
|
||||
var captchaInput = document.getElementById('captchaInput');
|
||||
|
||||
// Initialize captcha with an empty string
|
||||
var captcha = '';
|
||||
|
||||
// Check if the CAPTCHA element exists and is not disabled
|
||||
if (captchaInput && !captchaInput.disabled) {
|
||||
captcha = captchaInput.value; // Assign the value of the CAPTCHA input
|
||||
}
|
||||
|
||||
fetch('check.php', {
|
||||
method: 'POST',
|
||||
|
@ -68,15 +260,29 @@ $c = require_once 'config.php';
|
|||
.then(data => {
|
||||
document.getElementById('result').innerText = data;
|
||||
document.getElementById('bottom').style.display = 'block';
|
||||
// Reload captcha after a successful response
|
||||
document.getElementById('captchaImg').src = 'captcha.php?' + Math.random();
|
||||
if (captchaInput && !captchaInput.disabled) {
|
||||
// Reload captcha after a successful response
|
||||
document.getElementById('captchaImg').src = 'captcha.php?' + Math.random();
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Error:', error));
|
||||
.catch(error => {
|
||||
console.error('Error:', error); // Log the error to the console
|
||||
document.getElementById('result').innerText = 'Error: ' + error.message; // Display the error message on the page
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('rdapButton').addEventListener('click', function() {
|
||||
var domain = document.getElementById('domainInput').value;
|
||||
// Get the CAPTCHA input element
|
||||
var captchaInput = document.getElementById('captchaInput');
|
||||
|
||||
// Initialize captcha with an empty string
|
||||
var captcha = '';
|
||||
|
||||
// Check if the CAPTCHA element exists and is not disabled
|
||||
if (captchaInput && !captchaInput.disabled) {
|
||||
captcha = captchaInput.value; // Assign the value of the CAPTCHA input
|
||||
}
|
||||
|
||||
fetch('check.php', {
|
||||
method: 'POST',
|
||||
|
@ -95,11 +301,16 @@ $c = require_once 'config.php';
|
|||
let output = parseRdapResponse(data);
|
||||
document.getElementById('result').innerText = output;
|
||||
document.getElementById('bottom').style.display = 'block';
|
||||
// Reload captcha
|
||||
document.getElementById('captchaImg').src = 'captcha.php?' + Math.random();
|
||||
if (captchaInput && !captchaInput.disabled) {
|
||||
// Reload captcha
|
||||
document.getElementById('captchaImg').src = 'captcha.php?' + Math.random();
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Error:', error));
|
||||
.catch(error => {
|
||||
console.error('Error:', error); // Log the error to the console
|
||||
document.getElementById('result').innerText = 'Error: ' + error.message; // Display the error message on the page
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -206,6 +417,5 @@ $c = require_once 'config.php';
|
|||
return vcardOutput;
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue