nitro-web 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -549,7 +549,7 @@ export async function tokenSend({ type = 'reset', _id, email, firstName, beforeU
549
549
  }
550
550
 
551
551
  function getBaseUrl(req) {
552
- return resolveBaseUrl(req?.baseUrl, authConfig.baseUrl)
552
+ return resolveBaseUrl(req?.nitroBaseUrl, authConfig.baseUrl)
553
553
  }
554
554
 
555
555
  export function resolveBaseUrl(reqUrl, cfgUrl) {
@@ -82,7 +82,7 @@ async function billingPortalSessionCreate(req, res) {
82
82
  }
83
83
  const session = await stripe.billingPortal.sessions.create({
84
84
  customer: req.user.stripeCustomer.id,
85
- return_url: resolveBaseUrl(req.baseUrl, config.baseUrl) + '/subscriptions',
85
+ return_url: resolveBaseUrl(req.nitroBaseUrl, config.baseUrl) + '/subscriptions',
86
86
  })
87
87
  res.json(session.url)
88
88
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-web",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "repository": "github:boycce/nitro-web",
5
5
  "homepage": "https://boycce.github.io/nitro-web/",
6
6
  "description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
package/server/router.js CHANGED
@@ -338,8 +338,8 @@ export const middleware = {
338
338
  modifyRequest: (req, res, next) => {
339
339
  // Handy boolean denoting that the request wants JSON returned
340
340
  req.json = req.xhr || req.accepts(['html', 'json']) == 'json'
341
- // Dynamic baseUrl from the request headers, may require app.set('trust proxy', 1) in the server setup
342
- req.baseUrl = req.protocol + '://' + req.headers.host
341
+ // Dynamic baseUrl from the request headers, may require app.set('trust proxy', 1) in the server setup for heroku proxying
342
+ req.nitroBaseUrl = req.protocol + '://' + req.headers.host
343
343
  // log the headers if the config.logHeaders is true
344
344
  if (configLocal.logHeaders) {
345
345
  console.info('Headers:', req.headers)