Code Modifications #261
@ -1,67 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -ex
|
|
||||||
# Update Debian Repository
|
|
||||||
apt update
|
|
||||||
|
|
||||||
# Install Necessary Packages
|
|
||||||
apt -qq install -y curl wget git zsh sudo unzip zip jq python3 screen xz-utils
|
|
||||||
|
|
||||||
# Install nodejs from github release
|
|
||||||
NODEVERSION=$(curl -sL https://api.github.com/repos/nodejs/node/releases | grep tag_name | cut -d '"' -f 4 | sort -V | tail -n 1)
|
|
||||||
case $(uname -m) in
|
|
||||||
x86_64 ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-x64.tar.xz" -O /tmp/node.tar.xz;;
|
|
||||||
aarch64 ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-arm64.tar.xz" -O /tmp/node.tar.xz;;
|
|
||||||
armv7l ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-armv7l.tar.xz" -O /tmp/node.tar.xz;;
|
|
||||||
ppc64el ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-ppc64le.tar.xz" -O /tmp/node.tar.xz;;
|
|
||||||
s390x ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-s390x.tar.xz" -O /tmp/node.tar.xz;;
|
|
||||||
*) echo "Unsupported architecture"; exit 1;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Extract nodejs
|
|
||||||
mkdir /tmp/Node
|
|
||||||
tar -xJf /tmp/node.tar.xz -C /tmp/Node
|
|
||||||
rm -rf /tmp/node.tar.xz
|
|
||||||
cp -rf /tmp/Node/*/* /usr
|
|
||||||
|
|
||||||
# Install Build Dependencies and others Packages
|
|
||||||
apt -qq install -y ca-certificates make build-essential procps lsb-release xdg-utils g++ libatomic1 libnss3 libatk-bridge2.0-0 gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxrandr2 libxrender1 libxss1 libxtst6 fonts-liberation libnss3 libgbm-dev
|
|
||||||
|
|
||||||
# Update npm
|
|
||||||
npm -g install npm@$(curl -sL https://api.github.com/repos/npm/cli/releases/latest | grep tag_name | cut -d '"' -f 4)
|
|
||||||
|
|
||||||
# Install Dependencies to diferent architectures
|
|
||||||
if ! [ "$(uname -m)" == "x86_64" ];then
|
|
||||||
mkdir -p /lib64
|
|
||||||
apt install -y qemu-user-static
|
|
||||||
wget -q "https://github.com/The-Bds-Maneger/external_files/raw/main/Linux/libs_amd64.zip" -O /tmp/libries.zip
|
|
||||||
unzip -o /tmp/libries.zip -d /
|
|
||||||
rm -rfv /tmp/libries.zip
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install openjdk
|
|
||||||
case "$(apt search openjdk)" in
|
|
||||||
*openjdk-17* ) apt install -y openjdk-17*;;
|
|
||||||
*openjdk-11* ) apt install -y openjdk-11*;;
|
|
||||||
* ) echo "No openjdk version found, skipping";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Setup non root user
|
|
||||||
setup_user() {
|
|
||||||
useradd -m -p "$(perl -e 'print crypt($ARGV[0], "password")' "LucaA1113ba21")" "thebds"
|
|
||||||
addgroup thebds sudo
|
|
||||||
addgroup thebds root
|
|
||||||
usermod --shell /usr/bin/zsh thebds;
|
|
||||||
echo "thebds ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remove Unnecessary Packages
|
|
||||||
apt autoremove -y
|
|
||||||
|
|
||||||
# Clean up apt cache
|
|
||||||
apt clean -y
|
|
||||||
|
|
||||||
# Remove Unnecessary Files
|
|
||||||
rm -rf /var/lib/apt/lists/* /root/.gnupg /tmp/*
|
|
||||||
|
|
||||||
# Sucessfully installed
|
|
||||||
exit 0
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
const path = require("path");
|
|
||||||
process.env.Docker_Root = path.resolve(__dirname, "../");
|
|
||||||
const Docker = require("docker-run_build");
|
|
||||||
Docker.Build().then(() => {
|
|
||||||
Docker.Run().catch((e) => {
|
|
||||||
console.log(e);
|
|
||||||
process.exit(2);
|
|
||||||
});
|
|
||||||
}).catch(e => {
|
|
||||||
console.log(e);
|
|
||||||
process.exit(1);
|
|
||||||
});
|
|
@ -1,28 +0,0 @@
|
|||||||
const child_process = require("child_process");
|
|
||||||
const fs = require("fs");
|
|
||||||
const path = require("path");
|
|
||||||
const cli_color = require("cli-color");
|
|
||||||
|
|
||||||
async function Render() {
|
|
||||||
// Fetch
|
|
||||||
if (typeof fetch === "undefined") global.fetch = (await import("node-fetch")).default;
|
|
||||||
fetch("https://registry.npmjs.org/@the-bds-maneger/core").then(res => res.json()).then(data => {
|
|
||||||
data.versions = Object.getOwnPropertyNames(data.versions).filter(version => /[0-9]+\.[0-9][0-9][0-9]/.test(version) && version !== data["dist-tags"].dev && version !== data["dist-tags"].latest)
|
|
||||||
fs.writeFileSync(path.resolve(__dirname, "Releases.json"), JSON.stringify(data, null, 2));
|
|
||||||
const Package = require("../package.json");
|
|
||||||
data.versions.map(version => {
|
|
||||||
const cmd = `npm unpublish ${Package.name}@${version}`;
|
|
||||||
console.log(cli_color.yellow(cmd));
|
|
||||||
try {
|
|
||||||
child_process.execSync(cmd).toString()
|
|
||||||
console.log(cli_color.green(`Sucess to remove ${Package.name}@${version}`, "\n"));
|
|
||||||
return cmd;
|
|
||||||
} catch (e) {
|
|
||||||
console.log(cli_color.red(`Failed to remove package: ${Package.name}@${version}`), "\n");
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
fs.writeFileSync(path.resolve(__dirname, "Releases.json"), JSON.stringify(data, null, 2));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Render();
|
|
@ -1,4 +0,0 @@
|
|||||||
const version = require("../package.json").version;
|
|
||||||
const ActionsCore = require("@actions/core");
|
|
||||||
console.log(version);
|
|
||||||
ActionsCore.exportVariable("BdsCoreVersion", version);
|
|
@ -1,19 +0,0 @@
|
|||||||
(async ()=>{
|
|
||||||
try {
|
|
||||||
const bds = require("../../index");
|
|
||||||
await bds.download("latest", true);
|
|
||||||
console.log("Api:", bds.api());
|
|
||||||
console.log("Backup:", bds.backup());
|
|
||||||
console.log("Detect Server:", bds.detect());
|
|
||||||
console.log("Kill Server:", bds.kill());
|
|
||||||
console.log("Get Config:", bds.get_config());
|
|
||||||
console.log("Start:", bds.start());
|
|
||||||
setTimeout(() => {
|
|
||||||
console.log("Kill Server:", bds.kill());
|
|
||||||
setTimeout(() => process.exit(0), 1000);
|
|
||||||
}, 1 * 30 * 1000);
|
|
||||||
} catch (err) {
|
|
||||||
console.log("Detect Error:", err);
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
})()
|
|
@ -1,10 +1,5 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
Docker/
|
|
||||||
!Docker/root_path
|
|
||||||
.git/
|
.git/
|
||||||
Docker.sh
|
|
||||||
BuildRunDocker.js
|
|
||||||
docker_config.json
|
|
||||||
*.log
|
*.log
|
||||||
Test
|
Test
|
||||||
test
|
test
|
@ -1,2 +0,0 @@
|
|||||||
test/**
|
|
||||||
Docker/
|
|
6
.github/ChangeVersion.js
vendored
6
.github/ChangeVersion.js
vendored
@ -1,6 +0,0 @@
|
|||||||
const fs = require('fs');
|
|
||||||
const Package_JSon = JSON.parse(fs.readFileSync(process.cwd()+'/package.json', 'utf8'));
|
|
||||||
const run_ID = process.env.RunID || "1111111111111111111111111111111111111";
|
|
||||||
Package_JSon.version = `${run_ID.slice(0, 2)}.${run_ID.slice(3, 6)}.${run_ID.slice(7, 11)}`;
|
|
||||||
fs.writeFileSync(process.cwd()+'/package.json', JSON.stringify(Package_JSon, null, 2));
|
|
||||||
console.log(Package_JSon.version);
|
|
12
.github/dependabot.yml
vendored
12
.github/dependabot.yml
vendored
@ -1,10 +1,10 @@
|
|||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: npm
|
||||||
directory: "/"
|
directory: /
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: daily
|
||||||
- package-ecosystem: "github-actions"
|
- package-ecosystem: github-actions
|
||||||
directory: "/"
|
directory: /
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: daily
|
||||||
|
35
.github/workflows/PullRequest.yml
vendored
35
.github/workflows/PullRequest.yml
vendored
@ -1,31 +1,10 @@
|
|||||||
name: Docker And Node Test
|
name: Docker And Node Test
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
CodeQL:
|
|
||||||
name: Analyze
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v1
|
|
||||||
with:
|
|
||||||
languages: "javascript"
|
|
||||||
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v1
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v1
|
|
||||||
|
|
||||||
Node:
|
Node:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
@ -42,10 +21,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
- name: Edit Version
|
- name: Edit Version to next release
|
||||||
env:
|
if: github.event_name != 'release'
|
||||||
RunID: ${{ github.run_id }}
|
shell: node {0}
|
||||||
run: node .github/ChangeVersion.js
|
run: |
|
||||||
|
const fs = require("fs");
|
||||||
|
const JsonPackage = JSON.parse(fs.readFileSync(process.cwd()+"/package.json", "utf8"));
|
||||||
|
const run_ID = "${{ github.run_id }}";
|
||||||
|
JsonPackage.version = `${run_ID.slice(0, 2)}.${run_ID.slice(3, 6)}.${run_ID.slice(7, 11)}`;
|
||||||
|
fs.writeFileSync(process.cwd()+"/package.json", JSON.stringify(JsonPackage, null, 2));
|
||||||
|
console.log("New Version to Package:", JsonPackage.version);
|
||||||
|
|
||||||
- name: Install node depedencies
|
- name: Install node depedencies
|
||||||
run: npm install --no-save
|
run: npm install --no-save
|
||||||
|
107
.github/workflows/main.yml
vendored
107
.github/workflows/main.yml
vendored
@ -1,107 +0,0 @@
|
|||||||
name: Publish dev npm package and Docker Image
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
DOCKER_ARCH: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
CodeQL:
|
|
||||||
name: Analyze
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v1
|
|
||||||
with:
|
|
||||||
languages: "javascript"
|
|
||||||
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v1
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v1
|
|
||||||
|
|
||||||
npm:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@master
|
|
||||||
- name: Npm and Node Setup
|
|
||||||
uses: actions/setup-node@v2.5.0
|
|
||||||
with:
|
|
||||||
node-version: 16.x
|
|
||||||
registry-url: https://registry.npmjs.org/
|
|
||||||
|
|
||||||
- name: Edit Version
|
|
||||||
env:
|
|
||||||
RunID: ${{ github.run_id }}
|
|
||||||
run: node .github/ChangeVersion.js
|
|
||||||
|
|
||||||
- name: Install Packages
|
|
||||||
run: npm install
|
|
||||||
|
|
||||||
- name: Install node depedencies
|
|
||||||
run: npm run esm_module
|
|
||||||
|
|
||||||
- name: NPM Publish
|
|
||||||
run: npm publish --tag dev
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: '${{ secrets.NPM_ORG_TOKEN }}'
|
|
||||||
|
|
||||||
DockerImage:
|
|
||||||
needs:
|
|
||||||
- npm
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Build Docker Image to Bds Core and Bds Base
|
|
||||||
steps:
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: checkout
|
|
||||||
uses: actions/checkout@master
|
|
||||||
|
|
||||||
- name: Install Node Depedencies
|
|
||||||
run: npm install --no-save -d
|
|
||||||
|
|
||||||
- name: Install node depedencies
|
|
||||||
run: npm run esm_module
|
|
||||||
|
|
||||||
- name: Get And Export Release Version
|
|
||||||
shell: node -p '{0}'
|
|
||||||
run: |
|
|
||||||
const version = require("./package.json").version;
|
|
||||||
const ActionsCore = require("@actions/core");
|
|
||||||
console.log(version);
|
|
||||||
ActionsCore.exportVariable("BdsCoreVersion", version);
|
|
||||||
|
|
||||||
- name: Build Docker image (Bds Maneger Base)
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
target: bdsbase
|
|
||||||
tags: ghcr.io/the-bds-maneger/base:main
|
|
||||||
platforms: ${{ env.DOCKER_ARCH }}
|
|
||||||
|
|
||||||
- name: Build Docker image (Bds Maneger core)
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
target: bdscore
|
|
||||||
cache-from: ghcr.io/the-bds-maneger/base:main
|
|
||||||
tags: ghcr.io/the-bds-maneger/core:main
|
|
||||||
platforms: ${{ env.DOCKER_ARCH }}
|
|
83
.github/workflows/relelases.yml
vendored
83
.github/workflows/relelases.yml
vendored
@ -1,83 +0,0 @@
|
|||||||
name: Publish Releases
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types:
|
|
||||||
- created
|
|
||||||
|
|
||||||
env:
|
|
||||||
DOCKER_ARCH: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
npm:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: ${{ github.actor }} == ${{ github.repository_owner }} && (contains('tag', ${{ github.ref }}) && contains('v', ${{ github.ref }}) || contains('V', ${{ github.ref }}))
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
- uses: actions/setup-node@v2.5.0
|
|
||||||
with:
|
|
||||||
node-version: 16.x
|
|
||||||
registry-url: https://registry.npmjs.org/
|
|
||||||
|
|
||||||
- name: Install Depedencies
|
|
||||||
run: npm install --no-save
|
|
||||||
|
|
||||||
- name: Install node depedencies
|
|
||||||
run: npm run esm_module
|
|
||||||
|
|
||||||
- name: Publish
|
|
||||||
continue-on-error: true
|
|
||||||
run: npm publish
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: '${{ secrets.NPM_ORG_TOKEN }}'
|
|
||||||
|
|
||||||
- name: Remove Dev Versions
|
|
||||||
run: npm run cirelease
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: '${{ secrets.NPM_ORG_TOKEN }}'
|
|
||||||
|
|
||||||
DockerImage:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Build Docker Image to Bds Core and Bds Base
|
|
||||||
steps:
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: checkout
|
|
||||||
uses: actions/checkout@master
|
|
||||||
|
|
||||||
- name: Install Node Depedencies
|
|
||||||
run: npm install --no-save -d
|
|
||||||
|
|
||||||
- name: Get And Export Release Version
|
|
||||||
run: node .Build/SetCIEnvs.js
|
|
||||||
|
|
||||||
- name: Build Docker image (Bds Maneger Base)
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
target: bdsbase
|
|
||||||
tags: |
|
|
||||||
ghcr.io/the-bds-maneger/base:latest
|
|
||||||
ghcr.io/the-bds-maneger/base:${{ env.BdsCoreVersion }}
|
|
||||||
platforms: ${{ env.DOCKER_ARCH }}
|
|
||||||
|
|
||||||
- name: Build Docker image (Bds Maneger core)
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
target: bdscore
|
|
||||||
cache-from: ghcr.io/the-bds-maneger/base:latest
|
|
||||||
tags: |
|
|
||||||
ghcr.io/the-bds-maneger/core:latest
|
|
||||||
ghcr.io/the-bds-maneger/core:${{ env.BdsCoreVersion }}
|
|
||||||
platforms: ${{ env.DOCKER_ARCH }}
|
|
184
.github/workflows/root.yml
vendored
Normal file
184
.github/workflows/root.yml
vendored
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
name: "Publish Packages"
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- released
|
||||||
|
jobs:
|
||||||
|
CodeQL:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: "javascript"
|
||||||
|
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node_version:
|
||||||
|
- 15.x
|
||||||
|
- 16.x
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Node.JS and NPM
|
||||||
|
uses: actions/setup-node@v2.5.0
|
||||||
|
with:
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
node-version: ${{ matrix.node_version }}
|
||||||
|
|
||||||
|
- name: Install Node Dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: npm test
|
||||||
|
|
||||||
|
npm:
|
||||||
|
name: Npm Publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [test]
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Node.JS and NPM
|
||||||
|
uses: actions/setup-node@v2.5.0
|
||||||
|
with:
|
||||||
|
node-version: 16.x
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
|
||||||
|
- name: Edit Version to next release
|
||||||
|
if: github.event_name != 'release'
|
||||||
|
shell: node {0}
|
||||||
|
run: |
|
||||||
|
const fs = require("fs");
|
||||||
|
const JsonPackage = JSON.parse(fs.readFileSync(process.cwd()+"/package.json", "utf8"));
|
||||||
|
const run_ID = "${{ github.run_id }}";
|
||||||
|
JsonPackage.version = `${run_ID.slice(0, 2)}.${run_ID.slice(3, 6)}.${run_ID.slice(7, 11)}`;
|
||||||
|
fs.writeFileSync(process.cwd()+"/package.json", JSON.stringify(JsonPackage, null, 2));
|
||||||
|
console.log("New Version to Package:", JsonPackage.version);
|
||||||
|
|
||||||
|
- name: Install Node Dependencies
|
||||||
|
run: npm install -d
|
||||||
|
|
||||||
|
- name: ESM Modules
|
||||||
|
run: npm run esm_module
|
||||||
|
|
||||||
|
- name: Remove Dev Version
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
shell: node {0}
|
||||||
|
run: |
|
||||||
|
const child_process = require("child_process");
|
||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
const cli_color = require("cli-color");
|
||||||
|
(async function() {
|
||||||
|
global.fetch = (await import("node-fetch")).default;
|
||||||
|
fetch("https://registry.npmjs.org/@the-bds-maneger/core").then(res => res.json()).then(data => {
|
||||||
|
data.versions = Object.getOwnPropertyNames(data.versions).filter(version => /[0-9]+\.[0-9][0-9][0-9]/.test(version) && version !== data["dist-tags"].dev && version !== data["dist-tags"].latest)
|
||||||
|
fs.writeFileSync(path.resolve(__dirname, "Releases.json"), JSON.stringify(data, null, 2));
|
||||||
|
const Package = require("../package.json");
|
||||||
|
data.versions.map(version => {
|
||||||
|
const cmd = `npm unpublish ${Package.name}@${version}`;
|
||||||
|
console.log(cli_color.yellow(cmd));
|
||||||
|
try {
|
||||||
|
child_process.execSync(cmd).toString()
|
||||||
|
console.log(cli_color.green(`Sucess to remove ${Package.name}@${version}`, "\n"));
|
||||||
|
return cmd;
|
||||||
|
} catch (e) {
|
||||||
|
console.log(cli_color.red(`Failed to remove package: ${Package.name}@${version}`), "\n");
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fs.writeFileSync(path.resolve(__dirname, "Releases.json"), JSON.stringify(data, null, 2));
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
|
- name: Publish Package
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "release" ]];then
|
||||||
|
npm publish
|
||||||
|
else
|
||||||
|
npm publish --tag next
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Publish Docker Image
|
||||||
|
needs: [test]
|
||||||
|
steps:
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Edit Version to next release
|
||||||
|
if: github.event_name != 'release'
|
||||||
|
shell: node {0}
|
||||||
|
run: |
|
||||||
|
const fs = require("fs");
|
||||||
|
const JsonPackage = JSON.parse(fs.readFileSync(process.cwd()+"/package.json", "utf8"));
|
||||||
|
const run_ID = "${{ github.run_id }}";
|
||||||
|
JsonPackage.version = `${run_ID.slice(0, 2)}.${run_ID.slice(3, 6)}.${run_ID.slice(7, 11)}`;
|
||||||
|
fs.writeFileSync(process.cwd()+"/package.json", JSON.stringify(JsonPackage, null, 2));
|
||||||
|
console.log("New Version to Package:", JsonPackage.version);
|
||||||
|
|
||||||
|
|
||||||
|
- name: Get Version and Set in Env
|
||||||
|
shell: node {0}
|
||||||
|
run: |
|
||||||
|
const { version } = require("../package.json");
|
||||||
|
const ActionsCore = require("@actions/core");
|
||||||
|
console.log(version);
|
||||||
|
ActionsCore.exportVariable("CoreVersion", version);
|
||||||
|
|
||||||
|
- name: Install Node Dependencies
|
||||||
|
if: github.event_name != 'release'
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build Bds Maneger Core (Release)
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/the-bds-maneger/core:latest
|
||||||
|
ghcr.io/the-bds-maneger/core:${{ env.CoreVersion }}
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
|
||||||
|
- name: Build Bds Maneger Core (Main)
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
if: github.event_name != 'release'
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/the-bds-maneger/core:nightly
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
@ -1,2 +0,0 @@
|
|||||||
include:
|
|
||||||
- .gitlab/workflows/*.yml
|
|
@ -1,13 +0,0 @@
|
|||||||
terminal:
|
|
||||||
image: bdsmaneger/core:latest
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
before_script:
|
|
||||||
- apt update && apt install -y curl &> /dev/null
|
|
||||||
- curl https://get.docker.com | bash -
|
|
||||||
variables:
|
|
||||||
DOCKER_TLS_CERTDIR: ""
|
|
||||||
DOCKER_DRIVER: overlay2
|
|
||||||
DOCKER_HOST: tcp://docker:2375
|
|
||||||
DEVELOP_WEBIDE: true
|
|
||||||
script: sleep 80
|
|
@ -1,19 +0,0 @@
|
|||||||
Docker:
|
|
||||||
image: ubuntu:latest
|
|
||||||
variables:
|
|
||||||
DOCKER_TLS_CERTDIR: ""
|
|
||||||
DOCKER_DRIVER: overlay2
|
|
||||||
DOCKER_HOST: tcp://docker:2375
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
before_script:
|
|
||||||
- |
|
|
||||||
apt update && apt install -y curl &> /dev/null
|
|
||||||
curl https://get.docker.com | bash - &> /dev/null
|
|
||||||
docker info
|
|
||||||
docker run --privileged --rm tonistiigi/binfmt --install all
|
|
||||||
docker run --privileged --rm multiarch/qemu-user-static --reset -p yes
|
|
||||||
docker buildx create --name multiarch --driver docker-container --use
|
|
||||||
docker buildx inspect --bootstrap
|
|
||||||
script:
|
|
||||||
- docker buildx build -t bdsmaneger/maneger:latest --platform=linux/amd64,linux/arm64,linux/arm/v7 .
|
|
@ -11,7 +11,8 @@
|
|||||||
|
|
||||||
# test files
|
# test files
|
||||||
*.test
|
*.test
|
||||||
*test*.js*
|
*test*.*js
|
||||||
|
*Test*.*js
|
||||||
test/
|
test/
|
||||||
Test/
|
Test/
|
||||||
|
|
||||||
|
33
Dockerfile
33
Dockerfile
@ -1,16 +1,28 @@
|
|||||||
# Setup Bds Manerger Project Docker Base
|
FROM ubuntu:latest
|
||||||
FROM debian:testing AS bdsbase
|
|
||||||
USER root
|
USER root
|
||||||
ENV DEBIAN_FRONTEND="noninteractive" DOCKER_IMAGE="true"
|
ENV DEBIAN_FRONTEND="noninteractive" DOCKER_IMAGE="true"
|
||||||
|
|
||||||
# Copy Docker Files
|
# Install Core Packages
|
||||||
COPY .Build/Docker/* /tmp
|
RUN apt update && apt install -y curl wget git sudo unzip zip jq python3 xz-utils tar
|
||||||
|
|
||||||
# Configure BASE
|
# Install Node.js
|
||||||
RUN bash /tmp/Configure.sh
|
RUN NODEVERSION=$(curl -sL https://api.github.com/repos/nodejs/node/releases | grep tag_name | cut -d '"' -f 4 | sort -V | tail -n 1) && \
|
||||||
|
case $(uname -m) in x86_64 ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-x64.tar.xz" -O /tmp/node.tar.xz;;aarch64 ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-arm64.tar.xz" -O /tmp/node.tar.xz;;armv7l ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-armv7l.tar.xz" -O /tmp/node.tar.xz;;ppc64el ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-ppc64le.tar.xz" -O /tmp/node.tar.xz;;s390x ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-s390x.tar.xz" -O /tmp/node.tar.xz;;*) echo "Unsupported architecture"; exit 1;;esac && \
|
||||||
|
mkdir /tmp/Node && \
|
||||||
|
tar -xJf /tmp/node.tar.xz -C /tmp/Node && \
|
||||||
|
rm -rf /tmp/node.tar.xz && \
|
||||||
|
cp -rf /tmp/Node/*/* /usr && \
|
||||||
|
rm -rf /tmp/Node
|
||||||
|
|
||||||
# Setup bdsmaneger/core
|
# Update NPM
|
||||||
FROM bdsbase AS bdscore
|
RUN npm -g install npm@latest
|
||||||
|
|
||||||
|
# Install external Libries to ARM64
|
||||||
|
ARG LibrieZip="https://github.com/The-Bds-Maneger/external_files/raw/main/Linux/libs_amd64.zip"
|
||||||
|
RUN if ! [ "$(uname -m)" == "x86_64" ];then mkdir -p /lib64;apt install -y qemu-user-static;wget -q "${LibrieZip}" -O /tmp/libries.zip;unzip -o /tmp/libries.zip -d /;rm -rfv /tmp/libries.zip; fi
|
||||||
|
|
||||||
|
# Install Java
|
||||||
|
RUN case "$(apt search openjdk)" in *openjdk-17* ) apt install -y openjdk-17*;; *openjdk-11* ) apt install -y openjdk-11*;; * ) echo "No openjdk version found, skipping";;esac
|
||||||
|
|
||||||
# Create Volume to Storage Server And Config
|
# Create Volume to Storage Server And Config
|
||||||
VOLUME [ "/root/bds_core" ]
|
VOLUME [ "/root/bds_core" ]
|
||||||
@ -24,7 +36,7 @@ ENV PLAYERS="5" \
|
|||||||
ENABLE_COMMANDS="false" \
|
ENABLE_COMMANDS="false" \
|
||||||
ACCOUNT="false" \
|
ACCOUNT="false" \
|
||||||
SERVER="bedrock" \
|
SERVER="bedrock" \
|
||||||
UPDATE_SERVER="true"
|
SERVER_VERSION="true"
|
||||||
|
|
||||||
# Bds Maneger Core required ports
|
# Bds Maneger Core required ports
|
||||||
EXPOSE 19132/udp 19133/udp 1932/tcp
|
EXPOSE 19132/udp 19133/udp 1932/tcp
|
||||||
@ -38,8 +50,7 @@ RUN npm install
|
|||||||
|
|
||||||
# Copy BdsManger Core
|
# Copy BdsManger Core
|
||||||
COPY ./ ./
|
COPY ./ ./
|
||||||
RUN chmod a+x -v bin/*
|
RUN chmod a+x -vR bin/*
|
||||||
RUN npm run esm_module
|
|
||||||
|
|
||||||
# Set Entrypint
|
# Set Entrypint
|
||||||
ENTRYPOINT [ "node", "./bin/Docker.js" ]
|
ENTRYPOINT [ "node", "./bin/Docker.js" ]
|
||||||
|
104
bin/Docker.js
104
bin/Docker.js
@ -1,80 +1,50 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
process.env.BDS_DOCKER_IMAGE = true;
|
process.env.BDS_DOCKER_IMAGE = true;
|
||||||
const fs = require("fs");
|
|
||||||
|
|
||||||
const BdsCore = require("../index");
|
const BdsCore = require("../index");
|
||||||
const { GetPlatform } = require("../src/lib/BdsSettings");
|
|
||||||
const { CronJob } = require("cron");
|
const { CronJob } = require("cron");
|
||||||
const { PlatformVersionsV2 } = require("../src/BdsServersDownload");
|
|
||||||
|
|
||||||
// Get Current Tokens and Show in the console
|
async function UpdateInstallServer(OldServerRunner, pre_stop = () => {}) {
|
||||||
function ShowToken() {
|
if (process.env.SERVER_VERSION === "true") {
|
||||||
const TokenFilePath = BdsCore.BdsToken.TokenFile;
|
if (typeof pre_stop === "function") await pre_stop();
|
||||||
let Tokens = 1
|
if (typeof OldServerRunner === "function") {
|
||||||
if (fs.existsSync(TokenFilePath)) {
|
OldServerRunner.stop();
|
||||||
[...JSON.parse(fs.readFileSync(TokenFilePath, "utf8"))].slice(0, 5).forEach(token => {console.log(Tokens+":", "Bds API Token:", token.Token); Tokens++});
|
}
|
||||||
|
// Create Backup and Write
|
||||||
|
(BdsCore.BdsBackup.CreateBackup()).write_file()
|
||||||
|
const ServerDownloadResult = await BdsCore.BdsDownload("latest");
|
||||||
|
if (ServerDownloadResult.skip) {
|
||||||
|
console.log("Server Update Sucess, Version:", ServerDownloadResult.version);
|
||||||
|
}
|
||||||
|
return StartServer();
|
||||||
} else {
|
} else {
|
||||||
console.log(Tokens+":", "Bds API Token:", (BdsCore.BdsToken.CreateToken()).Token);
|
await BdsCore.BdsDownload(process.env.SERVER_VERSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function CheckAndUpdateServer() {
|
function StartServer() {
|
||||||
const LatestVersion = (await BdsCore.BdsDownload.PlatformVersionsV2()).latest;
|
let IsUpdate = false;
|
||||||
const LocalVersion = BdsCore.BdsSettings.GetServerVersion()[GetPlatform()];
|
const Server = BdsCore.BdsManegerServer.StartServer();
|
||||||
if (!LocalVersion) {
|
Server.on("log", data => {
|
||||||
console.log("Server is not installed, starting server implementation");
|
if (process.env.PULLIMAGE) {
|
||||||
const __InitInstall = await BdsCore.BdsDownload(true);
|
const { value: DataToTest, regex: IsRegex } = BdsCore.ExtraJSON.Extra.StartedServer[BdsCore.BdsSettings.GetPlatform()];
|
||||||
console.log("Installed Version:", __InitInstall.version, `Release Version: ${__InitInstall.data.getDate()}/${__InitInstall.data.getMonth()}/${__InitInstall.data.getFullYear()}`);
|
if (IsRegex) {
|
||||||
} else if (LocalVersion !== LatestVersion) {
|
if (RegExp(DataToTest, "gi").test(data)) {
|
||||||
console.log("Server is out of date, starting server implementation");
|
return Server.stop();
|
||||||
const __UpdateInstall = await BdsCore.BdsDownload(true);
|
|
||||||
console.log("Updated Version:", __UpdateInstall.version, `Release Version: ${__UpdateInstall.data.getDate()}/${__UpdateInstall.data.getMonth()}/${__UpdateInstall.data.getFullYear()}`);
|
|
||||||
}
|
}
|
||||||
}
|
} else return Server.stop();
|
||||||
|
|
||||||
async function StartServer(){
|
|
||||||
ShowToken();
|
|
||||||
console.log("The entire log can be accessed via the api and/or the docker log");
|
|
||||||
const ServerStarted = BdsCore.BdsManegerServer.StartServer();
|
|
||||||
BdsCore.BdsManegerAPI.api();
|
|
||||||
ServerStarted.on("log", a => process.stdout.write(a));
|
|
||||||
ServerStarted.on("exit", code => process.exit(code));
|
|
||||||
if (process.env.PULL_REQUEST === "true") {
|
|
||||||
console.log((require("cli-color")).red("Pull Request Actived 1 Min to exit"));
|
|
||||||
setTimeout(() => {
|
|
||||||
ServerStarted.stop();
|
|
||||||
}, 1 * 60 * 1000)
|
|
||||||
}
|
|
||||||
new CronJob("0 */1 * * *", async () => {
|
|
||||||
try {
|
|
||||||
const CurrentLocalVersion = BdsCore.BdsSettings.GetServerVersion()[GetPlatform()],
|
|
||||||
CurrentRemoteVersion = (await PlatformVersionsV2(GetPlatform())).latest;
|
|
||||||
if (CurrentLocalVersion !== CurrentRemoteVersion) {
|
|
||||||
let currenttime = `Hello we are starting the server upgrade from version ${CurrentLocalVersion} to version ${CurrentRemoteVersion}, you have 20 seconds to exit the server`
|
|
||||||
console.log("Update Server:", currenttime);
|
|
||||||
ServerStarted.say(currenttime);
|
|
||||||
let countdown = 20;
|
|
||||||
while (countdown > 1) {
|
|
||||||
currenttime = `${countdown} seconds remaining to stop Server!`;
|
|
||||||
console.log(currenttime);
|
|
||||||
ServerStarted.say(currenttime);
|
|
||||||
countdown--;
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
||||||
}
|
|
||||||
currenttime = "Stopping the server"
|
|
||||||
console.log(currenttime);
|
|
||||||
ServerStarted.say(currenttime);
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 600));
|
|
||||||
ServerStarted.stop();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
}
|
||||||
|
return process.stdout.write(data)
|
||||||
|
});
|
||||||
|
Server.on("exit", code => {
|
||||||
|
if (!IsUpdate) process.exit(code);
|
||||||
|
});
|
||||||
|
new CronJob("*/1 * * * *", async () => {
|
||||||
|
console.log("Checking for updates...");
|
||||||
|
await UpdateInstallServer(Server, () => IsUpdate = true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function RenderCLI(){
|
function WriteServerConfig() {
|
||||||
await CheckAndUpdateServer();
|
|
||||||
const { DESCRIPTION, WORLD_NAME, GAMEMODE, DIFFICULTY, ACCOUNT, PLAYERS, SERVER, ENABLE_COMMANDS } = process.env;
|
const { DESCRIPTION, WORLD_NAME, GAMEMODE, DIFFICULTY, ACCOUNT, PLAYERS, SERVER, ENABLE_COMMANDS } = process.env;
|
||||||
BdsCore.BdsSettings.UpdatePlatform(SERVER || "bedrock");
|
BdsCore.BdsSettings.UpdatePlatform(SERVER || "bedrock");
|
||||||
const ServerConfig = {
|
const ServerConfig = {
|
||||||
@ -90,6 +60,10 @@ async function RenderCLI(){
|
|||||||
portv6: 19133,
|
portv6: 19133,
|
||||||
}
|
}
|
||||||
BdsCore.BdsServerSettings.config(ServerConfig);
|
BdsCore.BdsServerSettings.config(ServerConfig);
|
||||||
await StartServer();
|
|
||||||
}
|
}
|
||||||
RenderCLI();
|
|
||||||
|
(async () => {
|
||||||
|
WriteServerConfig();
|
||||||
|
await UpdateInstallServer();
|
||||||
|
StartServer();
|
||||||
|
})();
|
||||||
|
2
index.js
2
index.js
@ -3,7 +3,7 @@
|
|||||||
// Load Root JSON
|
// Load Root JSON
|
||||||
const BdsManegerCoreJSONs = {
|
const BdsManegerCoreJSONs = {
|
||||||
Package: require("./package.json"),
|
Package: require("./package.json"),
|
||||||
Extra: require("./BdsManegerInfo.json")
|
Extra: require("./src/BdsManegerInfo.json")
|
||||||
};
|
};
|
||||||
|
|
||||||
// Bds Maneger Core Version
|
// Bds Maneger Core Version
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Mount Module Oject
|
// Mount Module Oject
|
||||||
const ModuleExport = {}
|
const ModuleExport = {}
|
||||||
import package_json from "./package.json";
|
import package_json from "./package.json";
|
||||||
import BdsManegerInfo from "./BdsManegerInfo.json";
|
import BdsManegerInfo from "./src/BdsManegerInfo.json";
|
||||||
|
|
||||||
const BdsManegerCoreJSONs = {
|
const BdsManegerCoreJSONs = {
|
||||||
Package: package_json,
|
Package: package_json,
|
||||||
|
213
package-lock.json
generated
213
package-lock.json
generated
@ -15,8 +15,8 @@
|
|||||||
"android"
|
"android"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/storage-blob": "^12.6.0",
|
|
||||||
"@iarna/toml": "^2.2.5",
|
"@iarna/toml": "^2.2.5",
|
||||||
|
"@the-bds-maneger/clouds_uploads": "^0.1.0",
|
||||||
"adm-zip": "^0.5.1",
|
"adm-zip": "^0.5.1",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"cli-color": "^2.0.0",
|
"cli-color": "^2.0.0",
|
||||||
@ -27,13 +27,11 @@
|
|||||||
"express-fileupload": "^1.2.1",
|
"express-fileupload": "^1.2.1",
|
||||||
"express-prettify": "^0.1.1",
|
"express-prettify": "^0.1.1",
|
||||||
"express-rate-limit": "^5.5.1",
|
"express-rate-limit": "^5.5.1",
|
||||||
"googleapis": "^92.0.0",
|
|
||||||
"inquirer": "^8.1.5",
|
"inquirer": "^8.1.5",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"node-cron": "^3.0.0",
|
"node-cron": "^3.0.0",
|
||||||
"node-fetch": "^3.0.0",
|
"node-fetch": "^3.0.0",
|
||||||
"oci-sdk": "^2.0.0",
|
|
||||||
"ora": "^6.0.1",
|
"ora": "^6.0.1",
|
||||||
"properties-to-json": "^0.2.1",
|
"properties-to-json": "^0.2.1",
|
||||||
"request-ip": "^2.1.3",
|
"request-ip": "^2.1.3",
|
||||||
@ -103,9 +101,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@azure/core-http": {
|
"node_modules/@azure/core-http": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.2.tgz",
|
||||||
"integrity": "sha512-DCXm8OTNhPxErNvwuNgd9r/W+LjMrHHNc9/q4QgIOpCaoBvpJd1O5Nl2gbAhrwfiwmEBNWHMeGoe5+g3Lx2H/A==",
|
"integrity": "sha512-V1DdoO9V/sFimKpdWoNBgsE+QUjQgpXYnxrTdUp5RyhsTJjvEVn/HKmTQXIHuLUUo6IyIWj+B+Dg4VaXse9dIA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/abort-controller": "^1.0.0",
|
"@azure/abort-controller": "^1.0.0",
|
||||||
"@azure/core-asynciterator-polyfill": "^1.0.0",
|
"@azure/core-asynciterator-polyfill": "^1.0.0",
|
||||||
@ -128,9 +126,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@azure/core-http/node_modules/node-fetch": {
|
"node_modules/@azure/core-http/node_modules/node-fetch": {
|
||||||
"version": "2.6.5",
|
"version": "2.6.6",
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
|
||||||
"integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==",
|
"integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"whatwg-url": "^5.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
},
|
},
|
||||||
@ -139,9 +137,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@azure/core-lro": {
|
"node_modules/@azure/core-lro": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.1.tgz",
|
||||||
"integrity": "sha512-TJo95eNT1dwYOPCb0m1C2zyxVlHuRRkKGeg9TKu8XMF2qh4v6c1weD63r9RVIrLdHdnSqS0n6PTXBpWoB8NqMw==",
|
"integrity": "sha512-HE6PBl+mlKa0eBsLwusHqAqjLc5n9ByxeDo3Hz4kF3B1hqHvRkBr4oMgoT6tX7Hc3q97KfDctDUon7EhvoeHPA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/abort-controller": "^1.0.0",
|
"@azure/abort-controller": "^1.0.0",
|
||||||
"@azure/core-tracing": "1.0.0-preview.13",
|
"@azure/core-tracing": "1.0.0-preview.13",
|
||||||
@ -177,14 +175,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@azure/logger": {
|
"node_modules/@azure/logger": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.3.tgz",
|
||||||
"integrity": "sha512-YZNjNV0vL3nN2nedmcjQBcpCTo3oqceXmgiQtEm6fLpucjRZyQKAQruhCmCpRlB1iykqKJJ/Y8CDmT5rIE6IJw==",
|
"integrity": "sha512-aK4s3Xxjrx3daZr3VylxejK3vG5ExXck5WOHDJ8in/k9AqlfIyFMMT1uG7u8mNjX+QRILTIn0/Xgschfh/dQ9g==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.0.0"
|
"tslib": "^2.2.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8.0.0"
|
"node": ">=12.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@azure/storage-blob": {
|
"node_modules/@azure/storage-blob": {
|
||||||
@ -2231,6 +2229,21 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@the-bds-maneger/clouds_uploads": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@the-bds-maneger/clouds_uploads/-/clouds_uploads-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-RART4i5EIZPp4vlPefPhnnAPtVY19x9Asl7Bx0Ol3O/ZhNR06TXRtJ3bzJFPGLkMQ4guhSYiClo6gNH0WMiTLg==",
|
||||||
|
"dependencies": {
|
||||||
|
"@azure/storage-blob": "^12.8.0",
|
||||||
|
"body-parser": "^1.19.0",
|
||||||
|
"cors": "^2.8.5",
|
||||||
|
"express": "^4.17.1",
|
||||||
|
"express-rate-limit": "^5.5.1",
|
||||||
|
"googleapis": "^92.0.0",
|
||||||
|
"oci-sdk": "^2.9.0",
|
||||||
|
"open": "^8.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/component-emitter": {
|
"node_modules/@types/component-emitter": {
|
||||||
"version": "1.2.11",
|
"version": "1.2.11",
|
||||||
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
|
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
|
||||||
@ -2605,9 +2618,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/agent-base/node_modules/debug": {
|
"node_modules/agent-base/node_modules/debug": {
|
||||||
"version": "4.3.2",
|
"version": "4.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
||||||
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
|
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ms": "2.1.2"
|
"ms": "2.1.2"
|
||||||
},
|
},
|
||||||
@ -3930,6 +3943,14 @@
|
|||||||
"integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==",
|
"integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/define-lazy-prop": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/define-properties": {
|
"node_modules/define-properties": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
||||||
@ -5143,9 +5164,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/gaxios/node_modules/node-fetch": {
|
"node_modules/gaxios/node_modules/node-fetch": {
|
||||||
"version": "2.6.5",
|
"version": "2.6.6",
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
|
||||||
"integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==",
|
"integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"whatwg-url": "^5.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
},
|
},
|
||||||
@ -5327,9 +5348,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/google-auth-library": {
|
"node_modules/google-auth-library": {
|
||||||
"version": "7.9.2",
|
"version": "7.10.2",
|
||||||
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-7.9.2.tgz",
|
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-7.10.2.tgz",
|
||||||
"integrity": "sha512-HjxbJt660a+YUTYAgYor87JCuBZvjUSNBExk4bXTEaMuCn8IHSDeHmFxKqThuDPrLCiKJp8blk/Ze8f7SI4N6g==",
|
"integrity": "sha512-M37o9Kxa/TLvOLgF71SXvLeVEP5sbSTmKl1zlIgl72SFy5PtsU3pOdu8G8MIHHpQ3/NZabDI8rQkA9DvQVKkPA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"arrify": "^2.0.0",
|
"arrify": "^2.0.0",
|
||||||
"base64-js": "^1.3.0",
|
"base64-js": "^1.3.0",
|
||||||
@ -5597,9 +5618,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/https-proxy-agent/node_modules/debug": {
|
"node_modules/https-proxy-agent/node_modules/debug": {
|
||||||
"version": "4.3.2",
|
"version": "4.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
||||||
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
|
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ms": "2.1.2"
|
"ms": "2.1.2"
|
||||||
},
|
},
|
||||||
@ -5940,6 +5961,20 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/is-docker": {
|
||||||
|
"version": "2.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
|
||||||
|
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
|
||||||
|
"bin": {
|
||||||
|
"is-docker": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/is-extendable": {
|
"node_modules/is-extendable": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
|
||||||
@ -6119,6 +6154,17 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/is-wsl": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
|
||||||
|
"dependencies": {
|
||||||
|
"is-docker": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/is-yarn-global": {
|
"node_modules/is-yarn-global": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz",
|
||||||
@ -8391,6 +8437,22 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/open": {
|
||||||
|
"version": "8.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz",
|
||||||
|
"integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"define-lazy-prop": "^2.0.0",
|
||||||
|
"is-docker": "^2.1.1",
|
||||||
|
"is-wsl": "^2.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/opossum": {
|
"node_modules/opossum": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/opossum/-/opossum-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/opossum/-/opossum-5.0.1.tgz",
|
||||||
@ -10906,9 +10968,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@azure/core-http": {
|
"@azure/core-http": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.2.tgz",
|
||||||
"integrity": "sha512-DCXm8OTNhPxErNvwuNgd9r/W+LjMrHHNc9/q4QgIOpCaoBvpJd1O5Nl2gbAhrwfiwmEBNWHMeGoe5+g3Lx2H/A==",
|
"integrity": "sha512-V1DdoO9V/sFimKpdWoNBgsE+QUjQgpXYnxrTdUp5RyhsTJjvEVn/HKmTQXIHuLUUo6IyIWj+B+Dg4VaXse9dIA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@azure/abort-controller": "^1.0.0",
|
"@azure/abort-controller": "^1.0.0",
|
||||||
"@azure/core-asynciterator-polyfill": "^1.0.0",
|
"@azure/core-asynciterator-polyfill": "^1.0.0",
|
||||||
@ -10928,9 +10990,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-fetch": {
|
"node-fetch": {
|
||||||
"version": "2.6.5",
|
"version": "2.6.6",
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
|
||||||
"integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==",
|
"integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"whatwg-url": "^5.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
}
|
}
|
||||||
@ -10938,9 +11000,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@azure/core-lro": {
|
"@azure/core-lro": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.1.tgz",
|
||||||
"integrity": "sha512-TJo95eNT1dwYOPCb0m1C2zyxVlHuRRkKGeg9TKu8XMF2qh4v6c1weD63r9RVIrLdHdnSqS0n6PTXBpWoB8NqMw==",
|
"integrity": "sha512-HE6PBl+mlKa0eBsLwusHqAqjLc5n9ByxeDo3Hz4kF3B1hqHvRkBr4oMgoT6tX7Hc3q97KfDctDUon7EhvoeHPA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@azure/abort-controller": "^1.0.0",
|
"@azure/abort-controller": "^1.0.0",
|
||||||
"@azure/core-tracing": "1.0.0-preview.13",
|
"@azure/core-tracing": "1.0.0-preview.13",
|
||||||
@ -10967,11 +11029,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@azure/logger": {
|
"@azure/logger": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.3.tgz",
|
||||||
"integrity": "sha512-YZNjNV0vL3nN2nedmcjQBcpCTo3oqceXmgiQtEm6fLpucjRZyQKAQruhCmCpRlB1iykqKJJ/Y8CDmT5rIE6IJw==",
|
"integrity": "sha512-aK4s3Xxjrx3daZr3VylxejK3vG5ExXck5WOHDJ8in/k9AqlfIyFMMT1uG7u8mNjX+QRILTIn0/Xgschfh/dQ9g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^2.0.0"
|
"tslib": "^2.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@azure/storage-blob": {
|
"@azure/storage-blob": {
|
||||||
@ -12418,6 +12480,21 @@
|
|||||||
"defer-to-connect": "^1.0.1"
|
"defer-to-connect": "^1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@the-bds-maneger/clouds_uploads": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@the-bds-maneger/clouds_uploads/-/clouds_uploads-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-RART4i5EIZPp4vlPefPhnnAPtVY19x9Asl7Bx0Ol3O/ZhNR06TXRtJ3bzJFPGLkMQ4guhSYiClo6gNH0WMiTLg==",
|
||||||
|
"requires": {
|
||||||
|
"@azure/storage-blob": "^12.8.0",
|
||||||
|
"body-parser": "^1.19.0",
|
||||||
|
"cors": "^2.8.5",
|
||||||
|
"express": "^4.17.1",
|
||||||
|
"express-rate-limit": "^5.5.1",
|
||||||
|
"googleapis": "^92.0.0",
|
||||||
|
"oci-sdk": "^2.9.0",
|
||||||
|
"open": "^8.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/component-emitter": {
|
"@types/component-emitter": {
|
||||||
"version": "1.2.11",
|
"version": "1.2.11",
|
||||||
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
|
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
|
||||||
@ -12742,9 +12819,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": {
|
"debug": {
|
||||||
"version": "4.3.2",
|
"version": "4.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
||||||
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
|
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"ms": "2.1.2"
|
"ms": "2.1.2"
|
||||||
}
|
}
|
||||||
@ -13744,6 +13821,11 @@
|
|||||||
"integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==",
|
"integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"define-lazy-prop": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og=="
|
||||||
|
},
|
||||||
"define-properties": {
|
"define-properties": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
||||||
@ -14693,9 +14775,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-fetch": {
|
"node-fetch": {
|
||||||
"version": "2.6.5",
|
"version": "2.6.6",
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
|
||||||
"integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==",
|
"integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"whatwg-url": "^5.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
}
|
}
|
||||||
@ -14827,9 +14909,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"google-auth-library": {
|
"google-auth-library": {
|
||||||
"version": "7.9.2",
|
"version": "7.10.2",
|
||||||
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-7.9.2.tgz",
|
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-7.10.2.tgz",
|
||||||
"integrity": "sha512-HjxbJt660a+YUTYAgYor87JCuBZvjUSNBExk4bXTEaMuCn8IHSDeHmFxKqThuDPrLCiKJp8blk/Ze8f7SI4N6g==",
|
"integrity": "sha512-M37o9Kxa/TLvOLgF71SXvLeVEP5sbSTmKl1zlIgl72SFy5PtsU3pOdu8G8MIHHpQ3/NZabDI8rQkA9DvQVKkPA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"arrify": "^2.0.0",
|
"arrify": "^2.0.0",
|
||||||
"base64-js": "^1.3.0",
|
"base64-js": "^1.3.0",
|
||||||
@ -15035,9 +15117,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": {
|
"debug": {
|
||||||
"version": "4.3.2",
|
"version": "4.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
||||||
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
|
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"ms": "2.1.2"
|
"ms": "2.1.2"
|
||||||
}
|
}
|
||||||
@ -15277,6 +15359,11 @@
|
|||||||
"kind-of": "^6.0.2"
|
"kind-of": "^6.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"is-docker": {
|
||||||
|
"version": "2.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
|
||||||
|
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="
|
||||||
|
},
|
||||||
"is-extendable": {
|
"is-extendable": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
|
||||||
@ -15393,6 +15480,14 @@
|
|||||||
"integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
|
"integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"is-wsl": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
|
||||||
|
"requires": {
|
||||||
|
"is-docker": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"is-yarn-global": {
|
"is-yarn-global": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz",
|
||||||
@ -17371,6 +17466,16 @@
|
|||||||
"mimic-fn": "^2.1.0"
|
"mimic-fn": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"open": {
|
||||||
|
"version": "8.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz",
|
||||||
|
"integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==",
|
||||||
|
"requires": {
|
||||||
|
"define-lazy-prop": "^2.0.0",
|
||||||
|
"is-docker": "^2.1.1",
|
||||||
|
"is-wsl": "^2.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"opossum": {
|
"opossum": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/opossum/-/opossum-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/opossum/-/opossum-5.0.1.tgz",
|
||||||
|
@ -14,11 +14,9 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node bin/bds_maneger.js -sk",
|
"start": "node bin/bds_maneger.js -sk",
|
||||||
"test": "mocha --exit .test/*.js",
|
"test": "mocha --exit .test/*.js",
|
||||||
"ci": "node .Build/test/ci.js",
|
|
||||||
"esm_module": "cjs2esm",
|
"esm_module": "cjs2esm",
|
||||||
"eslint": "eslint --debug --fix .",
|
"eslint": "eslint --debug --fix .",
|
||||||
"Docker": "docker-compose build && docker-compose up",
|
"Docker": "docker-compose build && docker-compose up"
|
||||||
"cirelease": "node .Build/RemoveVersions.js"
|
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"bds_maneger": "bin/BdsManeger.js"
|
"bds_maneger": "bin/BdsManeger.js"
|
||||||
@ -53,8 +51,8 @@
|
|||||||
"android"
|
"android"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/storage-blob": "^12.6.0",
|
|
||||||
"@iarna/toml": "^2.2.5",
|
"@iarna/toml": "^2.2.5",
|
||||||
|
"@the-bds-maneger/clouds_uploads": "^0.1.0",
|
||||||
"adm-zip": "^0.5.1",
|
"adm-zip": "^0.5.1",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"cli-color": "^2.0.0",
|
"cli-color": "^2.0.0",
|
||||||
@ -65,13 +63,11 @@
|
|||||||
"express-fileupload": "^1.2.1",
|
"express-fileupload": "^1.2.1",
|
||||||
"express-prettify": "^0.1.1",
|
"express-prettify": "^0.1.1",
|
||||||
"express-rate-limit": "^5.5.1",
|
"express-rate-limit": "^5.5.1",
|
||||||
"googleapis": "^92.0.0",
|
|
||||||
"inquirer": "^8.1.5",
|
"inquirer": "^8.1.5",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"node-cron": "^3.0.0",
|
"node-cron": "^3.0.0",
|
||||||
"node-fetch": "^3.0.0",
|
"node-fetch": "^3.0.0",
|
||||||
"oci-sdk": "^2.0.0",
|
|
||||||
"ora": "^6.0.1",
|
"ora": "^6.0.1",
|
||||||
"properties-to-json": "^0.2.1",
|
"properties-to-json": "^0.2.1",
|
||||||
"request-ip": "^2.1.3",
|
"request-ip": "^2.1.3",
|
||||||
|
@ -64,11 +64,13 @@ function CreateBackup() {
|
|||||||
|
|
||||||
// Zip Buffer
|
// Zip Buffer
|
||||||
const ZipBuffer = zip.toBuffer();
|
const ZipBuffer = zip.toBuffer();
|
||||||
fs.writeFileSync(PathBackup, ZipBuffer, "binary");
|
|
||||||
return {
|
return {
|
||||||
file_path: PathBackup,
|
file_path: PathBackup,
|
||||||
Buffer: ZipBuffer,
|
Buffer: ZipBuffer,
|
||||||
file_name: ZipName,
|
file_name: ZipName,
|
||||||
|
write_file: () => {
|
||||||
|
fs.writeFileSync(PathBackup, ZipBuffer, "binary");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,23 +2,16 @@ const child_process = require("child_process");
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const { randomUUID } = require("crypto");
|
const { randomUUID } = require("crypto");
|
||||||
const { Backup } = require("./BdsBackup");
|
const BdsBackup = require("./BdsBackup");
|
||||||
const { CronJob } = require("cron");
|
const { CronJob } = require("cron");
|
||||||
const BdsSettings = require("../src/lib/BdsSettings");
|
const BdsSettings = require("../src/lib/BdsSettings");
|
||||||
|
|
||||||
const PlayerJson = require("./ManegerServer/Players_json");
|
const PlayerJson = require("./ManegerServer/Players_json");
|
||||||
const BasicCommands = require("./ManegerServer/BasicCommands");
|
const BasicCommands = require("./ManegerServer/BasicCommands");
|
||||||
|
|
||||||
const ServerSessions = {};
|
const ServerSessions = {};
|
||||||
module.exports.GetSessions = () => ServerSessions;
|
|
||||||
module.exports.GetSessionsArray = () => Object.keys(ServerSessions).map(key => ServerSessions[key]);
|
|
||||||
|
|
||||||
const PlayersCallbacks = [];
|
const PlayersCallbacks = [];
|
||||||
module.exports.RegisterPlayerGlobalyCallbacks = function RegisterPlayerGlobalyCallbacks(callback){
|
|
||||||
PlayersCallbacks.push(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports.StartServer = function start() {
|
function StartServer() {
|
||||||
const commandExists = require("../src/lib/commandExist");
|
const commandExists = require("../src/lib/commandExist");
|
||||||
const io = require("./api").SocketIO;
|
const io = require("./api").SocketIO;
|
||||||
const CurrentBdsPlatform = BdsSettings.GetPlatform();
|
const CurrentBdsPlatform = BdsSettings.GetPlatform();
|
||||||
@ -239,28 +232,26 @@ module.exports.StartServer = function start() {
|
|||||||
return returnFuntion;
|
return returnFuntion;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.CronBackups = BdsSettings.GetCronBackup().map(Crron => {
|
const CronBackups = BdsSettings.GetCronBackup().map(CronConfig => {
|
||||||
const Cloud_Backup = {
|
if (!CronConfig.enabled) return;
|
||||||
Azure: require("./clouds/Azure").Uploadbackups,
|
const BackupUpload = require("@the-bds-maneger/clouds_uploads");
|
||||||
Driver: require("./clouds/GoogleDriver").Uploadbackups,
|
return new CronJob(CronConfig.cron, async () => {
|
||||||
Oracle: require("./clouds/OracleCI").Uploadbackups,
|
console.log("Starting Backup, Cron:", CronConfig.cron);
|
||||||
}
|
const CurrentBackup = BdsBackup.CreateBackup();
|
||||||
//
|
const BackupClass = new BackupUpload(CurrentBackup.Buffer, CurrentBackup.file_name);
|
||||||
return {
|
BackupClass.upload.GoogleDriver = CronConfig.Driver;
|
||||||
CronFunction: new CronJob(Crron.cron, async () => {
|
BackupClass.upload.OracleCloudInfrastructure = CronConfig.Oracle;
|
||||||
console.log("Starting Server and World Backup");
|
BackupClass.upload.Azure = CronConfig.Azure;
|
||||||
const CurrentBackup = Backup();
|
return await BackupClass.Start();
|
||||||
// Azure
|
});
|
||||||
if (Crron.Azure) Cloud_Backup.Azure(CurrentBackup.file_name, CurrentBackup.file_path);
|
|
||||||
else console.info("Azure Backup Disabled");
|
|
||||||
|
|
||||||
// Google Driver
|
|
||||||
if (Crron.Driver) Cloud_Backup.Driver(CurrentBackup.file_name, CurrentBackup.file_path);
|
|
||||||
else console.info("Google Driver Backup Disabled");
|
|
||||||
|
|
||||||
// Oracle Bucket
|
|
||||||
if (Crron.Oracle) Cloud_Backup.Oracle(CurrentBackup.file_name, CurrentBackup.file_path);
|
|
||||||
else console.info("Oracle Bucket Backup Disabled");
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
GetSessions: () => ServerSessions,
|
||||||
|
GetSessionsArray: () => Object.keys(ServerSessions).map(key => ServerSessions[key]),
|
||||||
|
RegisterPlayerGlobalyCallbacks: function RegisterPlayerGlobalyCallbacks(callback){
|
||||||
|
PlayersCallbacks.push(callback);
|
||||||
|
},
|
||||||
|
StartServer: StartServer,
|
||||||
|
CronBackups: CronBackups
|
||||||
|
}
|
@ -4,7 +4,7 @@ const { writeFileSync, existsSync, readFileSync, readdirSync, rmSync } = fs;
|
|||||||
const { join, resolve } = path;
|
const { join, resolve } = path;
|
||||||
var AdmZip = require("adm-zip");
|
var AdmZip = require("adm-zip");
|
||||||
const { GetServerPaths, GetPlatform } = require("../src/lib/BdsSettings");
|
const { GetServerPaths, GetPlatform } = require("../src/lib/BdsSettings");
|
||||||
const Extra = require("../BdsManegerInfo.json");
|
const Extra = require("./BdsManegerInfo.json");
|
||||||
const bds = require("../index");
|
const bds = require("../index");
|
||||||
const Request = require("../src/lib/Requests");
|
const Request = require("../src/lib/Requests");
|
||||||
|
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
const fs = require("fs");
|
|
||||||
const { join } = require("path")
|
|
||||||
const { randomUUID } = require("crypto");
|
|
||||||
const express = require("express");
|
|
||||||
const { google } = require("googleapis");
|
|
||||||
|
|
||||||
const ip_andress = require("../../BdsNetwork");
|
|
||||||
const { bds_dir } = require("../../../src/lib/BdsSettings");
|
|
||||||
|
|
||||||
const PathToToken = join(bds_dir, "google_user_token.json");
|
|
||||||
|
|
||||||
// Urls
|
|
||||||
global.GoogleAuth = {}
|
|
||||||
|
|
||||||
async function LoadExpress(GoogleDriveCredentials, app = express(), closer = express().listen(1221)){
|
|
||||||
return new Promise((resolve => {
|
|
||||||
app.get("/request", (req, res) => {
|
|
||||||
const SessionUUID = randomUUID();
|
|
||||||
const secret = GoogleDriveCredentials.installed.client_secret;
|
|
||||||
const client = GoogleDriveCredentials.installed.client_id;
|
|
||||||
const redirect = `${req.protocol}://${req.headers.host}/${SessionUUID}/save`;
|
|
||||||
const oAuth2Client = new google.auth.OAuth2(client, secret, redirect);
|
|
||||||
global.GoogleAuth[SessionUUID] = oAuth2Client;
|
|
||||||
res.redirect(oAuth2Client.generateAuthUrl({
|
|
||||||
access_type: "offline",
|
|
||||||
scope: [
|
|
||||||
"https://www.googleapis.com/auth/drive"
|
|
||||||
]
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
app.get("/:SessionUUID/save", (req, res) => {
|
|
||||||
const { code } = req.query;
|
|
||||||
const { SessionUUID } = req.params;
|
|
||||||
// http://localhost:6899/save?code=********************************************************************&scope=https://www.googleapis.com/auth/drive
|
|
||||||
|
|
||||||
const oAuth2Client = global.GoogleAuth[SessionUUID];
|
|
||||||
oAuth2Client.getToken(code, (err, save_token) => {
|
|
||||||
if (err) return console.error("Error accessing keys and saving, Error:", err);
|
|
||||||
oAuth2Client.setCredentials(save_token);
|
|
||||||
// Save Token File
|
|
||||||
fs.writeFile(PathToToken, JSON.stringify(save_token, null, 4), function (err){
|
|
||||||
if (err) {
|
|
||||||
console.error("We were unable to save json, please try again later");
|
|
||||||
return closer();
|
|
||||||
}
|
|
||||||
res.json({
|
|
||||||
"token": save_token,
|
|
||||||
status: "success"
|
|
||||||
})
|
|
||||||
closer.close()
|
|
||||||
resolve(oAuth2Client);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
app.all("*", ({res}) => res.redirect("/request"));
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
function RandomPort(){
|
|
||||||
let Port = parseInt(Math.random().toString().replace(/[01]\./, "").slice(0, 4));
|
|
||||||
if (Port > 1024 && Port < 2542) return Port; else return RandomPort();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function authorize() {
|
|
||||||
return new Promise(async resolve => {
|
|
||||||
const GoogleDriveCredentials = (await (await fetch("https://raw.githubusercontent.com/The-Bds-Maneger/external_files/main/Credentials/Google.json")).json())
|
|
||||||
const client_secret = GoogleDriveCredentials.installed.client_secret;
|
|
||||||
const client_id = GoogleDriveCredentials.installed.client_id;
|
|
||||||
const redirect_uris = "http://localhost:1932/SaveToken"
|
|
||||||
const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uris);
|
|
||||||
fs.readFile(PathToToken, async (err, user_cred) => {
|
|
||||||
if (err) {
|
|
||||||
const app = express();
|
|
||||||
app.use(require("body-parser").json());
|
|
||||||
app.use(require("body-parser").urlencoded({ extended: true }));
|
|
||||||
app.use(require("express-rate-limit")({windowMs: 1 * 60 * 1000, max: 100}));
|
|
||||||
app.use(require("cors")());
|
|
||||||
const port = RandomPort();
|
|
||||||
ip_andress.internal_ip.forEach(ips => {
|
|
||||||
let { ipv4, ipv6 } = ips.Interna_IP;
|
|
||||||
console.log(`Open: http://${ipv4}:${port}/request`);
|
|
||||||
if (ipv6) console.log(`Open: http://[${ipv6}]:${port}/request`);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Return auth
|
|
||||||
const AuthToken = await LoadExpress(GoogleDriveCredentials, app, app.listen(port));
|
|
||||||
resolve(AuthToken);
|
|
||||||
} else {
|
|
||||||
oAuth2Client.setCredentials(JSON.parse(user_cred));
|
|
||||||
resolve(oAuth2Client);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
authorize,
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
const path = require("path");
|
|
||||||
const { BlobServiceClient, StorageSharedKeyCredential } = require("@azure/storage-blob");
|
|
||||||
const NewBdsSettings = require("../../src/lib/BdsSettings");
|
|
||||||
|
|
||||||
// Upload Function
|
|
||||||
async function Uploadbackups(object = "Backup.zip", fileLocation = "Backup.zip", callback = function (){}) {
|
|
||||||
return new Promise(async function(resolve, reject){
|
|
||||||
try {
|
|
||||||
const { Account, AccountKey, Container } = NewBdsSettings.GetCloudConfig("Azure");
|
|
||||||
const sharedKeyCredential = new StorageSharedKeyCredential(Account, AccountKey);
|
|
||||||
const blobClient = new BlobServiceClient(`https://${Account}.blob.core.windows.net`, sharedKeyCredential).getContainerClient(Container)
|
|
||||||
if (!(blobClient.exists())) await blobClient.create();
|
|
||||||
const containerClient = blobClient.getBlockBlobClient(path.resolve(object));
|
|
||||||
const Reponse = await containerClient.uploadFile(fileLocation, {
|
|
||||||
blockSize: 4 * 1024 * 1024,
|
|
||||||
concurrency: 20,
|
|
||||||
onProgress: (env) => console.log(env)
|
|
||||||
})
|
|
||||||
if (typeof callback === "function") callback(Reponse);
|
|
||||||
resolve(Reponse);
|
|
||||||
} catch (err) {
|
|
||||||
console.log(`uploadFile failed, requestId - ${err.details.requestId}, statusCode - ${err.statusCode}, errorCode - ${err.details.errorCode}`);
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
Uploadbackups
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
const fs = require("fs");
|
|
||||||
const { google } = require("googleapis");
|
|
||||||
const { authorize } = require("./Auth/Google");
|
|
||||||
const { GetCloudConfig } = require("../../src/lib/BdsSettings");
|
|
||||||
|
|
||||||
module.exports.Uploadbackups = async function (file_name = "Backup.zip", fileLocation = "Backup.zip", BackupCallback){
|
|
||||||
return new Promise(async function (resolve, reject){
|
|
||||||
const parent_id = GetCloudConfig("Driver").RootID
|
|
||||||
const UploadFile = {
|
|
||||||
resource: {
|
|
||||||
name: file_name
|
|
||||||
},
|
|
||||||
media: {
|
|
||||||
mimeType: "application/octet-stream",
|
|
||||||
body: fs.createReadStream(fileLocation)
|
|
||||||
},
|
|
||||||
fields: "id"
|
|
||||||
}
|
|
||||||
// Driver Root ID Backups
|
|
||||||
if (parent_id) UploadFile.resource.parents = [parent_id];
|
|
||||||
|
|
||||||
const auth = await authorize();
|
|
||||||
const drive = google.drive({version: "v3", auth});
|
|
||||||
drive.files.create(UploadFile, (err, file) => {
|
|
||||||
if (err) reject(err)
|
|
||||||
else {
|
|
||||||
console.log(`File URL: https://drive.google.com/file/d/${file.data.id}/`);
|
|
||||||
if (typeof BackupCallback === "function") BackupCallback(file);
|
|
||||||
resolve(`https://drive.google.com/file/d/${file.data.id}/`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
};
|
|
@ -1,41 +0,0 @@
|
|||||||
const oci_storage = require("oci-objectstorage");
|
|
||||||
const oci_common = require("oci-common");
|
|
||||||
const fs = require("fs");
|
|
||||||
const { resolve } = require("path");
|
|
||||||
const { CloudConfig } = require("../../src/lib/BdsSettings");
|
|
||||||
|
|
||||||
async function Uploadbackups(object = "Backup.zip", fileLocation = resolve(__dirname, "../Backup.zip"), callback = function (data){console.log(data)}){
|
|
||||||
return new Promise(async function (resolve, reject){
|
|
||||||
try {
|
|
||||||
const bucket = CloudConfig.Oracle().Bucket;
|
|
||||||
const provider = new oci_common.ConfigFileAuthenticationDetailsProvider();
|
|
||||||
const client = new oci_storage.ObjectStorageClient({
|
|
||||||
authenticationDetailsProvider: provider
|
|
||||||
});
|
|
||||||
const request = {};
|
|
||||||
const response = await client.getNamespace(request);
|
|
||||||
const namespace = response.value;
|
|
||||||
const stats = fs.statSync(fileLocation);
|
|
||||||
const nodeFsBlob = new oci_storage.NodeFSBlob(fileLocation, stats.size);
|
|
||||||
const objectData = await nodeFsBlob.getData();
|
|
||||||
const putObjectRequest = {
|
|
||||||
namespaceName: namespace,
|
|
||||||
bucketName: bucket,
|
|
||||||
putObjectBody: objectData,
|
|
||||||
objectName: object,
|
|
||||||
contentLength: stats.size
|
|
||||||
};
|
|
||||||
const putObjectResponse = await client.putObject(putObjectRequest);
|
|
||||||
console.log("File upload successful");
|
|
||||||
if (typeof callback === "function") return callback(putObjectResponse);
|
|
||||||
resolve(putObjectResponse);
|
|
||||||
} catch (error) {
|
|
||||||
console.log("Error ", error);
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
Uploadbackups,
|
|
||||||
}
|
|
@ -1,21 +1,25 @@
|
|||||||
const { join, basename } = require("path");
|
const fs = require("fs");
|
||||||
const { existsSync, writeFileSync, mkdirSync, readFileSync } = require("fs");
|
const path = require("path");
|
||||||
|
const { existsSync, writeFileSync, mkdirSync, readFileSync } = fs;
|
||||||
const { homedir } = require("os");
|
const { homedir } = require("os");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const deepmerge = require("deepmerge");
|
const deepmerge = require("deepmerge");
|
||||||
|
|
||||||
// PATHs
|
// PATHs
|
||||||
const home = homedir();
|
const home = homedir(),
|
||||||
const bds_dir = join(home, "bds_core");
|
bds_dir = path.join(home, "bds_core"),
|
||||||
if (!(existsSync(bds_dir))) mkdirSync(bds_dir, {recursive: true})
|
ExternalPlugins = path.join(bds_dir, "plugins");
|
||||||
|
|
||||||
|
if (!(existsSync(bds_dir))) fs.mkdirSync(bds_dir, {recursive: true});
|
||||||
|
if (!(existsSync(ExternalPlugins))) fs.mkdirSync(ExternalPlugins, {recursive: true});
|
||||||
|
|
||||||
// Config Base to Bds Maneger Core and others Projects
|
// Config Base to Bds Maneger Core and others Projects
|
||||||
var Config = {
|
var Config = {
|
||||||
paths: {
|
paths: {
|
||||||
servers: join(bds_dir, "Servers"),
|
servers: path.join(bds_dir, "Servers"),
|
||||||
backups: join(bds_dir, "Backups"),
|
backups: path.join(bds_dir, "Backups"),
|
||||||
log: join(bds_dir, "Logs"),
|
log: path.join(bds_dir, "Logs"),
|
||||||
player: join(bds_dir, "Players.json")
|
player: path.join(bds_dir, "Players.json")
|
||||||
},
|
},
|
||||||
bds: {
|
bds: {
|
||||||
enable_tmp_host: false
|
enable_tmp_host: false
|
||||||
@ -67,30 +71,6 @@ var Config = {
|
|||||||
pocketmine: true,
|
pocketmine: true,
|
||||||
jsprismarine: true,
|
jsprismarine: true,
|
||||||
spigot: true,
|
spigot: true,
|
||||||
},
|
|
||||||
{
|
|
||||||
username: "Alex",
|
|
||||||
bedrock: true,
|
|
||||||
java: true,
|
|
||||||
pocketmine: true,
|
|
||||||
jsprismarine: true,
|
|
||||||
spigot: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
username: "steve",
|
|
||||||
bedrock: true,
|
|
||||||
java: true,
|
|
||||||
pocketmine: true,
|
|
||||||
jsprismarine: true,
|
|
||||||
spigot: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
username: "alex",
|
|
||||||
bedrock: true,
|
|
||||||
java: true,
|
|
||||||
pocketmine: true,
|
|
||||||
jsprismarine: true,
|
|
||||||
spigot: true,
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
telegram: {
|
telegram: {
|
||||||
@ -101,7 +81,7 @@ var Config = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
const ConfigPath = join(bds_dir, "BdsConfig.yaml")
|
const ConfigPath = path.join(bds_dir, "BdsConfig.yaml")
|
||||||
|
|
||||||
const SaveConfig = () => writeFileSync(ConfigPath, yaml.dump(Config));
|
const SaveConfig = () => writeFileSync(ConfigPath, yaml.dump(Config));
|
||||||
process.on("exit", () => SaveConfig());
|
process.on("exit", () => SaveConfig());
|
||||||
@ -121,16 +101,16 @@ if (!(existsSync(Config.paths["servers"]))) mkdirSync(Config.paths["servers"], {
|
|||||||
|
|
||||||
// Server Paths
|
// Server Paths
|
||||||
const ServersPaths = {
|
const ServersPaths = {
|
||||||
bedrock: join(Config.paths.servers, "Bedrock"),
|
bedrock: path.join(Config.paths.servers, "Bedrock"),
|
||||||
java: join(Config.paths.servers, "Java"),
|
java: path.join(Config.paths.servers, "Java"),
|
||||||
pocketmine: join(Config.paths.servers, "Pocketmine-MP"),
|
pocketmine: path.join(Config.paths.servers, "Pocketmine-MP"),
|
||||||
dragonfly: join(Config.paths.servers, "Dragonfly_go"),
|
dragonfly: path.join(Config.paths.servers, "Dragonfly_go"),
|
||||||
spigot: join(Config.paths.servers, "Spigot")
|
spigot: path.join(Config.paths.servers, "Spigot")
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.getOwnPropertyNames(ServersPaths).map(Servers => ServersPaths[Servers]).forEach(Servers => {
|
Object.getOwnPropertyNames(ServersPaths).map(Servers => ServersPaths[Servers]).forEach(Servers => {
|
||||||
if (!(existsSync(Servers))) {
|
if (!(existsSync(Servers))) {
|
||||||
console.log(`Creating the ${basename(Servers)} Folder`);
|
console.log(`Creating the ${path.basename(Servers)} Folder`);
|
||||||
mkdirSync(Servers, {recursive: true})
|
mkdirSync(Servers, {recursive: true})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -267,6 +247,8 @@ if (!(existsSync(GetPaths("player")))) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
bds_dir: bds_dir,
|
bds_dir: bds_dir,
|
||||||
|
BdsDir: bds_dir,
|
||||||
|
ExternalPlugins: ExternalPlugins,
|
||||||
ServersPaths: ServersPaths,
|
ServersPaths: ServersPaths,
|
||||||
GetJsonConfig,
|
GetJsonConfig,
|
||||||
GetPaths,
|
GetPaths,
|
||||||
|
21
src/lib/LoadPlugin.js
Normal file
21
src/lib/LoadPlugin.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
const BdsSettings = require("./BdsSettings");
|
||||||
|
|
||||||
|
function LoadPlugins() {
|
||||||
|
return fs.readdirSync(BdsSettings.ExternalPlugins).filter(file => fs.fstatSync(path.join(BdsSettings.ExternalPlugins, file)).isFile()).map(files => {
|
||||||
|
try {
|
||||||
|
return require(path.join(BdsSettings.ExternalPlugins, files));
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}).filter(plugin => plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.plugin = LoadPlugins();
|
||||||
|
fs.watch(BdsSettings.ExternalPlugins, () => {
|
||||||
|
module.exports.plugin = LoadPlugins();
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports.LoadPlugins = LoadPlugins;
|
Reference in New Issue
Block a user