mirror of
https://github.com/partofmyid/register.git
synced 2026-06-05 10:36:50 +07:00
initial
This commit is contained in:
parent
f5c9916a52
commit
aa73cbf9d1
8 changed files with 214 additions and 0 deletions
2
.github/CODEOWNERS
vendored
Normal file
2
.github/CODEOWNERS
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
* @SX-9
|
||||||
|
/domains/ @partofmyid/maintainers
|
||||||
14
.github/workflows/check.yml
vendored
Normal file
14
.github/workflows/check.yml
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
name: Check
|
||||||
|
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: DNSControl check
|
||||||
|
uses: koenrh/dnscontrol-action@v3
|
||||||
|
with:
|
||||||
|
args: check
|
||||||
|
config_file: 'dnsconfig.js'
|
||||||
29
.github/workflows/deploy.yml
vendored
Normal file
29
.github/workflows/deploy.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
name: Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- "domains/**"
|
||||||
|
- ".github/workflows/publish.yml"
|
||||||
|
- "dnsconfig.js"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.ref }}-publish
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dns:
|
||||||
|
name: DNS
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: echo '{"cloudflare":{"TYPE":"CLOUDFLAREAPI","apitoken":"$CLOUDFLARE_API_TOKEN"}}' > ./creds.json
|
||||||
|
- name: Publish
|
||||||
|
uses: is-cool-me/dnscontrol-action@v4.11.0
|
||||||
|
env:
|
||||||
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
||||||
|
with:
|
||||||
|
args: push
|
||||||
|
config_file: "dnsconfig.js"
|
||||||
38
.github/workflows/validation.yml
vendored
Normal file
38
.github/workflows/validation.yml
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
name: Validation
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- "domains/**"
|
||||||
|
- ".github/workflows/validation.yml"
|
||||||
|
- "dnsconfig.js"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.ref }}-validation
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dns:
|
||||||
|
name: DNS
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Check
|
||||||
|
uses: koenrh/dnscontrol-action@v3
|
||||||
|
with:
|
||||||
|
args: check
|
||||||
|
config_file: "dnsconfig.js"
|
||||||
|
json:
|
||||||
|
name: JSON
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: JSON Syntax Check
|
||||||
|
uses: limitusus/json-syntax-check@v2
|
||||||
|
with:
|
||||||
|
pattern: "\\.json$"
|
||||||
|
env:
|
||||||
|
BASE: "domains/"
|
||||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
creds.json
|
||||||
|
types-dnscontrol.d.ts
|
||||||
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"cSpell.words": [
|
||||||
|
"dnscontrol"
|
||||||
|
]
|
||||||
|
}
|
||||||
116
dnsconfig.js
Normal file
116
dnsconfig.js
Normal file
|
|
@ -0,0 +1,116 @@
|
||||||
|
// @ts-check
|
||||||
|
/// <reference path="types-dnscontrol.d.ts" />
|
||||||
|
// ^^^^^^ https://docs.dnscontrol.org/getting-started/typescript
|
||||||
|
var regNone = NewRegistrar("none");
|
||||||
|
var providerCf = DnsProvider(NewDnsProvider("cloudflare", "", {
|
||||||
|
// manage_redirects: true,
|
||||||
|
}));
|
||||||
|
|
||||||
|
var rootDomain = 'part-of.my.id';
|
||||||
|
var registerSite = 'register-site.pages.dev';
|
||||||
|
var proxy = {
|
||||||
|
on: { "cloudflare_proxy": "on" },
|
||||||
|
off: { "cloudflare_proxy": "off" }
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDomainsList(filesPath) {
|
||||||
|
// @ts-expect-error
|
||||||
|
var files = glob.apply(null, [filesPath, true, '.json']);
|
||||||
|
var result = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < files.length; i++) {
|
||||||
|
var basename = files[i].split('/').reverse()[0];
|
||||||
|
var name = basename.split('.')[0];
|
||||||
|
result.push({ name: name, data: require(files[i]) });
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
var domains = getDomainsList('./domains');
|
||||||
|
var commits = [];
|
||||||
|
|
||||||
|
for (var idx in domains) {
|
||||||
|
var domainData = domains[idx].data;
|
||||||
|
var subdomain = domains[idx].name;
|
||||||
|
var proxyState = proxy.on;
|
||||||
|
if (domainData.proxied === false) proxyState = proxy.off;
|
||||||
|
|
||||||
|
if ('A' in domainData.record) {
|
||||||
|
for (var a in domainData.record.A) {
|
||||||
|
commits.push(
|
||||||
|
A(subdomain, IP(domainData.record.A[a]), proxyState)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('AAAA' in domainData.record) {
|
||||||
|
for (var aaaa in domainData.record.AAAA) {
|
||||||
|
commits.push(
|
||||||
|
AAAA(subdomain, domainData.record.AAAA[aaaa], proxyState)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('CNAME' in domainData.record) {
|
||||||
|
commits.push(
|
||||||
|
CNAME(subdomain, domainData.record.CNAME + ".", proxyState)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('MX' in domainData.record) {
|
||||||
|
for (var mx in domainData.record.MX) {
|
||||||
|
commits.push(
|
||||||
|
MX(subdomain, 10, domainData.record.MX[mx] + ".")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if ('NS' in domainData.record) {
|
||||||
|
// for (var ns in domainData.record.NS) {
|
||||||
|
// commits.push(
|
||||||
|
// NS(subdomain, domainData.record.NS[ns] + ".")
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ('TXT' in domainData.record) {
|
||||||
|
for (var txt in domainData.record.TXT) {
|
||||||
|
commits.push(
|
||||||
|
TXT(subdomain, domainData.record.TXT[txt])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if ('CAA' in domainData.record) {
|
||||||
|
// for (var caa in domainData.record.CAA) {
|
||||||
|
// var caaRecord = domainData.record.CAA[caa];
|
||||||
|
// commits.push(
|
||||||
|
// CAA(subdomain, caaRecord.flags, caaRecord.tag, caaRecord.value)
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ('SRV' in domainData.record) {
|
||||||
|
for (var srv in domainData.record.SRV) {
|
||||||
|
var srvRecord = domainData.record.SRV[srv];
|
||||||
|
commits.push(
|
||||||
|
SRV(subdomain, srvRecord.priority, srvRecord.weight, srvRecord.port, srvRecord.target + ".")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if ('PTR' in domainData.record) {
|
||||||
|
// for (var ptr in domainData.record.PTR) {
|
||||||
|
// commits.push(
|
||||||
|
// PTR(subdomain, domainData.record.PTR[ptr] + ".")
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
commits.push(
|
||||||
|
// CF_REDIRECT("*", "https://" + rootDomain + '/unregistered'),
|
||||||
|
ALIAS("@", registerSite + ".", proxy.on)
|
||||||
|
);
|
||||||
|
|
||||||
|
D(rootDomain, regNone, providerCf, commits);
|
||||||
8
domains/satr14.json
Normal file
8
domains/satr14.json
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"owner": {
|
||||||
|
"username": "SX-9"
|
||||||
|
},
|
||||||
|
"record": {
|
||||||
|
"CNAME": "4th-site.pages.dev"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue