fix: remove rclone webUI

This commit is contained in:
Eli Bosley
2025-05-23 10:58:17 -04:00
parent a5c7b9fdd3
commit 3ffde0272c
3 changed files with 0 additions and 59 deletions

View File

@@ -1,3 +0,0 @@
{
"demo": "hello.unraider"
}

View File

@@ -1,5 +1,4 @@
import { Injectable, Logger, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
import crypto from 'crypto';
import { ChildProcess } from 'node:child_process';
import { existsSync } from 'node:fs';
import { mkdir, rm, writeFile } from 'node:fs/promises';
@@ -39,8 +38,6 @@ export class RCloneApiService implements OnModuleInit, OnModuleDestroy {
private readonly logger = new Logger(RCloneApiService.name);
private rcloneSocketPath: string = '';
private rcloneBaseUrl: string = '';
private rcloneUsername: string = 'unraid-rclone';
private rclonePassword: string = crypto.randomBytes(32).toString('hex');
private rcloneProcess: ChildProcess | null = null;
constructor() {}
@@ -427,16 +424,4 @@ export class RCloneApiService implements OnModuleInit, OnModuleDestroy {
}
}
}
async serveWebGui(): Promise<{ url: string; username: string; password: string }> {
if (!this.isInitialized) {
throw new Error('RClone service is not initialized');
}
return {
url: this.rcloneBaseUrl,
username: this.rcloneUsername,
password: this.rclonePassword,
};
}
}

View File

@@ -54,45 +54,4 @@ export class RestController {
return res.status(500).send(`Error: Failed to get customizations`);
}
}
/*
@All('/graphql/api/rclone-webgui/*')
@UsePermissions({
action: AuthActionVerb.READ,
resource: Resource.FLASH,
possession: AuthPossession.ANY,
})
async proxyRcloneWebGui(@Req() req: FastifyRequest, @Res() res: FastifyReply) {
try {
const rcloneDetails = await this.flashBackupService.serveWebGui();
const path = req.url.replace('/graphql/api/rclone-webgui/', '');
const targetUrl = `${rcloneDetails.url}${path}`;
this.logger.debug(`Proxying request to: ${targetUrl}`);
// Forward the request to the RClone service
const method = req.method.toLowerCase();
const options = {
headers: {
...req.headers,
Authorization: `Basic ${Buffer.from(`${rcloneDetails.username}:${rcloneDetails.password}`).toString('base64')}`,
},
body: req.body,
responseType: 'buffer',
enableUnixSockets: true,
};
const response = await got[method](targetUrl, options);
// Forward the response back to the client
return res
.status(response.statusCode)
.headers(response.headers)
.send(response.body);
} catch (error: unknown) {
const errorMessage = error instanceof Error ? error.message : String(error);
this.logger.error(`Error proxying to RClone WebGUI: ${errorMessage}`);
return res.status(500).send(`Error: Failed to proxy to RClone WebGUI`);
}
}
*/
}