Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

156
LINES

< > BotCompany Repo | #4000805 // ubaTaeCJ

User-supplied dialog

1  
!7
2  
3  
// NOTE: make sure the SOA is correct!
4  
5  
static double refreshEvery = 0 /*60*/;
6  
static int smartBotTimeOut = 60*30;
7  
8  
sS zone = [[
9  
botcompany.de. IN    SOA   ns1.stefantrades.me.  stefan\.reich\.maker\.of\.eye.gmail.com.  (
10  
                                        20190925     ; Serial
11  
                                        60M     ; Refresh
12  
                                        15M     ; Retry
13  
                                        7D      ; Expiry
14  
                                        30M )   ; Minimum
15  
@                       IN      NS      ns1.stefantrades.me.
16  
@                       IN      NS      ns2.stefantrades.me.
17  
@                       IN      A       167.86.121.181
18  
c8                      IN      A       167.86.121.181
19  
home                300 IN      A       2.203.147.51
20  
oldmain                 IN      A       185.183.156.46
21  
coffee                  IN      A       195.154.179.147
22  
*.coffee                IN      A       195.154.179.147
23  
vnc-coffee              IN      A       195.154.179.147
24  
transpile-coffee        IN      A       195.154.179.147
25  
avor                    IN      A       195.154.179.147
26  
robin-avor              IN      A       195.154.179.147
27  
christian-avor          IN      A       195.154.179.147
28  
avor-qa                 IN      A       195.154.179.147
29  
*.avor-qa               IN      A       195.154.179.147
30  
cruddie                 IN      A       195.154.179.147
31  
*.cruddie               IN      A       195.154.179.147
32  
stripe-test             IN      A       195.154.179.147
33  
meta-bot                IN      A       195.154.179.147
34  
ada-v2                  IN      A       195.154.179.147
35  
fia                     IN      A       195.154.179.147
36  
e-buck                  IN      A       195.154.179.147
37  
ada-aws                 IN      A       18.233.63.26
38  
; sometimes the * entry doesn't work? vnc.botcompany.de caused NXDOMAIN
39  
*                       IN      A       167.86.121.181
40  
vnc                     IN      A       167.86.121.181
41  
code                    IN      A       167.86.121.181
42  
www                     IN      A       167.86.121.181
43  
butter                  IN      A       167.86.121.181
44  
stefans-os              IN      A       167.86.121.181
45  
smartbot                IN      A       167.86.121.181
46  
create                  IN      A       167.86.121.181
47  
mail                    IN      A       167.86.121.181
48  
javax                   IN      A       167.86.121.181
49  
ada                     IN      A       167.86.121.181
50  
mech                    IN      A       167.86.121.181
51  
theadmi                 IN      A       176.58.127.141
52  
theadmi2                IN      A       176.58.127.141
53  
tester                  IN      A       144.126.145.56
54  
gazellebot              IN      A       173.212.209.120
55  
;pays5-bot               IN      A       173.212.209.120
56  
pays5-bot               IN      A       195.154.179.147
57  
bea-bot                 IN      A       173.212.209.120
58  
tlc                     IN      A       195.154.179.147
59  
big                     IN      A       192.99.13.227
60  
;@                       MX      10      mail1.domainssaubillig.de.
61  
@                       MX      10      mail.botcompany.de.
62  
mail                    MX      10      mail.botcompany.de.
63  
_acme-challenge.botcompany.de. IN      TXT   "aWAwa7cLpPcFoIylAqQn13tmNyfZ6H36GUt2dFyt-eM"
64  
botcompany.de.          IN      TXT     "google-site-verification=YL5Hu5zvww8np30b4LLv_fgK0rppl2uzUKe8-14Gk98"
65  
]];
66  
67  
// Note: zone2 not active yet
68  
69  
sS zone2 = [[
70  
gazelle.rocks. IN    SOA   ns1.stefantrades.me.  stefan\.reich\.maker\.of\.eye.gmail.com.  (
71  
                                        20190101     ; Serial
72  
                                        5M     ; Refresh
73  
                                        15M     ; Retry
74  
                                        7D      ; Expiry
75  
                                        30M )   ; Minimum
76  
@                       IN      NS      ns1.stefantrades.me.
77  
@                       IN      NS      ns2.stefantrades.me.
78  
@                       IN      A       173.212.209.120
79  
*                       IN      A       173.212.209.120
80  
;@                       MX      10      mail1.domainssaubillig.de.
81  
]];
82  
83  
lib 1008223 // dnsjava
84  
lib 1010766 // EagleDNS
85  
lib 1004911 // log4j
86  
87  
import se.unlogic.eagledns.EagleDNS;
88  
89  
static File zonesDir;
90  
static EagleDNS eagleDNS;
91  
92  
p {
93  
  tryToAcquirePort5000();
94  
  
95  
  S conf = loadSnippet(#1010767);
96  
  zonesDir = programFile("zones");
97  
  saveZones();
98  
  
99  
  conf = conf.replace(
100  
    [[<Property name="zoneFileDirectory">zones</Property>]],
101  
    [[<Property name="zoneFileDirectory">]] + f2s(zonesDir) + [[</Property>]]);
102  
  File configFile = saveProgramTextFile("config.xml", conf);
103  
  
104  
  //eagleDNS = nuObject("se.unlogic.eagledns.EagleDNS", f2s(configFile));
105  
  print("Making EagleDNS.");
106  
  pcall {
107  
    eagleDNS = new EagleDNS(f2s(configFile));
108  
  }
109  
  
110  
  // For some weird reason, on the servers, no lines are printed
111  
  // after this point... but they still execute!? (Auto-reload works.)
112  
  
113  
  printAndProgramLog("Made EagleDNS." + (eagleDNS == null ? "..not" : ""));
114  
  bot("Eagle DNS.");
115  
  if (refreshEvery != 0) doEvery_daemon(refreshEvery, r refresh);
116  
  
117  
  // Restart after successful transpile
118  
  
119  
  print("Making SnippetUpdateConnector.");
120  
  ownResource(snippetUpdateConnector(verbose := true));
121  
  
122  
  ownResource(vmBus_onMessage snippetUpdate(voidfunc(L l) {
123  
    print("Got snippet update: " + l);
124  
    S uri = getString(l, 1);
125  
    new Matches m;
126  
    if (swic(uri, "/transpileOK/", m))
127  
      if (sameSnippetID(programID(), firstIntAsString(m.rest()))) {
128  
        programLog("Restarting");
129  
        restart();
130  
      }
131  
  }));
132  
}
133  
134  
answer {
135  
  if "test" ret "OK";
136  
  if "refresh" {
137  
    refresh();
138  
    ret "OK";
139  
  }
140  
}
141  
142  
static void refresh() {
143  
  saveZones();
144  
  eagleDNS.reloadZones();
145  
}
146  
147  
static void saveZones {
148  
  S acmeChallenge = loadTextFileTrim(userFile("acme-challenge.txt")); // Note: not used anymore, just edit this source
149  
  if (nempty(acmeChallenge))
150  
    zone = jreplace(zone,
151  
      "_acme-challenge.botcompany.de. IN TXT <quoted>",
152  
      "_acme-challenge.botcompany.de. IN TXT " + quote(unnull(acmeChallenge)));
153  
  print(zone);
154  
  saveTextFile(newFile(zonesDir, "botcompany.de"), zone);
155  
  saveTextFile(newFile(zonesDir, "gazelle.rocks"), zone2);
156  
}

Author comment

1

download  show line numbers   

Travelled to 1 computer(s): mqqgnosmbjvj

No comments. add comment

Snippet ID: #4000805
Snippet name: ubaTaeCJ
Eternal ID of this version: #4000805/1
Text MD5: bbdc4a3c243bdf1a146801f8fd8b2c96
Author: ubataecj
Category: 1
Type: User-supplied dialog
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2024-05-01 03:37:13
Source code size: 6387 bytes / 156 lines
Pitched / IR pitched: No / No
Views / Downloads: 51 / 17
Referenced in: [show references]