fix conflict

merge-requests/4/head
Matthew 2020-05-05 19:41:56 -04:00
commit a5fefbd264
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
5 changed files with 42 additions and 31 deletions

View File

@ -1,19 +1,19 @@
stages:
- build
- test
typescript_build:
stage: build
script:
- cp ../config.json ./src/config.json
- yarn install --ignore-engines
- tsc -p ./tsconfig.json
lint:
stage: test
before_script:
- cp ../config.json ./src/config.json
- yarn install --ignore-engines
script:
- yarn run lint-find
stages:
- build
- test
typescript_build:
stage: build
script:
- cp ../config.json ./src/config.json
- yarn install --ignore-engines
- tsc -p ./tsconfig.json
lint:
stage: test
before_script:
- cp ../config.json ./src/config.json
- yarn install --ignore-engines
script:
- yarn run lint-find

View File

@ -29,7 +29,8 @@
"uuid": "^3.3.3"
},
"devDependencies": {
"@types/express": "^4.17.2",
"@types/express": "^4.17.6",
"@types/express-serve-static-core": "^4.17.5",
"@types/fs-extra": "^8.0.0",
"@types/helmet": "^0.0.45",
"@types/ioredis": "^4.0.18",

View File

@ -70,7 +70,7 @@ export default class Security {
return req.headers.authorization.split(' ')[1];
}
if (req.query && req.query.token) {
return req.query.token;
return req.query.token as string;
}
return '0000000000';
}

View File

@ -32,15 +32,25 @@ export default class Util {
* @param options childProcess.ExecOptions
*/
public async exec(command: string, options: childProcess.ExecOptions = {}): Promise<string> {
const ex = promisify(childProcess.exec);
let result: string;
try {
const res = await ex(command, options);
result = `${res.stdout}${res.stderr}`;
} catch (err) {
return Promise.reject(new Error(`Command failed: ${err.cmd}\n${err.stderr}${err.stdout}`));
}
return result;
return new Promise((res, rej) => {
let error = false;
let output = '';
const writeFunction = (data: string|Buffer|Error) => {
if (data instanceof Error) error = true;
output += `${data}`;
};
const cmd = childProcess.exec(command, options);
cmd.stdout.on('data', writeFunction);
cmd.stderr.on('data', writeFunction);
cmd.on('error', writeFunction);
cmd.once('close', (code, signal) => {
cmd.stdout.removeListener('data', writeFunction);
cmd.stderr.removeListener('data', writeFunction);
cmd.removeListener('error', writeFunction);
if (error) rej(output);
res(output);
});
});
}
/**

View File

@ -32,7 +32,7 @@ export default class Load extends Command {
delete require.cache[`${corepath}/commands/index.js`];
delete require.cache[`${corepath}/commands/${args[1]}.js`];
Object.keys(require.cache).filter((path) => path.includes(`${args[1]}_`)).forEach((path) => delete require.cache[path]);
const cmdIndex = require('../commands');
const cmdIndex = require('.');
let Cmd = cmdIndex[args[1]];
if (!Cmd) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Could not find file***`);
Cmd = require(`${corepath}/commands/${args[1]}`).default;