From bf2672cc9446ea6374c85a8c2fd677631c82390a Mon Sep 17 00:00:00 2001 From: smthbh Date: Sat, 21 Jun 2025 16:28:23 -0400 Subject: [PATCH] add feature flags for new pages --- .env.example | 3 +++ config.default.json | 7 ++++++- src/armory/Armory.ts | 14 ++++++++++---- src/armory/Config.ts | 7 +++++++ src/armory/controllers/CharacterController.ts | 3 +++ static/partials/character-header.hbs | 12 +++++++++--- 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index d7d2550..b2a7cad 100644 --- a/.env.example +++ b/.env.example @@ -23,3 +23,6 @@ ACORE_ARMORY_WORLD_DATABASE__USER="acore" ACORE_ARMORY_WORLD_DATABASE__PASSWORD="acore" ACORE_ARMORY_WORLD_DATABASE__DATABASE="acore_world" ACORE_ARMORY_DB_QUERY_TIMEOUT=10000 +ACORE_ARMORY_FEATURE_FLAGS__ENABLE_QUESTS_PAGE=1 +ACORE_ARMORY_FEATURE_FLAGS__ENABLE_SKILLS_PAGE=1 +ACORE_ARMORY_FEATURE_FLAGS__ENABLE_REPUTATION_PAGE=1 \ No newline at end of file diff --git a/config.default.json b/config.default.json index 2b6bcf2..5cd4c60 100644 --- a/config.default.json +++ b/config.default.json @@ -33,5 +33,10 @@ "password": "acore", "database": "acore_world" }, - "dbQueryTimeout": 10000 + "dbQueryTimeout": 10000, + "featureFlags": { + "enableQuestsPage": true, + "enableReputationPage": true, + "enableSkillsPage": true + } } diff --git a/src/armory/Armory.ts b/src/armory/Armory.ts index c9ff9cd..fa3db03 100644 --- a/src/armory/Armory.ts +++ b/src/armory/Armory.ts @@ -191,13 +191,19 @@ export class Armory { await charsController.load(); app.get("/character/:realm/:name", this.wrapRoute(charsController.character.bind(charsController))); app.get("/character/:realm/:name/talents", this.wrapRoute(charsController.talents.bind(charsController))); - app.get("/character/:realm/:name/skills", this.wrapRoute(charsController.skills.bind(charsController))); + if (this.config.featureFlags.enableSkillsPage) { + app.get("/character/:realm/:name/skills", this.wrapRoute(charsController.skills.bind(charsController))); + } app.get("/character/:realm/:name/achievements", this.wrapRoute(charsController.achievements.bind(charsController))); app.get("/character/:realm/:character/achievements/data", this.wrapRoute(charsController.achievementsData.bind(charsController))); app.get("/character/:realm/:name/pvp", this.wrapRoute(charsController.pvp.bind(charsController))); - app.get("/character/:realm/:name/reputation", this.wrapRoute(charsController.reputation.bind(charsController))); - app.get("/character/:realm/:name/quests", this.wrapRoute(charsController.quests.bind(charsController))); - app.get("/character/:realm/:name/quests/compare/:otherRealm/:otherName", this.wrapRoute(charsController.questsCompare.bind(charsController))); + if (this.config.featureFlags.enableReputationPage) { + app.get("/character/:realm/:name/reputation", this.wrapRoute(charsController.reputation.bind(charsController))); + } + if (this.config.featureFlags.enableQuestsPage) { + app.get("/character/:realm/:name/quests", this.wrapRoute(charsController.quests.bind(charsController))); + app.get("/character/:realm/:name/quests/compare/:otherRealm/:otherName", this.wrapRoute(charsController.questsCompare.bind(charsController))); + } const guildsController = new GuildController(this); app.get("/guild/:realm/:name", this.wrapRoute(guildsController.guild.bind(guildsController))); diff --git a/src/armory/Config.ts b/src/armory/Config.ts index 905159a..dbf84d2 100644 --- a/src/armory/Config.ts +++ b/src/armory/Config.ts @@ -23,6 +23,12 @@ export interface IIframeModeConfig { url: string; } +export interface IFeatureFlags { + enableQuestsPage: boolean; + enableReputationPage: boolean; + enableSkillsPage: boolean; +} + export class Config { public aowowUrl: string; public wowheadUrl: string; @@ -37,6 +43,7 @@ export class Config { public realms: IRealmConfig[]; public worldDatabase: IDatabaseConfig; public dbQueryTimeout: number; + public featureFlags: IFeatureFlags; private static envPrefix = "ACORE_ARMORY"; private static checkedMissingField = false; diff --git a/src/armory/controllers/CharacterController.ts b/src/armory/controllers/CharacterController.ts index ff49cc9..4b81c47 100644 --- a/src/armory/controllers/CharacterController.ts +++ b/src/armory/controllers/CharacterController.ts @@ -789,6 +789,9 @@ export class CharacterController { guild: charData.guild, zone: charData.zone, zoneName: this.getZoneName(charData.zone), + enableQuestsPage: this.armory.config.featureFlags.enableQuestsPage, + enableSkillsPage: this.armory.config.featureFlags.enableSkillsPage, + enableReputationPage: this.armory.config.featureFlags.enableReputationPage }; } diff --git a/static/partials/character-header.hbs b/static/partials/character-header.hbs index 904879d..2e8d6e9 100644 --- a/static/partials/character-header.hbs +++ b/static/partials/character-header.hbs @@ -3,9 +3,15 @@ CharacterTalents  +{{#if enableSkillsPage}} Skills  +{{/if}} +{{#if enableReputationPage}} Reputation  +{{/if}} +{{#if enableQuestsPage}} Quests  +{{/if}} AchievementsPvP
@@ -23,11 +29,11 @@
{{realm}}
{{#if online}} - Online 🟢 + Online 🟢 {{else}} - Offline 🔴 + Offline 🔴 {{/if}} - - + {{#if zoneName}} {{zoneName}} {{/if}}