Web interface #525
							
								
								
									
										51
									
								
								.github/uploadToBucket.mjs
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										51
									
								
								.github/uploadToBucket.mjs
									
									
									
									
										vendored
									
									
								
							@@ -1,38 +1,37 @@
 | 
			
		||||
#!/usr/bin/env node
 | 
			
		||||
import { oracleBucket } from "@sirherobrine23/cloud";
 | 
			
		||||
import { pipeline } from "node:stream/promises";
 | 
			
		||||
import extendsFS from "@sirherobrine23/extends";
 | 
			
		||||
import path from "node:path";
 | 
			
		||||
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 bucket = oracleBucket.oracleBucketPreAuth("sa-saopaulo-1", "grwodtg32n4d", "bdsFiles", process.env.ociauth || process.env.OCI_AUTHKEY);
 | 
			
		||||
 | 
			
		||||
for (let argI = 0; argI < args.length; argI++) {
 | 
			
		||||
  if (args.at(argI).startsWith("-")) continue;
 | 
			
		||||
  const file = path.resolve(process.cwd(), args.at(argI));
 | 
			
		||||
  if (!(await extendsFS.exists(file))) {
 | 
			
		||||
    console.log("File %O dont exists!", file);
 | 
			
		||||
    if (args.at(argI + 1) && args.at(argI + 1).startsWith("-")) argI++;
 | 
			
		||||
  }
 | 
			
		||||
  let filename = path.basename(args.at(argI));
 | 
			
		||||
  if (typeof filename === "string" && args.at(argI + 1) && args.at(argI + 1).startsWith("-")) {
 | 
			
		||||
    argI++;
 | 
			
		||||
    filename = args.at(argI).slice(1);
 | 
			
		||||
    while (filename.startsWith("-")) filename = filename.slice(1);
 | 
			
		||||
    filename.split(path.win32.sep).join(path.posix.sep);
 | 
			
		||||
/** @type {string} */
 | 
			
		||||
let arg;
 | 
			
		||||
while (!!(arg = args.shift())) {
 | 
			
		||||
  if (arg.startsWith("-")) continue;
 | 
			
		||||
  let inPath, outPath;
 | 
			
		||||
  let index;
 | 
			
		||||
  if ((index = arg.indexOf(":")) === -1) outPath = path.relative(process.cwd(), (inPath = path.resolve(process.cwd(), arg)));
 | 
			
		||||
  else {
 | 
			
		||||
    inPath = path.resolve(process.cwd(), arg.slice(0, index));
 | 
			
		||||
    outPath = arg.slice(index+1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (await extendsFS.isDirectory(file)) {
 | 
			
		||||
    const fileList = await extendsFS.readdirV2(file, true, (_1, _2, stats) => stats.isFile() || stats.isDirectory());
 | 
			
		||||
    for (const file of fileList) {
 | 
			
		||||
      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.exists(inPath))) {
 | 
			
		||||
    console.log("%O not exists", inPath);
 | 
			
		||||
    continue;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  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 {
 | 
			
		||||
    console.log("Uploading %O to %O", file, filename);
 | 
			
		||||
    await pipeline(fs.createReadStream(file), bucket.uploadFile(filename));
 | 
			
		||||
    console.log("Uploading %O to in Bucket %O", filePath, path.join(outPath, relativePath));
 | 
			
		||||
    await finished(fs.createReadStream(inPath, "binary").pipe(bucket.uploadFile(outPath)));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  console.log("Done!");
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/phpBuild.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/phpBuild.yaml
									
									
									
									
										vendored
									
									
								
							@@ -216,7 +216,7 @@ jobs:
 | 
			
		||||
        path: ./phpOutput
 | 
			
		||||
 | 
			
		||||
    - name: Upload to bucket
 | 
			
		||||
      run: node .github/uploadToBucket.mjs phpOutput -/php_bin
 | 
			
		||||
      run: node .github/uploadToBucket.mjs phpOutput:php_bin
 | 
			
		||||
      timeout-minutes: 25
 | 
			
		||||
      env:
 | 
			
		||||
        OCI_AUTHKEY: ${{ secrets.OCI_AUTHKEY }}
 | 
			
		||||
							
								
								
									
										23
									
								
								.github/workflows/publish.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								.github/workflows/publish.yaml
									
									
									
									
										vendored
									
									
								
							@@ -12,19 +12,6 @@ jobs:
 | 
			
		||||
    - uses: actions/checkout@v3
 | 
			
		||||
      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
 | 
			
		||||
      name: Setup node.js
 | 
			
		||||
      with:
 | 
			
		||||
@@ -41,13 +28,3 @@ jobs:
 | 
			
		||||
      run: npm --workspaces publish --access public --tag ${{ github.event.release.prerelease && 'next' || 'latest' }}
 | 
			
		||||
      env:
 | 
			
		||||
        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
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/spigotBuild.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/spigotBuild.yaml
									
									
									
									
										vendored
									
									
								
							@@ -54,7 +54,7 @@ jobs:
 | 
			
		||||
        path: artifacts
 | 
			
		||||
 | 
			
		||||
    - name: Upload to actifial
 | 
			
		||||
      run: node .github/uploadToBucket.mjs SpigotBuild artifacts
 | 
			
		||||
      run: node .github/uploadToBucket.mjs artifacts:SpigotBuild
 | 
			
		||||
      env:
 | 
			
		||||
        ociauth: "${{ secrets.OCI_AUTHKEY }}"
 | 
			
		||||
        OCI_AUTHKEY: "${{ secrets.OCI_AUTHKEY }}"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user