# cloudns

> A Node.js library for controlling and accessing your domains on ClouDNS.

Latest version **0.0.7** (published 2020-02-19) · 0 weekly downloads

## Install

```sh
npm install cloudns
pnpm add cloudns
yarn add cloudns
bun add cloudns
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2020-02-19 |
| First published | 2020-01-23 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | rubybae |

## Links

- npm: https://www.npmjs.com/package/cloudns
- npm.io page: https://npm.io/package/cloudns

## Dependencies (2)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0
- [node-html-parser](https://npm.io/package/node-html-parser.md) ^1.1.18

## Recent versions

- 0.0.7 (latest) — 2020-02-19
- 0.0.6 — 2020-02-19
- 0.0.5 — 2020-02-19
- 0.0.4 — 2020-01-23
- 0.0.3 — 2020-01-23
- 0.0.2 — 2020-01-23
- 0.0.1 — 2020-01-23

## README

# ClouDNS (Unoffical Node.js API)
[![Discord](https://img.shields.io/discord/418093857394262020?style=for-the-badge)](https://discord.gg/rj3YQQu)
[![Website](https://img.shields.io/website?style=for-the-badge&url=https%3A%2F%2Fruby.js.org)](https://ruby.js.org)
[![GitHub followers](https://img.shields.io/github/followers/rubybae?style=for-the-badge)](https://github.com/rubybae)

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?
```bash
npm install cloudns
```

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

#### How would I use this?
```js
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.
```js
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 + ")")
    }
  });
});

```

```js
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
  })
})
```

---
_Source: https://npm.io/package/cloudns · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
