diff --git a/src/controllers/custom/addVaultDecoRecipeController.ts b/src/controllers/custom/addVaultDecoRecipeController.ts index 437e555e..0ea06594 100644 --- a/src/controllers/custom/addVaultDecoRecipeController.ts +++ b/src/controllers/custom/addVaultDecoRecipeController.ts @@ -1,16 +1,16 @@ import { getAccountIdForRequest } from "../../services/loginService.ts"; import { getInventory } from "../../services/inventoryService.ts"; import type { RequestHandler } from "express"; -import { hasAccessToDojo, getGuildForRequestEx, hasGuildPermission } from "../../services/guildService.ts"; +import { getGuildForRequestEx, hasGuildPermission } from "../../services/guildService.ts"; import { GuildPermission } from "../../types/guildTypes.ts"; import type { ITypeCount } from "../../types/commonTypes.ts"; export const addVaultDecoRecipeController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); const requests = req.body as ITypeCount[]; - const inventory = await getInventory(accountId, "LevelKeys GuildId"); + const inventory = await getInventory(accountId, "GuildId"); const guild = await getGuildForRequestEx(req, inventory); - if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) { + if (!(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) { res.status(400).send("-1").end(); return; } diff --git a/src/controllers/custom/setGuildCheatController.ts b/src/controllers/custom/setGuildCheatController.ts index 6a5d8631..5be9226f 100644 --- a/src/controllers/custom/setGuildCheatController.ts +++ b/src/controllers/custom/setGuildCheatController.ts @@ -1,5 +1,5 @@ import { GuildMember } from "../../models/guildModel.ts"; -import { getGuildForRequestEx, hasAccessToDojo } from "../../services/guildService.ts"; +import { getGuildForRequestEx } from "../../services/guildService.ts"; import { getInventory } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import type { IGuildCheats } from "../../types/guildTypes.ts"; @@ -8,12 +8,12 @@ import type { RequestHandler } from "express"; export const setGuildCheatController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); const payload = req.body as ISetGuildCheatRequest; - const inventory = await getInventory(accountId, `${payload.key} GuildId LevelKeys`); + const inventory = await getInventory(accountId, `GuildId`); const guild = await getGuildForRequestEx(req, inventory); const member = await GuildMember.findOne({ accountId: accountId, guildId: guild._id }); if (member) { - if (!hasAccessToDojo(inventory) || member.rank > 1) { + if (member.rank > 1) { res.end(); return; } diff --git a/src/controllers/custom/techProjectController.ts b/src/controllers/custom/techProjectController.ts index 38965fd0..25c4823e 100644 --- a/src/controllers/custom/techProjectController.ts +++ b/src/controllers/custom/techProjectController.ts @@ -2,7 +2,6 @@ import { getAccountIdForRequest } from "../../services/loginService.ts"; import { getInventory } from "../../services/inventoryService.ts"; import type { RequestHandler } from "express"; import { - hasAccessToDojo, getGuildForRequestEx, setGuildTechLogState, processFundedGuildTechProject, @@ -19,9 +18,9 @@ import { GuildMember } from "../../models/guildModel.ts"; export const addTechProjectController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); const requests = req.body as ITechProjectRequest[]; - const inventory = await getInventory(accountId, "LevelKeys GuildId"); + const inventory = await getInventory(accountId, "GuildId"); const guild = await getGuildForRequestEx(req, inventory); - if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Tech))) { + if (!(await hasGuildPermission(guild, accountId, GuildPermission.Tech))) { res.status(400).send("-1").end(); return; } @@ -54,9 +53,9 @@ export const addTechProjectController: RequestHandler = async (req, res) => { export const removeTechProjectController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); const requests = req.body as ITechProjectRequest[]; - const inventory = await getInventory(accountId, "LevelKeys GuildId"); + const inventory = await getInventory(accountId, "GuildId"); const guild = await getGuildForRequestEx(req, inventory); - if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Tech))) { + if (!(await hasGuildPermission(guild, accountId, GuildPermission.Tech))) { res.status(400).send("-1").end(); return; } @@ -74,13 +73,13 @@ export const removeTechProjectController: RequestHandler = async (req, res) => { export const fundTechProjectController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); const requests = req.body as ITechProjectRequest[]; - const inventory = await getInventory(accountId, "LevelKeys GuildId"); + const inventory = await getInventory(accountId, "GuildId"); const guild = await getGuildForRequestEx(req, inventory); const guildMember = (await GuildMember.findOne( { accountId, guildId: guild._id }, "RegularCreditsContributed MiscItemsContributed" ))!; - if (!hasAccessToDojo(inventory)) { + if (!(await hasGuildPermission(guild, accountId, GuildPermission.Tech))) { res.status(400).send("-1").end(); return; } @@ -105,9 +104,9 @@ export const fundTechProjectController: RequestHandler = async (req, res) => { export const completeTechProjectsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); const requests = req.body as ITechProjectRequest[]; - const inventory = await getInventory(accountId, "LevelKeys GuildId"); + const inventory = await getInventory(accountId, "GuildId"); const guild = await getGuildForRequestEx(req, inventory); - if (!hasAccessToDojo(inventory)) { + if (!(await hasGuildPermission(guild, accountId, GuildPermission.Tech))) { res.status(400).send("-1").end(); return; } diff --git a/static/webui/script.js b/static/webui/script.js index bf971cf8..bbc8985a 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -1992,32 +1992,6 @@ function updateInventory() { }); } -function addVaultDecoRecipe() { - const uniqueName = getKey(document.getElementById("acquire-type-VaultDecoRecipes")); - if (!guildId) { - return; - } - if (!uniqueName) { - $("acquire-type-VaultDecoRecipes").addClass("is-invalid").focus(); - return; - } - revalidateAuthz().then(() => { - const req = $.post({ - url: "/custom/addVaultDecoRecipe?" + window.authz + "&guildId=" + window.guildId, - contentType: "application/json", - data: JSON.stringify([ - { - ItemType: uniqueName, - ItemCount: 1 - } - ]) - }); - req.done(() => { - updateInventory(); - }); - }); -} - function changeGuildRank(guildId, targetId, rankChange) { revalidateAuthz().then(() => { const req = $.get(