Merge remote-tracking branch 'upstream/dev' into pgp
commit
8c1468fa59
|
@ -1,23 +0,0 @@
|
|||
stages:
|
||||
- lint
|
||||
- build
|
||||
|
||||
lint:
|
||||
stage: lint
|
||||
script: |
|
||||
yarn install
|
||||
yarn lint
|
||||
only:
|
||||
- pushes
|
||||
- merge_requests
|
||||
- web
|
||||
|
||||
tsc:
|
||||
stage: build
|
||||
script: |
|
||||
yarn install
|
||||
tsc -p tsconfig.json -noEmit
|
||||
only:
|
||||
- pushes
|
||||
- merge_requests
|
||||
- web
|
|
@ -14,7 +14,8 @@ export default class Root extends Route {
|
|||
this.server.client.once('ready', async () => {
|
||||
this.guild = this.server.client.guilds.get(this.server.client.config.guildID) || await this.server.client.getRESTGuild(this.server.client.config.guildID);
|
||||
this.directorRole = '662163685439045632';
|
||||
this.directorLogs = <TextChannel>this.guild.channels.get('807444198969835550');
|
||||
this.brsVotingChannel = <TextChannel>this.guild.channels.get('807444198969835550');
|
||||
this.brsLogChannel = <TextChannel>this.guild.channels.get('858547883853873173');
|
||||
this.chairman = '278620217221971968';
|
||||
});
|
||||
}
|
||||
|
@ -23,7 +24,9 @@ export default class Root extends Route {
|
|||
|
||||
private directorRole: string;
|
||||
|
||||
private directorLogs: GuildTextableChannel;
|
||||
private brsVotingChannel: GuildTextableChannel;
|
||||
|
||||
private brsLogChannel: GuildTextableChannel;
|
||||
|
||||
private chairman: string;
|
||||
|
||||
|
@ -91,7 +94,7 @@ export default class Root extends Route {
|
|||
break;
|
||||
|
||||
case 'proc':
|
||||
title = 'Proclamation';
|
||||
title = 'Proposed Proclamation';
|
||||
color = 0x9b89ff;
|
||||
break;
|
||||
|
||||
|
@ -285,7 +288,8 @@ export default class Root extends Route {
|
|||
body: req.body.body,
|
||||
},
|
||||
);
|
||||
const msg = await this.directorLogs.createMessage({ embed });
|
||||
const msg = await this.brsVotingChannel.createMessage({ embed });
|
||||
await this.brsLogChannel.createMessage({ embed });
|
||||
|
||||
const eo = await this.server.client.db.ExecutiveOrder.create({
|
||||
issuer: authenticated.director.userID,
|
||||
|
@ -331,7 +335,8 @@ export default class Root extends Route {
|
|||
body: req.body.body,
|
||||
},
|
||||
);
|
||||
const msg = await this.directorLogs.createMessage({ embed });
|
||||
const msg = await this.brsVotingChannel.createMessage({ embed });
|
||||
await this.brsLogChannel.createMessage({ embed });
|
||||
|
||||
const motion = await this.server.client.db.Motion.create({
|
||||
issuer: authenticated.director.userID,
|
||||
|
@ -378,7 +383,7 @@ export default class Root extends Route {
|
|||
body: req.body.body,
|
||||
},
|
||||
);
|
||||
const msg = await this.directorLogs.createMessage({ embed });
|
||||
const msg = await this.brsVotingChannel.createMessage({ embed });
|
||||
await msg.addReaction('modSuccess:578750988907970567');
|
||||
await msg.addReaction('modError:578750737920688128');
|
||||
await msg.addReaction('🙋');
|
||||
|
@ -657,7 +662,7 @@ export default class Root extends Route {
|
|||
});
|
||||
|
||||
if (eo.subject !== req.body.subject || eo.body !== req.body.body) {
|
||||
const message = await this.directorLogs.getMessage(eo.msg);
|
||||
const message = await this.brsVotingChannel.getMessage(eo.msg);
|
||||
const embed = this.genEmbed(
|
||||
eo.oID,
|
||||
'eo',
|
||||
|
@ -711,7 +716,7 @@ export default class Root extends Route {
|
|||
});
|
||||
|
||||
if (motion.subject !== req.body.subject || motion.body !== req.body.body) {
|
||||
const message = await this.directorLogs.getMessage(motion.msg);
|
||||
const message = await this.brsVotingChannel.getMessage(motion.msg);
|
||||
const embed = this.genEmbed(
|
||||
motion.oID,
|
||||
'motion',
|
||||
|
@ -765,7 +770,7 @@ export default class Root extends Route {
|
|||
});
|
||||
|
||||
if (proc.subject !== req.body.subject || proc.body !== req.body.body) {
|
||||
const message = await this.directorLogs.getMessage(proc.msg);
|
||||
const message = await this.brsVotingChannel.getMessage(proc.msg);
|
||||
const embed = this.genEmbed(
|
||||
proc.oID,
|
||||
'proc',
|
||||
|
@ -819,7 +824,7 @@ export default class Root extends Route {
|
|||
});
|
||||
|
||||
if (resolution.subject !== req.body.subject || resolution.body !== req.body.body) {
|
||||
const message = await this.directorLogs.getMessage(resolution.msg);
|
||||
const message = await this.brsVotingChannel.getMessage(resolution.msg);
|
||||
const embed = this.genEmbed(
|
||||
resolution.oID,
|
||||
'res',
|
||||
|
@ -1008,7 +1013,7 @@ export default class Root extends Route {
|
|||
},
|
||||
);
|
||||
confirmationEmbed.addField('Results', `**Total:** ${total.length}\n**Yea:** ${yea}\n**Nay:** ${nay}\n**Present:** ${present}\n**Absent:** ${absent}`);
|
||||
await this.directorLogs.createMessage({ embed: confirmationEmbed });
|
||||
await this.brsVotingChannel.createMessage({ embed: confirmationEmbed });
|
||||
|
||||
const totalDirectors = yea + nay + present + absent;
|
||||
if (yea / totalDirectors >= 0.6) {
|
||||
|
@ -1024,7 +1029,7 @@ export default class Root extends Route {
|
|||
body: motion.body,
|
||||
},
|
||||
);
|
||||
const resolutionMessage = await this.directorLogs.createMessage({ embed: resolutionEmbed });
|
||||
const resolutionMessage = await this.brsVotingChannel.createMessage({ embed: resolutionEmbed });
|
||||
const resolutionID = genUUID();
|
||||
|
||||
await this.server.client.db.Resolution.create({
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
export { default as keys } from './keys';
|
||||
export { default as report } from './report';
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
import { Route, Server } from '../../../class';
|
||||
|
||||
export default class Keys extends Route {
|
||||
constructor(server: Server) {
|
||||
super(server);
|
||||
this.conf = {
|
||||
path: '/keys',
|
||||
};
|
||||
}
|
||||
|
||||
protected pre() {
|
||||
this.router.all('*', (_req, res, next) => {
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
res.setHeader('Access-Control-Allow-Methods', '*');
|
||||
res.setHeader('Access-Control-Allow-Headers', '*');
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
||||
public bind() {
|
||||
this.pre();
|
||||
|
||||
this.router.get('/x509/:userID', async (req, res) => {
|
||||
const memberDoc = await this.server.client.db.Member.findOne({ userID: req.params.userID }).lean().exec();
|
||||
const member = this.mainGuild.members.get(req.params.userID);
|
||||
if (!member || !memberDoc || !memberDoc?.x509) return res.status(404).json({ code: this.constants.codes.NOT_FOUND, message: this.constants.messages.NOT_FOUND });
|
||||
return res.status(200).json({
|
||||
code: this.constants.codes.SUCCESS,
|
||||
message: memberDoc.x509,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
|
@ -19,8 +19,8 @@ export default class Internal extends Route {
|
|||
|
||||
public bind() {
|
||||
this.router.get('/directory', async (req, res) => {
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
try {
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
if (req.query.id) {
|
||||
let member = this.server.client.guilds.get(this.server.client.config.guildID).members.get(req.query.id.toString());
|
||||
if (!member) member = await this.server.client.getRESTGuildMember(this.server.client.config.guildID, req.query.id.toString());
|
||||
|
|
Loading…
Reference in New Issue