0.0.7 • Published 4 years ago

cloudns v0.0.7

Weekly downloads
21
License
-
Repository
-
Last release
4 years ago

ClouDNS (Unoffical Node.js API)

Discord Website GitHub followers

I created this little library because apparently ClouDNS has a paywalled API, and that's really dumb.

A little disclaimer, I'm not affiliated with ClouDNS in anyway, so anything I do doesn't represent them nor do they represent me. Anything wrong with your accounts or domains when using this may prevent you from getting support from the ClouDNS Team.

How to install?

npm install cloudns

Important notes.

To use this, you'd need to disable 2FA on your account.

How would I use this?

const ClouDNS = require("cloudns");

Once you've logged into using await ClouDNS.login(options);, if there was no problems with the login, you'd be able to use the other functions.

An example. ヾ( ̄0 ̄ )ノ

Here is a potential use-case for this library, this little snippet takes all the names in the queued variable and binds their IP respectively as an A record.

const ClouDNS = require("./ClouDNS/entry.js");

// Declare some authentication.
const options = {
  
  // Using the session key will ignore email and password.
  //  this is optional unless recapcha is blocking.
  session: "a69vebs3ifmt3ned184snmbxdw9scpou",

  // If your getting blocked by recaptcha, 
  //  you must use session key instead of
  //  email and password.
  email: "me@ruby.js.org",
  password: "ClouDNS_Password"
};

// Attempt to login to ClouDNS.
ClouDNS.login(options).then(login => {
  
  if (login.error) {
    // Login has failed somehow, maybe my password is wrong?
    console.error("Login failed");
    process.exit(1);
  }

  let zone_id = 1432921; // Obtainable via `await ClouDNS.getZones();`
  let queued = {
    subdomain: "189.37.194.66",
    jimsminecraft: "81.145.211.161",
    uwucraft: "8.222.154.147",
    ewwitsaweeb: "127.85.78.11"
  };

  // Loop though all the queued bindings.
  Object.keys(queued).forEach(async name => {
    let ip = queued[name];
    
    // This is where the magic happens.
    let record = await ClouDNS.addRecord(zone_id, "A", name, ip);
    
    // Successful.
    if (record.status === 1) {
      console.log("Added " + name + " with an IP of " + ip + " (" + record.id + ")")
    }
  });
});
ClouDNS.getRecords(zone_id).then((records) => {
  if (records.error) {
    // Welp.
  }
  
  records.forEach((record) => {
    let host = record.host;
    let type = record.type;
    let value = record.value;
    
    console.log(host, type, value);
    // ruby.js.org ALIAS oewm15vlo23zlvpk.shw.io
  })
})
0.0.5

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago