Web interface #525

Closed
Sirherobrine23 wants to merge 7 commits from web-interface into main
45 changed files with 1864 additions and 1104 deletions
Showing only changes of commit 0dbc7b16ba - Show all commits

View File

@ -1,38 +1,37 @@
#!/usr/bin/env node #!/usr/bin/env node
import { oracleBucket } from "@sirherobrine23/cloud"; import { oracleBucket } from "@sirherobrine23/cloud";
import { pipeline } from "node:stream/promises";
import extendsFS from "@sirherobrine23/extends"; import extendsFS from "@sirherobrine23/extends";
import path from "node:path";
import fs from "node:fs"; import fs from "node:fs";
const bucket = oracleBucket.oracleBucketPreAuth("sa-saopaulo-1", "grwodtg32n4d", "bdsFiles", process.env.ociauth || process.env.OCI_AUTHKEY); import path from "node:path";
import { finished } from "node:stream/promises";
const args = process.argv.slice(2).map(String); const args = process.argv.slice(2).map(String);
const bucket = oracleBucket.oracleBucketPreAuth("sa-saopaulo-1", "grwodtg32n4d", "bdsFiles", process.env.ociauth || process.env.OCI_AUTHKEY);
for (let argI = 0; argI < args.length; argI++) { /** @type {string} */
if (args.at(argI).startsWith("-")) continue; let arg;
const file = path.resolve(process.cwd(), args.at(argI)); while (!!(arg = args.shift())) {
if (!(await extendsFS.exists(file))) { if (arg.startsWith("-")) continue;
console.log("File %O dont exists!", file); let inPath, outPath;
if (args.at(argI + 1) && args.at(argI + 1).startsWith("-")) argI++; let index;
} if ((index = arg.indexOf(":")) === -1) outPath = path.relative(process.cwd(), (inPath = path.resolve(process.cwd(), arg)));
let filename = path.basename(args.at(argI)); else {
if (typeof filename === "string" && args.at(argI + 1) && args.at(argI + 1).startsWith("-")) { inPath = path.resolve(process.cwd(), arg.slice(0, index));
argI++; outPath = arg.slice(index+1);
filename = args.at(argI).slice(1);
while (filename.startsWith("-")) filename = filename.slice(1);
filename.split(path.win32.sep).join(path.posix.sep);
} }
if (await extendsFS.isDirectory(file)) { if (!(await extendsFS.exists(inPath))) {
const fileList = await extendsFS.readdirV2(file, true, (_1, _2, stats) => stats.isFile() || stats.isDirectory()); console.log("%O not exists", inPath);
for (const file of fileList) { continue;
if (extendsFS.isDirectory(file.fullPath)) continue; }
console.log("Uploading %O to %O", file.fullPath, path.join(filename, file.path));
await pipeline(fs.createReadStream(file.fullPath), bucket.uploadFile(path.join(filename, file.path))); if (await extendsFS.isDirectory(inPath)) {
} await extendsFS.readdirV2(inPath, true, () => true, async (relativePath, filePath, stats) => {
if (stats.isDirectory()) return;
console.log("Uploading %O to in Bucket %O", filePath, path.join(outPath, relativePath));
return finished(fs.createReadStream(filePath, "binary").pipe(bucket.uploadFile(path.join(outPath, relativePath))));
});
} else { } else {
console.log("Uploading %O to %O", file, filename); console.log("Uploading %O to in Bucket %O", filePath, path.join(outPath, relativePath));
await pipeline(fs.createReadStream(file), bucket.uploadFile(filename)); await finished(fs.createReadStream(inPath, "binary").pipe(bucket.uploadFile(outPath)));
} }
console.log("Done!");
} }

View File

@ -216,7 +216,7 @@ jobs:
path: ./phpOutput path: ./phpOutput
- name: Upload to bucket - name: Upload to bucket
run: node .github/uploadToBucket.mjs phpOutput -/php_bin run: node .github/uploadToBucket.mjs phpOutput:php_bin
timeout-minutes: 25 timeout-minutes: 25
env: env:
OCI_AUTHKEY: ${{ secrets.OCI_AUTHKEY }} OCI_AUTHKEY: ${{ secrets.OCI_AUTHKEY }}

View File

@ -12,19 +12,6 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
name: Code checkout name: Code checkout
- name: Setup QEMU to Docker
uses: docker/setup-qemu-action@v2
- name: Setup Buildx
uses: docker/setup-buildx-action@v2
- name: Login into registry Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3.6.0 - uses: actions/setup-node@v3.6.0
name: Setup node.js name: Setup node.js
with: with:
@ -40,14 +27,4 @@ jobs:
- name: Publish - name: Publish
run: npm --workspaces publish --access public --tag ${{ github.event.release.prerelease && 'next' || 'latest' }} run: npm --workspaces publish --access public --tag ${{ github.event.release.prerelease && 'next' || 'latest' }}
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Build docker image
uses: docker/build-push-action@v4
with:
cache-from: type=gha,scope=sirherobrine23_docker
cache-to: type=gha,scope=sirherobrine23_docker
platforms: "linux/amd64,linux/arm64"
context: ./
tags: ghcr.io/sirherobrine23/bdsmaneger
push: true

View File

@ -54,7 +54,7 @@ jobs:
path: artifacts path: artifacts
- name: Upload to actifial - name: Upload to actifial
run: node .github/uploadToBucket.mjs SpigotBuild artifacts run: node .github/uploadToBucket.mjs artifacts:SpigotBuild
env: env:
ociauth: "${{ secrets.OCI_AUTHKEY }}" ociauth: "${{ secrets.OCI_AUTHKEY }}"
OCI_AUTHKEY: "${{ secrets.OCI_AUTHKEY }}" OCI_AUTHKEY: "${{ secrets.OCI_AUTHKEY }}"