0.11.0 • Published 3 months ago

discloud.app v0.11.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 months ago

Discloud.app

Instalation

npm i discloud.app
yarn add discloud.app

Links

Documentation
Github
NPM
Discloud Server

Examples usage

Examples usage
How to upload/commit your application
How to fetch your application
How to start, stop, restart or delete your application
How to view app logs
How to send a terminal command
How to backup apps
How to see your app statuses
How to change your app's name and/or avatar
How to change the amount of RAM in the app
How to install or uninstall APT
How to fetch/add/edit/remove moderators for your application

// index.js
// Get instanced discloud
const { discloud } = require("discloud.app");

// Set token
await discloud.login("DISCLOUD_TOKEN");
// Other file
// Get instanced discloud
const { discloud } = require("discloud.app");

// ...

await discloud.apps.fetch("ID"); // Promise<App>

How to upload/commit your application

Before continuing, make sure your zip contains the discloud.config file.

Upload with simply the file path/url:

const { discloud } = require("discloud.app");

await discloud.apps.create({
  file: "FILE_PATH/FILE_NAME.zip"
}); // Promise<RESTPostApiUploadResult>

Upload with Blob | Buffer | File | RawFile | ReadableStream:

const { discloud } = require("discloud.app");

await discloud.apps.create({
  file: {
    data: readFileSync("FILE_PATH/FILE_NAME.zip"), // Blob | Buffer
    name: "FILE_NAME.zip"
  }
}); // Promise<RESTPostApiUploadResult>

Commit with simply the file path/url:

const { discloud } = require("discloud.app");

await discloud.apps.update("APP_ID", {
  file: "FILE_PATH/FILE_NAME.zip"
}); // Promise<RESTPutApiAppCommitResult>

Commit with Blob | Buffer | File | RawFile | ReadableStream:

const { discloud } = require("discloud.app");

await discloud.apps.update("APP_ID", {
  file: {
    data: readFileSync("FILE_PATH/FILE_NAME.zip"), // Blob | Buffer
    name: "FILE_NAME.zip"
  }
}); // Promise<RESTPutApiAppCommitResult>

For you to send a stream, import the streamToFile function to convert:

const { discloud, streamToFile } = require("discloud.app");

const file = await streamToFile(stream, "FILE_NAME.zip");

await discloud.apps.create({ file }); // Promise<RESTPostApiUploadResult>

How to fetch your application

const { discloud } = require("discloud.app");

await discloud.apps.fetch("APP_ID"); // Promise<App>
await discloud.apps.fetch(/* "all" | undefined */); // Promise<Map<string, App>>

How to start, stop, restart or delete your application

const { discloud } = require("discloud.app");

await discloud.apps.start("APP_ID"); // Promise<RESTApiBaseResult>
await discloud.apps.start(/* "all" | undefined */); // Promise<ApiAppManagerStartedAll>

await discloud.apps.stop("APP_ID"); // Promise<RESTApiBaseResult>
await discloud.apps.stop(/* "all" | undefined */); // Promise<ApiAppManagerStopedAll>

await discloud.apps.restart("APP_ID"); // Promise<RESTApiBaseResult>
await discloud.apps.restart(/* "all" | undefined */); // Promise<ApiAppManagerRestartedAll>

await discloud.apps.delete("APP_ID"); // Promise<RESTDeleteApiAppDeleteResult>
await discloud.apps.delete(/* "all" | undefined */); // Promise<ApiAppManagerRemovedAll>

How to view app logs

const { discloud } = require("discloud.app");

await discloud.apps.terminal("APP_ID"); // Promise<ApiTerminal>
await discloud.apps.terminal(/* "all" | undefined */); // Promise<Map<string, ApiTerminal>>

How to send a terminal command

const { discloud } = require("discloud.app");

await discloud.apps.console("APP_ID", "bash command"); // Promise<string>

How to backup apps

const { discloud } = require("discloud.app");

await discloud.apps.backup("APP_ID"); // Promise<AppBackup>
await discloud.apps.backup(/* "all" | undefined */); // Promise<Map<string, AppBackup>>

How to see your app statuses

const { discloud } = require("discloud.app");

await discloud.apps.status("APP_ID"); // Promise<AppStatus>
await discloud.apps.status(/* "all" | undefined */); // Promise<Map<string, AppStatus>>

How to change your app's name and/or avatar

const { discloud } = require("discloud.app");

await discloud.apps.profile("APP_ID", {
  avatarURL // Optional URL ending with GIF, JPG, JPEG or PNG
  name // Optional text up to 30 characters
}); // Promise<RESTApiBaseResult>

How to change the amount of RAM in the app

const { discloud } = require("discloud.app");

await discloud.apps.ram("APP_ID", 100 /* number greater than 100 */); // Promise<RESTPutApiAppRamResult>
// Remember that if your app type is site, the minimum is 512

How to install or uninstall APT

const { discloud } = require("discloud.app");

// Install APTs
await discloud.appApt.install("APP_ID", [
  "canvas",
  "ffmpeg",
  "java",
  "libgl",
  "openssl",
  "puppeteer",
  "tools",
]); // Promise<RESTPutApiAppAptResult>

// Uninstall APTs
await discloud.appApt.uninstall("APP_ID", ["canvas", "ffmpeg"]); // Promise<RESTDeleteApiAppAptResult>

How to fetch/add/edit/remove moderators for your application

const { discloud, ModPermissions } = require("discloud.app");

// Fetch mods and permissions
await discloud.appTeam.fetch("APP_ID"); // Promise<ApiAppTeam[]>

// Add a mod
await discloud.appTeam.create("APP_ID", "MOD_ID", [
  "backup_app",
  "commit_app",
  "edit_ram",
  "logs_app",
  "restart_app",
  "start_app",
  "status_app",
  "stop_app",
]); // Promise<ApiAppTeamManager>

// Edit mod permissions
await discloud.appTeam.edit("APP_ID", "MOD_ID", [
  ModPermissions.backup_app,
  ModPermissions.commit_app,
  ModPermissions.edit_ram,
  ModPermissions.logs_app,
  ModPermissions.restart_app,
  ModPermissions.start_app,
  ModPermissions.status_app,
  ModPermissions.stop_app,
]); // Promise<ApiAppTeamManager>

// Remove a mod
await discloud.appTeam.delete("APP_ID", "MOD_ID"); // Promise<RESTApiBaseResult>
0.11.0

3 months ago

0.10.9

3 months ago

0.10.8

3 months ago

0.10.7

3 months ago

0.10.6

4 months ago

0.10.5

5 months ago

0.10.4-beta

5 months ago

0.10.4

5 months ago

0.10.1

5 months ago

0.10.2

5 months ago

0.10.3

5 months ago

0.10.0

5 months ago

0.6.12

10 months ago

0.6.11

10 months ago

0.6.14

10 months ago

0.6.13

10 months ago

0.9.0

8 months ago

0.7.2

9 months ago

0.7.1

9 months ago

0.9.2

8 months ago

0.9.1

8 months ago

0.7.0

10 months ago

0.9.4

6 months ago

0.9.3

8 months ago

0.9.6

6 months ago

0.9.5

6 months ago

0.8.1-beta.0

9 months ago

0.8.1

9 months ago

0.8.0

9 months ago

0.6.10

1 year ago

0.6.9

1 year ago

0.6.8

1 year ago

0.6.7

1 year ago

0.6.6

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.5

1 year ago

0.6.4

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.4.9

1 year ago

0.4.8

1 year ago

0.4.10

1 year ago

0.4.17

1 year ago

0.4.15

1 year ago

0.4.16

1 year ago

0.4.13

1 year ago

0.4.14

1 year ago

0.4.11

1 year ago

0.4.12

1 year ago

0.5.0

1 year ago

0.1.4-beta.0

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.4.5

1 year ago

0.4.4

1 year ago

0.4.7

1 year ago

0.4.6

1 year ago

0.4.1

1 year ago

0.1.4

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.1.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.3

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago