diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
deleted file mode 100644
index a8026c3..0000000
--- a/.github/workflows/check.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-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'
\ No newline at end of file
diff --git a/.github/workflows/db.yml b/.github/workflows/db.yml
index 0d2d5da..3d6f972 100644
--- a/.github/workflows/db.yml
+++ b/.github/workflows/db.yml
@@ -24,19 +24,16 @@ jobs:
with:
node-version: '18'
- - name: Generate database
- run: node scripts/dbgen.js > stats/database.json
-
- - name: Count domains
- run: ls domains | wc -l > stats/count.txt
+ - name: Generate statistics
+ run: |
+ node scripts/dict.js > stats/dict.json 2>&1 &
+ ls domains | wc -l > stats/count.txt 2>&1 &
+ wait
- name: Commit changes
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- git add stats/database.json stats/count.txt
- ls -l
- ls -l stats
- pwd
+ git add stats/dict.json stats/count.txt
git commit -m "[automated] update stats"
git push
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 9bcae7c..d037912 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -7,7 +7,7 @@ on:
paths:
- "domains/**"
- ".github/workflows/publish.yml"
- - "dnsconfig.js"
+ - "scripts/dnsconfig.js"
concurrency:
group: ${{ github.ref }}-publish
@@ -26,4 +26,4 @@ jobs:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
with:
args: push
- config_file: "dnsconfig.js"
\ No newline at end of file
+ config_file: "scripts/dnsconfig.js"
\ No newline at end of file
diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml
index fbba480..bbfd9e4 100644
--- a/.github/workflows/validation.yml
+++ b/.github/workflows/validation.yml
@@ -8,7 +8,8 @@ on:
paths:
- "domains/**"
- ".github/workflows/validation.yml"
- - "dnsconfig.js"
+ - "scripts/dnsconfig.js"
+ - "scripts/schema.json"
concurrency:
group: ${{ github.ref }}-validation
@@ -24,7 +25,7 @@ jobs:
uses: koenrh/dnscontrol-action@v3
with:
args: check
- config_file: "dnsconfig.js"
+ config_file: "scripts/dnsconfig.js"
json:
name: JSON
runs-on: ubuntu-latest
@@ -40,4 +41,4 @@ jobs:
uses: cardinalby/schema-validator-action@v3
with:
file: 'domains/*.json'
- schema: 'schema.json'
+ schema: 'scripts/schema.json'
diff --git a/scripts/dbgen.js b/scripts/dbgen.js
deleted file mode 100644
index 0cdea2d..0000000
--- a/scripts/dbgen.js
+++ /dev/null
@@ -1,12 +0,0 @@
-const fs = require('fs');
-
-console.log(
- JSON.stringify(
- fs.readdirSync('./domains').map(f =>
- [
- f.split('.').slice(0, -1).join('.'), // subdomain
- JSON.parse(fs.readFileSync(`./domains/${f}`, 'utf8')).owner.username // owner
- ]
- )
- )
-);
\ No newline at end of file
diff --git a/scripts/dict.js b/scripts/dict.js
new file mode 100644
index 0000000..c2378e0
--- /dev/null
+++ b/scripts/dict.js
@@ -0,0 +1,12 @@
+const fs = require('fs');
+
+const dict = fs.readdirSync('./domains').map(f => [
+ f.split('.').slice(0, -1).join('.'),
+ JSON.parse(fs.readFileSync(`./domains/${f}`, 'utf8')).owner.username // owner
+]).reduce((v, [s, o]) => {
+ if (!v[o]) v[o] = [];
+ v[o].push(s);
+ return v;
+}, {});
+
+console.log(dict);
\ No newline at end of file
diff --git a/dnsconfig.js b/scripts/dnsconfig.js
similarity index 96%
rename from dnsconfig.js
rename to scripts/dnsconfig.js
index 1245c58..982c949 100644
--- a/dnsconfig.js
+++ b/scripts/dnsconfig.js
@@ -1,5 +1,5 @@
// @ts-check
-///
+///
// ^^^^^^ https://docs.dnscontrol.org/getting-started/typescript
var regNone = NewRegistrar("none");
@@ -26,7 +26,7 @@ function getDomainsList(filesPath) {
return result;
}
-var domains = getDomainsList('./domains');
+var domains = getDomainsList('../domains');
var commits = [];
for (var idx in domains) {
diff --git a/stats/.gitkeep b/stats/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/stats/count.txt b/stats/count.txt
deleted file mode 100644
index 209e3ef..0000000
--- a/stats/count.txt
+++ /dev/null
@@ -1 +0,0 @@
-20
diff --git a/stats/database.json b/stats/database.json
deleted file mode 100644
index c5c3f14..0000000
--- a/stats/database.json
+++ /dev/null
@@ -1 +0,0 @@
-[["@","partofmyid"],["_discord.cutedog5695","CuteDog5695"],["_discord","SX-9"],["_discord.justdeveloper","JustDeveloper1"],["c","orangci"],["cutedog5695","CuteDog5695"],["j","JustDeveloper1"],["jd","JustDeveloper1"],["js","JustDeveloper1"],["just","JustDeveloper1"],["justdev","JustDeveloper1"],["justdeveloper","JustDeveloper1"],["juststudio","JustDeveloper1"],["katz","Bananalolok"],["no-one-is","EducatedSuddenBucket"],["rchessauth","vortexprime24"],["satr14","SX-9"],["stef","Stef-00012"],["ukriu","ukriu"],["you-are","Stef-00012"]]