Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 242 #1089

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/src/views/account/ResetUsername.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default {
let response = await userService.updateUsername(this.username)

if (response.status === 200) {
this.$store.commit('setUsername', this.username);
this.$toasted.show(`Username updated.`, { type: 'success' })
router.push({ name: 'account-settings' })
} else {
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/game/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@
</div>

<div class="mb-2">
<label for="specialistTokenReward" class="col-form-label">Specialist Token Reward <help-tooltip tooltip="Determines the amount of specialist tokens awarded for the banking technology at the end of a galactic cycle"/></label>
<label for="specialistTokenReward" class="col-form-label">Specialist Token Reward <help-tooltip tooltip="Determines the amount of specialist tokens awarded for the specialist technology at the end of a galactic cycle"/></label>
<select class="form-control" id="specialistTokenReward" v-model="settings.technology.specialistTokenReward" :disabled="isCreatingGame">
<option v-for="opt in options.technology.specialistTokenReward" v-bind:key="opt.value" v-bind:value="opt.value">
{{ opt.text }}
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/game/components/settings/GameSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@
:value="game.settings.technology.experimentationReward"
:compareValue="compareSettings.technology.experimentationReward"/>
<game-setting-value title="Specialist Token Reward"
tooltip="Determines the amount of specialist tokens awarded for the banking technology at the end of a galactic cycle"
tooltip="Determines the amount of specialist tokens awarded for the specialist technology at the end of a galactic cycle"
:valueText="getFriendlyText(game.settings.technology.specialistTokenReward)"
:value="game.settings.technology.specialistTokenReward"
:compareValue="compareSettings.technology.specialistTokenReward"/>
Expand Down
68 changes: 45 additions & 23 deletions server/api/controllers/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export default (container: DependencyContainer) => {
try {
let result = await container.adminService.getInsights();

return res.status(200).json(result);
res.status(200).json(result);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -16,16 +17,18 @@ export default (container: DependencyContainer) => {
try {
const result = await container.adminService.addWarning(req.params.userId, req.body.text);

return res.status(200).json(result);
res.status(200).json(result);
return next();
} catch (err) {
next(err);
return next(err);
}
},
listUsers: async (req, res, next) => {
try {
let result = await container.adminService.listUsers(req.session.roles, 300);

return res.status(200).json(result);
res.status(200).json(result);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -34,7 +37,8 @@ export default (container: DependencyContainer) => {
try {
let result = await container.adminService.listPasswordResets();

return res.status(200).json(result);
res.status(200).json(result);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -43,7 +47,8 @@ export default (container: DependencyContainer) => {
try {
const result = await container.reportService.conversationForReport(req.params.reportId, req.session.userId);

return res.status(200).json(result);
res.status(200).json(result);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -52,7 +57,8 @@ export default (container: DependencyContainer) => {
try {
let result = await container.reportService.listReports(req.session.userId);

return res.status(200).json(result);
res.status(200).json(result);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -61,7 +67,8 @@ export default (container: DependencyContainer) => {
try {
await container.reportService.actionReport(req.session.userId, req.params.reportId);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -71,7 +78,8 @@ export default (container: DependencyContainer) => {
try {
await container.adminService.setRoleContributor(req.params.userId, req.body.enabled);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -80,7 +88,8 @@ export default (container: DependencyContainer) => {
try {
await container.adminService.setRoleDeveloper(req.params.userId, req.body.enabled);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -89,7 +98,8 @@ export default (container: DependencyContainer) => {
try {
await container.adminService.setRoleGameMaster(req.params.userId, req.body.enabled);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -98,7 +108,8 @@ export default (container: DependencyContainer) => {
try {
await container.adminService.setRoleCommunityManager(req.params.userId, req.body.enabled);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -107,7 +118,8 @@ export default (container: DependencyContainer) => {
try {
await container.userService.setCredits(req.params.userId, req.body.credits);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -116,7 +128,8 @@ export default (container: DependencyContainer) => {
try {
await container.adminService.ban(req.params.userId);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -125,7 +138,8 @@ export default (container: DependencyContainer) => {
try {
await container.adminService.unban(req.params.userId);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -134,7 +148,8 @@ export default (container: DependencyContainer) => {
try {
await container.adminService.resetAchievements(req.params.userId);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -143,7 +158,8 @@ export default (container: DependencyContainer) => {
try {
await container.adminService.promoteToEstablishedPlayer(req.params.userId);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -162,12 +178,13 @@ export default (container: DependencyContainer) => {
req.session.userCredits = user.credits;
req.session.isImpersonating = true;

return res.status(200).json({
res.status(200).json({
_id: user._id,
username: user.username,
roles: user.roles,
credits: user.credits
});
return next();
} catch (err) {
return next(err);
}
Expand All @@ -176,7 +193,8 @@ export default (container: DependencyContainer) => {
try {
let result = await container.adminService.listGames(100);

return res.status(200).json(result);
res.status(200).json(result);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -185,7 +203,8 @@ export default (container: DependencyContainer) => {
try {
await container.adminService.setGameFeatured(req.params.gameId, req.body.featured);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -194,7 +213,8 @@ export default (container: DependencyContainer) => {
try {
await container.adminService.setGameTimeMachine(req.params.gameId, req.body.timeMachine);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -203,7 +223,8 @@ export default (container: DependencyContainer) => {
try {
await container.gameService.forceEndGame(req.game);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -212,7 +233,8 @@ export default (container: DependencyContainer) => {
try {
await container.gameService.resetQuitters(req.game);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand Down
25 changes: 16 additions & 9 deletions server/api/controllers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ export default (container: DependencyContainer) => {
req.session.userCredits = user.credits;
req.session.isImpersonating = false;

return res.status(200).json({
res.status(200).json({
_id: user._id,
username: user.username,
roles: user.roles,
credits: user.credits
});
return next();
} catch (err) {
next(err);
return next(err);
}
},
logout: (req, res, next) => {
Expand All @@ -32,21 +33,24 @@ export default (container: DependencyContainer) => {
return next(err);
}

return res.sendStatus(200);
res.sendStatus(200);
return next();
});
} else {
return res.sendStatus(200);
res.sendStatus(200);
return next();
}
},
verify: (req, res, next) => {
const session = (req as any).session;

return res.status(200).json({
res.status(200).json({
_id: session.userId,
username: session.username,
roles: session.roles,
credits: session.userCredits
});
return next();
},
authoriseDiscord: async (req: any, res, next) => {
const code = req.query.code;
Expand Down Expand Up @@ -81,7 +85,8 @@ export default (container: DependencyContainer) => {
if (userResult.status === 200) {
await container.discordService.updateOAuth(req.session.userId, userResult.data.id, oauthResult.data);

return res.redirect(`${process.env.CLIENT_URL_ACCOUNT_SETTINGS}?discordSuccess=true`);
res.redirect(`${process.env.CLIENT_URL_ACCOUNT_SETTINGS}?discordSuccess=true`);
return next();
}
}
} catch (error) {
Expand All @@ -91,15 +96,17 @@ export default (container: DependencyContainer) => {
}
}

return res.redirect(`${process.env.CLIENT_URL_ACCOUNT_SETTINGS}?discordSuccess=false`);
res.redirect(`${process.env.CLIENT_URL_ACCOUNT_SETTINGS}?discordSuccess=false`);
return next();
},
unauthoriseDiscord: async (req, res, next) => {
try {
await container.discordService.clearOAuth(req.session.userId);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
next(err);
return next(err);
}
}
}
Expand Down
15 changes: 10 additions & 5 deletions server/api/controllers/badges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export default (container: DependencyContainer) => {
try {
const result = container.badgeService.listPurchasableBadges();

return res.status(200).json(result);
res.status(200).json(result);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -15,7 +16,8 @@ export default (container: DependencyContainer) => {
try {
const result = await container.badgeService.listBadgesByUser(req.params.userId);

return res.status(200).json(result);
res.status(200).json(result);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -24,7 +26,8 @@ export default (container: DependencyContainer) => {
try {
const result = await container.badgeService.listBadgesByPlayer(req.game, req.params.playerId);

return res.status(200).json(result);
res.status(200).json(result);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -33,7 +36,8 @@ export default (container: DependencyContainer) => {
try {
await container.badgeService.purchaseBadgeForUser(req.session.userId, req.params.userId, req.body.badgeKey);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand All @@ -42,7 +46,8 @@ export default (container: DependencyContainer) => {
try {
await container.badgeService.purchaseBadgeForPlayer(req.game, req.session.userId, req.params.playerId, req.body.badgeKey);

return res.sendStatus(200);
res.sendStatus(200);
return next();
} catch (err) {
return next(err);
}
Expand Down
Loading
Loading