import { authWithHeaders } from '../../middlewares/auth'; let api = {}; // @TODO export this const, cannot export it from here because only routes are exported from controllers const LAST_ANNOUNCEMENT_TITLE = 'JULY SUBSCRIBER ITEMS AND HABITICA BLOG POSTS'; const worldDmg = { // @TODO bailey: false, }; /** * @api {get} /api/v3/news Get latest Bailey announcement * @apiName GetNews * @apiGroup News * * * @apiSuccess {Object} html Latest Bailey html * */ api.getNews = { method: 'GET', url: '/news', async handler (req, res) { const baileyClass = worldDmg.bailey ? 'npc_bailey_broken' : 'npc_bailey'; res.status(200).send({ html: `

${res.t('newStuff')}

7/25/2019 - ${LAST_ANNOUNCEMENT_TITLE}


July Subscriber Items Revealed!

The July Subscriber Items have been revealed: the extra-special 3-piece Beach Buddy Item Set! You only have until July 31 to receive the item set when you subscribe.

If you're already an active subscriber, reload the site or app and then head to Inventory > Items to claim your gear!

Subscribers also receive the ability to buy Gems for Gold -- the longer you subscribe, the more Gems you can buy per month! There are other perks as well, such as longer access to uncompressed data and a cute Jackalope pet. Best of all, subscriptions let us keep Habitica running. Thank you very much for your support -- it means a lot to us.

by Beffymaroo

Blog Posts: Healer

This month's featured Wiki article and Use Case Spotlight are about the Healer Class! We hope that they will help you as you choose the best class for your Habitica play style. Be sure to check them out, and let us know what you think by reaching out on Twitter, Tumblr, and Facebook.

Plus, we're collecting user submissions for the next spotlight! We want to hear your best tricks and strategies for playing the Rogue class to its full advantage. We’ll be featuring player-submitted examples in Use Case Spotlights on the Habitica Blog next month, so post your suggestions in the Use Case Spotlight Guild now. We look forward to learning more about how you use Habitica to improve your life and get things done!

by shanaqui and the Wiki Wizards

Guild Spotlight: More New and Notable Guilds!

There's a new Guild Spotlight on the blog that highlights more of the upcoming Guilds in Habitica dedicated to a variety of topics! Check it out now to find some of Habitica's best new communities.

by shanaqui
`, }); }, }; /** * @api {post} /api/v3/news/tell-me-later Get latest Bailey announcement in a second moment * @apiName TellMeLaterNews * @apiGroup News * * * @apiSuccess {Object} data An empty Object * */ api.tellMeLaterNews = { method: 'POST', middlewares: [authWithHeaders()], url: '/news/tell-me-later', async handler (req, res) { const user = res.locals.user; user.flags.newStuff = false; const existingNotificationIndex = user.notifications.findIndex(n => { return n && n.type === 'NEW_STUFF'; }); if (existingNotificationIndex !== -1) user.notifications.splice(existingNotificationIndex, 1); user.addNotification('NEW_STUFF', { title: LAST_ANNOUNCEMENT_TITLE }, true); // seen by default await user.save(); res.respond(200, {}); }, }; module.exports = api;