diff --git a/src/Client.ts b/src/Client.ts index d3d0393..9e1a074 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -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`]; diff --git a/src/commands/cwg_create.ts b/src/commands/cwg_create.ts index fa738af..6966cd0 100644 --- a/src/commands/cwg_create.ts +++ b/src/commands/cwg_create.ts @@ -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); diff --git a/src/commands/cwg_updatecert.ts b/src/commands/cwg_updatecert.ts index aa11590..fa108e9 100644 --- a/src/commands/cwg_updatecert.ts +++ b/src/commands/cwg_updatecert.ts @@ -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); diff --git a/src/commands/exec.ts b/src/commands/exec.ts index 0a9cc2f..f286635 100644 --- a/src/commands/exec.ts +++ b/src/commands/exec.ts @@ -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; } diff --git a/src/commands/load.ts b/src/commands/load.ts index 1c94df7..92ce2bd 100644 --- a/src/commands/load.ts +++ b/src/commands/load.ts @@ -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`]; diff --git a/src/commands/pull.ts b/src/commands/pull.ts index 39d7920..cdd0fe7 100644 --- a/src/commands/pull.ts +++ b/src/commands/pull.ts @@ -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\`\`\``); diff --git a/src/intervals/storage.ts b/src/intervals/storage.ts index 2c1c503..ec81b7d 100644 --- a/src/intervals/storage.ts +++ b/src/intervals/storage.ts @@ -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;