Merge branch 'main' into main

This commit is contained in:
Frans Allen authored and GitHub committed 2022-06-13 05:59:43 +07:00
commit 43a6c73751
5 files changed
+6 -1764

No files matched your search

-8
View File
@@ -1,8 +0,0 @@
{
"require": {
"cloudflare/sdk": "^1.1",
"mailgun/mailgun-php": "^3.5",
"kriswallsmith/buzz": "^1.2",
"nyholm/psr7": "^1.4"
}
}
Generated
-1664
View File
File diff suppressed because it is too large. Load diff
-90
View File
@@ -1,90 +0,0 @@
<?php
require 'vendor/autoload.php';
use Mailgun\Mailgun;
// set variables
$email = getenv('CF_EMAIL');
$apiKey = getenv('CF_API_KEY');
$zoneID = getenv('CF_ZONE_ID');
$mailgunDomain = getenv('MG_DOMAIN');
$mailgunKey = getenv('MG_KEY');
$mailFrom = getenv('MAIL_FROM');
$mailTo = getenv('MAIL_TO');
// instantiation
$key = new Cloudflare\API\Auth\APIKey($email, $apiKey);
$adapter = new Cloudflare\API\Adapter\Guzzle($key);
$dns = new Cloudflare\API\Endpoints\DNS($adapter);
$mg = Mailgun::create($mailgunKey);
// get subdomains
$json = file_get_contents('./subdomains.json');
$data = json_decode($json, true);
function send_mail($subject, $text) {
global $mg;
global $mailgunDomain;
global $mailFrom;
global $mailTo;
$mg->messages()->send($mailgunDomain, [
'from' => $mailFrom,
'to' => $mailTo,
'subject' => $subject,
'text' => $text
]);
}
function get_status($url) {
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_NOBODY => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HEADER => 1,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36 thedev.id-status-check',
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $status;
}
foreach ($data as $subdomain => $cname) {
$domain = $subdomain . '.thedev.id';
$recordID = $dns->getRecordID($zoneID, 'CNAME', $domain);
$updatedRecord = [
'type' => 'CNAME',
'name' => $domain,
'content' => $cname,
'ttl' => 0,
'proxied' => false
];
$status = get_status("https://$domain/");
// get & check record ID
if ($recordID == true) {
echo "The subdomain $domain already exist.\n";
// if record exist, update content
if ($dns->updateRecordDetails($zoneID, $recordID, $updatedRecord) == true) {
echo "Updated the subdomain $domain with new content $cname.\n";
if ($status != '200') {
echo "Status for $domain is $status.\n";
send_mail("$domain is not configured properly!", "Please check if the domain $domain is still valid before removing it from the list.");
}
}
} else {
// add new CNAME record
if ($dns->addRecord($zoneID, "CNAME", $subdomain, $cname, 0, false) === true) {
echo "A new CNAME record created for $domain.\n";
}
}
}
+1 -1
View File
@@ -17,7 +17,7 @@
<meta name="twitter:image" content="https://cdn.statically.io/og/theme=dark/%7Bname%7D.thedev.id.jpg">
<link rel="icon" href="https://cdn.statically.io/icon/g/t.png" type="image/png">
<link rel="stylesheet" href="https://cdn.statically.io/libs/tailwindcss/1.4.6/tailwind.min.css">
<script async defer data-website-id="a398ec42-5c1b-45de-8e78-edf92ca8f06e" src="https://anila.statically.io/script.js"></script>
<script async defer data-website-id="a398ec42-5c1b-45de-8e78-edf92ca8f06e" src="https://respectedprivacy.com/app"></script>
</head>
<body class="p-8 max-w-xl m-auto">
<header class="text-center mt-10">
+5 -1
View File
@@ -7,14 +7,17 @@
"ahmadhayyan": "ahmadhayyan.github.io",
"ahmedazhar05": "ahmedazhar05.github.io",
"ahskript": "ahskript.github.io",
"ali": "hmd-ali.github.io",
"anamolsapkota": "anamolsapkota.github.io",
"anil": "anilseervi.github.io",
"anon": "glitch.edgeapp.net",
"asacanell": "asacanell.github.io",
"ash-hnry": "ash-hnry.github.io",
"ashutosh": "ashutoshcoder.github.io",
"ashwin" : "ashwin3082002.github.io",
"asim": "asimbera.pages.dev",
"appls": "appls2appls.github.io",
"avyanshralph": "avyansh0001.github.io",
"ayush": "iddev5.github.io",
"bal": "vps35.heliohost.us",
"cozmo": "cozmodev.github.io",
@@ -61,6 +64,7 @@
"smartman": "smartmanru.github.io",
"subtra3t": "subtra3t.github.io",
"sulthan": "sulthan16.github.io",
"suman": "thatsuman.github.io",
"syofyanzuhad": "syofyanzuhad.github.io",
"tanilayagirlar": "tanilayagirlar.github.io",
"techout": "proxy.techout.tech",
@@ -78,5 +82,5 @@
"yeff": "yeffycodegit.github.io",
"zen": "zen-sveltekit.vercel.app",
"zh": "zh.github.io"
"avyanshralph": "avyansh0001.github.io"
"zarconweb": "zaxyan.github.io"
}