Changes to path location

merge-requests/4/head
Matthew 2020-03-17 01:39:18 -04:00
parent 4c0d5cad32
commit 8e7a641c7b
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
7 changed files with 12 additions and 12 deletions

View File

@ -119,8 +119,8 @@ export default class Client extends Eris.Client {
});
this.server = new Server(this, { port: this.config.port });
const corepath = '/var/CloudServices/dist';
const cmdFiles = await fs.readdir('/var/CloudServices/dist/commands');
const corepath = '/opt/CloudServices/dist';
const cmdFiles = await fs.readdir('/opt/CloudServices/dist/commands');
cmdFiles.forEach((f) => delete require.cache[`${corepath}/${f}`]);
delete require.cache[`${corepath}/config.json`];
delete require.cache[`${corepath}/class/Util`];

View File

@ -150,7 +150,7 @@ export default class CWG_Create extends Command {
if (x509Certificate) {
x509 = await this.createCertAndPrivateKey(domain, x509Certificate.cert, x509Certificate.key);
}
let cfg = await fs.readFile('/var/CloudServices/dist/static/nginx.conf', { encoding: 'utf8' });
let cfg = await fs.readFile('/opt/CloudServices/dist/static/nginx.conf', { encoding: 'utf8' });
cfg = cfg.replace(/\[DOMAIN]/g, domain);
cfg = cfg.replace(/\[PORT]/g, String(port));
cfg = cfg.replace(/\[CERTIFICATE]/g, x509.cert);
@ -185,7 +185,7 @@ export default class CWG_Create extends Command {
public async createCertAndPrivateKey(domain: string, certChain: string, privateKey: string) {
if (!this.isValidCertificateChain(certChain)) throw new Error('Invalid Certificate Chain');
if (!this.isValidPrivateKey(privateKey)) throw new Error('Invalid Private Key');
const path = `/var/CloudServices/temp/${domain}`;
const path = `/opt/CloudServices/temp/${domain}`;
const temp = [writeFile(`${path}.chain.crt`, certChain), writeFile(`${path}.key.pem`, privateKey)];
const removeFiles = [unlink(`${path}.chain.crt`), unlink(`${path}.key.pem`)];
await Promise.all(temp);

View File

@ -32,7 +32,7 @@ export default class CWG_UpdateCert extends Command {
if (!this.isValidCertificateChain(certAndPrivateKey[0])) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid Certificate Chain***`);
if (!this.isValidPrivateKey(certAndPrivateKey[1])) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid Private Key***`);
const path = `/var/CloudServices/temp/${account.id}`;
const path = `/opt/CloudServices/temp/${account.id}`;
const temp = [writeFile(`${path}.chain.crt`, certAndPrivateKey[0]), writeFile(`${path}.key.pem`, certAndPrivateKey[1])];
const removeFiles = [unlink(`${path}.chain.crt`), unlink(`${path}.key.pem`)];
await Promise.all(temp);

View File

@ -21,7 +21,7 @@ export default class Exec extends Command {
const response = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Executing \`${args.join(' ')}\`***`);
let result: string;
try {
result = await this.client.util.exec(args.join(' '), { cwd: '/var/CloudServices' });
result = await this.client.util.exec(args.join(' '), { cwd: '/opt/CloudServices' });
} catch (error) {
result = error.message;
}

View File

@ -19,7 +19,7 @@ export default class Load extends Command {
const type = args[0].toLowerCase();
if (!allowed.includes(type)) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid type to (re)load***`);
const corepath = '/var/CloudServices/dist';
const corepath = '/opt/CloudServices/dist';
if (type === 'config') {
this.client.config = require(`${corepath}/config.json`);
delete require.cache[`${corepath}/config.json`];

View File

@ -20,7 +20,7 @@ export default class Pull extends Command {
let pull: string;
try {
pull = await this.client.util.exec('git pull', { cwd: '/var/CloudServices' });
pull = await this.client.util.exec('git pull', { cwd: '/opt/CloudServices' });
} catch (error) {
const updatedMessage = updateMessage.content.replace(`${this.client.stores.emojis.loading} ***Fetching latest commit...***`, `${this.client.stores.emojis.error} ***Could not fetch latest commit***`)
.replace(/```$/, `${error.message}\n\`\`\``);
@ -46,7 +46,7 @@ export default class Pull extends Command {
let install: string;
try {
install = await this.client.util.exec('yarn install', { cwd: '/var/CloudServices' });
install = await this.client.util.exec('yarn install', { cwd: '/opt/CloudServices' });
} catch (error) {
this.client.updating = false;
const updatedMessage = passedPull.content.replace(`${this.client.stores.emojis.loading} ***Reinstalling dependencies...***`, `${this.client.stores.emojis.error} ***Failed to reinstall dependencies***`)
@ -71,7 +71,7 @@ export default class Pull extends Command {
let build: string;
try {
build = await this.client.util.exec('yarn run build', { cwd: '/var/CloudServices' });
build = await this.client.util.exec('yarn run build', { cwd: '/opt/CloudServices' });
} catch (error) {
const updatedMessage = updatedPackages.content.replace(`${this.client.stores.emojis.loading} ***Rebuilding files...***`, `${this.client.stores.emojis.error} ***Failed to rebuild files***`)
.replace(/```$/, `${error.message}\n\`\`\``);

View File

@ -11,8 +11,8 @@ export default async function storage(client: Client) {
const res = await client.util.exec(`du -bs /home/${account.username}`);
let bytes = Number(res.split('/')[0].replace('\t', ''));
try {
await fs.access(`/var/mail/${account.username}`, fs.constants.F_OK);
const res2 = await client.util.exec(`du -bs /var/mail/${account.username}`);
await fs.access(`/opt/mail/${account.username}`, fs.constants.F_OK);
const res2 = await client.util.exec(`du -bs /opt/mail/${account.username}`);
bytes += Number(res2.split('/')[0].replace('\t', ''));
} catch {
bytes += 0;